File syn_dipswitch.h¶
FileList > input > syn_dipswitch.h
Go to the source code of this file
DIP Switch & Multi-Bit Rotary Selector Driver.
#include "../common/syn_defs.h"#include "../port/syn_port_gpio.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_DipSwitch DIP Switch Context. |
Public Functions¶
| Type | Name |
|---|---|
| uint32_t | syn_dipswitch_get_value (const SYN_DipSwitch * ds) Get the current combined integer bitmask value of switches. |
| bool | syn_dipswitch_has_changed (SYN_DipSwitch * ds) Check if DIP switch values changed since last read. |
| SYN_Status | syn_dipswitch_init (SYN_DipSwitch * ds, const SYN_GPIO_Pin * pins, uint8_t count, bool active_low) Initialize a DIP Switch instance. |
| void | syn_dipswitch_read (SYN_DipSwitch * ds) Read all DIP switch pins and update binary value. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_DIPSWITCH_MAX_PINS 16 |
Public Functions Documentation¶
function syn_dipswitch_get_value¶
Get the current combined integer bitmask value of switches.
Parameters:
dsDIP switch context.
Returns:
Bitmask where bit N corresponds to pin N.
function syn_dipswitch_has_changed¶
Check if DIP switch values changed since last read.
Parameters:
dsDIP switch context.
Returns:
True if state changed.
function syn_dipswitch_init¶
Initialize a DIP Switch instance.
SYN_Status syn_dipswitch_init (
SYN_DipSwitch * ds,
const SYN_GPIO_Pin * pins,
uint8_t count,
bool active_low
)
Configures input GPIO pins with internal pull-ups or pull-downs.
Parameters:
dsDIP switch context.pinsArray of GPIO pin identifiers.countNumber of switch pins (1 to 16).active_lowTrue if switch ON connects pin to GND (uses Pull-UP).
Returns:
SYN_OK on success.
function syn_dipswitch_read¶
Read all DIP switch pins and update binary value.
Parameters:
dsDIP switch context.
Macro Definition Documentation¶
define SYN_DIPSWITCH_MAX_PINS¶
The documentation for this class was generated from the following file src/syntropic/input/syn_dipswitch.h