本文整理汇总了C++中ETS_UART_INTR_ENABLE函数的典型用法代码示例。如果您正苦于以下问题:C++ ETS_UART_INTR_ENABLE函数的具体用法?C++ ETS_UART_INTR_ENABLE怎么用?C++ ETS_UART_INTR_ENABLE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ETS_UART_INTR_ENABLE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readRx
static char * ICACHE_FLASH_ATTR readRx(RcvMsgBuff *rxBfr) {
static int idx = 0;
static char bfr[400];
char c;
ETS_UART_INTR_DISABLE();
while (rxBfr->count > 0) {
c = *(rxBfr->pReadPos);
rxBfr->count--;
rxBfr->pReadPos++;
if (rxBfr->pReadPos == (rxBfr->pRcvMsgBuff + RX_BUFF_SIZE)) {
rxBfr->pReadPos = rxBfr->pRcvMsgBuff ;
}
if (c == '\r' || c == '\n') {
if (idx > 0) { // Otherwise ignore blank line
bfr[idx] = 0;
idx = 0;
ETS_UART_INTR_ENABLE();
return bfr;
}
} else {
if (idx < sizeof(bfr)-3) {
bfr[idx++] = c;
} else {
ERRORP("Bfr overflow\n");
}
}
}
ETS_UART_INTR_ENABLE();
return NULL;
}
示例2: at_setupCmdCwmode
/**
* @brief Setup commad of set wifi mode.
* @param id: commad id number
* @param pPara: AT input param
* @retval None
*/
void ICACHE_FLASH_ATTR
at_setupCmdCwmode(uint8_t id, char *pPara)
{
uint8_t mode;
char temp[32];
pPara++;
mode = atoi(pPara);
if(mode == at_wifiMode)
{
uart0_sendStr("no change\r\n");
return;
}
if((mode >= 1) && (mode <= 3))
{
ETS_UART_INTR_DISABLE();
wifi_set_opmode(mode);
ETS_UART_INTR_ENABLE();
at_backOk;
// system_restart();
}
else
{
at_backError;
}
}
示例3: uart_resize_rx_buffer
size_t uart_resize_rx_buffer(uart_t* uart, size_t new_size)
{
if(uart == NULL || !uart->rx_enabled) {
return 0;
}
if(uart->rx_buffer->size == new_size) {
return uart->rx_buffer->size;
}
uint8_t * new_buf = (uint8_t*)malloc(new_size);
if(!new_buf) {
return uart->rx_buffer->size;
}
size_t new_wpos = 0;
ETS_UART_INTR_DISABLE();
while(uart_rx_available(uart) && new_wpos < new_size) {
new_buf[new_wpos++] = uart_read_char(uart);
}
uint8_t * old_buf = uart->rx_buffer->buffer;
uart->rx_buffer->rpos = 0;
uart->rx_buffer->wpos = new_wpos;
uart->rx_buffer->size = new_size;
uart->rx_buffer->buffer = new_buf;
free(old_buf);
ETS_UART_INTR_ENABLE();
return uart->rx_buffer->size;
}
示例4: at_recvTask
/**
* @brief Uart receive task.
* @param events: contain the uart receive data
* @retval None
*/
static void ICACHE_FLASH_ATTR ///////
at_recvTask(os_event_t *events)
{
uint8_t temp;
while(READ_PERI_REG(UART_STATUS(UART0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S))
{
temp = READ_PERI_REG(UART_FIFO(UART0)) & 0xFF;
if (ser_count>64) ser_count = 0;
ser[ser_count] = temp;
ser_count++;
ser[64] = ser_count;
feedwdt();
}
if(UART_RXFIFO_FULL_INT_ST == (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_FULL_INT_ST))
{
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_FULL_INT_CLR);
}
else if(UART_RXFIFO_TOUT_INT_ST == (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_TOUT_INT_ST))
{
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_TOUT_INT_CLR);
}
ETS_UART_INTR_ENABLE();
}
示例5: recvTask
//Read from UART0(requires special uart.c!)
static void ICACHE_FLASH_ATTR recvTask(os_event_t *events)
{
uint8_t c, i;
char ch[1000];
c = 0;
i = 0;
//uart0_tx_buffer("uart",4);
while (READ_PERI_REG(UART_STATUS(UART0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S))
{
WRITE_PERI_REG(0X60000914, 0x73); //WTD
c = READ_PERI_REG(UART_FIFO(UART0)) & 0xFF;
ch[i] = c;
i++;
}
if(UART_RXFIFO_FULL_INT_ST == (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_FULL_INT_ST))
{
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_FULL_INT_CLR);
}
else if(UART_RXFIFO_TOUT_INT_ST == (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_TOUT_INT_ST))
{
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_TOUT_INT_CLR);
}
ETS_UART_INTR_ENABLE();
// send to Server if available
if (pconn && i != 0)
{
espconn_sent(pconn, ch, i);
}
}
示例6: wifi_connect
/**
* @brief Setup commad of join to wifi ap.
* @param id: commad id number
* @param pPara: AT input param
* @retval None
*/
static void ICACHE_FLASH_ATTR wifi_connect(char * ssid, char * password, char * bssid)
{
char temp[64];
struct station_config stationConf;
int8_t len;
connect_attempts++;
//wifi_station_get_config(&stationConf);
os_bzero(&stationConf, sizeof(struct station_config));
os_memcpy(&stationConf.ssid, ssid, os_strlen(ssid));
//os_memcpy(&stationConf.password, password, os_strlen(password));
os_memcpy(&stationConf.bssid, bssid, 6);
stationConf.bssid_set = 1;
wifi_station_disconnect();
os_printf("stationConf.ssid: -%s-\r\n", stationConf.ssid);
os_printf("stationConf.password: -%s-\r\n", stationConf.password);
ETS_UART_INTR_DISABLE();
wifi_station_set_config(&stationConf);
ETS_UART_INTR_ENABLE();
wifi_station_connect();
os_timer_disarm(&at_japDelayChack);
os_timer_setfn(&at_japDelayChack, (os_timer_func_t *)at_japChack, NULL);
os_timer_arm(&at_japDelayChack, 3000, 0);
}
示例7: ETS_UART_INTR_DISABLE
/**
* Setting the ESP8266 station to connect to the AP (which is recorded)
* automatically or not when powered on. Enable auto-connect by default.
* @param autoConnect bool
* @return if saved
*/
bool ESP8266WiFiSTAClass::setAutoConnect(bool autoConnect) {
bool ret;
ETS_UART_INTR_DISABLE();
ret = wifi_station_set_auto_connect(autoConnect);
ETS_UART_INTR_ENABLE();
return ret;
}
示例8: recvTask
static void ICACHE_FLASH_ATTR recvTask(os_event_t *events)
{
uint8_t i;
while (READ_PERI_REG(UART_STATUS(UART0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S))
{
WRITE_PERI_REG(0X60000914, 0x73); //WTD
uint16 length = 0;
while ((READ_PERI_REG(UART_STATUS(UART0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S)) && (length<MAX_UARTBUFFER))
uartbuffer[length++] = READ_PERI_REG(UART_FIFO(UART0)) & 0xFF;
for (i = 0; i < MAX_CONN; ++i)
if (connData[i].conn)
espbuffsent(&connData[i], uartbuffer, length);
}
if(UART_RXFIFO_FULL_INT_ST == (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_FULL_INT_ST))
{
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_FULL_INT_CLR);
}
else if(UART_RXFIFO_TOUT_INT_ST == (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_TOUT_INT_ST))
{
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_TOUT_INT_CLR);
}
ETS_UART_INTR_ENABLE();
}
示例9: user_init
void user_init(void)
{
ETS_UART_INTR_DISABLE();
UART_SetBaudrate(UART0, BIT_RATE_9600);
UART_ResetFifo(UART0);
UART_SetBaudrate(UART1, BIT_RATE_115200);
UART_ResetFifo(UART1);
flash_param_init();
flash_param = flash_param_get();
emsRxBuf = allocateRcvMsgBuff();
uart_init(BIT_RATE_9600, BIT_RATE_115200);
rtc_clock_calibration = system_rtc_clock_cali_proc(); // get RTC clock period
os_printf("rtc_clock_calibration: %0x\n", rtc_clock_calibration >>12 );
os_printf("system_get_rtc_time: %d\n", system_get_rtc_time());
os_printf("system_get_time: %d\n", system_get_time());
serverInit(flash_param->port);
wifi_set_sleep_type(LIGHT_SLEEP_T);
system_os_task(recvTask, recvTaskPrio, recvTaskQueue, recvTaskQueueLen);
ETS_UART_INTR_ENABLE();
}
示例10: ETS_UART_INTR_DISABLE
int ESP8266WiFiClass::disconnect(bool wifioff)
{
struct station_config conf;
*conf.ssid = 0;
*conf.password = 0;
ETS_UART_INTR_DISABLE();
if (_persistent)
wifi_station_set_config(&conf);
else
wifi_station_set_config_current(&conf);
wifi_station_disconnect();
ETS_UART_INTR_ENABLE();
if(wifioff) {
_useClientMode = false;
if(_useApMode) {
// turn on AP
_mode(WIFI_AP);
} else {
// turn wifi off
_mode(WIFI_OFF);
}
}
return 0;
}
示例11: recvTask
//// modified for LASS , receive data from UART0 (sensor)
static void ICACHE_FLASH_ATTR recvTask(os_event_t *events)
{
uint8_t i;
uint16 length = 0;
//char* p;
//p=&LASSstring[0];
while (READ_PERI_REG(UART_STATUS(UART0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S))
{
WRITE_PERI_REG(0X60000914, 0x73); //WTD
//length=0;
while ((READ_PERI_REG(UART_STATUS(UART0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S)) && (length<MAX_UARTBUFFER))
uartbuffer[length++] = READ_PERI_REG(UART_FIFO(UART0)) & 0xFF;
//refer to Plantower PMS5003
p1_0 = (uint32)uartbuffer[4]*256+(uint32)uartbuffer[5];
p2_5 = (uint32)uartbuffer[6]*256+(uint32)uartbuffer[7];
p10_0 = (uint32)uartbuffer[8]*256+(uint32)uartbuffer[9];
}
if(UART_RXFIFO_FULL_INT_ST == (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_FULL_INT_ST))
{
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_FULL_INT_CLR);
}
else if(UART_RXFIFO_TOUT_INT_ST == (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_TOUT_INT_ST))
{
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_TOUT_INT_CLR);
}
INFO("%s\r\n",LASSstring);
//uart_rx_intr_enable(UART0);
ETS_UART_INTR_ENABLE();
///// BUG ! TX malfunctioned!
}
示例12: if
/**
* set new mode
* @param m WiFiMode_t
*/
bool ESP8266WiFiGenericClass::mode(WiFiMode_t m) {
if(_persistent){
if(wifi_get_opmode() == (uint8) m && wifi_get_opmode_default() == (uint8) m){
return true;
}
} else if(wifi_get_opmode() == (uint8) m){
return true;
}
bool ret = false;
if (m != WIFI_STA && m != WIFI_AP_STA)
// calls lwIP's dhcp_stop(),
// safe to call even if not started
wifi_station_dhcpc_stop();
ETS_UART_INTR_DISABLE();
if(_persistent) {
ret = wifi_set_opmode(m);
} else {
ret = wifi_set_opmode_current(m);
}
ETS_UART_INTR_ENABLE();
return ret;
}
示例13: ETS_UART_INTR_DISABLE
void ESP8266WiFiClass::mode(WiFiMode m)
{
if(wifi_get_opmode() == (uint8)m) {
return;
}
ETS_UART_INTR_DISABLE();
wifi_set_opmode(m);
ETS_UART_INTR_ENABLE();
}
示例14: _mode
void ESP8266WiFiClass::softAP(const char* ssid, const char* passphrase, int channel, int ssid_hidden)
{
_useApMode = true;
if(_useClientMode) {
// turn on AP+STA mode
_mode(WIFI_AP_STA);
} else {
// turn on STA mode
_mode(WIFI_AP);
}
if(!ssid || *ssid == 0 || strlen(ssid) > 31) {
// fail SSID too long or missing!
return;
}
if(passphrase && strlen(passphrase) > 63) {
// fail passphrase to long!
return;
}
struct softap_config conf;
wifi_softap_get_config(&conf);
strcpy(reinterpret_cast<char*>(conf.ssid), ssid);
conf.channel = channel;
conf.ssid_len = strlen(ssid);
conf.ssid_hidden = ssid_hidden;
conf.max_connection = 4;
conf.beacon_interval = 100;
if (!passphrase || strlen(passphrase) == 0)
{
conf.authmode = AUTH_OPEN;
*conf.password = 0;
}
else
{
conf.authmode = AUTH_WPA2_PSK;
strcpy(reinterpret_cast<char*>(conf.password), passphrase);
}
struct softap_config conf_current;
wifi_softap_get_config(&conf_current);
if (softap_config_equal(conf, conf_current))
{
DEBUGV("softap config unchanged");
return;
}
ETS_UART_INTR_DISABLE();
if (_persistent)
wifi_softap_set_config(&conf);
else
wifi_softap_set_config_current(&conf);
ETS_UART_INTR_ENABLE();
}
示例15: at_setupCmdCwsap
/**
* @brief Setup commad of module as wifi ap.
* @param id: commad id number
* @param pPara: AT input param
* @retval None
*/
void ICACHE_FLASH_ATTR
at_setupCmdCwsap(uint8_t id, char *pPara)
{
char temp[64];
int8_t len;
struct softap_config apConfig;
wifi_softap_get_config(&apConfig);
if(at_wifiMode == STATION_MODE)
{
at_backError;
return;
}
pPara++;
len = at_dataStrCpy(apConfig.ssid, pPara, 32);
if(len < 1)
{
uart0_sendStr("ssid ERROR\r\n");
return;
}
pPara += (len+3);
len = at_dataStrCpy(apConfig.password, pPara, 64);
if(len < 8)
{
uart0_sendStr("pwd ERROR\r\n");
return;
}
pPara += (len+3);
apConfig.channel = atoi(pPara);
if(apConfig.channel<1 || apConfig.channel>13)
{
uart0_sendStr("ch ERROR\r\n");
return;
}
pPara++;
pPara = strchr(pPara, ',');
pPara++;
apConfig.authmode = atoi(pPara);
if(apConfig.authmode >= 5)
{
uart0_sendStr("s ERROR\r\n");
return;
}
// os_sprintf(temp,"%s,%s,%d,%d\r\n",
// apConfig.ssid,
// apConfig.password,
// apConfig.channel,
// apConfig.authmode);
// uart0_sendStr(temp);
ETS_UART_INTR_DISABLE();
wifi_softap_set_config(&apConfig);
ETS_UART_INTR_ENABLE();
at_backOk;
// system_restart();
}