quasar_button.h
This module configures buttons and provides functions to control each of them.
- Copyright
Copyright (C) 2026 SPARK Microsystems International Inc. All rights reserved.
- License
This source code is proprietary and subject to the SPARK Microsystems Software EULA found in this package in file EULA.txt.
- Author
SPARK FW Team.
Typedefs
-
typedef enum quasar_button_selection quasar_button_selection_t
Quasar BSP button peripherals selection.
Enums
-
enum quasar_button_selection
Quasar BSP button peripherals selection.
Values:
-
enumerator QUASAR_BUTTON_USER_1
User application button.
-
enumerator QUASAR_BUTTON_USER_2
User application button.
-
enumerator QUASAR_BUTTON_USER_3
User application button.
-
enumerator QUASAR_BUTTON_USER_4
User application button.
-
enumerator QUASAR_BUTTON_USER_1
Functions
-
void quasar_button_init(void)
Initialize button peripherals.
-
void quasar_button_deinit(void)
Deinitialize button peripherals.
-
void quasar_button_configure_irq(quasar_button_selection_t button_selection, quasar_irq_priority_t irq_priority)
Configure and enable the interrupt for the selected button.
- Parameters:
button_selection – [in] Selected button.
irq_priority – [in] IRQ priority.
-
void quasar_button_enable_irq(quasar_button_selection_t button_selection)
Enable the interrupt for the selected button.
- Parameters:
button_selection – [in] Selected button.
-
void quasar_button_disable_irq(quasar_button_selection_t button_selection)
Disable the interrupt for the selected button.
- Parameters:
button_selection – [in] Selected button.
-
void quasar_button_set_button1_callback(void (*irq_callback)(void))
Set button 1 interrupt callback.
- Parameters:
irq_callback – [in] Button 1 callback.
-
void quasar_button_set_button2_callback(void (*irq_callback)(void))
Set button 2 interrupt callback.
- Parameters:
irq_callback – [in] Button 2 callback.
-
void quasar_button_set_button3_callback(void (*irq_callback)(void))
Set button 3 interrupt callback.
Note
The same EXTI is also used for USB detection.
- Parameters:
irq_callback – [in] Button 3 callback.
-
void quasar_button_set_button4_callback(void (*irq_callback)(void))
Set button 4 interrupt callback.
- Parameters:
irq_callback – [in] Button 4 callback.
-
bool quasar_button_read_state(quasar_button_selection_t button_peripheral)
Read button state.
Note
The GPIO must have been initialized in input mode. Since the button is connected to VDD and the GPIO has a pull-down resistor, the return value is true if the button is pressed, false otherwise.
- Parameters:
button_peripheral – [in] Selected button peripheral.
- Returns:
Return true if the button is pressed, flase otherwise.