void USART1_IRQHandler(void) { if (USART_GetITStatus(USART1,USART_IT_RXNE)==SET) { set_xL(0); set_yL(0); // USART_SendData(USART1,0xFF); delay(0xFF);delay(0xFF); read_str_uart(USART1, Buffer); delay(0xFF);delay(0xFF); // USART_SendData(USART1,0xFF); delay(0xFF);delay(0xFF); dm=USART_ReceiveData(USART1); delay(0xFF);delay(0xFF); // USART_SendData(USART1,0xFF); delay(0xFF);delay(0xFF); Receive_buf[Receive_W]= USART_ReceiveData(USART1); delay(0xFF);delay(0xFF); Receive_W++; Receive_C++; send_Uart_str(USART1, Buffer); delay(0xFF);delay(0xFF); delay(0xFF);delay(0xFF); USART_ClearITPendingBit(USART1,USART_IT_RXNE); } }
void webif_data(uint8_t id, eth_frame_t *frame, uint16_t len) { ip_packet_t *ip = (void*)(frame->data); tcp_packet_t *tcp = (void*)(ip->data); char *req = (void*)tcp_get_data(tcp); char *buf = (void*)(tcp->data), *buf_ptr = buf; char *url, *p, *params, *name, *value; if(!len) return; if( (memcmp_P(req, PSTR("GET "), 4) == 0) && ((p = strchr(req + 4, ' ')) != 0) ) { url = req + 4; *p = 0; if((params = strchr(url, '?'))) *(params++) = 0; if(strcmp_P(url, PSTR("/")) == 0) { if(params==NULL) { send_Uart_str(" No params!"); send_Uart(13); }else { send_Uart_str(" With params!"); send_Uart(13); } while(params) { if((p = strchr(params, '&'))) *(p++) = 0; name = params; if((value = strchr(name, '='))) *(value++) = 0; if( (strcmp_P(name, PSTR("led")) == 0 ) && value ) { if(strcmp_P(value, PSTR("on")) == 0) led_on() else if(strcmp_P(value, PSTR("off")) == 0) led_off() } else if( (strcmp_P(name, PSTR("lang")) == 0) && value ) { if(strcmp_P(value, PSTR("en")) == 0) lang_ru = 0; else if(strcmp_P(value, PSTR("ru")) == 0) lang_ru = 1; } params = p; } fill_buf_p(&buf_ptr, webif_200_header); fill_buf_p(&buf_ptr, PSTR("<pre>")); if(!lang_ru) { fill_buf_p(&buf_ptr, PSTR("<p align='right'>[<b>EN</b> | " "<a href='/?lang=ru'>RU</a>]</p>")); } else { fill_buf_p(&buf_ptr, PSTR("<p align='right'>[<a href='/?lang=en'>EN</a> | " "<b>RU</b>]</p>")); } if((!led_state)&&(!lang_ru)) fill_buf_p(&buf_ptr, PSTR("Led is OFF. Turn <a href='/?led=on'>on</a>.")); else if(led_state &&(!lang_ru)) fill_buf_p(&buf_ptr, PSTR("Led is ON. Turn <a href='/?led=off'>off</a>.")); else if((!led_state)&&(lang_ru)) fill_buf_p(&buf_ptr, PSTR("Светодиод выключен. <a href='/?led=on'>Включить</a>.")); else if(led_state &&(lang_ru)) fill_buf_p(&buf_ptr, PSTR("Светодиод включен. <a href='/?led=off'>Выключить</a>.")); fill_buf_p(&buf_ptr, PSTR("</pre>")); }