2026-04-07 07:34:24 +09:00
|
|
|
#include "pico/stdlib.h"
|
|
|
|
|
#include "hardware/gpio.h"
|
2026-04-06 17:36:41 +09:00
|
|
|
#include "dispatch.h"
|
2026-04-06 17:24:34 +09:00
|
|
|
#include "handlers.h"
|
2026-04-11 07:25:16 +09:00
|
|
|
#include "test_handlers.h"
|
2026-04-05 21:04:56 +09:00
|
|
|
|
2026-04-07 07:34:24 +09:00
|
|
|
static constexpr uint8_t LED_PIN = 25;
|
|
|
|
|
|
|
|
|
|
static void led_toggle() {
|
|
|
|
|
gpio_xor_mask(1 << LED_PIN);
|
|
|
|
|
dispatch_schedule_ms(1000, led_toggle);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-06 20:09:30 +09:00
|
|
|
std::string_view firmware_name = "picomap_test";
|
|
|
|
|
|
2026-04-06 17:36:41 +09:00
|
|
|
static constexpr handler_entry handlers[] = {
|
2026-04-10 22:21:31 +09:00
|
|
|
{RequestPICOBOOT::ext_id, typed_handler<RequestPICOBOOT, handle_picoboot>},
|
|
|
|
|
{RequestInfo::ext_id, typed_handler<RequestInfo, handle_info>},
|
|
|
|
|
{RequestLog::ext_id, typed_handler<RequestLog, handle_log>},
|
2026-04-11 22:26:54 +09:00
|
|
|
{RequestFlashErase::ext_id, typed_handler<RequestFlashErase, handle_flash_erase>},
|
|
|
|
|
{RequestFlashWrite::ext_id, typed_handler<RequestFlashWrite, handle_flash_write>},
|
|
|
|
|
{RequestReboot::ext_id, typed_handler<RequestReboot, handle_reboot>},
|
2026-04-11 07:25:16 +09:00
|
|
|
{RequestListTests::ext_id, typed_handler<RequestListTests, handle_list_tests>},
|
2026-04-07 06:58:39 +09:00
|
|
|
{RequestTest::ext_id, typed_handler<RequestTest, handle_test>},
|
2026-04-06 17:36:41 +09:00
|
|
|
};
|
2026-04-05 21:04:56 +09:00
|
|
|
|
|
|
|
|
int main() {
|
2026-04-12 08:17:22 +09:00
|
|
|
handlers_init();
|
2026-04-06 20:01:22 +09:00
|
|
|
dispatch_init();
|
2026-04-07 06:58:39 +09:00
|
|
|
|
2026-04-07 07:34:24 +09:00
|
|
|
gpio_init(LED_PIN);
|
|
|
|
|
gpio_set_dir(LED_PIN, GPIO_OUT);
|
|
|
|
|
dispatch_schedule_ms(1000, led_toggle);
|
2026-04-07 06:58:39 +09:00
|
|
|
|
2026-04-06 20:01:22 +09:00
|
|
|
dispatch_run(handlers);
|
2026-04-05 21:04:56 +09:00
|
|
|
}
|