leds
This commit is contained in:
parent
9578c81dc0
commit
5ea3df10a4
@ -1 +1 @@
|
||||
Subproject commit 8bc5a982d1d8ff909136af73541df7a05471266d
|
||||
Subproject commit 0b79eb839961095ddf2b1a1a07479a791871acc6
|
||||
@ -9,6 +9,7 @@
|
||||
#include "blk_box.h"
|
||||
#include "blk_box_drivers/i2c.h"
|
||||
#include "blk_box_drivers/inputs.hpp"
|
||||
#include "blk_box_drivers/leds.hpp"
|
||||
|
||||
extern "C" void app_main(void) {
|
||||
BlkBoxInitConfig blk_box_cfg = {};
|
||||
@ -16,10 +17,23 @@ extern "C" void app_main(void) {
|
||||
|
||||
printf("Hello, Blk Box!\n");
|
||||
|
||||
uint32_t i = 0;
|
||||
|
||||
while (1) {
|
||||
if (InputsController::has_button_press()) {
|
||||
Button b = InputsController::wait_button_press();
|
||||
printf("Button pressed: %d\n", raw_value(b));
|
||||
if (b == Button::GREEN) {
|
||||
LEDController::set_indicator(static_cast<IndicatorLED>(i + LED_SHAPE_COUNT), LEDColor::GREEN);
|
||||
LEDController::flush();
|
||||
} else if (b == Button::YELLOW) {
|
||||
LEDController::set_indicator(static_cast<IndicatorLED>(i + LED_SHAPE_COUNT), LEDColor::YELLOW);
|
||||
LEDController::flush();
|
||||
} else if (b == Button::RED) {
|
||||
i = (i + 1) % LED_INDICATOR_COUNT;
|
||||
} else if (b == Button::BLUE) {
|
||||
i = (i + LED_INDICATOR_COUNT - 1) % LED_INDICATOR_COUNT;
|
||||
}
|
||||
}
|
||||
|
||||
if (InputsController::has_switch_flip()) {
|
||||
@ -30,6 +44,7 @@ extern "C" void app_main(void) {
|
||||
if (InputsController::has_keypad_press()) {
|
||||
KeypadKey k = InputsController::wait_keypad_press();
|
||||
printf("Keypad key pressed: %c\n", keypad_key_to_char(k));
|
||||
LEDController::flush();
|
||||
}
|
||||
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user