JM9 XRCU Board 0.1.0
Libraries API Reference
Loading...
Searching...
No Matches
Buttons.h File Reference
#include <Arduino.h>

Go to the source code of this file.

Enumerations

enum  {
  button_raw_mode , button_fall_mode , button_fall_pulse_mode , button_fall_pulse_secured_mode ,
  button_rise_mode
}
 

Functions

bool is_button_clicked (const uint32_t button_no)
 Checks whether a button is clicked.
 
void set_buttons_mode (const uint8_t mode)
 Sets the buttons mode.
 
void button_attach_interrupt (const uint32_t button_no, void(*user_func)(void))
 Attaches an interrupt to a button.
 
void button_detach_interrupt (const uint32_t button_no)
 Detaches the interrupt on a button from the button.
 

Detailed Description

Buttons.h - Buttons Driver for XRCU.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

button_fall_pulse_secured_mode is recommended for GUI menu applications.

Enumerator
button_raw_mode 

Clicks whenever button is down.

button down: true,
button up: false

button_fall_mode 

Clicks on every falling edge.

Returns 1 true per click on falling edge.

button_fall_pulse_mode 

Clicks on every falling edge and during long pulses.

Returns 1 true per short pulse on falling edge,
returns continuous true during long pulses.

button_fall_pulse_secured_mode 

Clicks on every falling edge and during long pulses with anti-misclick.

Returns 1 true per short pulse on falling edge,
returns continuous true during long pulses,
with anti-misclick mechanism.

button_rise_mode 

Clicks on every rising edge.

Returns 1 true per click on rising edge.

Function Documentation

◆ button_attach_interrupt()

void button_attach_interrupt ( const uint32_t button_no,
void(* user_func )(void) )

Attaches an interrupt to a button.

Parameters
button_nothe number of button to attach an interrupt to
user_functhe interrupt service routine

◆ button_detach_interrupt()

void button_detach_interrupt ( const uint32_t button_no)

Detaches the interrupt on a button from the button.

Parameters
button_nothe number of button whose interrupt has to be detached

◆ is_button_clicked()

bool is_button_clicked ( const uint32_t button_no)

Checks whether a button is clicked.

Parameters
button_nothe button number (starts from 1)
Returns
true if the button is considered clicked under the buttons mode set, false otherwise

◆ set_buttons_mode()

void set_buttons_mode ( const uint8_t mode)

Sets the buttons mode.

The buttons mode decides how every button is considered clicked.

Parameters
modethe mode to be set (see examples for modes available)