Example #1
0
int main(void)
{
  unsigned int x, y;

  while(1) {
    display_clear(DISPLAY_COLOR_WHITE);

    for(x = 0; x < DISPLAY_WIDTH; x++) {
      for(y = 0; y < DISPLAY_HEIGHT; y++) {
	display_set_pixel(x, y, DISPLAY_COLOR_BLUE);
      }
    }
  }

  return 0;
}
Example #2
0
void
display_gui_draw_button_bar (void)
{
    // Clear background
    display_set_inverted (true);
    display_draw_rect (0, BUTTON_INFO_BAR_TOP - 1, DISPLAY_WIDTH, DISPLAY_HEIGHT - 1, true);
    display_set_inverted (false);
    // Arrows panel

    if (display_gui_right_available || display_gui_left_available || display_gui_up_available || display_gui_down_available)
    {
        display_draw_rect (0, BUTTON_INFO_BAR_TOP, 29, DISPLAY_HEIGHT, true);
        display_set_pixel (0, BUTTON_INFO_BAR_TOP, false);
        display_set_pixel (29, BUTTON_INFO_BAR_TOP, false);
    }

    // A-Button panel

    if (strcmp (display_gui_a_function, ""))
    {
        display_draw_rect (31, BUTTON_INFO_BAR_TOP, 31 + 48, DISPLAY_HEIGHT, true);
        display_set_pixel (31, BUTTON_INFO_BAR_TOP, false);
        display_set_pixel (31 + 48, BUTTON_INFO_BAR_TOP, false);
    }

    // B-Button panel

    if (strcmp (display_gui_b_function, ""))
    {
        display_draw_rect (81, BUTTON_INFO_BAR_TOP, 127, DISPLAY_HEIGHT, true);
        display_set_pixel (81, BUTTON_INFO_BAR_TOP, false);
        display_set_pixel (127, BUTTON_INFO_BAR_TOP, false);
    }

    // A/B Functions
    display_set_inverted (true);

    display_draw_string (32, BUTTON_INFO_BAR_TOP + 1, 0, display_gui_a_function);

    display_draw_string (82, BUTTON_INFO_BAR_TOP + 1, 0, display_gui_b_function);

    // Arrows
    uint8_t current_x = 0;

    if (display_gui_left_available)
    {
        display_draw_image (current_x, BUTTON_INFO_BAR_TOP + 1, arrow_left);
        current_x += 8;
    }

    if (display_gui_right_available)
    {
        display_draw_image (current_x, BUTTON_INFO_BAR_TOP + 1, arrow_right);
        current_x += 8;
    }

    if (display_gui_up_available)
    {
        display_draw_image (current_x, BUTTON_INFO_BAR_TOP + 1, arrow_up);
        current_x += 8;
    }

    if (display_gui_down_available)
    {
        display_draw_image (current_x, BUTTON_INFO_BAR_TOP + 1, arrow_down);
    }

    display_set_inverted (false);
}
/******************************************************************************
 * FunctionName : user_init
 * Description  : entry of user application, init user function here
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void user_init(void)
{
    os_delay_us(1000*1000);
    uart_init (BIT_RATE_115200, BIT_RATE_115200, USER_TASK_PRIO_0, 0);
    os_delay_us(100*1000);

    os_printf("Interactive Cube starting..\n");

    config_init();

    platform_i2c_setup(i2c_endpoint_id, 1, 2, PLATFORM_I2C_SPEED_SLOW);
    display_init();

    NODE_DBG("SDK version: %s\n", system_get_sdk_version());
    system_print_meminfo();

    os_printf("Heap size: %d.\n", system_get_free_heap_size());

#ifndef NODE_DEBUG
    system_set_os_print(1);
#endif

    int b;
    for(b=0; b<4; b++) {
        display_set_pixel(0, 1);
        display_update_inner();

        os_delay_us(500*1000);
        display_update_inner();

        display_set_pixel(0, 0);
        display_update_inner();

        os_delay_us(500*1000);
        display_update_inner();
    }

    if (display_is_key_down(0)) {
        // enter setup mode, show as blinking...!
        configui_init();
        return;
    }

    display_set_pixel(0, 1);
    display_set_pixel(1, 1);
    display_set_pixel(2, 1);
    display_update_inner();

    // uart_init(BIT_RATE_9600,0);
    os_delay_us(100*1000);

    os_delay_us(1000*1000);

    display_anim();
    //  os_delay_us(500*1000);

    NODE_DBG("Hello Wurst.\n");
    // os_delay_us(500*1000);

    // Set up I2C
    // Wire.begin(D1, D2); // sda, scl

    display_set_pixel(0, 0);
    display_set_pixel(1, 0);
    display_set_pixel(2, 0);
    display_set_pixel(3, 0);
    display_update();

    comm_init();
    orient_init();

    // system_init_done_cb(nodemcu_init);

    system_os_task(loop, user_procTaskPrio,user_procTaskQueue, user_procTaskQueueLen);
    system_os_post(user_procTaskPrio, 0, 0);

    NODE_DBG("End of user_init.\n");
}