Turn off IR, use HAL in blink and implement some HAL
This commit is contained in:
parent
6c6b7713c8
commit
f67c122a60
|
@ -47,4 +47,5 @@ call the REGISTER() macro to define the entry point to your application.
|
|||
* _delay_ms() function will be replaced (it waits too long and the application
|
||||
cannot be quit while waiting)
|
||||
* add more functions to the hardware abstraction layer
|
||||
* a mechanism to select which applications to include in the firmware
|
||||
|
||||
|
|
|
@ -6,19 +6,16 @@
|
|||
|
||||
#include <pentabug/app.h>
|
||||
#include <pentabug/lifecycle.h>
|
||||
#include <pentabug/hal.h>
|
||||
|
||||
static void init(void) {
|
||||
_delay_ms(1000);
|
||||
led_on(RIGHT);
|
||||
}
|
||||
|
||||
static void blinker(void) {
|
||||
PORTD |= 1 << 4;
|
||||
_delay_ms(800);
|
||||
test_stop_app();
|
||||
|
||||
PORTD &= ~(1 << 4);
|
||||
_delay_ms(200);
|
||||
test_stop_app();
|
||||
led_inv(RIGHT);
|
||||
led_inv(LEFT);
|
||||
_delay_ms(500);
|
||||
}
|
||||
|
||||
REGISTER(blinker, init, NULL);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <pentabug/timer.h>
|
||||
|
||||
static uint8_t ir_active = 1;
|
||||
static uint8_t ir_active = 0;
|
||||
static int int_skip = 0;
|
||||
|
||||
static int button_count[2];
|
||||
|
@ -85,3 +85,27 @@ void reset_hw(void) {
|
|||
DDRD = (1 << 2) | (1 << 4);
|
||||
}
|
||||
|
||||
void led_on(uint8_t led) {
|
||||
if(led == RIGHT) {
|
||||
PORTC &= ~(1 << 2);
|
||||
} else {
|
||||
PORTD &= ~(1 << 4);
|
||||
}
|
||||
}
|
||||
|
||||
void led_off(uint8_t led) {
|
||||
if(led == RIGHT) {
|
||||
PORTC |= 1 << 2;
|
||||
} else {
|
||||
PORTD |= 1 << 4;
|
||||
}
|
||||
}
|
||||
|
||||
void led_inv(uint8_t led) {
|
||||
if(led == RIGHT) {
|
||||
PORTC ^= 1 << 2;
|
||||
} else {
|
||||
PORTD ^= 1 << 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user