enum plugin_status plugin_start(const void* parameter) { int button; (void)(parameter); #ifdef HAVE_LCD_CHARCELLS if (!pgfx_init(4, 2)) { rb->splash(HZ*2, "Old LCD :("); return PLUGIN_OK; } #endif #ifdef HAVE_LCD_COLOR rb->lcd_clear_display(); rb->lcd_set_foreground(LCD_WHITE); rb->lcd_set_background(LCD_DEFAULT_BG); #endif snow_init(); while (1) { snow_move(); mylcd_update(); #ifdef HAVE_REMOTE_LCD rb->lcd_remote_update(); #endif rb->sleep(HZ/20); button = rb->button_get(false); if (button == SNOW_QUIT #ifdef SNOW_RC_QUIT || button == SNOW_RC_QUIT #endif ) { #ifdef HAVE_LCD_CHARCELLS pgfx_release(); #endif return PLUGIN_OK; } else if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { #ifdef HAVE_LCD_CHARCELLS pgfx_release(); #endif return PLUGIN_USB_CONNECTED; } } }
enum plugin_status plugin_start(const void* parameter) { int button; (void)(parameter); #ifdef HAVE_LCD_CHARCELLS if (!pgfx_init(4, 2)) { rb->splash(HZ*2, "Old LCD :("); return PLUGIN_OK; } #endif #ifdef HAVE_LCD_COLOR rb->lcd_clear_display(); rb->lcd_set_foreground(LCD_WHITE); rb->lcd_set_background(LCD_DEFAULT_BG); #endif snow_init(); while (1) { snow_move(); mylcd_update(); #ifdef HAVE_REMOTE_LCD rb->lcd_remote_update(); #endif rb->sleep(HZ/20); /*We get button from PLA this way */ button = pluginlib_getaction(TIMEOUT_NOBLOCK, plugin_contexts, ARRAYLEN(plugin_contexts)); if ((button == SNOW_QUIT) || (button == SNOW_QUIT2)) { #ifdef HAVE_LCD_CHARCELLS pgfx_release(); #endif return PLUGIN_OK; } else if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { #ifdef HAVE_LCD_CHARCELLS pgfx_release(); #endif return PLUGIN_USB_CONNECTED; } } }