The latest development version of this page may be more current than this released 3.7.0 version.

Time-aware General-Purpose Input/Output (TGPIO)

Overview

Configuration Options

Related configuration options:

API Reference

group tgpio_interface

Time-aware GPIO Interface.

Since

3.5

Version

0.1.0

Enums

enum tgpio_pin_polarity

Event polarity.

Values:

enumerator TGPIO_RISING_EDGE = 0
enumerator TGPIO_FALLING_EDGE
enumerator TGPIO_TOGGLE_EDGE

Functions

int tgpio_port_get_time(const struct device *dev, uint64_t *current_time)

Get time from ART timer.

Parameters:
  • dev – TGPIO device

  • current_time – Pointer to store timer value in cycles

Returns:

0 if successful

Returns:

negative errno code on failure.

int tgpio_port_get_cycles_per_second(const struct device *dev, uint32_t *cycles)

Get current running rate.

Parameters:
  • dev – TGPIO device

  • cycles – pointer to store current running frequency

Returns:

0 if successful, negative errno code on failure.

int tgpio_pin_disable(const struct device *dev, uint32_t pin)

Disable operation on pin.

Parameters:
  • dev – TGPIO device

  • pin – TGPIO pin

Returns:

0 if successful, negative errno code on failure.

int tgpio_pin_config_ext_timestamp(const struct device *dev, uint32_t pin, uint32_t event_polarity)

Enable/Continue operation on pin.

Parameters:
  • dev – TGPIO device

  • pin – TGPIO pin

  • event_polarity – TGPIO pin event polarity

Returns:

0 if successful, negative errno code on failure.

int tgpio_pin_periodic_output(const struct device *dev, uint32_t pin, uint64_t start_time, uint64_t repeat_interval, bool periodic_enable)

Enable periodic pulse generation on a pin.

Parameters:
  • dev – TGPIO device

  • pin – TGPIO pin

  • start_time – start_time of first pulse in hw cycles

  • repeat_interval – repeat interval between two pulses in hw cycles

  • periodic_enable – enables periodic mode if ‘true’ is passed.

Returns:

0 if successful, negative errno code on failure.

int tgpio_pin_read_ts_ec(const struct device *dev, uint32_t pin, uint64_t *timestamp, uint64_t *event_count)

Read timestamp and event counter from TGPIO.

Parameters:
  • dev – TGPIO device

  • pin – TGPIO pin

  • timestamp – timestamp of the last pulse received

  • event_count – number of pulses received since the pin is enabled

Returns:

0 if successful, negative errno code on failure.