Fujitsu SK-AMAPOLLO-BASE-V11 Kullanıcı Kılavuzu - Sayfa 17

Anakart Fujitsu SK-AMAPOLLO-BASE-V11 için çevrimiçi göz atın veya pdf Kullanıcı Kılavuzu indirin. Fujitsu SK-AMAPOLLO-BASE-V11 46 sayfaları. Ambiq micro apollo 1 / 2 evaluation board

Fujitsu SK-AMAPOLLO-BASE-V11 Kullanıcı Kılavuzu

2.5.2 Drive buttons via IRQ

Start with the FEEU MCU Temlate for Apollo 1 or Apollo 2. Enable GPIO FEEU Low-Level-
Driver for Apollo in RTE_Device.h (in example\source\config):
#define APOLLOGPIO ENABLED 1
Add apollogpio.c to your project and include apollogpio.h in you C-file. Following code gives
an example how to use GPIOs with callbacks:
#include "mcu.h"
#include "apollogpio.h"
static volatile boolean_t bSw1CallbackHappened = FALSE;
void Sw1_Callback(uint8_t u8Gpio)
{
bSw1CallbackHappened = TRUE;
}
int main(void)
{
ApolloGpio_RegisterIrq(PIN_GPIO28,
NVIC_ClearPendingIRQ(GPIO_IRQn);
NVIC_EnableIRQ(GPIO_IRQn);
NVIC_SetPriority(GPIO_IRQn,1);
while(1)
{
if (bSw1CallbackHappened)
{
bSw1CallbackHappened = FALSE;
//do the script executing code
}
}
}
© Fujitsu Electronics Europe GmbH
FEEU Ultra-Low-Power Apollo Evaluation Kit Platform
Chapter 2 Using the Hardware
GpioFallingEdge,
Sw1_Callback);
- 17 -
//set GPIO28 to IRQ usage
//clear pending flag
//enable IRQ
//set priority of IRQ
//smaller value means
//higher priority
//button SW1 is pressed
EEU-UG-2017120001-10