本文整理汇总了C++中ETS_UART_INTR_ENABLE函数的典型用法代码示例。如果您正苦于以下问题:C++ ETS_UART_INTR_ENABLE函数的具体用法?C++ ETS_UART_INTR_ENABLE怎么用?C++ ETS_UART_INTR_ENABLE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ETS_UART_INTR_ENABLE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Daven005,项目名称:ESP8266,代码行数:31,代码来源:user_main.c
示例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;
}
}
开发者ID:EUA,项目名称:esp8266,代码行数:32,代码来源:at_wifiCmd.c
示例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;
}
开发者ID:Anandpatel1,项目名称:Arduino,代码行数:26,代码来源:uart.c
示例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();
}
开发者ID:holgiw,项目名称:esp8266_roomba,代码行数:33,代码来源:at_port.c
示例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);
}
}
开发者ID:christianuhlmann,项目名称:ESP8266_Transparent_TCP_Client_Bridge,代码行数:35,代码来源:user_main.c
示例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);
}
开发者ID:eeijcea,项目名称:ESP8266,代码行数:31,代码来源:slave_main.c
示例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;
}
开发者ID:Makuna,项目名称:Arduino,代码行数:13,代码来源:ESP8266WiFiSTA.cpp
示例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();
}
开发者ID:LeandroTE,项目名称:ESP8266,代码行数:25,代码来源:user_main.c
示例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();
}
开发者ID:brainwagon,项目名称:EMS-ESP12,代码行数:27,代码来源:user_main.c
示例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;
}
开发者ID:ccaroon,项目名称:arduino,代码行数:27,代码来源:ESP8266WiFi.cpp
示例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!
}
开发者ID:zack-wang,项目名称:esp_mqtt_pms5003,代码行数:33,代码来源:user_main.c
示例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;
}
开发者ID:everslick,项目名称:Arduino,代码行数:30,代码来源:ESP8266WiFiGeneric.cpp
示例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();
}
开发者ID:Red680812,项目名称:WeMos_Boards,代码行数:9,代码来源:ESP8266WiFi.cpp
示例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();
}
开发者ID:ccaroon,项目名称:arduino,代码行数:56,代码来源:ESP8266WiFi.cpp
示例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();
}
开发者ID:EUA,项目名称:esp8266,代码行数:62,代码来源:at_wifiCmd.c
示例16: ETS_UART_INTR_DISABLE
void EEPROMClass::commit()
{
if (!_size || !_dirty)
return;
ETS_UART_INTR_DISABLE();
spi_flash_erase_sector(CONFIG_SECTOR);
spi_flash_write(CONFIG_ADDR, reinterpret_cast<uint32_t*>(_data), _size);
ETS_UART_INTR_ENABLE();
_dirty = false;
}
开发者ID:ElAngeluz,项目名称:arduino-esp8266,代码行数:11,代码来源:EEPROM.cpp
示例17: ETS_UART_INTR_DISABLE
int ESP8266WiFiClass::disconnect()
{
struct station_config conf;
*conf.ssid = 0;
*conf.password = 0;
ETS_UART_INTR_DISABLE();
wifi_station_set_config(&conf);
wifi_station_disconnect();
ETS_UART_INTR_ENABLE();
return 0;
}
开发者ID:Beck-Sisyphus,项目名称:dubhacks15,代码行数:11,代码来源:ESP8266WiFi.cpp
示例18: uart_init
/******************************************************************************
* FunctionName : uart_init
* Description : user interface for init uart
* Parameters : UartBautRate uart0_br - uart0 bautrate
* UartBautRate uart1_br - uart1 bautrate
* Returns : NONE
*******************************************************************************/
void ICACHE_FLASH_ATTR uart_init (UartBautRate uart0_br, UartBautRate uart1_br)
{
// rom use 74880 baut_rate, here reinitialize
UartDev.baut_rate = uart0_br;
uart_config (UART0);
UartDev.baut_rate = uart1_br;
uart_config (UART1);
ETS_UART_INTR_ENABLE();
// install uart1 putc callback
os_install_putc1 ((void *)uart1_write_char);
}
开发者ID:Intelligent-Productions,项目名称:UDP_SPI_project,代码行数:19,代码来源:uart.c
示例19: user_init
/******************************************************************************
* FunctionName : user_init
* Description : entry of user application, init user function here
* Parameters : none
* Returns : none
*******************************************************************************/
void user_init(void)
{
bool ret;
PIN_FUNC_SELECT(LED_GPIO_MUX, LED_GPIO_FUNC);
xUARTQueue = xQueueCreate(128, sizeof(char));
uart_init_new();
UART_intr_handler_register(&uart0_rx_intr_handler, &xUARTQueue);
ETS_UART_INTR_ENABLE();
printf("SDK version:%s\n", system_get_sdk_version());
GPIO_OUTPUT_SET(LED_GPIO, 0);
//Set station mode
wifi_set_opmode(STATIONAP_MODE);
// ESP8266 connect to router.
// user_set_station_config();
// Setup TCP server
wifi_station_set_auto_connect(0);
// wifi_station_set_reconnect_policy(0);
printf("Wifi Button example program. \r\n");
if (!read_user_config(&user_config))
{
ret = wifi_set_opmode(STATIONAP_MODE);
DBG("wifi_set_opmode returns %d op_mode now %d\r\n", ret, wifi_get_opmode());
// user_set_station_config();
user_tcpserver_init(SERVER_LOCAL_PORT);
// user_tcpserver_init(SERVER_LOCAL_PORT);
wifi_station_set_auto_connect(1);
}
else
{
printf ("No valid config\r\n");
}
printf("Hiya");
// sys_init_timing();
lwip_init();
// while(1);
// xTaskCreate(check_input, "input", 256, &xUARTQueue, 3, NULL);
// xTaskCreate(helloworld, "hw", configMINIMAL_STACK_SIZE, NULL, 2, NULL);
// xTaskCreate(blinky, "bl", configMINIMAL_STACK_SIZE, NULL, 2, NULL);
}
开发者ID:Andrew-Collins,项目名称:esp8266-sdk,代码行数:57,代码来源:user_main.c
示例20: flash_read
void ICACHE_FLASH_ATTR flash_read() {
os_printf("flashRead() size-%d\n", sizeof(FlashData));
flashData->magic =0;
ETS_UART_INTR_DISABLE();
spi_flash_read((PRIV_PARAM_START_SEC + PRIV_PARAM_SAVE) * SPI_FLASH_SEC_SIZE,
(uint32 *)flashData, sizeof(FlashData));
ETS_UART_INTR_ENABLE();
if (flashData->magic != MAGIC_NUM)
{
os_printf("ReadFlash ERROR!\n");
initFlash();
}
}
开发者ID:darcyg,项目名称:ESP8266Rest,代码行数:14,代码来源:user_main.c
注:本文中的ETS_UART_INTR_ENABLE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论