SLVAFT2A May 2024 – July 2024 TPS2HCS10-Q1
While a variety of example architecture implementations are provided, the HCS platform drivers are architected to be easily ported to any microprocessor or architecture that supports SPI and the C programming language. In the header file for the drivers (hcs_control_driver.h), the following two functions are declared with an external reference:
/* --------------------------- Porting Functions ---------------------------- */
/*
* These functions need to be implemented by each individual device port. The functions
* handle the low-level hardware specific implementation with the respective
* architecture's specific hardware peripherals (SPI and GPIO)
*/
bool HCS_port_spiSendData(uint8_t *data, uint8_t len, uint8_t* respData);
void HCS_port_assertSPI(void);
void HCS_port_deassertSPI(void);
Porting is meant to be straight forward, however a description of each function and guidance for porting is shown in Table 2-2.
Function | Description | Return Value |
---|---|---|
HCS_port_spiSendData | Performs a full-duplex SPI transaction. data represents the data to be sent and respData is the data that is received. len is the length of the transaction. The function needs to be blocking (either by sleeping or polling) until the entirety of the SPI transaction is complete. | stdbool representation of result of transaction. true if transaction completed without issue, false otherwise. |
HCS_port_assertSPI | Sets the chip select (CS) line of the SPI bus low. This is used for both single and daisy chained transactions as well as used by the HCS_port_spiSendData function above. | None |
HCS_port_deassertSPI | Sets the chip select (CS) line of the SPI bus high. This is used for both single and daisy chained transactions as well as used by the HCS_port_spiSendData function above. | None |