blk_box_control/main/main.cpp
2026-04-01 15:55:37 -05:00

39 lines
1.1 KiB
C++

#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_system.h"
#include "blk_box.h"
#include "blk_box_drivers/i2c.h"
#include "blk_box_drivers/expander.hpp"
extern "C" void app_main(void) {
BlkBoxInitConfig blk_box_cfg = {};
init_blk_box(blk_box_cfg);
printf("Hello, Blk Box!\n");
while (1) {
if (InputsController::has_button_press()) {
Button b = InputsController::wait_button_press();
printf("Button pressed: %d\n", raw_value(b));
}
if (InputsController::has_switch_flip()) {
SwitchFlip flip = InputsController::wait_switch_flip();
printf("Switch flipped: %d, new state: %d\n", raw_value(flip.get_switch()), flip.is_up());
}
if (InputsController::has_keypad_press()) {
KeypadKey k = InputsController::wait_keypad_press();
printf("Keypad key pressed: %c\n", keypad_key_to_char(k));
}
vTaskDelay(10 / portTICK_PERIOD_MS);
}
}