Skip to end of banner
Go to start of banner

NVIC Interrupt Priority Grouping

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Q

How does the NVIC work?

A

Here is an example code using the wrapper functions in our driver on top of the original CMSIS NVIC functions.

NVICExample.c
#include "Examples.h"
#include "netx_drv.h"

void callbackGPIO0(void*pvContext,void*pvCustom){
  DRV_NVIC_SetPendingIRQ(gpio_app1_IRQn);
  __BKPT();
}
void callbackGPIO1(void*pvContext,void*pvCustom){
  __BKPT();
}

int nvicexample(int argc, const char* argv[]) {
  (void) DRV_DIO_ChannelIRQAttach(DRV_DIO_ID_GPIO_0,callbackGPIO0,0);
  (void) DRV_DIO_ChannelIRQAttach(DRV_DIO_ID_GPIO_1,callbackGPIO1,0);
  // Callback callbackGPIO1 is called after callbackGPIO0
  DRV_NVIC_SetPendingIRQ(gpio_app0_IRQn);
  DRV_NVIC_SetPriority(gpio_app1_IRQn,1,0);
  DRV_NVIC_SetPriority(gpio_app0_IRQn,2,0);
  // Callback callbackGPIO1 is called inside callbackGPIO0
  DRV_NVIC_SetPendingIRQ(gpio_app0_IRQn);
  return 0;
}
  • No labels