some code cleanup

Sat, 03 Dec 2011 12:10:10 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Sat, 03 Dec 2011 12:10:10 +0100
changeset 34
d12d095e3282
parent 33
c261350bb394
child 35
00166228a419

some code cleanup

blackbox/lowlevel.c file | annotate | diff | comparison | revisions
blackbox/main.c file | annotate | diff | comparison | revisions
--- a/blackbox/lowlevel.c	Sat Dec 03 11:55:01 2011 +0100
+++ b/blackbox/lowlevel.c	Sat Dec 03 12:10:10 2011 +0100
@@ -7,6 +7,10 @@
 #include "driver/rs232.h"
 #include "lowlevel.h"
 
+void blinkdelay(void) {
+   _delay_ms(50);
+}
+
 void LED(uint8_t num, uint8_t state) {
     switch (num) {
         case 1: switch (state) {
@@ -49,7 +53,7 @@
     DDRD = 0; PORTD = 0;
 
 
-    RS232_init(); // initialize RS485 interface
+    RS232_init(); // initialize RS232 interface
     initADC();
     SFIOR = 0;
 
@@ -76,16 +80,16 @@
     DDR(RAIL_POWER_PORT) |= _BV(RAIL_POWER);
 
     // display init sequence on LEDs
-    LED(1, 1); _delay_ms(50);
-    LED(2, 1); _delay_ms(50);
-    LED(3, 1); _delay_ms(50);
-    LED(4, 1); _delay_ms(50);
-    LED(5, 1); _delay_ms(50);
-    LED(1, 0); _delay_ms(50);
-    LED(2, 0); _delay_ms(50);
-    LED(3, 0); _delay_ms(50);
-    LED(4, 0); _delay_ms(50);
-    LED(5, 0); _delay_ms(50);
+    LED(1, 1); blinkdelay();
+    LED(2, 1); blinkdelay();
+    LED(3, 1); blinkdelay();
+    LED(4, 1); blinkdelay();
+    LED(5, 1); blinkdelay();
+    LED(1, 0); blinkdelay();
+    LED(2, 0); blinkdelay();
+    LED(3, 0); blinkdelay();
+    LED(4, 0); blinkdelay();
+    LED(5, 0);
 
 
     // setup response receiver timer
@@ -111,9 +115,6 @@
 }
 
 
-void blinkdelay(void) {
-   _delay_ms(100);
-}
 
 void check_rails_shortcut(void) {
     // check for short circuit on the rails
--- a/blackbox/main.c	Sat Dec 03 11:55:01 2011 +0100
+++ b/blackbox/main.c	Sat Dec 03 12:10:10 2011 +0100
@@ -125,7 +125,7 @@
         case 4: tmp = (1<<5); break; // todo regler 5
         case 5: tmp = (1<<5); break; // todo regler 6
     }
-    tmp |=  0b1000000000 | (controller << 6);
+    tmp |=  (0b1000000000 | (controller << 6));
     if ( (PIN(SW_FUEL_PORT) & _BV(SW_FUEL)) != 0) tmp |= 1; // benzinstand aktiv - tankmodusschalter
 
     return insert_queue(tmp, 9);

mercurial