![]() |
PS_Fgen_FW
4da88f4073c1cc65ea45c3a652a2751e495e50db
Firmware for an Power Supply and Function Generator build from an ATX power supply
|
Containing methods to handle on/off buttons. More...
#include "../Pins/Pins.h"
Go to the source code of this file.
Macros | |
#define | ONOFFBUTTON_MCP23S08_PIN_PS 5 |
Pin on the IO expander for the PS button. | |
#define | ONOFFBUTTON_MCP23S08_PIN_DDS1 3 |
Pin on the IO expander for the DDS1 button. | |
#define | ONOFFBUTTON_MCP23S08_PIN_DDS2 1 |
Pin on the IO expander for the DDS2 button. | |
#define | ONOFFBUTTON_MCP23S08_PIN_MASK ((1<<ONOFFBUTTON_MCP23S08_PIN_PS) | (1<<ONOFFBUTTON_MCP23S08_PIN_DDS1) | (1<<ONOFFBUTTON_MCP23S08_PIN_DDS2)) |
Mask for all button pins on the IO expander. | |
#define | ONOFFLED_MCP23S08_PIN_PS 4 |
Pin on the IO expander for the PS LED. | |
#define | ONOFFLED_MCP23S08_PIN_PS_ERROR 6 |
Pin on the IO expander for the PS error LED. | |
#define | ONOFFLED_MCP23S08_PIN_DDS1 2 |
Pin on the IO expander for the DDS1 LED. | |
#define | ONOFFLED_MCP23S08_PIN_DDS2 0 |
Pin on the IO expander for the DDS2 LED. | |
Typedefs | |
typedef enum OnOffButtons | OnOffButtons_t |
Enumeration with all available on/off buttons. | |
typedef enum OnOffLEDs | OnOffLEDs_t |
Enumeration with all available on/off LEDs. | |
Enumerations | |
enum | OnOffButtons { ONOFFBUTTON_NONE , ONOFFBUTTON_PS , ONOFFBUTTON_DDS1 , ONOFFBUTTON_DDS2 } |
Enumeration with all available on/off buttons. More... | |
enum | OnOffLEDs { ONOFFLED_PS , ONOFFLED_PS_ERROR , ONOFFLED_DDS1 , ONOFFLED_DDS2 } |
Enumeration with all available on/off LEDs. More... | |
Functions | |
void | OnOffControls_Init () |
Initialize the IO expander used to access the on/off controls. | |
bool | OnOffControls_IsButtonChanged () |
Check if the state of any on/off button has changed (was pressed or was released). | |
OnOffButtons_t | OnOffControls_GetButton () |
Get the last pressed on/off button. | |
void | OnOffControls_DoButtonAction (OnOffButtons_t button) |
Do some action depending on the pressed on/off button. | |
void | OnOffControls_SetLEDState (OnOffLEDs_t led, bool state) |
Set the state of the on/off LED. | |
void | OnOffControls_UpdatePSLeds () |
Update the PS and PS error LEDs depending on the output enabled and protection states of the PS channel. | |
Containing methods to handle on/off buttons.
enum OnOffButtons |
enum OnOffLEDs |
void OnOffControls_DoButtonAction | ( | OnOffButtons_t | button | ) |
Do some action depending on the pressed on/off button.
button | on/off button that should be handled. |
OnOffButtons_t OnOffControls_GetButton | ( | ) |
Get the last pressed on/off button.
Only one button is returned even if multiple buttons were pressed.
bool OnOffControls_IsButtonChanged | ( | ) |
Check if the state of any on/off button has changed (was pressed or was released).
void OnOffControls_SetLEDState | ( | OnOffLEDs_t | led, |
bool | state ) |
Set the state of the on/off LED.
led | on/off LED that should be set. |
state | when true, the LED is turned on; if false, the LED is turned off |
void OnOffControls_UpdatePSLeds | ( | ) |
Update the PS and PS error LEDs depending on the output enabled and protection states of the PS channel.
Output Enabled | Protection active | LED PS | LED PS error |
---|---|---|---|
false | false | off | off |
true | false | on | off |
false | true | off | on |
true | true | off | on |