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 uint16_t ADCRead() = 0
Reads the analog value on the ADC.
- Returns:
Analog value of the ADC (uint16_t)
-
virtual uint16_t ADCRead() = 0
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
-
enumerator INT_FALLING_EDGE
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
-
enum IntEvent_t
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 init() = 0