-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsvga.cpp
67 lines (56 loc) · 1.89 KB
/
svga.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//==============================================================================
// _____ __ __ __ ____ ____ ___ _ __
// | ____| \/ | / /_| ___| / ___( _ )/ |/ /_
// | _| | |\/| |_____| '_ \___ \| | / _ \| | '_ \
// | |___| | | |_____| (_) |__) | |__| (_) | | (_) |
// |_____|_|__|_|___ __\___/____/ \____\___/|_|\___/
// | ____/ ___|| _ \___ /___ \
// | _| \___ \| |_) ||_ \ __) |
// | |___ ___) | __/___) / __/
// |_____|____/|_| |____/_____|
//
//------------------------------------------------------------------------------
// Copyright (C),2019 Andrew John Jacobs
// All rights reserved.
//
// This work is made available under the terms of the Creative Commons
// Attribution-NonCommercial-ShareAlike 4.0 International license. Open the
// following URL to see the details.
//
// http://creativecommons.org/licenses/by-nc-sa/4.0/
//------------------------------------------------------------------------------
// Notes:
//
//==============================================================================
#include <Arduino.h>
#include "svga.h"
uint16_t SVGA::line = 0;
SVGA::SVGA (void)
{ }
void SVGA::begin (uint16_t hsync, uint16_t vsync, uint16_t signal)
{
pinMode (SVGA::hsync = hsync, OUTPUT);
pinMode (SVGA::hsync = vsync, OUTPUT);
pinMode (SVGA::hsync = signal, OUTPUT);
// SET up RMT
// Interrupt on pin change
}
void IRAM_ATTR SVGA::onHSync (void)
{
if (line < 599) {
// Visible region (600)
digitalWrite (vsync, LOW);
// Start DMA
}
else if (line == 600) {
// Front porch (1)
}
else if (line < 605) {
// Sync pulse (4)
digitalWrite (vsync, HIGH);
}
else {
// Back porch (23)
}
if (++line == 628) line = 0;
}