esp_mqtt
esp_mqtt copied to clipboard
Interrupt attachment in c not working
How do I add a interrupt to GPIO 0
This seems not to work (derived from user_basic/user_main.c):
#include "user_interface.h"
#include "mqtt/mqtt_server.h"
#include "user_config.h"
#include "easygpio.h"
static void sonoffBtnInterrupt(void* arg) {
uint8_t value = easygpio_inputGet(13);
easygpio_outputSet(13, !value);
}
int interruptOne = 42;
void ICACHE_FLASH_ATTR user_init() {
struct station_config stationConf;
// Initialize the UART
uart_div_modify(0, UART_CLK_FREQ / 115200);
os_printf("\r\n\r\nMQTT Broker starting\r\n");
// Setup STA
...
// Allow larger number of TCP (=MQTT) clients
...
easygpio_pinMode(13, EASYGPIO_PULLUP, EASYGPIO_OUTPUT);
easygpio_outputSet(13, 0); // turn on
//easygpio_pinMode(0, EASYGPIO_PULLUP, EASYGPIO_INPUT);
easygpio_attachInterrupt(0, EASYGPIO_PULLUP, &sonoffBtnInterrupt, &interruptOne);
//Start MQTT broker
MQTT_server_start(MQTT_PORT, MQTT_MAX_SUBSCRIPTIONS, MQTT_MAX_RETAINED_TOPICS);
}
Using the scripting language is no option?
No. I tried backtracking from the script method, but unfortunately do not see the issue.
Any idea?