API¶
The EVT-core library is broken up into several semantic sections. The sections are meant as a way to divide functionality semantically. Each section may or may not have additional divisions between platform specific and platform agnostic features. For more information on each section, and for specifics on using the EVT-core API refer to the links below.
DEV¶
Devices, representation of hardware that can be interfaced with. In general, devices are communicated with via some sort of IO interface, but that is not strictly a rule. An LED is a simplistic example of a device.
IWDG —
-
class EVT::core::DEV::IWDG¶
The IWDG is the independent watchdog, which is used to detect software failures.
This class represents features common to watchdog timers.
Subclassed by EVT::core::DEV::IWDGf3xx
LED¶
RTC¶
-
class EVT::core::DEV::RTC¶
The RTC is the real time clock interface.
This class represents features common acrross real time clocks.
Subclassed by EVT::core::DEV::RTCf3xx
Public Functions
-
virtual void getTime(EVT::core::time::TimeStamp &time) = 0¶
Get the current time as determined by the real time clock.
- Parameters
time – [out] The time struct to populate
-
virtual void getTime(EVT::core::time::TimeStamp &time) = 0¶
Timer¶
-
class EVT::core::DEV::Timer¶
This class will represent an internal general purpose timer device for the STM32.
It is capable of triggering interrupts with a given frequency
Subclassed by EVT::core::DEV::RTCTimer, EVT::core::DEV::Timerf3xx
Public Functions
-
virtual void startTimer(void (*irqHandler)(void *htim)) = 0¶
Starts the given timer and registers the given interrupt pointer to trigger when the timer overflows.
- Parameters
irqHandler – [in] The IRQ Handler function pointer. Sets a new interrupt handler function
-
virtual void startTimer() = 0¶
Starts the given timer using the IRQ Handler already assigned to that timer.
-
virtual void stopTimer() = 0¶
Stops the current timer from running.
Does not complete its current counting sequence.
-
virtual void reloadTimer() = 0¶
Resets the timer counter.
-
virtual void setPeriod(uint32_t clockPeriod) = 0¶
Set the clock period for the timer.
Will stop the timer, re-initialize the device with the updated period. You must call startTimer again to continue timer operation.
- Parameters
clockPeriod – [in] the clock period in ms. An interrupt will be triggered at that frequency.
-
virtual void startTimer(void (*irqHandler)(void *htim)) = 0¶
EEPROM¶
-
class EVT::core::DEV::EEPROM¶
EEPROMs are a type of small non-volatile storage devices.
This class represents features common across all EEPROMs.
Subclassed by EVT::core::DEV::M24C32
Public Functions
-
virtual uint8_t readByte(uint32_t address) = 0¶
Read 8 bits of data from the given address.
- Parameters
address – [in] The address to read from
- Returns
The 8 bits of data at the address
-
virtual uint16_t readHalfWord(uint32_t address) = 0¶
Read 16 bits of data from the given address.
- Parameters
address – [in] The address to read from
- Returns
The 16 bits of data at the address
-
virtual uint32_t readWord(uint32_t address) = 0¶
Read 32 bits of data from the given address.
- Parameters
address – [in] The address to read from
- Returns
The 32 bits of data at the address
-
virtual void readBytes(uint32_t address, uint8_t *buffer, uint8_t numBytes) = 0¶
Read a number of consecutive bytes starting at a given memory address.
- Parameters
address – [in] The memory address to start reading from
buffer – [out] Buffer to output bytes to
numBytes – [in] The number of bytes to read
-
virtual void readHalfWords(uint8_t address, uint16_t *buffer, uint8_t numHWords) = 0¶
Read a number of consecutive half words starting at a given memory address.
- Parameters
address – [in] The memory address to start reading from
buffer – [out] Buffer to output half words to
numHWords – [in] The number of half words to read
-
virtual void readWords(uint8_t address, uint32_t *buffer, uint8_t numWords) = 0¶
Read a number of consecutive words starting at a given memory address.
- Parameters
address – [in] The memory address to start reading from
buffer – [out] Buffer to output words to
numWords – [in] The number of words to read
-
virtual void writeByte(uint32_t address, uint8_t data) = 0¶
Write 8 bits of data to the given address.
- Parameters
address – [in] The address to write to
data – [in] The data to write out
-
virtual void writeHalfWord(uint32_t address, uint16_t data) = 0¶
Write 16 bits of data to the given address.
- Parameters
address – [in] The address to write to
data – [in] The data to write out
-
virtual void writeWord(uint32_t address, uint32_t data) = 0¶
Write 32 bits of data to the given address.
- Parameters
address – [in] The address to write to
data – [in] The data to write out
-
virtual void writeBytes(uint32_t address, uint8_t *dataArr, uint8_t numBytes) = 0¶
Write a number of consecutive bytes to a given memory address.
- Parameters
address – [in] The address to start writing to
dataArr – [in] The array of bytes to write out
numBytes – [in] The number of bytes to write out
-
virtual void writeHalfWords(uint8_t address, uint16_t *dataArr, uint8_t numHWords) = 0¶
Write a number of consecutive half words to a given memory address.
- Parameters
address – [in] The address to start writing to
dataArr – [in] The array of half words to write out
numHWords – [in] The number of half words to write out
-
virtual void writeWords(uint8_t address, uint32_t *dataArr, uint8_t numWords) = 0¶
Write a number of consecutive half words to a given memory address.
- Parameters
address – [in] The address to start writing to
dataArr – [in] The array of half words to write out
numWords – [in] The number of half words to write out
-
virtual uint8_t readByte(uint32_t address) = 0¶
IO¶
IO represents different IO interfaces. The common ones are I2C, GPIO, PWM, and CAN. IO generally includes and means for interfacing beyond the microcontroller running the code.
Each platform will implement the IO functionality (if supported by the microcontroller). Since the IO interfaces represent common functionality shared across many devices, platform specific functionality may be supported by the platform’s implementation of the IO interface.
ADC¶
-
class EVT::core::IO::ADC¶
Subclassed by EVT::core::IO::ADCf3xx
CAN¶
-
class EVT::core::IO::CAN¶
Generic interface for CAN bus communication.
Devices can send and recieve messages over the CAN bus using this interface.
This provides the standard set of features supported across all hardware for CAN communication. Any hardware specific features are not included. This interface should be used for the majority of cases and should be deviated from when there is a need for hardware spoecific functionality.
NOTE: You cannot directly make an instance of this class via a constructor. You will need to use the getCAN function in the IO namespace.
Subclassed by EVT::core::IO::CANf3xx
Public Types
Public Functions
-
CAN(Pin txPin, Pin rxPin, bool loopbackEnabled = false)¶
Creates a new instance of the CAN interface which will use the given transmit and receive pins.
- Parameters
txPin – [in] The pin to use for transmitting data
rxPin – [in] The pin to use for receiving data
loopbackEnabled – [in] Flag to enable CAN loop back functionality
-
virtual CANStatus connect(bool autoBusOff = false) = 0¶
Join the CAN network.
Will attempt to connect to the CAN network and return the corresponding status.
- Parameters
autoBusOff – [in] Indicates whether AutoBusOff should be enabled
- Returns
The status associated with the success of joining the network
-
virtual CANStatus disconnect() = 0¶
Disconnect from the CAN network.
- Returns
The status associated with attempting to disconnect
-
virtual CANStatus transmit(CANMessage &message) = 0¶
Transmit the message over CAN.
- Parameters
message – [in] The message to send over CAN.
- Returns
The status associated with sending the message
-
virtual CANStatus receive(CANMessage *message, bool blocking = false) = 0¶
Receive a message over CAN.
The user can either receive in blocking or non-blocking mode. In blocking mode, the code will hang until a message is received then return a pointer to the message that was passed in. In non-blocking, a nullptr will be returned if no message is currently in the mailbox.
- Parameters
message – [out] The message to populate with data
blocking – [in] Used to determine if received should block or not, by default receive is blocking
- Returns
A pointer to the passed in message, nullptr if message not received.
- Returns
The status of the receive call, CANStatus::TIMEOUT returned if no message received
-
virtual CANStatus addCANFilter(uint16_t filterExplicitId, uint16_t filterMask, uint8_t filterBank) = 0¶
Instantiates a new CAN filter using the 16-bit ID-Mask mode.
If a filter bank that is already in use is provided, the existing filter will be overwritten. A second pair of filter Id and mask can be given to the same filter bank.
- Parameters
filterExplicitId – [in] 11-bit identifier that must be an exact match to pass
filterMask – [in] 16-bit mask where [1] means care and [0] means don’t care
filterBank – [in] value between 0-13 where the filter info is stored
- Returns
The status associated with adding a new CAN message filter
-
virtual CANStatus enableEmergencyFilter(uint32_t state) = 0¶
Enable or disable a filter that lets through any CAN messages that, following the CANopen standard, begin with the Emergency code of 001.
- Parameters
state – [in] Enum passed to set filter functional state
- Returns
The status associated with setting the energency filter state
-
void addIRQHandler(void (*handler)(CANMessage&, void *priv), void *priv)¶
Add an interrupt handler for CAN messages.
This will be called with the provided private data when a new CAN message comes in.
NOTE: Having an interrupt handler will bypass the CAN’s internal storage queue thus making CAN::receive ineffective.
- Parameters
handler – [in] The interrupt handler. Takes in a CANmessage and some other parameter
priv – [in] The private data to pass into the handler
-
CAN(Pin txPin, Pin rxPin, bool loopbackEnabled = false)¶
GPIO¶
-
class EVT::core::IO::GPIO¶
Interface for interacting with GPIO pins on a device.
GPIO pins can have their state read and written to.
This provides the standard set of features supported across all hardware for GPIO pins. Hardware specific features are not included. This interface should be used for the majority of cases and should only be deviated from when there is a need for hardware specific functionality.
NOTE: You cannot directly make an instance of this class via a constructor. To make an instance, use the GPIO::getInstance method.
Subclassed by EVT::core::IO::GPIOf3xx
Public Types
-
enum State¶
Binary representation of the states the GPIO can be in.
Values:
-
enumerator LOW¶
-
enumerator HIGH¶
-
enumerator LOW¶
-
enum Direction¶
Binary representation of the flow of information, either input or output.
Values:
-
enumerator INPUT¶
-
enumerator OUTPUT¶
-
enumerator INPUT¶
Public Functions
-
GPIO(Pin pin)¶
Create a new GPIO interface on a specific pin.
The direction will not be set and will have to be set manually.
- Parameters
pin – [in] The pin for the GPIO instance to use.
-
GPIO(Pin pin, Direction direction, Pull pull = Pull::PULL_DOWN)¶
Create a new GPIO instance on a specific pin with a given direction.
- Parameters
pin – [in] The pin for the GPIO instance to use.
direction – [in] The directional flow of data.
pull – [in] The direction of the internal pull resistor
-
virtual void setDirection(Direction direction) = 0¶
Set the direction of the pin.
- Parameters
direction – [in] The direction of information.
-
virtual void writePin(State state) = 0¶
Used for writing a state to a pin.
- Parameters
state – [in] The state to write to the pin
-
virtual void registerIRQ(TriggerEdge edge, void (*irqHandler)(GPIO *pin)) = 0¶
Registers the IRQHandler for this instances GPIO pin on the given edge condition.
- Parameters
edge – [in] The edge trigger event to trigger the interrupt
irqHandler – [in] The function pointer to handle the GPIO interrupt
-
enum State¶
I2C¶
-
class EVT::core::IO::I2C¶
Contains generic implementations for some of the I2C functionality.
Some hardware has the ability to implement the functionality in this file so specific implementations of the I2C driver may override these methods for a hardware speedup.
Subclassed by EVT::core::IO::I2Cf3xx
Public Types
Public Functions
-
I2C(Pin sclPin, Pin sdaPin)¶
Make an instance of an I2C interface that will use the given pins for clock and data lines.
- Parameters
sclPin – [in] The clock pin
sdaPin – [in] The data pin
-
virtual I2CStatus read(uint8_t addr, uint8_t *output) = 0¶
Read a single byte back from the I2C bus.
- Parameters
addr – [in] The 7 bit unshifted I2C address to read from
output – [out] The location to store the result from the read
- Returns
The status of making the read request
-
virtual I2CStatus write(uint8_t addr, uint8_t *bytes, uint8_t length)¶
Write out multiple bytes over I2C.
Each byte will be written one by one.
-
virtual I2CStatus read(uint8_t addr, uint8_t *bytes, uint8_t length)¶
Read multiple bytes from an I2C device.
- Parameters
addr – [in] The 7 bit unshifted I2C address to write to
bytes – [out] The buffer to fill with the read in bytes
length – [in] The number of bytes to read
- Returns
The status of making the read request
-
virtual I2CStatus writeReg(uint8_t addr, uint8_t reg, uint8_t byte)¶
Write a value to a register has that 8 bit addresses and 8 bit values.
- Parameters
addr – [in] The 7 bit unshifted I2C address to write to
reg – [in] The 8 bit register
byte – [in] The byte to write out
- Returns
The status of attempting to write out to a register
-
virtual I2CStatus readReg(uint8_t addr, uint8_t reg, uint8_t *output)¶
Read a value from a register that has an 8 bit address and 8 bit value.
- Parameters
addr – [in] The 7 bit unshifted I2C address to read from
reg – [in] The 8 bit register
output – [out] Will store the value of the read request
- Returns
The 8 bit value of the register
-
virtual I2CStatus writeReg(uint8_t addr, uint8_t *reg, uint8_t regLength, uint8_t *bytes, uint8_t length)¶
Write out a multi byte register value.
- Parameters
addr – [in] The 7 bit unshifted I2C address to write to
reg – [in] The register bytes
regLength – [in] The number of bytes in the register address
bytes – [in] The data to write out
length – [in] The number of bytes in the data
- Returns
The status of attempting to write out to the register
-
virtual I2CStatus readReg(uint8_t addr, uint8_t *reg, uint8_t regLength, uint8_t *bytes, uint8_t length)¶
Read a value from a register.
- Parameters
addr – [in] The 7 bit unshifted I2C address to read from
reg – [in] The bytes containing the register to read from
regLength – [in] The size in bytes of the register
bytes – [out] The bytes read from the register
length – [in] The size of the data returned by the register in bytes
- Returns
The status of reading from the register
-
virtual I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t byte, uint16_t memAddSize, uint8_t maxWriteTime) = 0¶
Write a single byte to a register in memory.
This is a separate method from normal I2C communication because memory read/write methods use a slightly different I2C pattern.
- Parameters
addr – [in] The 7 bit unshifted I2C address to write to
memAddress – [in] The word containing the register to write to
byte – [in] The data to write out
memAddSize – [in] The number of bytes in the memory address (1 or 2)
- Returns
The status of writing out a memory register
-
virtual I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, uint8_t *byte, uint16_t memAddSize) = 0¶
Read a single byte from a register in memory.
This is a separate method from normal I2C communication because memory read/write methods use a slightly different I2C pattern.
- Parameters
addr – [in] The 7 bit unshifted I2C address to read from
memAddress – [in] The word containing the register to read from
byte – [out] The byte read from memory
memAddSize – [in] The number of bytes in the memory address (1 or 2)
- Returns
The result of attempting to read from memory
-
virtual I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t *byte, uint8_t size, uint16_t memAddSize, uint8_t maxWriteTime) = 0¶
Write a number of bytes to consecutive registers in memory, starting at a specified register.
This is a separate method from normal I2C communication because memory read/write methods use a slightly different I2C pattern.
- Parameters
addr – [in] The 7 bit unshifted I2C address to write to
memAddress – [in] The word containing the register to start writing to
byte – [in] The list of data to write out
size – [in] The number of bytes to be written
memAddSize – [in] The number of bytes in the memory address (1 or 2)
- Returns
The status of writing out to the memory address
-
virtual I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, uint8_t *byte, uint8_t size, uint16_t memAddSize) = 0¶
Read a number of consecutive bytes, starting at a specified register in memory.
This is a separate method from normal I2C communication because memory read/write methods use a slightly different I2C pattern.
- Parameters
addr – [in] The 7 bit unshifted I2C address to read from
memAddress – [in] The word containing the register to start reading from
byte – [out] The list of bytes read from memory
size – [in] The number of bytes to be read
memAddSize – [in] The number of bytes in the memory address (1 or 2)
output – [out] The value to store the read back memory
- Returns
The status of reading from the memory address;
-
I2C(Pin sclPin, Pin sdaPin)¶
PWM¶
-
class EVT::core::IO::PWM¶
Subclassed by EVT::core::IO::PWMf3xx
Public Functions
-
virtual void setDutyCycle(uint32_t dutyCycle) = 0¶
Set the duty cycle for the pin to operate at.
- Parameters
dutyCycle – [in] Duty cycle as a whole number to set the pin to.
-
virtual void setPeriod(uint32_t period) = 0¶
Set the period for the PWM in microseconds.
- Parameters
period – [in] The period of the PWM in microseconds.
-
virtual void setDutyCycle(uint32_t dutyCycle) = 0¶
SPI¶
-
class EVT::core::IO::SPI¶
Subclassed by EVT::core::IO::SPIf3xx
Public Types
Public Functions
-
SPI(GPIO *CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin misoPin)¶
Constructs an SPI instance in full duplex mode to send and receive data.
- Parameters
CSPins – an array of chip select pins for selecting which device to communicate with.
pinLength – the number of pins in the chip select array
sckPin – the pin for the clk line
mosiPin – the mosi pin for sending data
misoPin – the miso pin for receiving data
-
SPI(GPIO *CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin)¶
Constructs an SPI instance in half duplex mode to only send data.
- Parameters
CSPins – an array of chip select pins for selecting which device to communicate with.
pinLength – the number of pins in the chip select array
sckPin – the pin for the clk line
mosiPin – the mosi pin for sending data
-
virtual bool startTransmission(uint8_t device) = 0¶
Begin a device transmission.
Call before each set of read and write interactions.
- Parameters
device – the device number in the CSPins array
- Returns
true if valid device, false if device not in CSPins
-
virtual bool endTransmission(uint8_t device) = 0¶
Toggle the state of the chip select pin of a device back at the end of a transmission.
Call when finished reading or writing a data packet.
- Parameters
device – the device index in the CSPins
- Returns
true if valid device, false if device not in CSPins
-
virtual SPI::SPIStatus write(uint8_t byte) = 0¶
Writes a single byte out to the SPI device.
Call startTransmission() first to initiate device communication.
- Parameters
byte – the byte to write
- Returns
the status after calling the function
-
virtual SPI::SPIStatus read(uint8_t *out) = 0¶
Reads a single byte from a SPI device.
Call startTransmission() first to initiate device communication.
- Parameters
out – the byte read
- Returns
the status after calling the function
-
virtual SPI::SPIStatus write(uint8_t *bytes, uint8_t length)¶
Writes an array of bytes to the SPI device.
Call startTransmission() first to initiate device communication.
- Parameters
bytes – an array of bytes of length n to write to SPI device
length – the length of the array
- Returns
the status after calling the function
-
virtual SPI::SPIStatus read(uint8_t *bytes, uint8_t length)¶
Reads an array of bytes from a SPI device.
- Parameters
device – the device to write to in CSPins
bytes – an array of length n to receive the bytes from an SPI device
length – the number of bytes to receive
- Returns
SPIStatus of the HAL function call
-
SPI::SPIStatus writeReg(uint8_t device, uint8_t reg, uint8_t byte)¶
Writes a byte of data to a register of a device.
- Parameters
device – the device index in the CSPins
reg – the register address to write to
byte – the byte of data to write
- Returns
the status after calling the function
-
SPI::SPIStatus readReg(uint8_t device, uint8_t reg, uint8_t *out)¶
Reads a byte of data from a register from a device.
- Parameters
device – the device index in the CSPins
reg – the register address to read from
out – the byte of data from the device
- Returns
the status after calling the function
-
SPI::SPIStatus writeReg(uint8_t device, uint8_t reg, uint8_t *bytes, uint8_t length)¶
Writes a series of bytes to a device’s registers starting at a specific one.
(Device must support a multi-byte write)
- Parameters
device – the device index in the CSPins
reg – the register address to start the write at
bytes – an array of bytes of length n to write to SPI device
length – the length of the array
- Returns
the status after calling the function
-
SPI::SPIStatus readReg(uint8_t device, uint8_t reg, uint8_t *bytes, uint8_t length)¶
Reads a series of bytes from a device’s registers starting at a specific one.
- Parameters
device – the device index in the CSPins
reg – the register address to start the read from
bytes – an array of bytes of length n to store the byte from an SPI device
length – the length of the array
- Returns
the status after calling the function
-
SPI(GPIO *CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin misoPin)¶
UART¶
-
class EVT::core::IO::UART¶
Interface for UART operations.
The UART has the ability for character and byte centered operations.
This provides the standard set of features that are shared across all UART modules. Hardware specific features are not included.
The UART modules support both character and byte oriented transmit and receive operations. While fundamentally these operations are the same, semantically this makes working with character centered data and byte centered data cleaner.
NOTE: You cannot directly make an instance of this class via a constructor. To make an instance, use the UART::getInstance method.
Subclassed by EVT::core::IO::UARTf3xx
Public Types
-
enum Parity¶
Represents the options for the parity settings that may be used when setting up a UART.
Values:
-
enumerator NONE¶
-
enumerator ODD¶
-
enumerator EVEN¶
-
enumerator MASK¶
-
enumerator SPACE¶
-
enumerator NONE¶
Public Functions
-
UART(Pin txPin, Pin rxPin, uint32_t baudrate)¶
Creates a new UART instance that will have the given TX and RX pins as well as the given baud rate.
-
virtual void setBaudrate(uint32_t baudrate) = 0¶
Set the baudrate that the UART will operate with.
- Parameters
baudrate – [in] The new baudrate to use
-
virtual void setFormat(WordLength wordLength = WordLength::EIGHT, Parity parity = Parity::NONE, NumStopBits numStopBits = NumStopBits::ONE) = 0¶
Set the format that data will be communicated with over UART.
DEFAULT: 8 bit words, no parity, 1 stop bit
- Parameters
wordLength – [in] The number of bits in a work (5-8)
parity – [in] The parity settings to use.
numStopBits – [in] The number of stop bits (1-2)
-
virtual bool isReadable() = 0¶
Determines if the UART is currently readable.
- Returns
True if the UART is readable.
-
virtual bool isWritable() = 0¶
Determines if the UART is currently writable.
- Returns
True if the UART is writable
-
virtual void putc(char c) = 0¶
Put a single character to the UART module.
- Parameters
c – [in] The character to send over UART.
-
virtual void puts(const char *s) = 0¶
Put a null-terminal string out over UART.
- Parameters
s – [in] The null-terminated string to put over UART.
-
virtual char getc() = 0¶
Blocking call to read a single character from the UART module.
- Returns
The character read in over UART.
-
char *gets(char *buf, size_t size)¶
Blocking call to get a string from the UART module.
Stops when a newline or EOF character is received or if the maximum size is reached.
- Parameters
buf – [out] The character array to fill
size – [in] The maximum number of characters to read.
- Returns
The buf pointer on success, NULL otherwise
-
virtual void printf(const char *format, ...) = 0¶
Print a formatted string over UART, not great performance so best in test situations not production.
- Parameters
format – [in] The format string to print out.
-
virtual void write(uint8_t byte) = 0¶
Write out a single byte over UART.
- Parameters
byte – [in] The byte to write out over UART.
-
virtual uint8_t read() = 0¶
Blocking reading of a single byte from the UART.
- Returns
The byte read in from UART.
-
enum Parity¶
Types¶
CANMessage¶
-
class EVT::core::IO::CANMessage¶
Represents a generic CAN message which can be sent and received over a CAN bus.
Public Functions
-
CANMessage(uint32_t id, uint8_t dataLength, uint8_t *payload, bool isExtended)¶
Create an instance of a CANMessage.
-
CANMessage()¶
Create an empty CANMessage, the id will be 0, dataLength will be 0 and the payload will be empty.
-
uint8_t getDataLength()¶
Get the size of the payload in bytes.
- Returns
The size of the payload in bytes.
-
uint8_t *getPayload()¶
Get the pointer to the payload.
- Returns
pointer to the payload.
-
void setId(uint32_t id)¶
Set the id of the CAN Message.
- Parameters
id – [in] The id of the CAN message
-
void setDataLength(uint8_t size)¶
Set the size of the payload in bytes.
- Parameters
size – [in] The size of the payload in bytes
-
void setPayload(const uint8_t *payload)¶
Set the payload to the contents of the provided array.
Does a copy of the bytes stored.
NOTE: Will copy over CAN_MAX_PAYLOAD_SIZE number of bytes over
- Parameters
payload – [in] The payload to copy over
-
CANMessage &operator=(const CANMessage &other)¶
Assignment operator where the contents of the CANMessage is copied into this message.
- Parameters
other – [in] The CANMessage to copy from
-
CANMessage(uint32_t id, uint8_t dataLength, uint8_t *payload, bool isExtended)¶
Platform Implementations¶
Platform¶
Platform represents the microcontroller that the code is running on. Platform specific code such as system setup is included here. For example, placing the microcontroller into a “low power mode” is specific to the microcontroller itself.
STM32f3xx¶
Interrupt priorities are configured with priorities defined by stm32f3xx.hpp. A lower number corresponds to a higher priority. Interrupts of higher priority may interrupt those of lower priority.
Utils¶
Utilities refer to software utilities that make development easier. These can be used to reduce duplicated code, abstract common tasks, or handle functionality that is very common across platforms such as having the system wait for a number of seconds.
Time¶
-
namespace EVT::core::time¶
The functions defined in here are used for time based operations.
All operations are platform independent.
Functions
-
void wait(uint32_t ms)¶
Function to have the program hold for a set amount of time before continuing.
- Parameters
ms – The number of milliseconds to wait for
-
uint32_t millis()¶
Get the milliseconds since system startup.
- Returns
Time in milliseconds
-
struct TimeStamp¶
- #include <time.hpp>
Struct representing a timestamp.
-
void wait(uint32_t ms)¶