File syn_dipswitch.c¶
FileList > input > syn_dipswitch.c
Go to the source code of this file
DIP Switch & Multi-Bit Rotary Selector Driver.
#include "syn_dipswitch.h"#include "../util/syn_assert.h"#include <string.h>
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. |
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.
The documentation for this class was generated from the following file src/syntropic/input/syn_dipswitch.c