-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbutton.c
32 lines (27 loc) · 918 Bytes
/
button.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* button.c
*
* Created on: Mar 12, 2019
* Author: aakash
*/
#include "button.h"
void buttonInit()
{
/*
*Setup PF6 (PB0 on board) as input
* and setup interrupts on both rising and falling edge
* this raises interrupts on button press and release.
*/
GPIO_PinModeSet(BUTTON0_PORT, BUTTON0_PIN, gpioModeInput, true);
GPIO_ExtIntConfig(BUTTON0_PORT,BUTTON0_PIN,BUTTON0_PIN,true,false,true);
NVIC_EnableIRQ(GPIO_EVEN_IRQn);
/* For PB1 - unused for now
* Interrupt not enabled, use GPIO_IntEnable(1<<BUTTON1_PIN)
* or set last parameter of extintconfig to true to enable interrupts
*/
GPIO_PinModeSet(BUTTON1_PORT, BUTTON1_PIN, gpioModeInput, true);
GPIO_ExtIntConfig(BUTTON0_PORT,BUTTON1_PIN,BUTTON1_PIN,true,false,false);
//enable interrupts in NVIC using
//NVIC_EnableIRQ(GPIO_ODD_IRQn);
}
// Removed ISR register functions, using the Si Labs gpiointerrupt.h functions instead.