Platform Abstraction Layer Interface

The high side switch library requires ADCs, GPIOs and timer 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.

ADC PAL

class ADCPAL

ADC abstract API.

Subclassed by hss::ADCIno

Public Functions

virtual Error_t init() = 0

Initializes the ADC.

Returns:

High-side switch error code

virtual Error_t deinit() = 0

Deinitializes the ADC.

Returns:

High-side switch error code

virtual Error_t enable() = 0

Enable the ADC.

Returns:

High-side switch error code

virtual Error_t disable() = 0

Disable the ADC.

Returns:

High-side switch error code

virtual uint16_t ADCRead() = 0

Reads the analog value on the ADC.

Returns:

Analog value of the ADC (uint16_t)

virtual Error_t ADCWrite(uint8_t value) = 0

Write a desired analog value.

Parameters:

value[in] Desired analog value

Returns:

High-side switch error code

GPIO PAL

class GPIOPAL

GPIO abstract API.

Subclassed by hss::GPIOIno

Public Types

enum IntEvent_t

Interrupt event.

Values:

enumerator INT_FALLING_EDGE

Interrupt on falling edge

enumerator INT_RISING_EDGE

Interrupt on rising edge

enum VLevel_t

Voltage level.

Values:

enumerator GPIO_LOW

Level low

enumerator GPIO_HIGH

Level high

enum VLogic_t

Voltage logic.

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:

High-side switch error code

virtual Error_t deinit() = 0

Deinitializes the GPIO.

Return values:
  • OK – If success

  • INIT_ERROR – If deinitialization error

Returns:

High-side switch 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:

VLevel_t

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:

High-side switch 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:

High-side switch error code

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:

High-side switch error code

Timer PAL

class TimerPAL

Timer abstract API.

Subclassed by hss::TimerIno

Public Functions

virtual Error_t init() = 0

Initialize the timer.

Return values:
  • OK – If success

  • INIT_ERROR – If hardware interface error

Returns:

High-side switch error code

virtual Error_t deinit() = 0

Deinitialize the timer.

Return values:
  • OK – If success

  • INIT_ERROR – If hardware interface error

Returns:

High-side switch error code

virtual Error_t start() = 0

Starts the timer.

Return values:
  • OK – If success

  • INIT_ERROR – If hardware interface error

Returns:

High-side switch error code

virtual Error_t elapsed(uint32_t &elapsed) = 0

Elapsed time since the timer was started.

Parameters:

elapsed[out] Time in milliseconds

Return values:
  • OK – If success

  • INIT_ERROR – If hardware interface error

Returns:

High-side switch error code

virtual Error_t stop() = 0

Stops the timer.

Return values:
  • OK – If success

  • INIT_ERROR – If hardware interface error

Returns:

High-side switch error code

virtual Error_t delayMilli(uint32_t timeout) = 0

Introduces a delay during the specified time.

Parameters:

timeout[in] Delay time in milliseconds

Return values:
  • OK – If success

  • INIT_ERROR – If hardware interface error

Returns:

High-side switch error code

virtual Error_t delayMicro(uint32_t timeout) = 0

Introduces a delay during the specified time.

Parameters:

timeout[in] Delay time in microseconds

Return values:
  • OK – If success

  • INIT_ERROR – If hardware interface error

Returns:

High-side switch error code