本文整理汇总了C++中os_timer_setfn函数的典型用法代码示例。如果您正苦于以下问题:C++ os_timer_setfn函数的具体用法?C++ os_timer_setfn怎么用?C++ os_timer_setfn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了os_timer_setfn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: object_init_pool
void ICACHE_FLASH_ATTR object_init_pool(const struct object_config** object_configs)
{
struct object* object;
const struct object_config** config;
uint32_t cnt = 0, daemon_timeout_ms = 0;
// Count the objects
for(config=object_configs; *config != NULL; ++config, ++cnt);
global_objects = (struct object*) os_zalloc(sizeof(struct object) * (cnt + 1));
for(object=global_objects,config=object_configs; *config != NULL; ++object,++config)
{
object->config = *config;
if(object->config->init != NULL)
object->config->init(object, &daemon_timeout_ms);
if((object->config->daemon != NULL) && (daemon_timeout_ms != 0))
{
os_timer_setfn(&object->daemon, object_daemon_task, object);
os_timer_arm(&object->daemon, daemon_timeout_ms, 1);
object_daemon_task(object);
}
}
}
开发者ID:svenbw,项目名称:esp-mqtt-object,代码行数:27,代码来源:mqtt-object.c
示例2: cgiWiFiConnStatus
int ICACHE_FLASH_ATTR cgiWiFiConnStatus(HttpdConnData *connData) {
char buff[1024];
int len;
if (connData->conn==NULL) return HTTPD_CGI_DONE; // Connection aborted. Clean up.
jsonHeader(connData, 200);
len = os_sprintf(buff, "{");
len += printWifiInfo(buff+len);
len += os_sprintf(buff+len, ", ");
if (wifiReason != 0) {
len += os_sprintf(buff+len, "\"reason\": \"%s\", ", wifiGetReason());
}
#if 0
// commented out 'cause often the client that requested the change can't get a request in to
// find out that it succeeded. Better to just wait the std 15 seconds...
int st=wifi_station_get_connect_status();
if (st == STATION_GOT_IP) {
if (wifi_get_opmode() != 1) {
// Reset into AP-only mode sooner.
os_timer_disarm(&resetTimer);
os_timer_setfn(&resetTimer, resetTimerCb, NULL);
os_timer_arm(&resetTimer, 1000, 0);
}
}
#endif
len += os_sprintf(buff+len, "\"x\":0}\n");
//DBG(" -> %s\n", buff);
httpdSend(connData, buff, len);
return HTTPD_CGI_DONE;
}
开发者ID:mroavi,项目名称:esp-link,代码行数:34,代码来源:cgiwifi.c
示例3: syslog_timer_arm
static void ICACHE_FLASH_ATTR syslog_timer_arm(int delay) {
static os_timer_t wifi_chk_timer = {};
syslog_timer_armed = true;
os_timer_disarm(&wifi_chk_timer);
os_timer_setfn(&wifi_chk_timer, (os_timer_func_t *)syslog_chk_status, NULL);
os_timer_arm(&wifi_chk_timer, delay, 0);
}
开发者ID:susisstrolch,项目名称:ems-esp-link,代码行数:7,代码来源:syslog.c
示例4: ntp_get_time
void ICACHE_FLASH_ATTR ntp_get_time() {
ntp_t ntp;
// set up the udp "connection"
pCon = (struct espconn*)os_zalloc(sizeof(struct espconn));
pCon->type = ESPCONN_UDP;
pCon->state = ESPCONN_NONE;
pCon->proto.udp = (esp_udp*)os_zalloc(sizeof(esp_udp));
pCon->proto.udp->local_port = espconn_port();
pCon->proto.udp->remote_port = 123;
os_memcpy(pCon->proto.udp->remote_ip, ntp_server, 4);
// create a really simple ntp request packet
os_memset(&ntp, 0, sizeof(ntp_t));
ntp.options = 0b00100011; // leap = 0, version = 4, mode = 3 (client)
// set timeout timer
os_timer_disarm(&ntp_timeout);
os_timer_setfn(&ntp_timeout, (os_timer_func_t*)ntp_udp_timeout, pCon);
os_timer_arm(&ntp_timeout, NTP_TIMEOUT_MS, 0);
// send the ntp request
espconn_create(pCon);
espconn_regist_recvcb(pCon, ntp_udp_recv);
espconn_sent(pCon, (uint8*)&ntp, sizeof(ntp_t));
}
开发者ID:boyhuesd,项目名称:esp8266,代码行数:27,代码来源:ntp.c
示例5: wifi_check_ip
static void ICACHE_FLASH_ATTR wifi_check_ip(void *arg)
{
os_timer_disarm(&WiFiLinker);
switch(wifi_station_get_connect_status())
{
case STATION_GOT_IP:
wifi_get_ip_info(STATION_IF, &ipConfig);
if(ipConfig.ip.addr != 0) {
connState = WIFI_CONNECTED;
os_printf("WiFi connected\r\n");
} else {
connState = WIFI_CONNECTING_ERROR;
os_printf("WiFi connected, ip.addr is null\r\n");
}
break;
case STATION_WRONG_PASSWORD:
connState = WIFI_CONNECTING_ERROR;
os_printf("WiFi connecting error, wrong password\r\n");
break;
case STATION_NO_AP_FOUND:
connState = WIFI_CONNECTING_ERROR;
os_printf("WiFi connecting error, ap not found\r\n");
break;
case STATION_CONNECT_FAIL:
connState = WIFI_CONNECTING_ERROR;
os_printf("WiFi connecting fail\r\n");
break;
default:
connState = WIFI_CONNECTING;
os_printf("WiFi connecting...\r\n");
}
os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL);
os_timer_arm(&WiFiLinker, 2000, 0);
}
开发者ID:georgkreimer,项目名称:esp_hcp_temperature,代码行数:34,代码来源:user_main.c
示例6: SysTickStart
/*******************************************************************************
* 名称: SysTick_Handler
* 功能: 系统时钟节拍1MS
* 形参:
* 返回: 无
* 说明:
*******************************************************************************/
void ICACHE_FLASH_ATTR
SysTickStart(void)
{
os_timer_disarm(&SystemSysTick);
os_timer_setfn(&SystemSysTick,(os_timer_func_t*)SysTick_Handler,NULL);
os_timer_arm(&SystemSysTick, 1, 1);
}
开发者ID:greatlevi,项目名称:ESP8266-SDK1.3,代码行数:14,代码来源:SysLayerInit.c
示例7: luaopen_tmr
int luaopen_tmr( lua_State *L ){
int i;
luaL_rometatable(L, "tmr.timer", (void *)tmr_dyn_map);
for(i=0; i<NUM_TMR; i++){
alarm_timers[i].lua_ref = LUA_NOREF;
alarm_timers[i].self_ref = LUA_REFNIL;
alarm_timers[i].mode = TIMER_MODE_OFF;
os_timer_disarm(&alarm_timers[i].os);
}
last_rtc_time=system_get_rtc_time(); // Right now is time 0
last_rtc_time_us=0;
os_timer_disarm(&rtc_timer);
os_timer_setfn(&rtc_timer, rtc_callback, NULL);
os_timer_arm(&rtc_timer, 1000, 1);
SWTIMER_REG_CB(rtc_callback, SWTIMER_RESUME);
//The function rtc_callback calls the a function that calibrates the SoftRTC for drift in the esp8266's clock.
//My guess: after the duration of light_sleep there's bound to be some drift in the clock, so a calibration is due.
SWTIMER_REG_CB(alarm_timer_common, SWTIMER_RESUME);
//The function alarm_timer_common handles timers created by the developer via tmr.create().
//No reason not to resume the timers, so resume em'.
return 0;
}
开发者ID:NicolSpies,项目名称:nodemcu-firmware,代码行数:28,代码来源:tmr.c
示例8: connected_cloud_cb
void ICACHE_FLASH_ATTR connected_cloud_cb(void* param)
{
uint8 rcvbuf[16];
struct espconn* conn = (struct espconn*)param;
os_printf("connected_cloud_cb, conn: [%p]\n", conn);
client_status = STATUS_CONNECTED;
//注册 断开与接收、发送的回调
espconn_regist_recvcb(conn, data_received_cb);
espconn_regist_sentcb(conn, sent_cloud_cb);
espconn_regist_disconcb(conn, disconnected_cloud_cb);
//注册心跳回调
heart_timer* pheart = (heart_timer*)os_zalloc(sizeof(heart_timer));
ETSTimer* timer = (ETSTimer*)os_zalloc(sizeof(ETSTimer));
pheart->timer = timer;
pheart->conn = conn;
conn->reverse = (void*)pheart;
os_timer_disarm(timer);
os_timer_setfn(timer, heart_beat_cbfn, pheart);
os_timer_arm(timer, 120000, 1);//两分钟一个心跳包, 重复
uint32* pchipid = (uint32*)(rcvbuf + 2);
rcvbuf[0] = 7;
rcvbuf[1] = 0;
*pchipid = system_get_chip_id();
rcvbuf[6] = 1;
espconn_sent(conn, rcvbuf, 7);
os_printf("DEV RP OVER\n");
}
开发者ID:alexsunday,项目名称:esp_iot_sdk_1.0.1,代码行数:32,代码来源:user_main.c
示例9: cgiWiFiConnect
//This cgi uses the routines above to connect to a specific access point with the
//given ESSID using the given password.
CgiStatus ICACHE_FLASH_ATTR cgiWiFiConnect(HttpdConnData *connData) {
char essid[128];
char passwd[128];
static os_timer_t reassTimer;
if (connData->isConnectionClosed) {
//Connection aborted. Clean up.
return HTTPD_CGI_DONE;
}
httpdFindArg(connData->post.buff, "essid", essid, sizeof(essid));
httpdFindArg(connData->post.buff, "passwd", passwd, sizeof(passwd));
strncpy((char*)stconf.ssid, essid, 32);
strncpy((char*)stconf.password, passwd, 64);
//Schedule disconnect/connect
os_timer_disarm(&reassTimer);
os_timer_setfn(&reassTimer, reassTimerCb, NULL);
//Set to 0 if you want to disable the actual reconnecting bit
connTryStatus = CONNTRY_WORKING;
#ifdef DEMO_MODE
httpdRedirect(connData, "/wifi");
#else
os_timer_arm(&reassTimer, 500, 0);
httpdRedirect(connData, "connecting.html");
#endif
return HTTPD_CGI_DONE;
}
开发者ID:jkent,项目名称:libesphttpd,代码行数:30,代码来源:cgiwifi.c
示例10: user_check_ip
void ICACHE_FLASH_ATTR user_check_ip(uint8 reset_flag)
{
struct ip_info ipconfig;
os_timer_disarm(&check_sta_timer);
wifi_get_ip_info(STATION_IF, &ipconfig);
if (wifi_station_get_connect_status() == STATION_GOT_IP && ipconfig.ip.addr != 0)
{
fetch_code_from_cloud();
}
else
{
/* if there are wrong while connecting to some AP, then reset mode */
if ((wifi_station_get_connect_status() == STATION_WRONG_PASSWORD ||
wifi_station_get_connect_status() == STATION_NO_AP_FOUND ||
wifi_station_get_connect_status() == STATION_CONNECT_FAIL))
{
//TODO: reconfig wifi!!!
//user_esp_platform_reset_mode();
} else {
os_timer_setfn(&check_sta_timer, (os_timer_func_t *)user_check_ip, NULL);
os_timer_arm(&check_sta_timer, 100, 0);
}
}
}
开发者ID:Squonk42,项目名称:nodelua,代码行数:27,代码来源:user_main.c
示例11: light_pwm_dh_adj_proc
void light_pwm_dh_adj_proc(void *Targ)
{
uint8 i;
for(i=0;i<PWM_CHANNEL;i++){
duty_now[i] = (duty_now[i]*7 + current_duty[i])>>3;
if( ABS_MINUS(duty_now[i],current_duty[i])<20 ){
duty_now[i] = current_duty[i];
}
user_light_set_duty(duty_now[i],i);
}
//printf("duty:%u,%u,%u\r\n", duty_now[0],duty_now[1],duty_now[2] );
// pwm_init(light_param.pwm_period, light_param.pwm_duty,PWM_CHANNEL,pwmio_info); //lujian
pwm_start();
if(check_pwm_current_duty_diff()){
change_finish = 0;
os_timer_disarm(&timer_pwm_adj);
os_timer_setfn(&timer_pwm_adj, (os_timer_func_t *)light_pwm_dh_adj_proc, NULL);
os_timer_arm(&timer_pwm_adj, min_ms, 0);
}
else{
//printf("finish\n");
change_finish = 1;
//light_save_target_duty();
os_timer_disarm(&timer_pwm_adj);
light_pwm_smooth_adj_proc();
}
}
开发者ID:hongbinz,项目名称:ESP8266_RTOS_ALINK_DEMO,代码行数:31,代码来源:user_light_adj.c
示例12: mg_ev_mgr_init
void mg_ev_mgr_init(struct mg_mgr *mgr) {
LOG(LL_INFO, ("%p Mongoose init, tq %p", mgr, s_mg_task_queue));
system_os_task(mg_lwip_task, MG_TASK_PRIORITY, s_mg_task_queue,
MG_TASK_QUEUE_LEN);
os_timer_setfn(&s_poll_tmr, mg_poll_timer_cb, mgr);
os_timer_arm(&s_poll_tmr, MG_POLL_INTERVAL_MS, 0 /* no repeat */);
}
开发者ID:apmascalabs,项目名称:mongoose-iot,代码行数:7,代码来源:esp_mg_net_if.c
示例13: mg_lwip_check_rexmit
static void mg_lwip_check_rexmit(void *arg) {
struct mg_mgr *mgr = (struct mg_mgr *) arg;
struct mg_connection *nc;
uint32_t now = system_get_time();
uint32_t next_rexmit_in_micros = ~0;
for (nc = mgr->active_connections; nc != NULL; nc = nc->next) {
struct mg_lwip_conn_state *cs = (struct mg_lwip_conn_state *) nc->sock;
if (nc->sock == INVALID_SOCKET || nc->flags & MG_F_UDP ||
nc->flags & MG_F_LISTENING || cs->pcb.tcp == NULL) {
continue;
}
if (cs->next_rexmit_ts_micros > 0 &&
time_left_micros(now, cs->next_rexmit_ts_micros) == 0) {
mg_lwip_rexmit(nc);
}
if (cs->next_rexmit_ts_micros > 0) {
uint32_t time_left = time_left_micros(now, cs->next_rexmit_ts_micros);
next_rexmit_in_micros = MIN(next_rexmit_in_micros, time_left);
}
}
if (next_rexmit_in_micros != ~0U) {
uint32_t delay_millis = 1;
delay_millis = next_rexmit_in_micros / 1000;
if (delay_millis == 0) delay_millis = 1;
os_timer_disarm(&s_rexmit_tmr);
os_timer_setfn(&s_rexmit_tmr, mg_lwip_check_rexmit, mgr);
os_timer_arm(&s_rexmit_tmr, delay_millis, 0 /* no repeat */);
}
}
开发者ID:apmascalabs,项目名称:mongoose-iot,代码行数:29,代码来源:esp_mg_net_if.c
示例14: GPIO_DIS_OUTPUT
// initialization
void IRrecv::enableIRIn() {
// initialize state machine variables
irparams.rcvstate = STATE_IDLE;
irparams.rawlen = 0;
// set pin modes
//PIN_FUNC_SELECT(IR_IN_MUX, IR_IN_FUNC);
GPIO_DIS_OUTPUT(irparams.recvpin);
// Initialize timer
os_timer_disarm(&timer);
os_timer_setfn(&timer, (os_timer_func_t *)read_timeout, &timer);
// ESP Attach Interrupt
ETS_GPIO_INTR_DISABLE();
ETS_GPIO_INTR_ATTACH(gpio_intr, NULL);
gpio_pin_intr_state_set(GPIO_ID_PIN(irparams.recvpin), GPIO_PIN_INTR_ANYEDGE);
ETS_GPIO_INTR_ENABLE();
//ETS_INTR_UNLOCK();
//attachInterrupt(irparams.recvpin, readIR, CHANGE);
//irReadTimer.initializeUs(USECPERTICK, readIR).start();
//os_timer_arm_us(&irReadTimer, USECPERTICK, 1);
//ets_timer_arm_new(&irReadTimer, USECPERTICK, 1, 0);
}
开发者ID:hishamk,项目名称:IRremoteESP8266,代码行数:27,代码来源:IRremoteESP8266.cpp
示例15: statusWifiUpdate
// change the wifi state
void ICACHE_FLASH_ATTR statusWifiUpdate(uint8_t state) {
wifiState = state;
// schedule an update (don't want to run into concurrency issues)
os_timer_disarm(&ledTimer);
os_timer_setfn(&ledTimer, ledTimerCb, NULL);
os_timer_arm(&ledTimer, 500, 0);
}
开发者ID:alonewolfx2,项目名称:esp-link,代码行数:8,代码来源:status.c
示例16: user_sensor_deep_sleep_init
void ICACHE_FLASH_ATTR
user_sensor_deep_sleep_init(uint32 time)
{
os_timer_disarm(&sensor_sleep_timer);
os_timer_setfn(&sensor_sleep_timer, (os_timer_func_t *)user_sensor_deep_sleep_enter, NULL);
os_timer_arm(&sensor_sleep_timer, time, 0);
}
开发者ID:hewenhao2008,项目名称:esp8266_spi_slave,代码行数:7,代码来源:user_sensor.c
示例17: create_udp
// ----------------------------------------------------------------------------
// Send data
// Parameters: uint8* psent -- Data to send
// uint16 length -- Length of data to send
// ----------------------------------------------------------------------------
static void create_udp(void)
{
uint32_t ip;
os_timer_disarm(&WiFiLinker);
ip = ipaddr_addr(UDPSERVERIP);
os_memcpy(ConnUDP.remote_ip, &ip, 4);
struct ip_info ipConfig;
wifi_get_ip_info(STATION_IF, &ipConfig);
os_memcpy(ConnUDP.local_ip, &ipConfig.ip.addr, 4);
ConnUDP.local_port = UDPSERVERPORT;
ConnUDP.remote_port = UDPSERVERPORT;
Conn.proto.udp = &ConnUDP;
Conn.type = ESPCONN_UDP;
Conn.state = ESPCONN_NONE;
espconn_regist_recvcb(&Conn, recv_cb); // register a udp packet receiving callback
espconn_regist_sentcb(&Conn, sent_cb);
os_printf("Start espconn_connect to " IPSTR ":%d\n", IP2STR(Conn.proto.udp->remote_ip), Conn.proto.udp->remote_port);
os_printf("Start espconn_connect from " IPSTR ":%d\n", IP2STR(Conn.proto.udp->local_ip), Conn.proto.udp->local_port);
espconn_create(&Conn); // create udp
os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL);
os_timer_arm(&WiFiLinker, 1000, 0);
}
开发者ID:donnaware,项目名称:ESP8266,代码行数:34,代码来源:user_main.c
示例18: cgiWiFiConfigureBasicAuth
int ICACHE_FLASH_ATTR cgiWiFiConfigureBasicAuth(HttpdConnData *connData) {
char user[64];
char passwd[64];
static ETSTimer resetTimer;
if (connData->conn==NULL) {
//Connection aborted. Clean up.
return HTTPD_CGI_DONE;
}
httpdFindArg(connData->postBuff, "authUser", user, sizeof(user));
httpdFindArg(connData->postBuff, "authPasswd", passwd, sizeof(passwd));
flash_key_value_set("user", user);
flash_key_value_set("password", passwd);
os_printf("Reconfigure basic auth %s pw %s\n", user, passwd);
os_timer_disarm(&resetTimer);
os_timer_setfn(&resetTimer, systemRestartCb, NULL);
os_timer_arm(&resetTimer, 4000, 0);
httpdRedirect(connData, "/wifi");
return HTTPD_CGI_DONE;
}
开发者ID:matigumma,项目名称:esp8266,代码行数:25,代码来源:cgiwifi.c
示例19: stop
void Timer::start(bool repeating/* = true*/)
{
this->repeating = repeating;
stop();
if(interval == 0 || (!callback && !delegate_func))
return;
os_timer_setfn(&timer, (os_timer_func_t *)processing, this);
/* -> NONOS version for reference
ets_timer_setfn(&timer, (os_timer_func_t *)processing, this);
if (interval > 10000)
{
ets_timer_arm_new(&timer, (uint32_t)(interval / 1000),
(long_intvl_cntr_lim > 0 ? true : repeating), 1); // msec
}
else
{
ets_timer_arm_new(&timer, (uint32_t)interval, repeating, 0); // usec
}
*/
os_timer_arm(&timer, (uint32_t)(interval / 1000),
(long_intvl_cntr_lim > 0 ? true : repeating)); // msec
started = true;
}
开发者ID:alonewolfx2,项目名称:Sming_RTOS_POC,代码行数:26,代码来源:Timer.cpp
示例20: user_init
void ICACHE_FLASH_ATTR user_init(void)
{
char buf[128] = {0};
at_customLinkMax = 5;
sdio_slave_init();
sdio_register_recv_cb(sdio_recv_data_callback);
at_init();
at_register_uart_rx_buffer_fetch_cb(at_custom_uart_rx_buffer_fetch_cb);
#ifdef ESP_AT_FW_VERSION
if ((ESP_AT_FW_VERSION != NULL) && (os_strlen(ESP_AT_FW_VERSION) < 64)) {
os_sprintf(buf,"compile time:%s %s\r\n"ESP_AT_FW_VERSION,__DATE__,__TIME__);
} else {
os_sprintf(buf,"compile time:%s %s",__DATE__,__TIME__);
}
#else
os_sprintf(buf,"compile time:%s %s",__DATE__,__TIME__);
#endif
at_set_custom_info(buf);
at_fake_uart_enable(TRUE,at_sdio_response);
at_cmd_array_regist(&at_custom_cmd[0], sizeof(at_custom_cmd)/sizeof(at_custom_cmd[0]));
espconn_tcp_set_wnd(4);
at_port_print("\r\nready\r\n");
#ifdef SDIO_DEBUG
os_timer_disarm(&at_spi_check);
os_timer_setfn(&at_spi_check, (os_timer_func_t *)at_spi_check_cb, NULL);
os_timer_arm(&at_spi_check, 1000, 1);
os_printf("\r\ntimer start\r\n");
#endif
}
开发者ID:whdlut,项目名称:ESP8266_NONOS_SDK,代码行数:32,代码来源:user_main.c
注:本文中的os_timer_setfn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论