Statistics: Posted by ESP_Faye — Sun Jun 12, 2016 10:29 am
Statistics: Posted by gustavo — Wed Jun 08, 2016 7:05 pm
Code:
#include "esp_common.h"
#include "esp_timer.h"
#include "gpio.h"
static os_timer_t some_timer;
static void timer_handler(void* args) {
printf("timer");
}
static void intr_handler() {
u32 gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
gpio_pin_intr_state_set(GPIO_ID_PIN(12) , GPIO_PIN_INTR_DISABLE);
GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status & BIT(12) );
//printf("a,");
portENTER_CRITICAL();
//printf("b,");
os_timer_disarm(&some_timer);
os_timer_setfn(&some_timer, (os_timer_func_t *)timer_handler, NULL);
os_timer_arm(&some_timer, 3, 1);
//printf("c,");
portEXIT_CRITICAL();
//printf("d\n");
gpio_pin_intr_state_set(GPIO_ID_PIN(12) ,GPIO_PIN_INTR_NEGEDGE);
}
void user_init(void)
{
GPIO_ConfigTypeDef gpio_in_cfg12;
gpio_in_cfg12.GPIO_Pin = GPIO_Pin_12;
gpio_in_cfg12.GPIO_IntrType = GPIO_PIN_INTR_NEGEDGE;
gpio_in_cfg12.GPIO_Mode = GPIO_Mode_Input;
gpio_in_cfg12.GPIO_Pullup = GPIO_PullUp_EN;
gpio_config(&gpio_in_cfg12);
gpio_intr_handler_register(intr_handler, NULL);
_xt_isr_unmask(1 << ETS_GPIO_INUM);
}
Statistics: Posted by ESP_Faye — Tue Jun 07, 2016 7:40 pm
Code:
#include "gpio.h"
#include "esp_common.h"
#include "esp_timer.h"
static os_timer_t some_timer;
static void timer_handler(void* args) {
printf("timer");
}
static void intr_handler() {
portENTER_CRITICAL();
os_timer_disarm(&some_timer);
os_timer_setfn(&some_timer, (os_timer_func_t *)timer_handler, NULL);
os_timer_arm(&some_timer, 3, 1);
portEXIT_CRITICAL();
}
void user_init(void)
{
GPIO_ConfigTypeDef gpio_in_cfg12;
gpio_in_cfg12.GPIO_Pin = GPIO_Pin_12;
gpio_in_cfg12.GPIO_IntrType = GPIO_PIN_INTR_NEGEDGE;
gpio_in_cfg12.GPIO_Mode = GPIO_Mode_Input;
gpio_in_cfg12.GPIO_Pullup = GPIO_PullUp_EN;
gpio_config(&gpio_in_cfg12);
gpio_intr_handler_register(intr_handler, NULL);
_xt_isr_unmask(1 << ETS_GPIO_INUM);
}
Code:
ShowCritical:1
Statistics: Posted by gustavo — Thu Jun 02, 2016 11:08 pm