![]() |
WarpTwin
Documentation for WarpTwin models and classes.
|
Holds all platform-specific interfaces. More...
#include <Platform.h>
Public Member Functions | |
| Platform () | |
| virtual | ~Platform () |
| virtual int16 | startup () |
| Initialize the platform. | |
| virtual int16 | setPinMode (const GpioConfig_t &config) |
| Set the mode for a given GPIO pin on platform. | |
| virtual int16 | writePin (uint8 bank, uint32 pin, uint32 value) |
| Write data value to a pin. | |
| virtual int16 | readPin (uint8 bank, uint32 pin, uint32 &value) |
| Read data value from a pin. | |
| virtual int32 | openSPI (const SpiConfig_t &config) |
| Open and configure SPI. | |
| virtual int16 | readSPI (int32 spi_device, uint8 *buffer, uint8 size) |
| Read a set of bytes via SPI. | |
| virtual int16 | writeSPI (int32 spi_device, uint8 *buffer, uint8 size) |
| Write a set of bytes via SPI. | |
| virtual int16 | readWriteSPI (int32 spi_device, uint8 *buffer, uint8 size) |
| Write and read a set of bytes via SPI. | |
| virtual int32 | openSerial (const UartConfig_t &config) |
| Open and configture UART connection. | |
| virtual int16 | writeSerial (int32 device_fd, uint8 *buffer, uint8 size) |
| Write a byte to UART. | |
| virtual uint32 | readSerial (int32 device_fd, uint8 *buffer, uint32 size) |
| Read a byte from UART. | |
| virtual uint32 | bytesReadySerial (int32 device_fd) |
| Check number of bytes ready to read on UART. | |
| virtual int32 | openI2C (const I2cConfig_t &config) |
| Open an I2C device. | |
| virtual int16 | writeI2C (int32 i2c_fd, uint8 i2c_address, uint8 *buffer, uint8 size) |
| Write a byte to I2C. | |
| virtual int16 | readI2C (int32 i2c_fd, uint8 i2c_address, uint8 *buffer, uint32 size) |
| Read a byte from I2C. | |
| virtual int16 | writeI2CAddress (int32 i2c_fd, uint8 i2c_address, uint32 mem_address, uint8 *buffer, uint32 size, bool memory_16=false) |
| Write a buffer of data to an I2C address. | |
| virtual int16 | readI2CAddress (int32 i2c_fd, uint8 i2c_address, uint32 mem_address, uint8 *buffer, uint32 size, bool memory_16=false) |
| Write a buffer of data to an I2C address. | |
| virtual int16 | openPwmChannel (PwmConfig_t &config) |
| Open a PWM channel. | |
| virtual int16 | writePwm (int32 pwm_fd, uint8 channel, uint32 value) |
| Write a buffer of data to an I2C address. | |
| virtual int32 | openAdc (const AdcConfig_t &adc) |
| Open an ADC device. | |
| virtual int16 | readAdc (int32 adc_fd, uint32 adc_ch_idx, floating_point &read_voltage) |
| Read a voltage value from ADC. | |
Holds all platform-specific interfaces.
The Platform class is the warpOS method for applying the HAL, or Hardware Abstraction Layer. Platform defines all basic interfaces which are typical of hardware, such as writing to buffers, controlling pins, etc.
The Platform class by itself does not do anything. Users seeking to implement should create a child class with Platform as its base and implement the functions documented herein.
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Check number of bytes ready to read on UART.
| device_fd | The file descriptor of the device to check |
|
inlinevirtual |
Open an ADC device.
| adc | ADC configuration object |
|
inlinevirtual |
Open an I2C device.
| config | I2C configuration object |
|
inlinevirtual |
Open a PWM channel.
| config | PWM configuration object |
|
inlinevirtual |
Open and configture UART connection.
| config | UART config object for the device |
|
inlinevirtual |
Open and configure SPI.
| config | SPI config for the device |
|
inlinevirtual |
Read a voltage value from ADC.
| adc_fd | The file descriptor pointing to the ADC to read |
| adc_ch_idx | The index of the ADC channel to read from (determines which pin/sensor is read) |
| read_voltage | Implicit return of voltage value read from ADC |
|
inlinevirtual |
Read a byte from I2C.
| i2c_fd | The file descriptor to read |
| buffer | Implicit return of values read from buffer |
| size | The number of bytes to read |
|
inlinevirtual |
Write a buffer of data to an I2C address.
| i2c_fd | The file descriptor to write |
| i2c_address | The I2C address to communicate with |
| mem_address | The memory address to communicate with |
| buffer | The buffer of data to read to |
| size | The maximum amount of data (not including address) to read |
| memory_16 | Boolean if the memory addresses are 16 bit or 8 bit, default to false (8 bit) |
|
inlinevirtual |
Read data value from a pin.
| bank | The bank on which to set the pin |
| pin | The pin to read |
| value | Implicit return of the pin value |
|
inlinevirtual |
Read a byte from UART.
| device_fd | File descriptor of the device to read |
| buffer | Implicit return of values read from buffer |
| size | The number of bytes to read |
|
inlinevirtual |
Read a set of bytes via SPI.
| spi_device | The device to read from |
| buffer | The buffer of values to read |
| size | The number of bytes to read |
|
inlinevirtual |
Write and read a set of bytes via SPI.
| spi_device | The device to write/read |
| buffer | The buffer to write from and read to |
| size | Number of bytes to write/read |
|
inlinevirtual |
Set the mode for a given GPIO pin on platform.
| config | The GPIO config to set up for the pin |
|
inlinevirtual |
Initialize the platform.
| bank | The bank on which to set the pin |
| pin | The pin to set |
| mode | Operating mode for the pin |
| speed | Speed for output pins (not always used) |
| output_type | Output type for the pin |
| pull | Sets pull (up/down/no) for the selected pin |
| alternate | Specifies peripheral connected to pins |
|
inlinevirtual |
Write a byte to I2C.
| i2c_fd | The file descriptor to write |
| i2c_address | The address to write |
| buffer | The buffer of values to write |
| size | The number of bytes to write |
|
inlinevirtual |
Write a buffer of data to an I2C address.
| i2c_fd | The file descriptor to write |
| i2c_address | The I2C address to communicate with |
| mem_address | The memory address to communicate with |
| buffer | The buffer of data to write |
| size | The amount of data (not including address) to write |
| memory_16 | Boolean if the memory addresses are 16 bit or 8 bit, default to false (8 bit) |
|
inlinevirtual |
Write data value to a pin.
| bank | The bank on which to set the pin |
| pin | The pin to write |
| value | The value to write. Can be anything but typically HIGH/LOW |
|
inlinevirtual |
Write a buffer of data to an I2C address.
| pwm_fd | The file descriptor to write |
| channel | the Channel to write to |
| value | The value to write |
|
inlinevirtual |
Write a byte to UART.
| device_fd | The file descriptor of the device to write |
| buffer | The buffer of values to write |
| size | The number of bytes to write |
|
inlinevirtual |
Write a set of bytes via SPI.
| spi_device | The device to write to |
| buffer | The buffer of values to write |
| size | The number of bytes to write |