S32 SDK

Detailed Description

This section describes the programming interface of the PINS driver.

Data Structures

struct  pin_settings_config_t
 Defines the converter configuration. More...
 

Typedefs

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...
 

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_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 Documentation

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.

Enumeration Type Documentation

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.

Function Documentation

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.

Parameters
baseGPIO base pointer (PTA, PTB, PTC, etc.)
pinspin mask of bits to be cleared. Each bit represents one pin (LSB is pin 0, MSB is pin 31). For each bit:
  • 0: corresponding pin is unaffected
  • 1: corresponding pin is cleared(set to LOW)

Definition at line 312 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.

Parameters
baseGPIO base pointer (PTA, PTB, PTC, etc.)
Returns
GPIO outputs. Each bit represents one pin (LSB is pin 0, MSB is pin 31). For each bit:
  • 0: corresponding pin is set to LOW
  • 1: corresponding pin is set to HIGH

Definition at line 283 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.

Parameters
[in]pinCountthe number of configured pins in structure
[in]configthe configuration structure
Returns
the status of the operation

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.

Parameters
baseGPIO base pointer (PTA, PTB, PTC, etc.)
Returns
GPIO inputs. Each bit represents one pin (LSB is pin 0, MSB is pin 31). For each bit:
  • 0: corresponding pin is read as LOW
  • 1: corresponding pin is read as HIGH

Definition at line 340 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.

Parameters
baseGPIO base pointer (PTA, PTB, PTC, etc.)
pinspin mask of bits to be set. Each bit represents one pin (LSB is pin 0, MSB is pin 31). For each bit:
  • 0: corresponding pin is unaffected
  • 1: corresponding pin is set to HIGH

Definition at line 297 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.

Parameters
baseGPIO base pointer (PTA, PTB, PTC, etc.)
pinspin mask of bits to be toggled. Each bit represents one pin (LSB is pin 0, MSB is pin 31). For each bit:
  • 0: corresponding pin is unaffected
  • 1: corresponding pin is toggled

Definition at line 326 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).

Parameters
baseGPIO base pointer (PTA, PTB, PTC, etc.)
pinpin number to be written
valuepin value to be written
  • 0: corresponding pin is set to LOW
  • 1: corresponding pin is set to HIGH

Definition at line 254 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.

Parameters
baseGPIO base pointer (PTA, PTB, PTC, etc.)
pinspin mask to be written
  • 0: corresponding pin is set to LOW
  • 1: corresponding pin is set to HIGH

Definition at line 269 of file pins_driver.c.