Functions | |
int | DipSwitch_SetActive (int state) |
Sets whether the DIP Switch is active. | |
int | DipSwitch_GetActive () |
Returns the active state of the DIP Switch. | |
int | DipSwitch_GetValue () |
Read the current configuration of the on-board DIP switch. | |
bool | DipSwitch_GetValueChannel (int channel) |
Read a single channel's value. |
Mask off the appropriate bits in the value returned from the DIP switch to determine whether a particular channel is on or off.
See the Application Board overview for details.
int DipSwitch_GetActive | ( | void | ) |
Returns the active state of the DIP Switch.
if( DipSwitch_GetActive() ) { // DIP switch is active } else { // DIP switch is not active }
Definition at line 108 of file dipswitch.c.
int DipSwitch_GetValue | ( | void | ) |
Read the current configuration of the on-board DIP switch.
int dip_switch = DipSwitch_GetValue(); // now dip_switch has a bitmask of all 8 channels of the DIP switch
Definition at line 123 of file dipswitch.c.
bool DipSwitch_GetValueChannel | ( | int | channel | ) |
Read a single channel's value.
This is a convenience function that relies on DipSwitch_GetValue() internally, but extracts the value for a given channel.
channel | The channel (0-7) you'd like to read. return true if the channel is on, false if it's off. |
if(DipSwitch_GetValueChannel(4) ) { // DIP switch channel 4 is on } else { // DIP switch channel 4 is off } // now dip_switch has a bitmask of all 8 channels of the DIP switch
Definition at line 172 of file dipswitch.c.
int DipSwitch_SetActive | ( | int | state | ) |
Sets whether the DIP Switch is active.
state | An integer specifying the state of the DIP Switch - 1 (on) or 0 (off). |
// enable the DIP switch DipSwitch_SetActive(1);
Definition at line 68 of file dipswitch.c.