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

Go to the source code of this file.

Classes

class  Button
 Button Driver for XRCU. More...
 

Enumerations

enum  {
  button_raw_mode , button_fall_mode , button_fall_pulse_mode , button_fall_pulse_secured_mode ,
  button_rise_mode , button_rise_pulse_mode , button_rise_pulse_secured_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.
 

Variables

Button buttons [4]
 The buttons.
 
Buttonbutton1
 The leftmost button.
 
Buttonbutton2
 The 2nd leftmost button.
 
Buttonbutton3
 The 3rd leftmost button.
 
Buttonbutton4
 The rightmost 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.

Deprecated
This enum is only a forward to class Button API. Use class Button for new projects.
Warning
This enum will be removed in the next release.
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.

button_rise_pulse_mode 

Clicks on every rising edge and during long pulses.

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

button_rise_pulse_secured_mode 

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

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

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. [1 : 4]
user_funcThe interrupt service routine.
Deprecated
This function is only a forward to class Button API. Use class Button for new projects.
Warning
This function will be removed in the next release.
Deprecated

◆ 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
Deprecated
This function is only a forward to class Button API. Use class Button for new projects.
Warning
This function will be removed in the next release.
Deprecated

◆ is_button_clicked()

bool is_button_clicked ( const uint32_t button_no)

Checks whether a button is clicked.

Parameters
button_nothe button number [1 : 4]
Returns
true if the button is considered clicked under the buttons mode set, false otherwise
Deprecated
This function is only a forward to Button::isClicked() . Use class Button for new projects.
Warning
This function will be removed in the next release.
See also
Button::isClicked()
Deprecated

◆ 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)
Deprecated
This function is only a forward to class Button API. Use class Button for new projects.
Warning
This function will be removed in the next release.
Deprecated

Variable Documentation

◆ button1

Button& button1
extern

The leftmost button.

You may use it as a Button object.

◆ button2

Button& button2
extern

The 2nd leftmost button.

You may use it as a Button object.

◆ button3

Button& button3
extern

The 3rd leftmost button.

You may use it as a Button object.

◆ button4

Button& button4
extern

The rightmost button.

You may use it as a Button object.

◆ buttons

Button buttons[4]
extern

The buttons.

You may use its elements as Button objects.

Buttons.cpp - Buttons Driver for XRCU. Copyright (c) 2024 - 2025 YH Choi @ JM9. All right reserved.