Nordic Semiconductor nRF5 AirFuel SDK  version 2.2.0
common_hal_buttons.c File Reference

Button HAL. More...

#include <stdbool.h>
#include <stdint.h>
#include "nrf_gpio.h"
#include "nrf_error.h"
#include "nrf_soc.h"
#include "nrf_gpiote.h"
#include "common_hal_buttons.h"
#include "app_timer.h"
#include "app_util_platform.h"
#include "wpt.h"

Go to the source code of this file.

Macros

#define GPIOTE_CHANNEL_NUMBER_BUTTON_PRESS   0
 
#define GPIOTE_CHANNEL_NUMBER_BUTTON_RELEASE   1
 
#define DFU_BUTTON_PIN   17
 
#define GPIOTE_IRQ_INTENCLR_ALL_VAL   0xffffffff
 
#define GPIOTE_IRQ_ENABLE_VAL   3
 

Functions

void common_hal_buttons_init (uint32_t button_press_duration_ms, uint8_t app_timer_prescaler)
 Initialize button functionality. Used only for starting DFU. More...
 
void GPIOTE_IRQHandler (void)
 Handler for GPIOTE interrupts.
 

Variables

static uint32_t m_button_press_duration_ms
 
static uint8_t m_app_timer_prescaler
 

Detailed Description

Button HAL.

Definition in file common_hal_buttons.c.

Macro Definition Documentation

#define GPIOTE_CHANNEL_NUMBER_BUTTON_PRESS   0

GPIOTE channel number for button pressed event

Definition at line 31 of file common_hal_buttons.c.

#define GPIOTE_CHANNEL_NUMBER_BUTTON_RELEASE   1

GPIOTE channel number for button released event

Definition at line 32 of file common_hal_buttons.c.

#define DFU_BUTTON_PIN   17

Button 1 pin

Definition at line 33 of file common_hal_buttons.c.

#define GPIOTE_IRQ_INTENCLR_ALL_VAL   0xffffffff

Value used for clearing all interrupts for GPIOTE

Definition at line 34 of file common_hal_buttons.c.

#define GPIOTE_IRQ_ENABLE_VAL   3

Value used for enabling both GPIOTE interrupts

Definition at line 35 of file common_hal_buttons.c.

Variable Documentation

uint32_t m_button_press_duration_ms
static

For how long does the button need to be pressed before an attempt to switch to DFU mode is made

Definition at line 37 of file common_hal_buttons.c.

uint8_t m_app_timer_prescaler
static

The prescaler used for initializing the app_timer module

Definition at line 38 of file common_hal_buttons.c.