Platform Abstraction Layer Interface

The XENSIV™ TLx5012B library requires SPIC and GPIO resources from the platform. These are implemented in terms of the following abstract class APIs for each supported software framework:

Their member parameters and functions are described in this section.

SPIC PAL

class SPICPAL

Inheritance diagram for tle5012::SPICPAL:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="tle5012::SPICIno" tooltip="tle5012::SPICIno"] "1" [label="tle5012::SPICPAL" tooltip="tle5012::SPICPAL" fillcolor="#BFBFBF"] "2" -> "1" [dir=forward tooltip="public-inheritance"] }

SPI abstract API.

Subclassed by tle5012::SPICIno

Public Functions

virtual Error_t init() = 0

Initializes the SPIC.

Return values:
  • OK – if success

  • INIT_ERROR – if initialization error

Returns:

SPIC error code

virtual Error_t deinit() = 0

Deinitialize the SPIC.

Return values:
  • OK – if success

  • INIT_ERROR – if deinitialization error

Returns:

SPIC error code

virtual Error_t triggerUpdate() = 0

Sends a trigger through out the SPI bus.

Return values:
  • OK – if success

  • INIT_ERROR – if deinitialization error

Returns:

SPIC error code

virtual Error_t sendReceive(uint16_t *sent_data, uint16_t size_of_sent_data, uint16_t *received_data, uint16_t size_of_received_data) = 0

Function which allows 3wire SPI (SSC) by sending and receiving data in the same function.

Parameters:
  • sent_data – pointer two 2*unit16_t value for one command word and one data word if something should be written

  • size_of_sent_data – the size of the command word default 1 = only command 2 = command and data word

  • received_data – pointer to data structure buffer for the read data

  • size_of_received_data – size of data words to be read

Return values:
  • OK – if success

  • INIT_ERROR – if transfer fails

Returns:

SPIC error code

GPIO PAL

class GPIOPAL

Inheritance diagram for tle5012::GPIOPAL:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="tle5012::GPIOIno" tooltip="tle5012::GPIOIno"] "1" [label="tle5012::GPIOPAL" tooltip="tle5012::GPIOPAL" fillcolor="#BFBFBF"] "2" -> "1" [dir=forward tooltip="public-inheritance"] }

Subclassed by tle5012::GPIOIno

Interrupt event

enum IntEvent_t

Values:

enumerator INT_FALLING_EDGE

Interrupt on falling edge

enumerator INT_RISING_EDGE

Interrupt on rising edge

Voltage level

enum VLevel_t

Values:

enumerator GPIO_LOW

Level low

enumerator GPIO_HIGH

Level high

Voltage logic

enum VLogic_t

Values:

enumerator NEGATIVE

Negative logic. 0 on voltage level high, 1 on voltage low

enumerator POSITIVE

Positive logic. 1 on voltage level high, 0 on voltage low

Public Functions

virtual Error_t init() = 0

Initializes the GPIO.

Return values:
  • OK – if success

  • INIT_ERROR – if initialization error

Returns:

GPIO error code

virtual Error_t deinit() = 0

Deinitialize the GPIO.

Return values:
  • OK – if success

  • INIT_ERROR – if deinitialization error

Returns:

GPIO error code

virtual Error_t changeMode(uint8_t mode) = 0

Changes the IN/OUT mode.

Parameters:

mode[in] INPUT or OUTPUT mode of pin

Return values:
  • OK – if success

  • INIT_ERROR – if deinitialization error

Returns:

GPIO error code

virtual VLevel_t read() = 0

Reads the GPIO voltage level.

Return values:
  • GPIO_LOW – if voltage low

  • GPIO_HIGH – if voltage high

Returns:

GPIO voltage level

virtual Error_t write(VLevel_t level) = 0

Writes the GPIO output voltage level.

Parameters:

level[in] Voltage level

Return values:
  • OK – if success

  • WRITE_ERROR – if write error

Returns:

GPIO error code

virtual Error_t enable() = 0

Enables the GPIO output according to the GPIO logic.

  • Low if negative

  • High if positive

Return values:
  • OK – if success

  • WRITE_ERROR – if write error

Returns:

GPIO interrupt event

virtual Error_t disable() = 0

Disables the GPIO output according to the GPIO logic.

  • Low if positive

  • High if negative

Return values:
  • OK – if success

  • WRITE_ERROR – if write error

Returns:

GPIO error code