Files

72 lines
1.4 KiB
C++
Raw Permalink Normal View History

2024-06-04 20:35:17 -07:00
// Copyright (c) 2022 Cesanta Software Limited
// All rights reserved
2024-06-05 22:37:26 -07:00
#include "bsp/board.h"
2024-06-04 20:35:17 -07:00
#include "pico/stdlib.h"
2025-01-10 11:26:03 -07:00
#include "pico/multicore.h"
2024-06-04 20:35:17 -07:00
#include "tusb.h"
2024-06-05 22:37:26 -07:00
#include "flash_storage.h"
2024-06-07 16:55:54 -07:00
#include "sd_card_storage.h"
2025-01-10 11:26:03 -07:00
#include "fonts.h"
2025-01-10 13:19:34 -07:00
#include "pixelDisplaySSD1306.h"
2024-06-07 16:55:54 -07:00
2024-06-05 22:37:26 -07:00
#include <string.h>
#include <stdlib.h>
static uint32_t blink_interval_ms = 1000;
void led_blinking_task(void)
{
static uint32_t start_ms = 0;
if (!blink_interval_ms || board_millis() - start_ms < blink_interval_ms)
{
return;
}
start_ms += blink_interval_ms;
2024-06-04 20:35:17 -07:00
gpio_put(PICO_DEFAULT_LED_PIN, !gpio_get_out_level(PICO_DEFAULT_LED_PIN));
}
2025-01-10 11:26:03 -07:00
void core1_entry()
{
2025-12-28 13:52:50 -07:00
//printf("Hello core 1\n");
2025-01-10 11:26:03 -07:00
// displayDriver* display = (displayDriver*)new displaySSD1306();
// display->rotate(180);
// while (true)
// {
// display->fill(0x000000);
// display->drawString(0xffffff, fonts::Font_12x16(), 8, 0, "Hello");
// display->drawString(0xffffff, fonts::Font_12x16(), 8, 16, "World");
// display->drawDisplay();
// sleep_ms(100);
// }
}
2024-06-04 20:35:17 -07:00
2024-06-05 22:37:26 -07:00
int main(void)
{
2025-01-10 11:26:03 -07:00
stdio_init_all();
2025-12-29 17:53:12 -07:00
2025-01-10 11:26:03 -07:00
//multicore_launch_core1(core1_entry);
2024-06-04 20:35:17 -07:00
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
2024-06-05 22:37:26 -07:00
2025-12-29 17:53:12 -07:00
#if CONFIG_TYPE == 1 || CONFIG_TYPE == 2
2025-01-10 11:26:03 -07:00
flash_init();
2025-12-29 17:53:12 -07:00
#elif CONFIG_TYPE == 3
sd_card_init();
#endif
2024-06-05 22:37:26 -07:00
2024-06-04 20:35:17 -07:00
tusb_init();
2024-06-05 22:37:26 -07:00
while (true)
{
2024-06-04 20:35:17 -07:00
tud_task();
2024-06-05 22:37:26 -07:00
led_blinking_task();
2024-06-04 20:35:17 -07:00
}
return 0;
2025-12-29 17:53:12 -07:00
}