aboutsummaryrefslogtreecommitdiffstats
path: root/examples/vga-scope.cpp
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-05-02 14:33:05 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-05-04 13:31:24 -0400
commit11a0da5c63faffd45bde43da2777a9771cfdf5e9 (patch)
tree2f4d468a82925de416c1f455c37fad2ffe154836 /examples/vga-scope.cpp
parent7caa5711c3f2d03870cba71d175a057e573aff8d (diff)
downloadlibrambutan-11a0da5c63faffd45bde43da2777a9771cfdf5e9.tar.gz
librambutan-11a0da5c63faffd45bde43da2777a9771cfdf5e9.zip
/examples/ cleanups.
Diffstat (limited to 'examples/vga-scope.cpp')
-rw-r--r--examples/vga-scope.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/examples/vga-scope.cpp b/examples/vga-scope.cpp
index 66e72e9..9aa8bcb 100644
--- a/examples/vga-scope.cpp
+++ b/examples/vga-scope.cpp
@@ -40,7 +40,6 @@
// FIXME: generalize for Native and Mini
-#define LED_PIN BOARD_LED_PIN
#define ANALOG_PIN 18
// Pinouts -- you also must change the GPIO macros below if you change
@@ -90,9 +89,9 @@ void isr_stop(void);
void isr_update(void);
void setup() {
- pinMode(LED_PIN, OUTPUT);
+ pinMode(BOARD_LED_PIN, OUTPUT);
pinMode(ANALOG_PIN, INPUT_ANALOG);
- digitalWrite(LED_PIN, 1);
+ digitalWrite(BOARD_LED_PIN, 1);
pinMode(VGA_R, OUTPUT);
pinMode(VGA_G, OUTPUT);
pinMode(VGA_B, OUTPUT);
@@ -138,26 +137,26 @@ void setup() {
uint16 y = 0;
uint16 val = 0;
bool v_active = true;
-const uint16 x_max = 60; // empirically (and lazily) determined
+const uint16 x_max = 60; // empirically (and sloppily) determined
void isr_porch(void) {
VGA_H_HIGH;
y++;
val = map(analogRead(ANALOG_PIN), 0, 4095, 0, x_max);
- if(y >= 523) {
+ if (y >= 523) {
y = 1;
v_active = true;
return;
}
- if(y >= 492) {
+ if (y >= 492) {
VGA_V_HIGH;
return;
}
- if(y >= 490) {
+ if (y >= 490) {
VGA_V_LOW;
return;
}
- if(y >= 479) {
+ if (y >= 479) {
v_active = false;
return;
}
@@ -199,7 +198,7 @@ __attribute__((constructor)) void premain() {
int main(void) {
setup();
- while (1) {
+ while (true) {
loop();
}
return 0;