This section describes the programming interface of the PINS driver.
Data Structures | |
struct | port_digital_filter_config_t |
The digital filter configuration Implements : port_digital_filter_config_t_Class. More... | |
struct | pin_settings_config_t |
Defines the converter configuration. More... | |
Typedefs | |
typedef uint32_t | pins_channel_type_t |
Type of a GPIO channel representation Implements : pins_channel_type_t_Class. More... | |
typedef uint8_t | pins_level_type_t |
Type of a port levels representation. Implements : pins_level_type_t_Class. More... | |
Enumerations | |
enum | port_data_direction_t { GPIO_INPUT_DIRECTION = 0x0U, GPIO_OUTPUT_DIRECTION = 0x1U, GPIO_UNSPECIFIED_DIRECTION = 0x2U } |
Configures the port data direction Implements : port_data_direction_t_Class. More... | |
enum | port_pull_config_t { PORT_INTERNAL_PULL_NOT_ENABLED = 0U, PORT_INTERNAL_PULL_DOWN_ENABLED = 1U, PORT_INTERNAL_PULL_UP_ENABLED = 2U } |
Internal resistor pull feature selection Implements : port_pull_config_t_Class. More... | |
enum | port_drive_strength_t { PORT_LOW_DRIVE_STRENGTH = 0U, PORT_HIGH_DRIVE_STRENGTH = 1U } |
Configures the drive strength. Implements : port_drive_strength_t_Class. More... | |
enum | port_mux_t { PORT_PIN_DISABLED = 0U, PORT_MUX_AS_GPIO = 1U, PORT_MUX_ALT2 = 2U, PORT_MUX_ALT3 = 3U, PORT_MUX_ALT4 = 4U, PORT_MUX_ALT5 = 5U, PORT_MUX_ALT6 = 6U, PORT_MUX_ALT7 = 7U } |
Configures the Pin mux selection Implements : port_mux_t_Class. More... | |
enum | port_interrupt_config_t { PORT_DMA_INT_DISABLED = 0x0U, PORT_DMA_RISING_EDGE = 0x1U, PORT_DMA_FALLING_EDGE = 0x2U, PORT_DMA_EITHER_EDGE = 0x3U, PORT_INT_LOGIC_ZERO = 0x8U, PORT_INT_RISING_EDGE = 0x9U, PORT_INT_FALLING_EDGE = 0xAU, PORT_INT_EITHER_EDGE = 0xBU, PORT_INT_LOGIC_ONE = 0xCU } |
Configures the interrupt generation condition. Implements : port_interrupt_config_t_Class. More... | |
enum | port_digital_filter_clock_t { PORT_DIGITAL_FILTER_BUS_CLOCK = 0U, PORT_DIGITAL_FILTER_LPO_CLOCK = 1U } |
Clock source for the digital input filters Implements : port_digital_filter_clock_t_Class. More... | |
enum | port_global_control_pins_t { PORT_GLOBAL_CONTROL_LOWER_HALF_PINS = 0U, PORT_GLOBAL_CONTROL_UPPER_HALF_PINS = 1U } |
The port global pin/interuppt control registers Implements : port_global_control_pins_t_Class. More... | |
PINS DRIVER API. | |
status_t | PINS_DRV_Init (uint32_t pinCount, const pin_settings_config_t config[]) |
Initializes the pins with the given configuration structure. More... | |
void | PINS_DRV_SetPullSel (PORT_Type *const base, uint32_t pin, port_pull_config_t pullConfig) |
Configures the internal resistor. More... | |
void | PINS_DRV_SetMuxModeSel (PORT_Type *const base, uint32_t pin, port_mux_t mux) |
Configures the pin muxing. More... | |
void | PINS_DRV_SetPinIntSel (PORT_Type *const base, uint32_t pin, port_interrupt_config_t intConfig) |
Configures the port pin interrupt/DMA request. More... | |
port_interrupt_config_t | PINS_DRV_GetPinIntSel (const PORT_Type *const base, uint32_t pin) |
Gets the current port pin interrupt/DMA request configuration. More... | |
void | PINS_DRV_ClearPinIntFlagCmd (PORT_Type *const base, uint32_t pin) |
Clears the individual pin-interrupt status flag. More... | |
void | PINS_DRV_EnableDigitalFilter (PORT_Type *const base, uint32_t pin) |
Enables digital filter for digital pin muxing. More... | |
void | PINS_DRV_DisableDigitalFilter (PORT_Type *const base, uint32_t pin) |
Disables digital filter for digital pin muxing. More... | |
void | PINS_DRV_ConfigDigitalFilter (PORT_Type *const base, const port_digital_filter_config_t *const config) |
Configures digital filter for port with given configuration. More... | |
uint32_t | PINS_DRV_GetPortIntFlag (const PORT_Type *const base) |
Reads the entire port interrupt status flag. More... | |
void | PINS_DRV_ClearPortIntFlagCmd (PORT_Type *const base) |
Clears the entire port interrupt status flag. More... | |
void | PINS_DRV_SetGlobalPinControl (PORT_Type *const base, uint16_t pins, uint16_t value, port_global_control_pins_t halfPort) |
Quickly configures multiple pins with the same pin configuration. More... | |
void | PINS_DRV_SetGlobalIntControl (PORT_Type *const base, uint16_t pins, uint16_t value, port_global_control_pins_t halfPort) |
Quickly configures multiple pins with the same interrupt configuration. More... | |
pins_channel_type_t | PINS_DRV_GetPinsDirection (const GPIO_Type *const base) |
Get the pins directions configuration for a port. More... | |
void | PINS_DRV_SetPinDirection (GPIO_Type *const base, pins_channel_type_t pin, pins_level_type_t direction) |
Configure the direction for a certain pin from a port. More... | |
void | PINS_DRV_SetPinsDirection (GPIO_Type *const base, pins_channel_type_t pins) |
Set the pins directions configuration for a port. More... | |
void | PINS_DRV_WritePin (GPIO_Type *const base, pins_channel_type_t pin, pins_level_type_t value) |
Write a pin of a port with a given value. More... | |
void | PINS_DRV_WritePins (GPIO_Type *const base, pins_channel_type_t pins) |
Write all pins of a port. More... | |
pins_channel_type_t | PINS_DRV_GetPinsOutput (const GPIO_Type *const base) |
Get the current output from a port. More... | |
void | PINS_DRV_SetPins (GPIO_Type *const base, pins_channel_type_t pins) |
Write pins with 'Set' value. More... | |
void | PINS_DRV_ClearPins (GPIO_Type *const base, pins_channel_type_t pins) |
Write pins to 'Clear' value. More... | |
void | PINS_DRV_TogglePins (GPIO_Type *const base, pins_channel_type_t pins) |
Toggle pins value. More... | |
pins_channel_type_t | PINS_DRV_ReadPins (const GPIO_Type *const base) |
Read input pins. More... | |
typedef uint32_t pins_channel_type_t |
Type of a GPIO channel representation Implements : pins_channel_type_t_Class.
Definition at line 41 of file pins_driver.h.
typedef uint8_t pins_level_type_t |
Type of a port levels representation. Implements : pins_level_type_t_Class.
Definition at line 56 of file pins_driver.h.
Configures the port data direction Implements : port_data_direction_t_Class.
Enumerator | |
---|---|
GPIO_INPUT_DIRECTION |
General purpose input direction. |
GPIO_OUTPUT_DIRECTION |
General purpose output direction. |
GPIO_UNSPECIFIED_DIRECTION |
General purpose unspecified direction. |
Definition at line 62 of file pins_driver.h.
Clock source for the digital input filters Implements : port_digital_filter_clock_t_Class.
Enumerator | |
---|---|
PORT_DIGITAL_FILTER_BUS_CLOCK |
Digital filters are clocked by the bus clock. |
PORT_DIGITAL_FILTER_LPO_CLOCK |
Digital filters are clocked by the LPO clock. |
Definition at line 178 of file pins_driver.h.
Configures the drive strength. Implements : port_drive_strength_t_Class.
Enumerator | |
---|---|
PORT_LOW_DRIVE_STRENGTH |
low drive strength is configured. |
PORT_HIGH_DRIVE_STRENGTH |
high drive strength is configured. |
Definition at line 99 of file pins_driver.h.
The port global pin/interuppt control registers Implements : port_global_control_pins_t_Class.
Enumerator | |
---|---|
PORT_GLOBAL_CONTROL_LOWER_HALF_PINS |
the lower of pins is configured. |
PORT_GLOBAL_CONTROL_UPPER_HALF_PINS |
the upper of pins is configured. |
Definition at line 198 of file pins_driver.h.
Configures the interrupt generation condition. Implements : port_interrupt_config_t_Class.
Definition at line 140 of file pins_driver.h.
enum port_mux_t |
Configures the Pin mux selection Implements : port_mux_t_Class.
Definition at line 124 of file pins_driver.h.
enum port_pull_config_t |
Internal resistor pull feature selection Implements : port_pull_config_t_Class.
Definition at line 74 of file pins_driver.h.
void PINS_DRV_ClearPinIntFlagCmd | ( | PORT_Type *const | base, |
uint32_t | pin | ||
) |
Clears the individual pin-interrupt status flag.
This function clears the individual pin-interrupt status flag.
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | pin | Port pin number |
Definition at line 137 of file pins_driver.c.
void PINS_DRV_ClearPins | ( | GPIO_Type *const | base, |
pins_channel_type_t | pins | ||
) |
Write pins to 'Clear' value.
This function configures output pins listed in parameter pins (bits that are '1') to have a 'cleared' value (LOW). Pins corresponding to '0' will be unaffected.
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
[in] | pins | Pin mask of bits to be cleared. Each bit represents one pin (LSB is pin 0, MSB is pin 31). For each bit:
|
Definition at line 535 of file pins_driver.c.
void PINS_DRV_ClearPortIntFlagCmd | ( | PORT_Type *const | base | ) |
Clears the entire port interrupt status flag.
This function clears the entire port interrupt status flag.
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
Definition at line 203 of file pins_driver.c.
void PINS_DRV_ConfigDigitalFilter | ( | PORT_Type *const | base, |
const port_digital_filter_config_t *const | config | ||
) |
Configures digital filter for port with given configuration.
This function configures digital filter for port with given configuration
Note: Updating the filter configuration must be done only after all filters are disabled.
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | config | the digital filter configuration struct |
Definition at line 178 of file pins_driver.c.
void PINS_DRV_DisableDigitalFilter | ( | PORT_Type *const | base, |
uint32_t | pin | ||
) |
Disables digital filter for digital pin muxing.
This function disables digital filter feature for digital pin muxing
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | pin | Port pin number |
Definition at line 164 of file pins_driver.c.
void PINS_DRV_EnableDigitalFilter | ( | PORT_Type *const | base, |
uint32_t | pin | ||
) |
Enables digital filter for digital pin muxing.
This function enables digital filter feature for digital pin muxing
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | pin | Port pin number |
Definition at line 150 of file pins_driver.c.
port_interrupt_config_t PINS_DRV_GetPinIntSel | ( | const PORT_Type *const | base, |
uint32_t | pin | ||
) |
Gets the current port pin interrupt/DMA request configuration.
This function gets the current port pin interrupt/DMA request configuration.
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | pin | Port pin number |
Definition at line 124 of file pins_driver.c.
pins_channel_type_t PINS_DRV_GetPinsDirection | ( | const GPIO_Type *const | base | ) |
Get the pins directions configuration for a port.
This function returns the current pins directions for a port. Pins corresponding to bits with value of '1' are configured as output and pins corresponding to bits with value of '0' are configured as input.
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
Definition at line 217 of file pins_driver.c.
pins_channel_type_t PINS_DRV_GetPinsOutput | ( | const GPIO_Type *const | base | ) |
Get the current output from a port.
This function returns the current output that is written to a port. Only pins that are configured as output will have meaningful values.
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
Definition at line 506 of file pins_driver.c.
uint32_t PINS_DRV_GetPortIntFlag | ( | const PORT_Type *const | base | ) |
Reads the entire port interrupt status flag.
This function reads the entire port interrupt status flag.
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
Definition at line 191 of file pins_driver.c.
status_t PINS_DRV_Init | ( | uint32_t | pinCount, |
const pin_settings_config_t | config[] | ||
) |
Initializes the pins with the given configuration structure.
This function configures the pins with the options provided in the provided structure.
[in] | pinCount | The number of configured pins in structure |
[in] | config | The configuration structure |
Definition at line 53 of file pins_driver.c.
pins_channel_type_t PINS_DRV_ReadPins | ( | const GPIO_Type *const | base | ) |
Read input pins.
This function returns the current input values from a port. Only pins configured as input will have meaningful values.
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
Definition at line 563 of file pins_driver.c.
void PINS_DRV_SetGlobalIntControl | ( | PORT_Type *const | base, |
uint16_t | pins, | ||
uint16_t | value, | ||
port_global_control_pins_t | halfPort | ||
) |
Quickly configures multiple pins with the same interrupt configuration.
This function quickly configures multiple pins within the one port for the same peripheral function with the same interrupt configuration. Supports up to 16 pins with the lower or upper half of pin registers at the same port.
Note: The set global pin control function (PINS_DRV_SetGlobalPinControl) cannot be configured if you ever used this function at the same port
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | pins | Pin mask where each bit represents one pin. For each bit:
|
[in] | value | the config value will be updated for the pins are set to '1' |
[in] | halfPort | the lower or upper half of pin registers at the same port |
Definition at line 312 of file pins_driver.c.
void PINS_DRV_SetGlobalPinControl | ( | PORT_Type *const | base, |
uint16_t | pins, | ||
uint16_t | value, | ||
port_global_control_pins_t | halfPort | ||
) |
Quickly configures multiple pins with the same pin configuration.
This function quickly configures multiple pins within the one port for the same peripheral function with the same pin configuration. Supports up to 16 pins with the lower or upper half of pin registers at the same port.
Note: The set global interrupt control function (PINS_DRV_SetGlobalIntControl) cannot be configured if you ever used this function at the same port
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | pins | Pin mask where each bit represents one pin. For each bit:
|
[in] | value | the config value will be updated for the pins are set to '1' |
[in] | halfPort | the lower or upper half of pin registers at the same port |
Definition at line 295 of file pins_driver.c.
void PINS_DRV_SetMuxModeSel | ( | PORT_Type *const | base, |
uint32_t | pin, | ||
port_mux_t | mux | ||
) |
Configures the pin muxing.
This function configures the pin muxing.
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | pin | Port pin number |
[in] | mux | Pin muxing slot selection |
Definition at line 96 of file pins_driver.c.
void PINS_DRV_SetPinDirection | ( | GPIO_Type *const | base, |
pins_channel_type_t | pin, | ||
pins_level_type_t | direction | ||
) |
Configure the direction for a certain pin from a port.
This function configures the direction for the given pin, with the given value('1' for pin to be configured as output and '0' for pin to be configured as input)
Note: With some platforms when you want to set a pin as output only and disable input completely, it is required to call PINS_DRV_SetPortInputDisable if platform has this feature.
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
[in] | pin | The pin number for which to configure the direction |
[in] | direction | The pin direction:
|
Definition at line 231 of file pins_driver.c.
void PINS_DRV_SetPinIntSel | ( | PORT_Type *const | base, |
uint32_t | pin, | ||
port_interrupt_config_t | intConfig | ||
) |
Configures the port pin interrupt/DMA request.
This function configures the port pin interrupt/DMA request.
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | pin | Port pin number |
[in] | intConfig | Interrupt configuration |
Definition at line 110 of file pins_driver.c.
void PINS_DRV_SetPins | ( | GPIO_Type *const | base, |
pins_channel_type_t | pins | ||
) |
Write pins with 'Set' value.
This function configures output pins listed in parameter pins (bits that are '1') to have a value of 'set' (HIGH). Pins corresponding to '0' will be unaffected.
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
[in] | pins | Pin mask of bits to be set. Each bit represents one pin (LSB is pin 0, MSB is pin 31). For each bit:
|
Definition at line 520 of file pins_driver.c.
void PINS_DRV_SetPinsDirection | ( | GPIO_Type *const | base, |
pins_channel_type_t | pins | ||
) |
Set the pins directions configuration for a port.
This function sets the direction configuration for all pins in a port. Pins corresponding to bits with value of '1' will be configured as output and pins corresponding to bits with value of '0' will be configured as input.
Note: With some platforms when you want to set a pin as output only and disable input completely, it is required to call PINS_DRV_SetPortInputDisable if platform has this feature.
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
[in] | pins | Pin mask where each bit represents one pin (LSB is pin 0, MSB is pin 31). For each bit:
|
Definition at line 248 of file pins_driver.c.
void PINS_DRV_SetPullSel | ( | PORT_Type *const | base, |
uint32_t | pin, | ||
port_pull_config_t | pullConfig | ||
) |
Configures the internal resistor.
This function configures the internal resistor.
[in] | base | Port base pointer (PORTA, PORTB, PORTC, etc.) |
[in] | pin | Port pin number |
[in] | pullConfig | The pull configuration |
Definition at line 80 of file pins_driver.c.
void PINS_DRV_TogglePins | ( | GPIO_Type *const | base, |
pins_channel_type_t | pins | ||
) |
Toggle pins value.
This function toggles output pins listed in parameter pins (bits that are '1'). Pins corresponding to '0' will be unaffected.
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
[in] | pins | Pin mask of bits to be toggled. Each bit represents one pin (LSB is pin 0, MSB is pin 31). For each bit:
|
Definition at line 549 of file pins_driver.c.
void PINS_DRV_WritePin | ( | GPIO_Type *const | base, |
pins_channel_type_t | pin, | ||
pins_level_type_t | value | ||
) |
Write a pin of a port with a given value.
This function writes the given pin from a port, with the given value ('0' represents LOW, '1' represents HIGH).
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
[in] | pin | Pin number to be written |
[in] | value | Pin value to be written
|
Definition at line 477 of file pins_driver.c.
void PINS_DRV_WritePins | ( | GPIO_Type *const | base, |
pins_channel_type_t | pins | ||
) |
Write all pins of a port.
This function writes all pins configured as output with the values given in the parameter pins. '0' represents LOW, '1' represents HIGH.
[in] | base | GPIO base pointer (PTA, PTB, PTC, etc.) |
[in] | pins | Pin mask to be written
|
Definition at line 492 of file pins_driver.c.