当前位置: 首页>>代码示例>>C++>>正文


C++ os_timer_arm函数代码示例

本文整理汇总了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);

	}
}
开发者ID:koltegirish,项目名称:esp8266-mqtt-iot,代码行数:47,代码来源:user_network.c

示例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;
}
开发者ID:piersfinlayson,项目名称:otb-iot,代码行数:47,代码来源:otb_ds18b20.c

示例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);
    }
}
开发者ID:AlexShadow,项目名称:esp8266web,代码行数:67,代码来源:espconn_tcp.c

示例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);
}
开发者ID:alonewolfx2,项目名称:Ardunet,代码行数:8,代码来源:wiring.c

示例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);

}
开发者ID:Zhang-Jia,项目名称:ESP8266_LIGHT_WITH_MESH,代码行数:8,代码来源:user_light_hint.c

示例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");
}
开发者ID:alexsunday,项目名称:esp_iot_sdk_1.0.1,代码行数:13,代码来源:user_main.c

示例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);
}
开发者ID:christianuhlmann,项目名称:ESP8266_Transparent_TCP_Client_Bridge,代码行数:8,代码来源:client.c

示例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);
}
开发者ID:SUPLA,项目名称:supla-core,代码行数:8,代码来源:supla_ds18b20.c

示例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);
  }
}
开发者ID:ifzz,项目名称:smart.js,代码行数:8,代码来源:mg_lwip_test.c

示例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 */);
}
开发者ID:asmaklad,项目名称:smart.js,代码行数:8,代码来源:esp_mg_net_if.c

示例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);
}
开发者ID:fernandomorse,项目名称:noduino-sdk,代码行数:8,代码来源:user_main.c

示例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);
}
开发者ID:koanpl,项目名称:ESP8266_LIGHT_WITH_MESH,代码行数:8,代码来源:user_wifi_connect.c

示例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);
}
开发者ID:ClarePhang,项目名称:low_power_voltage_measurement,代码行数:8,代码来源:user_sensor.c

示例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);
}
开发者ID:eeijcea,项目名称:ESP8266,代码行数:8,代码来源:slave_main.c

示例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");
}
开发者ID:Ribster,项目名称:NoWire,代码行数:45,代码来源:user_main.c


注:本文中的os_timer_arm函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。