Port naming, turn on both LEDs on startup

This commit is contained in:
Rihards Skuja 2018-01-09 20:17:50 +02:00
parent 4a4d6e19de
commit a48b71620f
No known key found for this signature in database
GPG Key ID: 53FA13A3F7F8571B
5 changed files with 21 additions and 16 deletions

View File

@ -2,8 +2,9 @@
#define LED_H #define LED_H
#define LED_DDR DDRD #define LED_DDR DDRD
#define LED_1_BIT PD3 #define LED_PORT PORTD
#define LED_2_BIT PD4 #define LED_GREEN_BIT PD3
#define LED_BLUE_BIT PD4
void init_leds(void); void init_leds(void);

View File

@ -4,6 +4,6 @@
void init_leds(void) void init_leds(void)
{ {
SET(LED_DDR, LED_1_BIT); SET(LED_DDR, LED_GREEN_BIT);
SET(LED_DDR, LED_2_BIT); SET(LED_DDR, LED_BLUE_BIT);
} }

View File

@ -39,6 +39,10 @@ int main(void)
init_servos(); init_servos();
init_sonar(); init_sonar();
// Use green LED as power LED
SET(LED_PORT, LED_GREEN_BIT);
SET(LED_PORT, LED_BLUE_BIT); // Temporary for debug
run_servos(); run_servos();
read_temp(); read_temp();

View File

@ -22,12 +22,6 @@ void trigger_sonar(void)
_delay_us(1); _delay_us(1);
} }
ISR(TIMER1_OVF_vect)
{
++overflow_counter;
TCNT1 = 0;
}
int32_t read_sonar(void) int32_t read_sonar(void)
{ {
int dist_in_cm = 0; int dist_in_cm = 0;
@ -58,3 +52,9 @@ int32_t read_sonar(void)
return dist_in_cm; return dist_in_cm;
} }
ISR(TIMER1_OVF_vect)
{
++overflow_counter;
TCNT1 = 0;
}