Exemple #1
0
void mp_hal_init(void) {
    ets_wdt_disable(); // it's a pain while developing
    mp_hal_rtc_init();
    uart_init(UART_BIT_RATE_115200, UART_BIT_RATE_115200);
}
void ICACHE_FLASH_ATTR ws2812_init()
{
	ets_wdt_disable();
	char outbuffer[] = { 0x00, 0x00, 0x00 };
	ws2812_strip( outbuffer, sizeof(outbuffer) );
}
Exemple #3
0
void EspClass::wdtDisable(void)
{
	ets_wdt_disable();
}
Exemple #4
0
/// @brief  BLIT a bit array to the display
/// @param[in] win*: window structure
/// @param[in] *ptr: bit array w * h in size
/// @param[in] x: BLITX offset
/// @param[in] y: BLIT Y offset
/// @param[in] w: BLIT Width
/// @param[in] h: BLIT Height
/// @return  void
/// TODO CLIP window - depends on blit array
void tft_bit_blit(window *win, uint8_t *ptr, int x, int y, int w, int h)
{

    uint16_t color;
    int xx,yy;
    int32_t off;
	int32_t pixels;
	int wdcount;
	int ind;
	uint8_t buf[2*64];

    if(!w || !h)
        return;

#if 1
// BIT BLIT

// TODO CLIP window 
// Note: Clipping modifies offsets which in turn modifies blit array offsets
// We could use tft_drawPixel, and it clips - but that is slow

    pixels = tft_rel_window(win, x, y, w, h);

	
	tft_spi_begin();

    tft_Cmd(0x2c);

    off = 0;
	ind = 0;
	wdcount = 0;

    for (yy=0; yy < h; ++yy)
    {
        for (xx=0;xx < w; ++xx)
        {
            if(bittestv(ptr, xx + off))
                color = win->fg;
            else
                color = win->bg;

			buf[ind++] = color >> 8;
			buf[ind++] = color & 0xff;

			if(ind >= sizeof(buf))
			{
				tft_spi_TX(buf,ind,0);
				ind = 0;
			}
        }
		wdcount += xx;
		if(wdcount > 0x3ff)
		{
			ets_wdt_disable();
			wdcount = 0;
		}
        off += w;
    }
	if(ind)
	{
		tft_spi_TX(buf,ind,0);
	}

	tft_spi_end();
#else
    off = 0;
    for (yy=0; yy < h; ++yy)
    {
        for (xx=0;xx < w; ++xx)
        {
            if(bittestv(ptr, xx + off))
                tft_drawPixel(x+xx,y+yy,fg);
            else
                tft_drawPixel(x+xx,y+yy,bg);
        }
        off += w;
    }
#endif
}