Skip to content

Commit

Permalink
Merge pull request #48 from soburi/register_sysctrl_callback
Browse files Browse the repository at this point in the history
Register sysctrl callback on first call of attachInterrupt
  • Loading branch information
soburi authored Sep 12, 2017
2 parents 90e50b3 + 6a5876b commit 2f5538b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions variants/jn516x/w_interrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@
#include "wiring_private.h"

#include <AppHardwareApi.h>
#include "variant.h"

static void nop() { }

extern void sysctrl_callback(uint32 u32Device, uint32 u32ItemBitmap);

void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
{
if(pin > DIO_NUM) return;

//TODO: Register callback on bootup.
static int initialized = 0;
if(!initialized) {
DBG_PRINTF("vAHI_SysCtrlRegisterCallback\r\n");
vAHI_SysCtrlRegisterCallback(sysctrl_callback);
initialized = 1;
}

handler_table[pin] = callback;

Expand Down

0 comments on commit 2f5538b

Please sign in to comment.