From: Mikko Rasa Date: Sat, 2 Nov 2013 11:53:45 +0000 (+0200) Subject: Connect some status leds to port B X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e828083600fc8033aeb1768acabe98461347b906;p=model-railway-devices.git Connect some status leds to port B --- diff --git a/arducontrol/interface.c b/arducontrol/interface.c index a8ae2a2..2c55e2a 100644 --- a/arducontrol/interface.c +++ b/arducontrol/interface.c @@ -14,6 +14,7 @@ static uint8_t dispatch_command(const uint8_t *, uint8_t); void interface_init(void) { + DDRB |= 0x01; DDRD = (DDRD&0xFC)|0x02; serial_init(9600); @@ -28,6 +29,7 @@ void interface_check(void) count = serial_read_available(); if(count>0) { + PORTB |= 0x01; if(cmd_length==0) { uint8_t l = ~serial_read(); @@ -58,6 +60,7 @@ void interface_check(void) cmd_length = 0; } } + PORTB &= ~0x01; } } diff --git a/arducontrol/monitor.c b/arducontrol/monitor.c index de00fc1..b87e73e 100644 --- a/arducontrol/monitor.c +++ b/arducontrol/monitor.c @@ -22,6 +22,7 @@ static uint16_t input_voltage_millivolts(void); void monitor_init(void) { + DDRB |= 0x02; adc_init(); } @@ -42,14 +43,18 @@ void monitor_check(void) if(track_current_sum>overcurrent_limit) { output_set_power(0); + PORTB |= 0x02; if(!overcurrent_sent) { overcurrent_sent = 1; interface_send1(OVERCURRENT); } } - else + else if(overcurrent_sent && output_is_power_on()) + { + PORTB &= ~0x02; overcurrent_sent = 0; + } } else if(adc_state==4) {