本文整理汇总了C++中os_timer_arm函数的典型用法代码示例。如果您正苦于以下问题:C++ os_timer_arm函数的具体用法?C++ os_timer_arm怎么用?C++ os_timer_arm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了os_timer_arm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wifi_check_ip
LOCAL void ICACHE_FLASH_ATTR wifi_check_ip(void *arg) {
struct ip_info ipConfig;
uint8_t wifiStatus = STATION_IDLE;
os_timer_disarm(&wiFiLinker);
wifi_get_ip_info(STATION_IF, &ipConfig);
wifiStatus = wifi_station_get_connect_status();
if (wifiStatus == STATION_GOT_IP && ipConfig.ip.addr != 0) {
DEBUG("[NETWORK] Connected to network (IP: "IPSTR")\r\n", IP2STR(&ipConfig.ip));
os_timer_setfn(&wiFiLinker, (os_timer_func_t *) wifi_check_ip, NULL);
os_timer_arm(&wiFiLinker, 2000, 0);
} else {
if (wifi_station_get_connect_status() == STATION_WRONG_PASSWORD) {
DEBUG("[NETWORK] error: STATION_WRONG_PASSWORD\r\n");
station_connect();
} else if (wifi_station_get_connect_status() == STATION_NO_AP_FOUND) {
DEBUG("[NETWORK] error: STATION_NO_AP_FOUND\r\n");
station_connect();
} else if (wifi_station_get_connect_status() == STATION_CONNECT_FAIL) {
DEBUG("[NETWORK] error: STATION_CONNECT_FAIL\r\n");
station_connect();
} else {
//DEBUG("[NETWORK] error: STATION_IDLE\r\n");
}
if(state == USER_STATION_MODE){
os_timer_setfn(&wiFiLinker, (os_timer_func_t *) wifi_check_ip, NULL);
os_timer_arm(&wiFiLinker, 500, 0);
}
}
if (wifiStatus != lastWifiStatus) {
lastWifiStatus = wifiStatus;
if (wifiCb)
wifiCb(wifiStatus);
}
}
示例2: otb_ds18b20_initialize
void ICACHE_FLASH_ATTR otb_ds18b20_initialize(uint8_t bus)
{
bool rc;
void *vTask;
int ii;
uint32_t timer_int;
DEBUG("DS18B20: otb_ds18b20_initialize entry");
DEBUG("DS18B20: Initialize one wire bus on GPIO pin %d", bus);
otb_ds18b20_init(bus);
INFO("DS18B20: One Wire bus initialized");
rc = otb_ds18b20_get_devices();
INFO("DS18B20: DS18B20 device count %u", otb_ds18b20_count);
if (rc)
{
WARN("DS18B20: More than %d DS18B20 devices - only reading from first %d",
OTB_DS18B20_MAX_DS18B20S,
OTB_DS18B20_MAX_DS18B20S);
}
for (ii = 0; ii < otb_ds18b20_count; ii++)
{
// Stagger timer for each temperature sensor
INFO("DS18B20: Index %d Address %s", ii, otb_ds18b20_addresses[ii].friendly);
timer_int = OTB_DS18B20_REPORT_INTERVAL * (ii + 1) / otb_ds18b20_count;
otb_ds18b20_addresses[ii].timer_int = timer_int;
os_timer_disarm((os_timer_t*)(otb_ds18b20_timer + ii));
os_timer_setfn((os_timer_t*)(otb_ds18b20_timer + ii), (os_timer_func_t *)otb_ds18b20_callback, otb_ds18b20_addresses + ii);
if (timer_int != OTB_DS18B20_REPORT_INTERVAL)
{
os_timer_arm((os_timer_t*)(otb_ds18b20_timer + ii), timer_int, 0);
}
else
{
os_timer_arm((os_timer_t*)(otb_ds18b20_timer + ii), timer_int, 1);
}
}
DEBUG("DS18B20: otb_ds18b20_initialize entry");
return;
}
示例3: esponn_server_err
/******************************************************************************
* FunctionName : esponn_server_err
* Description : The pcb had an error and is already deallocated.
* The argument might still be valid (if != NULL).
* Parameters : arg -- Additional argument to pass to the callback function
* err -- Error code to indicate why the pcb has been closed
* Returns : none
*******************************************************************************/
static void ICACHE_FLASH_ATTR
esponn_server_err(void *arg, err_t err)
{
espconn_msg *pserr_cb = arg;
struct tcp_pcb *pcb = NULL;
if (pserr_cb != NULL) {
os_timer_disarm(&pserr_cb->pcommon.ptimer);
pcb = pserr_cb->pcommon.pcb;
pserr_cb->pespconn->state = ESPCONN_CLOSE;
/*remove the node from the server's active connection list*/
espconn_list_delete(&plink_active, pserr_cb);
if (err == ERR_ABRT) {
switch (pcb->state) {
case SYN_RCVD:
if (pcb->nrtx == TCP_SYNMAXRTX) {
pserr_cb->pcommon.err = ESPCONN_CONN;
} else {
pserr_cb->pcommon.err = err;
}
break;
case ESTABLISHED:
if (pcb->nrtx == TCP_MAXRTX) {
pserr_cb->pcommon.err = ESPCONN_TIMEOUT;
} else {
pserr_cb->pcommon.err = err;
}
break;
case CLOSE_WAIT:
if (pcb->nrtx == TCP_MAXRTX) {
pserr_cb->pcommon.err = ESPCONN_CLSD;
} else {
pserr_cb->pcommon.err = err;
}
break;
case LAST_ACK:
pserr_cb->pcommon.err = ESPCONN_CLSD;
break;
case CLOSED:
pserr_cb->pcommon.err = ESPCONN_CONN;
break;
default :
break;
}
} else {
pserr_cb->pcommon.err = err;
}
os_timer_setfn(&pserr_cb->pcommon.ptimer,
(os_timer_func_t *) espconn_tcp_reconnect, pserr_cb);
os_timer_arm(&pserr_cb->pcommon.ptimer, 10, 0);
}
}
示例4: init
void init(void) {
gpio_init();
_millis = 0L;
os_timer_disarm(&millis_timer);
os_timer_setfn(&millis_timer, (os_timer_func_t *)millis_func, NULL);
os_timer_arm(&millis_timer, 1, 1);
}
示例5: light_ShowDevLevel
void ICACHE_FLASH_ATTR
light_ShowDevLevel(uint32 mlevel,uint32 delay_ms)
{
os_timer_disarm(&show_level_delay_t);
os_timer_setfn(&show_level_delay_t,light_ShowDevLevel_t,mlevel);
os_timer_arm(&show_level_delay_t,delay_ms,0);
}
示例6: restart_init_station_chk_timer
/*
* 定时检查是否连接到云端,若未连接到云端则定时器开启,若已连接则关闭
* 从云端断开时,定时器将重新开启。
* station 模式使用
*/
void ICACHE_FLASH_ATTR restart_init_station_chk_timer(int interval)
{
os_printf("启动计时器\n");
os_timer_disarm(&station_chk_timer);
os_timer_setfn(&station_chk_timer, station_connect_status_check_timercb, &station_chk_timer);
os_timer_arm(&station_chk_timer, interval, 1);// 重复,每秒检查一次,若连上后取消,连接断开或其他事件重启此 timer
os_printf("station checker timer start completed\n");
}
示例7: network_init
void ICACHE_FLASH_ATTR network_init()
{
//uart0_tx_buffer("net init",8);
os_timer_disarm(&network_timer);
os_timer_setfn(&network_timer, (os_timer_func_t *)network_check_ip, NULL);
os_timer_arm(&network_timer, 1000, 0);
}
示例8: supla_ds18b20_start
void supla_ds18b20_start(void)
{
supla_ds18b20_last_temp = -275;
os_timer_disarm(&supla_ds18b20_timer1);
os_timer_setfn(&supla_ds18b20_timer1, supla_ds18b20_read_temperatureA, NULL);
os_timer_arm (&supla_ds18b20_timer1, 5000, 1);
}
示例9: mg_cb2
void mg_cb2(struct mg_connection *nc, int ev, void *ev_data) {
DBG(("%p %d %p", nc, ev, ev_data));
if (ev == MG_EV_CONNECT) {
DBG(("got http reply"));
nc->flags |= MG_F_CLOSE_IMMEDIATELY;
os_timer_arm(&tmr, 2000, 0);
}
}
示例10: mg_resume
void mg_resume() {
if (!s_suspended) {
return;
}
s_suspended = 0;
os_timer_arm(&s_poll_tmr, MG_POLL_INTERVAL_MS, 0 /* no repeat */);
}
示例11: test_timer_cb
static void ICACHE_FLASH_ATTR test_timer_cb()
{
int32_t cs = sntp_get_current_timestamp();
os_printf("Current timestamp: %d\r\n", cs);
os_printf("Current Time: %s\r\n\r\n", sntp_get_real_time(cs));
os_timer_arm(&test_timer, 3000, 0);
}
示例12: wifi_RestartMeshScan
void ICACHE_FLASH_ATTR
wifi_RestartMeshScan(uint32 t)
{
INFO("RE-SEARCH MESH NETWORK,in %ds \r\n",t/1000);
os_timer_disarm(&mesh_scan_t);
os_timer_setfn(&mesh_scan_t,user_MeshStart,NULL);
os_timer_arm(&mesh_scan_t,t,0);
}
示例13: user_link_led_timer_init
void ICACHE_FLASH_ATTR user_link_led_timer_init(void) {
link_start_time = system_get_time();
os_timer_disarm(&link_led_timer);
os_timer_setfn(&link_led_timer, (os_timer_func_t *)user_link_led_timer_cb, NULL);
os_timer_arm(&link_led_timer, 50, 1);
link_led_level = 0;
GPIO_OUTPUT_SET(GPIO_ID_PIN(SENSOR_LINK_LED_IO_NUM), link_led_level);
}
示例14: slave_sendalive
void slave_sendalive() {
struct ip_addr ipSend;
os_timer_disarm(&watchdog_slave);
IP4_ADDR(&ipSend, 255, 255, 255, 255);
os_printf("Sending out ACK \r\n");
SendBroadcastSlave("ALIVE", &ipSend, 8000);
os_timer_arm(&watchdog_slave, 2000, 0);
}
示例15: user_init
void user_init(void)
{
uart_init(BIT_RATE_230400, BIT_RATE_230400);
system_set_os_print(1); // enable/disable operating system printout
os_sprintf(topic_temp, MQTT_TOPICTEMP, system_get_chip_id());
os_sprintf(topic_hum, MQTT_TOPICHUM, system_get_chip_id());
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_GPIO13);
ETS_GPIO_INTR_DISABLE(); // Disable gpio interrupts
ETS_GPIO_INTR_ATTACH(interrupt_test, 4);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4);
gpio_output_set(0, 0, 0, GPIO_ID_PIN(4)); // Set GPIO12 as input
GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(4));
gpio_pin_intr_state_set(GPIO_ID_PIN(4), GPIO_PIN_INTR_ANYEDGE);
ETS_GPIO_INTR_ENABLE(); // Enable gpio interrupts
config_load();
DHTInit(DHT11);
MQTT_InitConnection(&mqttClient, config.mqtt_host, config.mqtt_port, config.security);
MQTT_InitClient(&mqttClient, config.device_id, config.mqtt_user, config.mqtt_pass, config.mqtt_keepalive, 1);
MQTT_InitLWT(&mqttClient, "lwt/", "offline", 0, 0);
MQTT_OnConnected(&mqttClient, mqtt_connected_cb);
MQTT_OnDisconnected(&mqttClient, mqtt_disconnected_cb);
MQTT_OnPublished(&mqttClient, mqtt_published_cb);
MQTT_OnData(&mqttClient, mqtt_data_cb);
WIFI_Connect(config.sta_ssid, config.sta_pwd, wifi_connect_cb);
os_timer_disarm(&dhtTimer);
os_timer_setfn(&dhtTimer, (os_timer_func_t *)dhtCb, (void *)0);
os_timer_arm(&dhtTimer, DELAY, 1);
os_timer_disarm(&hbTimer);
os_timer_setfn(&hbTimer, (os_timer_func_t *)application_heartbeat, (void *)0);
os_timer_arm(&hbTimer, 60000, 1);
INFO("\r\nSystem started ...\r\n");
}