Beispiel #1
0
lvar_all()
{
	if (lv_first)
	{
		lvbase = lv_init(yytext, 1);
		lvone = lvtwo = lvbase;
	}
	else
	{
		if (lv_search(lvbase, yytext) == NULL)
		{
			lvtwo = lv_add(lvone, yytext, 1);
			lvone = lvtwo;
		}
		else
		{
			yyredec(yytext);
		}
	}
}
Beispiel #2
0
larr_all()
{
	if (lv_first)
	{
		lvbase = lv_init(tsave, atoi(yytext));
		lvone = lvtwo = lvbase;
	}
	else
	{
		if (lv_search(lvbase, tsave) == NULL)
		{
			lvtwo = lv_add(lvone, tsave, atoi(yytext));
			lvone = lvtwo;
		}
		else
		{
			yyredec(yytext);
		}
	}
}
Beispiel #3
0
void user_init(void)
{
#if (OVERCLOCK)
    sdk_system_update_cpu_freq(160);
#endif

    // Setup HW
    uart_set_baud(0, 115200);
    printf("SDK version:%s\n", sdk_system_get_sdk_version());

#if (I2C_CONNECTION)
    i2c_init(I2C_BUS, SCL_PIN, SDA_PIN, I2C_FREQ_400K);
#else
#if (CS_PIN == 15)
    spi_init(SPI_BUS, SPI_MODE0, SPI_FREQ_DIV_8M, true, SPI_LITTLE_ENDIAN, false);
#else
    spi_init(SPI_BUS, SPI_MODE0, SPI_FREQ_DIV_8M, true, SPI_LITTLE_ENDIAN, true);
    gpio_enable(CS_PIN, GPIO_OUTPUT);
#endif
#endif
#if (RST_PIN != LV_DRIVER_NOPIN)
    gpio_enable(RST_PIN, GPIO_OUTPUT);
#endif

    /*Gui initialization*/
    lv_init();

    /*Screen initialization*/
#if (I2C_CONNECTION)
    dev.i2c_dev = (lv_i2c_handle_t)&i2c_dev;
#else
    dev.spi_dev = (lv_spi_handle_t)&spi_dev;
#endif
    dev.protocol = PROTOCOL ; //SSD1306_PROTO_SPI3;
    dev.screen   = SH1106_SCREEN; //SSD1306_SCREEN,  SH1106_SCREEN
    dev.width    = LV_HOR_RES;
    dev.height   = LV_VER_RES;
    dev.rst_pin  = RST_PIN; //No RST PIN USED

    while (ssd1306_init(&dev) != 0) {
        printf("%s: failed to init SSD1306 lcd\n", __func__);
        vTaskDelay(SECOND);
    }

    ssd1306_set_whole_display_lighting(&dev, true);

    /*inverse screen (180°) */
    ssd1306_set_scan_direction_fwd(&dev,true);
    ssd1306_set_segment_remapping_enabled(&dev, false);
    vTaskDelay(SECOND);

    /*lvgl screen registration */
    lv_disp_drv_t disp_drv;
    lv_disp_drv_init(&disp_drv);
    /*Set up the functions to access to your display*/
    disp_drv.disp_flush = ssd1306_flush; /*Used in buffered mode (LV_VDB_SIZE != 0  in lv_conf.h)*/
    disp_drv.disp_fill = NULL;//ex_disp_fill;   /*Used in unbuffered mode (LV_VDB_SIZE == 0  in lv_conf.h)*/
    disp_drv.disp_map = NULL;//ex_disp_map;    /*Used in unbuffered mode (LV_VDB_SIZE == 0  in lv_conf.h)*/
    disp_drv.vdb_wr = ssd1306_vdb_wr;
    lv_disp_drv_register(&disp_drv);

    /* Create user interface task */
    xTaskCreate(ssd1306_task, "ssd1306_task", 512, NULL, 2, NULL);

    font_timer_handle = xTimerCreate("font_timer", 5 * SECOND, pdTRUE, NULL, font_timer);
    xTimerStart(font_timer_handle, 0);

#if (!TICK_HANDLER && !LV_TICK_CUSTOM)
    lvgl_timer_handle = xTimerCreate("lvgl_timer", TICK_INC_MS/portTICK_PERIOD_MS, pdTRUE, NULL, lvgl_timer);
    xTimerStart(lvgl_timer_handle, 0);
#endif
}