Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interrupt attachment in c not working #41

Open
bastianhjaeger opened this issue Jul 2, 2018 · 3 comments
Open

Interrupt attachment in c not working #41

bastianhjaeger opened this issue Jul 2, 2018 · 3 comments

Comments

@bastianhjaeger
Copy link

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);
}
@martin-ger
Copy link
Owner

Using the scripting language is no option?

@bastianhjaeger
Copy link
Author

No. I tried backtracking from the script method, but unfortunately do not see the issue.

@bastianhjaeger
Copy link
Author

Any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants