Padframe

group Padframe

Padframe.

The padframe driver provides support for controlling PADs.

Defines

PI_PAD_IS_VALID_PULL(pull)
PI_PAD_IS_VALID_SCHMITT_TRIGGER(trigger)

Enums

enum pi_pad_func_e

Pad functions.

This is used to identify the function for each pad.

Values:

enumerator PI_PAD_FUNC0 = 0

Alternate func0, default func.

enumerator PI_PAD_FUNC1 = 1

Alternate func1. pads as GPIOs.

enumerator PI_PAD_FUNC2 = 2

Alternate func2,

enumerator PI_PAD_FUNC3 = 3

Alternate func3.

enum pi_pad_drive_strength_e

Pad drive strength.

Values:

enumerator PI_PAD_DRIVE_STRENGTH_MIN = 0b00
enumerator PI_PAD_DRIVE_STRENGTH_LOW = 0b01
enumerator PI_PAD_DRIVE_STRENGTH_HIGH = 0b10
enumerator PI_PAD_DRIVE_STRENGTH_MAX = 0b11
enum pi_pad_pull_e

List possible pad’s pull configurations.

Values:

enumerator PI_PAD_NO_PULL = 0b00
enumerator PI_PAD_PULL_DOWN = 0b01
enumerator PI_PAD_PULL_UP = 0b10
enum schmitt_trigger_e

Schmitt trigger setting enum.

Values:

enumerator PI_PAD_SCHMITT_TRIGGER_DISABLED = 0b00
enumerator PI_PAD_SCHMITT_TRIGGER_ENABLED = 0b01

Functions

void pi_pad_function_set(pi_pad_e pad, pi_pad_func_e function)

Set the function of one pad.

This function can be used to configure the function of the specified pad in the case that it supports several functions.

Parameters:
  • pad – Pad number. See the chip specific configuration for more details.

  • function – Pad function. See the chip specific configuration for more details.

void pi_pad_set_function(pi_pad_e pad, pi_pad_func_e function)

Deprecated:

Use ‘pi_pad_function_set’ instead.

pi_pad_func_e pi_pad_function_get(pi_pad_e pad)

Get the function of a pad.

Parameters:
  • pad – Pad number. See the chip specific configuration for more details.

Returns:

pi_pad_func_e Pad function. See the chip specific configuration for more details.

pi_pad_func_e pi_pad_get_function(pi_pad_e pad)

Deprecated:

Use ‘pi_pad_function_get’ instead.

void pi_pad_init(uint32_t pad_values[])

Set the function of all pads.

This function can be used to configure the function of all the pads in the case that they support several functions.

Parameters:
  • pad_values[] – Pad values. This is an array of 32 bit values, with one bit per pad and one 32 bit value per group of 32 pads.

void pi_pad_drive_strength_set(pi_pad_e pad, pi_pad_drive_strength_e drive_strength)

Set the drive strength of a pad.

Parameters:
  • pad – Pad number. See the chip specific configuration for more details.

  • drive_strength – The pad drive strength (see pi_pad_drive_strength_e enum)

int32_t pi_pad_pull_set(pi_pad_e pad, pi_pad_pull_e pull)

Configure a pull resistor on a pad.

Parameters:
  • pad – Pad number. See the chip specific configuration for more details.

  • pull – Pull type. It can be a value of pi_pad_pull_e enum

Return values:

Error – management.

int32_t pi_pad_schmitt_trigger_set(pi_pad_e pad, schmitt_trigger_e trigger)

Configure a schmitt trigger on a pad.

Parameters:
  • pad – Pad number. See the chip specific configuration for more details.

  • trigger – Status. It can be a value of schmitt_trigger_e enum

Return values:

Error – management.

void pi_pad_mux_group_set(pi_pad_e pad, pi_pad_mux_group_sel_e group_value)

Set the mux group of one pad.

This function can be used to configure the mux group of the specified pad in the case that it supports several mux groups.

Parameters:
  • pad – Pad number.

  • group_value – Pad mux group.

void pi_pad_set_mux_group(pi_pad_e pad, pi_pad_mux_group_sel_e group_value)

Deprecated:

Use ‘pi_pad_mux_group_set’ instead.

void pi_pad_mux_group_init(uint32_t reprog_values[])

Set all mux groupfunction.

This function is used to initialize the function of all reprogrammable pads

Parameters:
  • reprog_values – Reprog registers content to write. This is an array of 4 elements of 32 bits values. A pad’s function is encoded on 6 bits. Therefore, one register handles 5 pads as the following : reprog_value[0] controls reprogrammable pads 27,28,29,30,34 reprog_value[1] controls reprogrammable pads 35,40,41,42,43 reprog_value[2] controls reprogrammable pads 44,45,60,61,62 reprog_value[3] controls reprogrammable pads 63,65,66,67,68

void pi_pad_sleep_cfg_set(pi_pad_e pad, uint8_t cfg)

Set a pad configuration in deep sleep mode.

This function can be used to configure the pad when the chip is in deep sleep mode.

Parameters:
  • pad – Pad number.

  • cfg – Pad config. See pi_pad_sleep_cfg_e for options.

void pi_pad_set_sleep_cfg(pi_pad_e pad, pi_pad_sleep_cfg_e cfg)

Deprecated:

Use ‘pi_pad_sleep_cfg_set’ instead.

void pi_pad_sleep_cfg_force(int enabled)

Force the pads deep sleep mode configuration also in normal mode.

This function can be used to keep the pads sleep configuration also applied when the chip is not in deep sleep mode. This allows keeping the settings until the pads are configured again after wakeup.

Parameters:
  • enabled – Force deep sleep configuration if it is 1