expander test code
This commit is contained in:
parent
85fcb23a87
commit
c3075141fb
@ -1 +1 @@
|
||||
Subproject commit 8c0b6823fd8743cb829973811bed5f96226bb53d
|
||||
Subproject commit c82c9adf321b6e653c8069758f226d931fc39d9f
|
||||
@ -8,6 +8,7 @@
|
||||
#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 = {};
|
||||
@ -15,36 +16,23 @@ extern "C" void app_main(void) {
|
||||
|
||||
printf("Hello, Blk Box!\n");
|
||||
|
||||
/* Print chip information */
|
||||
esp_chip_info_t chip_info;
|
||||
uint32_t flash_size;
|
||||
esp_chip_info(&chip_info);
|
||||
printf("This is %s chip with %d CPU core(s), %s%s%s%s, ",
|
||||
CONFIG_IDF_TARGET,
|
||||
chip_info.cores,
|
||||
(chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "",
|
||||
(chip_info.features & CHIP_FEATURE_BT) ? "BT" : "",
|
||||
(chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "",
|
||||
(chip_info.features & CHIP_FEATURE_IEEE802154) ? ", 802.15.4 (Zigbee/Thread)" : "");
|
||||
|
||||
unsigned major_rev = chip_info.revision / 100;
|
||||
unsigned minor_rev = chip_info.revision % 100;
|
||||
printf("silicon revision v%d.%d, ", major_rev, minor_rev);
|
||||
if(esp_flash_get_size(NULL, &flash_size) != ESP_OK) {
|
||||
printf("Get flash size failed");
|
||||
return;
|
||||
while (1) {
|
||||
if (InputsController::has_button_press()) {
|
||||
Button b = InputsController::wait_button_press();
|
||||
printf("Button pressed: %d\n", raw_value(b));
|
||||
}
|
||||
|
||||
printf("%" PRIu32 "MB %s flash\n", flash_size / (uint32_t)(1024 * 1024),
|
||||
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
|
||||
|
||||
printf("Minimum free heap size: %" PRIu32 " bytes\n", esp_get_minimum_free_heap_size());
|
||||
|
||||
for (int i = 10; i >= 0; i--) {
|
||||
printf("Doing nothing in %d seconds...\n", i);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
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());
|
||||
}
|
||||
// printf("Restarting now.\n");
|
||||
// fflush(stdout);
|
||||
// esp_restart();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user