Master Thesis  V1.0
Research and Design of Sensor Node for NMSD Treatment
interrupt.c File Reference

Code to detect and generate interrupts. More...

#include "interrupt.h"
#include "pinout.h"
#include "debug_dbprint.h"
#include "delay.h"
#include "em_usart.h"
#include "em_device.h"
#include "em_chip.h"
#include "em_cmu.h"
#include "em_emu.h"
#include "em_gpio.h"
#include "bsp.h"
#include <stdint.h>
Include dependency graph for interrupt.c:

Go to the source code of this file.

Functions

void initGPIO_interrupt (void)
 GPIO interrupt initialization. More...
 

Detailed Description

Code to detect and generate interrupts.

Version
1.0
Author
Jona Cappelle

Definition in file interrupt.c.

Function Documentation

◆ initGPIO_interrupt()

void initGPIO_interrupt ( void  )

GPIO interrupt initialization.

Interrupt functionality used by IMU

Definition at line 42 of file interrupt.c.

43 {
44  // Configure GPIO pins
45  CMU_ClockEnable(cmuClock_GPIO, true);
46 
47  // Configure PB0 and PB1 as input with glitch filter enabled
48  GPIO_PinModeSet(ICM_20948_INTERRUPT_PORT, ICM_20948_INTERRUPT_PIN, gpioModeInputPullFilter, 0);
49 
50 
51  /* Clear all odd pin interrupt flags (just in case)
52  * NVIC_ClearPendingIRQ(GPIO_ODD_IRQn); would also work but is less "readable" */
53  GPIO_IntClear(0xAAAA);
54 
55  /* Clear all even pin interrupt flags (just in case)
56  * NVIC_ClearPendingIRQ(GPIO_EVEN_IRQn); would also work but is less "readable" */
57  GPIO_IntClear(0x5555);
58 
59  // Enable IRQ for even numbered GPIO pins
60  NVIC_EnableIRQ(GPIO_EVEN_IRQn);
61 
62  // Enable IRQ for odd numbered GPIO pins
63  NVIC_EnableIRQ(GPIO_ODD_IRQn);
64 
65  /* Enable rising-edge interrupts for ICM_20948 */
66  GPIO_ExtIntConfig(ICM_20948_INTERRUPT_PORT, ICM_20948_INTERRUPT_PIN, ICM_20948_INTERRUPT_PIN, true, false, true);
67 }

References ICM_20948_INTERRUPT_PIN, and ICM_20948_INTERRUPT_PORT.

ICM_20948_INTERRUPT_PIN
#define ICM_20948_INTERRUPT_PIN
Definition: pinout.h:40
ICM_20948_INTERRUPT_PORT
#define ICM_20948_INTERRUPT_PORT
Definition: pinout.h:41