void user_init(void) { uart_div_modify(0, UART_CLK_FREQ / 115200); os_delay_us(500); printf("SDK version : %s\n", system_get_sdk_version()); mainqueue = xQueueCreate(10, sizeof(my_event_t)); connectToAp(); //setap("test", 4); init_led(); PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO5_U, FUNC_GPIO5); PIN_PULLUP_DIS(PERIPHS_IO_MUX_GPIO5_U); // disable pullodwn GPIO_REG_WRITE(GPIO_ENABLE_W1TS_ADDRESS,BIT5); GPIO_OUTPUT_SET(GPIO_ID_PIN(5), 1); char outbuffer[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; WS2812OutBuffer( outbuffer, 6 , 0); //Initialize the output. write_textwall_buffer(0, "BIER ", 5); xTaskCreate(simple_task, (signed char * )"simple_task", 256, &mainqueue, tskIDLE_PRIORITY, NULL); xTaskCreate(receive_udp, (signed char * )"test", 256, &mainqueue, tskIDLE_PRIORITY, NULL); timerHandle = xTimerCreate((signed char *) "Trigger", 50 / portTICK_RATE_MS, pdTRUE, NULL, timer_cb); if (timerHandle != NULL) { if (xTimerStart(timerHandle, 0) != pdPASS) { printf("%s: Unable to start Timer ...\n", __FUNCTION__); } } else { printf("%s: Unable to create Timer ...\n", __FUNCTION__); } }
void user_init(void) { uart_init(BIT_RATE_115200, BIT_RATE_115200); int at_wifiMode = wifi_get_opmode(); uart0_sendStr("\r\nCustom Server\r\n"); wifi_set_opmode( 2 ); //We broadcast our ESSID, wait for peopel to join. pUdpServer = (struct espconn *)os_zalloc(sizeof(struct espconn)); if (pUdpServer == NULL) { uart0_sendStr("UdpServer Failure\r\n"); return; } pUdpServer->type = ESPCONN_UDP; pUdpServer->state = ESPCONN_NONE; pUdpServer->proto.udp = (esp_udp *)os_zalloc(sizeof(esp_udp)); pUdpServer->proto.udp->local_port = PORT; pUdpServer->reverse = NULL; espconn_regist_recvcb(pUdpServer, at_udpserver_recv); espconn_accept(pUdpServer); char outbuffer[] = { 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff }; WS2812OutBuffer( outbuffer, sizeof(outbuffer) ); system_os_task(at_procTask, at_procTaskPrio, at_procTaskQueue, at_procTaskQueueLen); uart0_sendStr("\r\nCustom Server\r\n"); system_os_post(at_procTaskPrio, 0, 0 ); }
static void ICACHE_FLASH_ATTR at_udpserver_recv(void *arg, char *pusrdata, unsigned short len) { struct espconn *pespconn = (struct espconn *)arg; WS2812OutBuffer( pusrdata, len ); uart0_sendStr("sent\r\n"); return; }
void setled(char* data, int len ,int dim) { WS2812OutBuffer(data, len, dim); }