WISBLOCK API - External Interrupt

I’d like to configure an interrupt on an external Pin or Sensor to wake up the RAK4630 MCU and send a LoRa message using the WISBLOCK API.

I’ve been reading the GitHub repository (GitHub - beegee-tokyo/WisBlock-API: WisBlock API takes care of all the LoRaWAN, BLE, AT command functionality. It makes development of event driven power savings applications easy.) and it looks like you have to somehow initiate the “api_wake_loop” with an event, but can figure out how to do this.

To keep things simple, can anyone shed some light on how this can be done using WISBLOCK-API and spare GPIO pin on the RAK4631 to initial a lora message e.g. wakeup the RAK4631 when say a button is pressed and then go back to sleep?


Hi Greg,

It is quite simple.

Write the ISR handler, call api_wake_loop() from it.

void ext_int_handler(void)

Then in init_app() setup the pin and attach the interrupt to it. In this example I use WB_IO4 and RISING flank of the signal to trigger the interrupt.

bool init_app(void)
	// Attach an external interrupt to wake-up the application
	pinMode(WB_IO4, INPUT);
	attachInterrupt(WB_IO4, ext_int_handler, RISING);

return true;

Points to know:

  • if the interrupt is called before LoRaWAN network join is finished, it will not send a packet.
  • if the interrupt is from a sensor, you might need to clear the sensors interrupt registers. You can check my RAK1904_acc.cpp example how I do it with the LIS3DH acc sensor.

Thankyou for your quick response.
The example provided looks pretty straight forward and exactly what I was after. I will give it a try and see how I get on.

Again thankyou for your help.

Kind Regards