Go to the source code of this file.
Data Structures | |
| struct | io_port_t |
| Properties and handlers for auxiliary digital and analog I/O. More... | |
| union | driver_caps_t |
| union | io_port_cando_t |
| struct | ioports_cfg |
| struct | io_ports_detail_t |
| struct | io_ports_data |
| struct | io_analog_t |
| struct | io_digital_t |
| struct | ioports_pwm_t |
| Precalculated values that may be set/used by HAL driver to speed up analog input to PWM conversions. */. More... | |
Macros | |
| #define | IOPORT_UNASSIGNED 255 |
Typedefs | |
| typedef void(* | digital_out_ptr) (uint8_t port, bool on) |
| Pointer to function for setting a digital output. More... | |
| typedef bool(* | analog_out_ptr) (uint8_t port, float value) |
| Pointer to function for setting an analog output. More... | |
| typedef int32_t(* | wait_on_input_ptr) (io_port_type_t type, uint8_t port, wait_mode_t wait_mode, float timeout) |
| Pointer to function for reading a digital or analog input. More... | |
| typedef int32_t(* | ll_wait_on_input_ptr) (uint8_t port, wait_mode_t wait_mode, float timeout) |
| Pointer to function for reading a digital or analog input. More... | |
| typedef void(* | set_pin_description_ptr) (io_port_type_t type, io_port_direction_t dir, uint8_t port, const char *s) |
| Pointer to function for setting pin description for a digital or analog port. More... | |
| typedef void(* | ll_set_pin_description_ptr) (io_port_direction_t dir, uint8_t port, const char *s) |
| Pointer to function for setting pin description for a digital or analog port. More... | |
| typedef xbar_t *(* | get_pin_info_ptr) (io_port_type_t type, io_port_direction_t dir, uint8_t port) |
| Pointer to function for getting information about a digital or analog port. NOTE: The port information pointed to will be overwritten by the next call to this function. More... | |
| typedef xbar_t *(* | ll_get_pin_info_ptr) (io_port_direction_t dir, uint8_t port) |
| Pointer to function for getting information about a digital or analog port. NOTE: The port information pointed to will be overwritten by the next call to this function. More... | |
| typedef bool(* | claim_port_ptr) (io_port_type_t type, io_port_direction_t dir, uint8_t *port, const char *description) |
| Pointer to function for claiming a digital or analog port for exclusive use. More... | |
| typedef bool(* | ll_claim_port_ptr) (io_port_direction_t dir, uint8_t port, uint8_t user_port, const char *description) |
| Pointer to function for claiming a digital or analog port for exclusive use. More... | |
| typedef bool(* | swap_pins_ptr) (io_port_type_t type, io_port_direction_t dir, uint8_t port_from, uint8_t port_to) |
| Pointer to function for swapping two digital or analog ports. More... | |
| typedef void(* | ioport_interrupt_callback_ptr) (uint8_t port, bool state) |
| Pointer to callback function for input port interrupt events. More... | |
| typedef bool(* | ioport_register_interrupt_handler_ptr) (uint8_t port, pin_irq_mode_t irq_mode, ioport_interrupt_callback_ptr interrupt_callback) |
| Pointer to function for registering or deregistering an interrupt handler for a digital input port. More... | |
| typedef bool(* | ll_ioport_register_interrupt_handler_ptr) (uint8_t port, uint8_t user_port, pin_irq_mode_t irq_mode, ioport_interrupt_callback_ptr interrupt_callback) |
| Pointer to function for registering or deregistering an interrupt handler for a digital input port. More... | |
| typedef bool(* | ioports_enumerate_callback_ptr) (xbar_t *properties, uint8_t port, void *data) |
| typedef status_code_t(* | ioport_set_value_ptr) (struct ioports_cfg *p, uint8_t *port, pin_cap_t caps, float value) |
| typedef float(* | ioport_get_value_ptr) (struct ioports_cfg *p, uint8_t port) |
| typedef uint8_t(* | ioport_get_next_ptr) (struct ioports_cfg *p, uint8_t port, const char *description, pin_cap_t caps) |
| typedef xbar_t *(* | ioport_claim_ptr) (struct ioports_cfg *p, uint8_t *port, const char *description, pin_cap_t caps) |
| typedef struct ioports_cfg | io_port_cfg_t |
| typedef struct io_ports_data | io_ports_data_t |
Enumerations | |
| enum | io_port_type_t { Port_Analog = 0 , Port_Digital = 1 } |
| enum | io_port_direction_t { Port_Input = 0 , Port_Output = 1 } |
Functions | |
| io_port_cfg_t * | ioports_cfg (io_port_cfg_t *p, io_port_type_t type, io_port_direction_t dir) |
| Get data and pointers to helper functions for managing ports and port settings. More... | |
| uint8_t | ioports_available (io_port_type_t type, io_port_direction_t dir) |
| Get number of digital or analog ports available. More... | |
| uint8_t | ioports_unclaimed (io_port_type_t type, io_port_direction_t dir) |
| Get number of unclaimed digital or analog ports available. More... | |
| xbar_t * | ioport_get_info (io_port_type_t type, io_port_direction_t dir, uint8_t port) |
| Return information about a digital or analog port. More... | |
| xbar_t * | ioport_claim (io_port_type_t type, io_port_direction_t dir, uint8_t *port, const char *description) |
| Claim a digital or analog port for exclusive use. More... | |
| bool | ioport_claimable (io_port_type_t type, io_port_direction_t dir, uint8_t port) |
| Check if a analog or digital port is available for exclusive use. More... | |
| io_port_cando_t | ioports_can_do (void) |
| Get basic ioports capabilities. More... | |
| uint8_t | ioport_find_free (io_port_type_t type, io_port_direction_t dir, pin_cap_t filter, const char *description) |
| find claimable or claimed analog or digital port. Search starts from the last port number. More... | |
| bool | ioports_enumerate (io_port_type_t type, io_port_direction_t dir, pin_cap_t filter, ioports_enumerate_callback_ptr callback, void *data) |
| Enumerate ports. More... | |
| bool | ioport_set_description (io_port_type_t type, io_port_direction_t dir, uint8_t port, const char *description) |
| Set pin description. More... | |
| bool | ioport_set_function (xbar_t *pin, pin_function_t function, driver_caps_t caps) |
| Set pin function. More... | |
| bool | ioport_analog_out (uint8_t port, float value) |
| bool | ioport_digital_out (uint8_t port, uint32_t value) |
| int32_t | ioport_wait_on_input (io_port_type_t type, uint8_t port, wait_mode_t wait_mode, float timeout) |
| bool | ioport_analog_out_config (uint8_t port, pwm_config_t *config) |
| bool | ioport_digital_pwm_config (uint8_t port, pwm_config_t *config) |
| bool | ioport_digital_in_config (uint8_t port, gpio_in_config_t *config) |
| bool | ioport_enable_irq (uint8_t port, pin_irq_mode_t irq_mode, ioport_interrupt_callback_ptr handler) |
| bool | ioport_digital_out_config (uint8_t port, gpio_out_config_t *config) |
| bool | ioports_add_analog (io_analog_t *ports) |
| bool | ioports_add_digital (io_digital_t *ports) |
| void | ioports_add_settings (driver_settings_load_ptr settings_loaded, setting_changed_ptr setting_changed) |
| bool | ioport_remap (io_port_type_t type, io_port_direction_t dir, uint8_t from, uint8_t to) |
| Remap (virtual) port. More... | |
| void | ioport_save_input_settings (xbar_t *xbar, gpio_in_config_t *config) |
| void | ioport_save_output_settings (xbar_t *xbar, gpio_out_config_t *config) |
| void | ioport_setting_changed (setting_id_t id) |
| uint8_t | ioports_map_reverse (io_ports_detail_t *type, uint8_t port) |
| bool | ioports_precompute_pwm_values (pwm_config_t *config, ioports_pwm_t *pwm_data, uint32_t clock_hz) |
| Precompute PWM values for faster conversion. More... | |
| uint_fast16_t | ioports_compute_pwm_value (ioports_pwm_t *pwm_data, float value) |
| Analog value to PWM conversion. More... | |
| bool | ioports_add (io_ports_data_t *ports, io_port_type_t type, uint8_t n_in, uint8_t n_out) |
| Deprecated - use ioports_add_analog() or ioports_add_digital() instead. More... | |
| bool | ioport_can_claim_explicit (void) |
| Deprecated - use ioports_can_do() instead. More... | |
| void | ioport_assign_function (aux_ctrl_t *aux_ctrl, pin_function_t *function) |
| Deprecated - use ioport_set_function() instead. More... | |
| void | ioport_assign_out_function (aux_ctrl_out_t *aux_ctrl, pin_function_t *function) |
| Deprecated - use ioport_set_function() instead. More... | |
| #define IOPORT_UNASSIGNED 255 |
| typedef bool(* analog_out_ptr) (uint8_t port, float value) |
Pointer to function for setting an analog output.
| port | port number. |
| value |
| typedef bool(* claim_port_ptr) (io_port_type_t type, io_port_direction_t dir, uint8_t *port, const char *description) |
Pointer to function for claiming a digital or analog port for exclusive use.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | port number. |
| description | description of the pin function. |
| typedef void(* digital_out_ptr) (uint8_t port, bool on) |
Pointer to function for setting a digital output.
| port | port number |
| on | true to set output high, false to set it low |
| typedef xbar_t*(* get_pin_info_ptr) (io_port_type_t type, io_port_direction_t dir, uint8_t port) |
Pointer to function for getting information about a digital or analog port.
NOTE: The port information pointed to will be overwritten by the next call to this function.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | port number. |
| typedef struct ioports_cfg io_port_cfg_t |
| typedef struct io_ports_data io_ports_data_t |
| typedef xbar_t*(* ioport_claim_ptr) (struct ioports_cfg *p, uint8_t *port, const char *description, pin_cap_t caps) |
| typedef uint8_t(* ioport_get_next_ptr) (struct ioports_cfg *p, uint8_t port, const char *description, pin_cap_t caps) |
| typedef float(* ioport_get_value_ptr) (struct ioports_cfg *p, uint8_t port) |
| typedef void(* ioport_interrupt_callback_ptr) (uint8_t port, bool state) |
Pointer to callback function for input port interrupt events.
| port | port number. |
| state | true if port level is high, false if it is low. |
| typedef bool(* ioport_register_interrupt_handler_ptr) (uint8_t port, pin_irq_mode_t irq_mode, ioport_interrupt_callback_ptr interrupt_callback) |
Pointer to function for registering or deregistering an interrupt handler for a digital input port.
| port | port number. |
| irq_mode | a pin_irq_mode_t enum value. |
| interrupt_callback | pointer to the callback function to register or NULL to deregister the current callback. |
| typedef status_code_t(* ioport_set_value_ptr) (struct ioports_cfg *p, uint8_t *port, pin_cap_t caps, float value) |
| typedef bool(* ioports_enumerate_callback_ptr) (xbar_t *properties, uint8_t port, void *data) |
| typedef bool(* ll_claim_port_ptr) (io_port_direction_t dir, uint8_t port, uint8_t user_port, const char *description) |
Pointer to function for claiming a digital or analog port for exclusive use.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | port number. |
| description | description of the pin function. |
| typedef xbar_t*(* ll_get_pin_info_ptr) (io_port_direction_t dir, uint8_t port) |
Pointer to function for getting information about a digital or analog port.
NOTE: The port information pointed to will be overwritten by the next call to this function.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | port number. |
| typedef bool(* ll_ioport_register_interrupt_handler_ptr) (uint8_t port, uint8_t user_port, pin_irq_mode_t irq_mode, ioport_interrupt_callback_ptr interrupt_callback) |
Pointer to function for registering or deregistering an interrupt handler for a digital input port.
| port | port number. |
| user_port | port number to be used for the callback. |
| irq_mode | a pin_irq_mode_t enum value. |
| interrupt_callback | pointer to the callback function to register or NULL to deregister the current callback. |
| typedef void(* ll_set_pin_description_ptr) (io_port_direction_t dir, uint8_t port, const char *s) |
Pointer to function for setting pin description for a digital or analog port.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | port number. |
| s | pointer to null terminated description string. |
| typedef int32_t(* ll_wait_on_input_ptr) (uint8_t port, wait_mode_t wait_mode, float timeout) |
Pointer to function for reading a digital or analog input.
NOTE: The latest value read is stored in sys sys.var5399.
| type | as an io_port_type_t enum value. |
| port | port number. |
| wait_mode | a wait_mode_t enum value. |
| timeout | in seconds, ignored if wait_mode is WaitMode_Immediate (0). |
| typedef void(* set_pin_description_ptr) (io_port_type_t type, io_port_direction_t dir, uint8_t port, const char *s) |
Pointer to function for setting pin description for a digital or analog port.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | port number. |
| s | pointer to null terminated description string. |
| typedef bool(* swap_pins_ptr) (io_port_type_t type, io_port_direction_t dir, uint8_t port_from, uint8_t port_to) |
Pointer to function for swapping two digital or analog ports.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port_from | port number. |
| port_to | port number. |
| typedef int32_t(* wait_on_input_ptr) (io_port_type_t type, uint8_t port, wait_mode_t wait_mode, float timeout) |
Pointer to function for reading a digital or analog input.
NOTE: The latest value read is stored in sys sys.var5399.
| type | as an io_port_type_t enum value. |
| port | port number. |
| wait_mode | a wait_mode_t enum value. |
| timeout | in seconds, ignored if wait_mode is WaitMode_Immediate (0). |
| enum io_port_direction_t |
| enum io_port_type_t |
| bool ioport_analog_out | ( | uint8_t | port, |
| float | value | ||
| ) |
| bool ioport_analog_out_config | ( | uint8_t | port, |
| pwm_config_t * | config | ||
| ) |
| void ioport_assign_function | ( | aux_ctrl_t * | aux_ctrl, |
| pin_function_t * | function | ||
| ) |
Deprecated - use ioport_set_function() instead.
| void ioport_assign_out_function | ( | aux_ctrl_out_t * | aux_ctrl, |
| pin_function_t * | function | ||
| ) |
Deprecated - use ioport_set_function() instead.
| bool ioport_can_claim_explicit | ( | void | ) |
Deprecated - use ioports_can_do() instead.
| xbar_t* ioport_claim | ( | io_port_type_t | type, |
| io_port_direction_t | dir, | ||
| uint8_t * | port, | ||
| const char * | description | ||
| ) |
Claim a digital or analog port for exclusive use.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | pointer to a uint8_t holding the ports aux number, returns the actual port number to use if successful. |
| description | pointer to a char constant for the pin description. |
| bool ioport_claimable | ( | io_port_type_t | type, |
| io_port_direction_t | dir, | ||
| uint8_t | port | ||
| ) |
Check if a analog or digital port is available for exclusive use.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | a uint8_t holding the ports aux number. |
| bool ioport_digital_in_config | ( | uint8_t | port, |
| gpio_in_config_t * | config | ||
| ) |
| bool ioport_digital_out | ( | uint8_t | port, |
| uint32_t | value | ||
| ) |
| bool ioport_digital_out_config | ( | uint8_t | port, |
| gpio_out_config_t * | config | ||
| ) |
| bool ioport_digital_pwm_config | ( | uint8_t | port, |
| pwm_config_t * | config | ||
| ) |
| bool ioport_enable_irq | ( | uint8_t | port, |
| pin_irq_mode_t | irq_mode, | ||
| ioport_interrupt_callback_ptr | handler | ||
| ) |
| uint8_t ioport_find_free | ( | io_port_type_t | type, |
| io_port_direction_t | dir, | ||
| pin_cap_t | filter, | ||
| const char * | description | ||
| ) |
find claimable or claimed analog or digital port. Search starts from the last port number.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| description | pointer to a char constant for the pin description of a previousely claimed port or a port number to be used as the upper limit for the search, or NULL if searching for the first free port. |
| xbar_t* ioport_get_info | ( | io_port_type_t | type, |
| io_port_direction_t | dir, | ||
| uint8_t | port | ||
| ) |
Return information about a digital or analog port.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | the claimed port aux number. |
| bool ioport_remap | ( | io_port_type_t | type, |
| io_port_direction_t | dir, | ||
| uint8_t | port_from, | ||
| uint8_t | port_to | ||
| ) |
Remap (virtual) port.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port_from | the assigned port number. |
| port_to | the remapped port number. The original port number will be swapped with port_from. |
| void ioport_save_input_settings | ( | xbar_t * | xbar, |
| gpio_in_config_t * | config | ||
| ) |
| void ioport_save_output_settings | ( | xbar_t * | xbar, |
| gpio_out_config_t * | config | ||
| ) |
| bool ioport_set_description | ( | io_port_type_t | type, |
| io_port_direction_t | dir, | ||
| uint8_t | port, | ||
| const char * | description | ||
| ) |
Set pin description.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| port | the port aux number. |
| description | pointer to a char constant for the pin description. |
| bool ioport_set_function | ( | xbar_t * | pin, |
| pin_function_t | function, | ||
| driver_caps_t | caps | ||
| ) |
Set pin function.
| port | pointer to a xbar_t structure. |
| function | a pin_function_t enum value. |
| caps | pointer to driver_caps_t capability flags. |
| void ioport_setting_changed | ( | setting_id_t | id | ) |
| int32_t ioport_wait_on_input | ( | io_port_type_t | type, |
| uint8_t | port, | ||
| wait_mode_t | wait_mode, | ||
| float | timeout | ||
| ) |
| bool ioports_add | ( | io_ports_data_t * | ports, |
| io_port_type_t | type, | ||
| uint8_t | n_in, | ||
| uint8_t | n_out | ||
| ) |
Deprecated - use ioports_add_analog() or ioports_add_digital() instead.
| bool ioports_add_analog | ( | io_analog_t * | ports | ) |
| bool ioports_add_digital | ( | io_digital_t * | ports | ) |
| void ioports_add_settings | ( | driver_settings_load_ptr | settings_loaded, |
| setting_changed_ptr | setting_changed | ||
| ) |
| uint8_t ioports_available | ( | io_port_type_t | type, |
| io_port_direction_t | dir | ||
| ) |
Get number of digital or analog ports available.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| io_port_cando_t ioports_can_do | ( | void | ) |
Get basic ioports capabilities.
| io_port_cfg_t* ioports_cfg | ( | io_port_cfg_t * | pp, |
| io_port_type_t | type, | ||
| io_port_direction_t | dir | ||
| ) |
Get data and pointers to helper functions for managing ports and port settings.
| pp | a pointer to a io_port_cfg_t struct to hold the data and pointers. |
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| uint_fast16_t ioports_compute_pwm_value | ( | ioports_pwm_t * | pwm_data, |
| float | value | ||
| ) |
Analog value to PWM conversion.
| pwm_data | pointer to a ioports_pwm_t structure. |
| value | analog value to be converted. |
NOTE: ioports_precompute_pwm_values() must be called to precompute values before this function is called. Typically this is done by the ioports initialization code.
| bool ioports_enumerate | ( | io_port_type_t | type, |
| io_port_direction_t | dir, | ||
| pin_cap_t | filter, | ||
| ioports_enumerate_callback_ptr | callback, | ||
| void * | data | ||
| ) |
Enumerate ports.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |
| filter | a pin_cap_t union with fields set that must match the port capabilities. |
| callback | pointer to a ioports_enumerate_callback_ptr function that will be called for each matching port. If the function returns true the enumeration will end. |
| data | a pointer to context data passed to the callback function. |
| uint8_t ioports_map_reverse | ( | io_ports_detail_t * | type, |
| uint8_t | port | ||
| ) |
| bool ioports_precompute_pwm_values | ( | pwm_config_t * | config, |
| ioports_pwm_t * | pwm_data, | ||
| uint32_t | clock_hz | ||
| ) |
Precompute PWM values for faster conversion.
| config | pointer to a pwm_config_t structure. |
| pwm_data | pointer to a ioports_pwm_t structure, to hold the precomputed values. |
| clock_hz | timer clock frequency used for PWM generation. |
| uint8_t ioports_unclaimed | ( | io_port_type_t | type, |
| io_port_direction_t | dir | ||
| ) |
Get number of unclaimed digital or analog ports available.
| type | as an io_port_type_t enum value. |
| dir | as an io_port_direction_t enum value. |