#include #include #include "pico/stdlib.h" #include "pico/multicore.h" #include "cvideo.h" #include "text_mode.h" // -------------------------------- // CORE 1 // -------------------------------- void core1_entry() { // Nothing yet } // -------------------------------- // -------------------------------- // CORE 0 // -------------------------------- static video_framebuffer_t fb0, fb1; static text_mode_buffer_t text_mode_buffer; static bool framebuffer_switched = true; static bool text_mode = true; void framebuffer_switched_cb(){ framebuffer_switched = true; } void main() { stdio_init_all(); multicore_launch_core1(core1_entry); init_font_cache(); video_set_framebuffer_switched_cb(framebuffer_switched_cb); video_init(fb0); memset(text_mode_buffer, 0, CHAR_LINES*CHARS_PER_LINE); strcpy(&text_mode_buffer[0][0], "PicoPAL text mode"); strcpy(&text_mode_buffer[1][0], "-----------------"); gpio_init(25); gpio_set_dir(25, GPIO_OUT); int fbnum = 1; video_framebuffer_ptr_t fbs[] = {fb0, fb1}; while (true) { // Check if need to draw new frame if(framebuffer_switched){ gpio_put(25, fbnum); if(text_mode){ draw_text_mode(fbs[fbnum], text_mode_buffer); } fbnum = (fbnum+1)%2; framebuffer_switched = false; } tight_loop_contents(); } } // --------------------------------