CubeMon-Vue-Demo-STM32F407VGT6U
do.h File Reference

digital outputs with set/get and toggle functions More...

Go to the source code of this file.

Data Structures

struct  digitalOutputInitData
 

Typedefs

typedef enum digOutputs digOutputs
 
typedef struct digitalOutputInitData digitalOutputInitData
 

Enumerations

enum  digOutputs {
  DO_NONE , DO_LED_ORANGE , DO_LED_RED , DO_LED_BLUE ,
  DO_NONE
}
 

Functions

retStatus output_init (digOutputs output, digitalOutputInitData digital_output_init_data)
 Digital output initialization function. More...
 
retStatus output_toggle (digOutputs output)
 Toggles the output state. More...
 
retStatus output_set (digOutputs output_name, GPIO_PinState state)
 Sets output state. More...
 
dioStates output_get_state (digOutputs output)
 Get the current output state. More...
 
__weak retStatus output_set_hw_HAL (digOutputs output_name, GPIO_PinState state)
 Sets HW output state. In case you want to implement it differently (f.e. not using HAL) More...
 

Detailed Description

digital outputs with set/get and toggle functions

Author
panvicka
Date
8.1.2022

To use this library define flag LIB_DO in the lib_config.h file and create an enum in init.h file with the outputs you would like to use. You then have to initialize each input with input_init function.

typedef enum digOutputs {
MY_OUTPUT_1,
MY_OUTPUT_2,
MY_OUTPUT_3,
digOutputs
Definition: do.h:35
@ DO_NONE
DUMMY to keep the track of enum length.
Definition: init.h:30
Note
Do not forget to include the DO_NONE at the end of the enum listing.

Typedef Documentation

◆ digOutputs

typedef enum digOutputs digOutputs

If the library is not used (LIB_DO is not defined as symbol) this dummy enum will be created to prevent compilation errors

Enumeration Type Documentation

◆ digOutputs

enum digOutputs

If the library is not used (LIB_DO is not defined as symbol) this dummy enum will be created to prevent compilation errors

Enumerator
DO_LED_ORANGE 

Orange LED (PD13)

DO_LED_RED 

Red LED (PD14)

DO_LED_BLUE 

Blue LED (PD15)

DO_NONE 

DUMMY to keep the track of enum length.

Function Documentation

◆ output_get_state()

dioStates output_get_state ( digOutputs  output)

Get the current output state.

Parameters
[in]outputoutput identification, defined by digOutputs
Returns
DIO_NOT_INITIALIZED ENODEV if the /p output is out of range defined by digOutputs or is not initialized DIO_OFF if output is in off state DIO_ON if output is in on state

◆ output_init()

retStatus output_init ( digOutputs  output,
digitalOutputInitData  digital_output_init_data 
)

Digital output initialization function.

Parameters
[in]outputoutput identification, defined by digOutputs
[in]digital_output_init_dataoutput initialization data digitalOutputInitData
Returns
EOK is the initialization completed OK ENODEV if the /p output is out of range defined by digOutputs or there are invalid values in the initialization struct

◆ output_set()

retStatus output_set ( digOutputs  output_name,
GPIO_PinState  state 
)

Sets output state.

Parameters
[in]output_nameoutput identification, defined by digOutputs
[in]statestate to be set
Returns
EOK action completed ENODEV if the /p output is out of range defined by digOutputs or is not initialized

◆ output_set_hw_HAL()

__weak retStatus output_set_hw_HAL ( digOutputs  output_name,
GPIO_PinState  state 
)

Sets HW output state. In case you want to implement it differently (f.e. not using HAL)

Parameters
[in]output_nameoutput identification, defined by digOutputs
[in]statestate to be set
Returns
ENODEV if if the /p output is out of range defined by digOutputs or is not initialized EOK if the output was set OK

◆ output_toggle()

retStatus output_toggle ( digOutputs  output)

Toggles the output state.

Parameters
[in]outputoutput identification, defined by digOutputs
Returns
EOK action completed ENODEV if the /p output is out of range defined by digOutputs or is not initialized