28 #include "pin_trace.h" 55 #define CS_TO_SCLK_DELAY 0x0001 56 #define CLK_TO_CS_DELAY 0x0001 61 #define HEADER_WRITE_MASK 0x00 62 #define HEADER_READ_MASK 0x01 63 #define HEADER_ADDRESS_MASK 0x00 64 #define HEADER_COMMAND_MASK 0x80 66 #define LINEAR_FIFO_ADDRESS 0xFF 92 #define BUILT_HEADER(add_comm, w_r) (add_comm | w_r) 93 #define WRITE_HEADER BUILT_HEADER(HEADER_ADDRESS_MASK, HEADER_WRITE_MASK) 94 #define READ_HEADER BUILT_HEADER(HEADER_ADDRESS_MASK, HEADER_READ_MASK) 95 #define COMMAND_HEADER BUILT_HEADER(HEADER_COMMAND_MASK, HEADER_WRITE_MASK) 108 //static SPI_HandleTypeDef SpiHandle; 295 .freq = HAL_SPIM_FREQ_250K,
299 .tx_done_handler = NULL,
300 .rx_done_handler = NULL,
316 uint8_t tx_buff[257];
318 tx_buff[1] = cRegAddress;
320 memcpy (&tx_buff[2], pcBuffer, cNbBytes);
327 ((uint8_t*)&status)[1]=rx_buff[0];
328 ((uint8_t*)&status)[0]=rx_buff[1];
344 uint8_t temp_buff[255];
350 memcpy (pcBuffer, &temp_buff[2],cNbBytes);
352 ((uint8_t*)&status)[1]=temp_buff[0];
353 ((uint8_t*)&status)[0]=temp_buff[1];
372 ((uint8_t*)&status)[1]=rx_buff[0];
373 ((uint8_t*)&status)[0]=rx_buff[1];
387 uint8_t tx_buff[cNbBytes + 2];
390 memcpy (&tx_buff[2], pcBuffer, cNbBytes);
397 ((uint8_t*)&status)[1]=rx_buff[0];
398 ((uint8_t*)&status)[0]=rx_buff[1];
414 uint8_t temp_buff[255];
422 memcpy (pcBuffer, &temp_buff[2],cNbBytes);
424 ((uint8_t*)&status)[1]=rx_buff[0];
425 ((uint8_t*)&status)[0]=rx_buff[1];
StatusBytes SdkEvalSpiCommandStrobes(uint8_t cCommandCode)
Send a command.
void hal_spim_init(hal_spim_init_t *spim_init)
Function to Initiate the SPIM module.
This file contains SDK EVAL configuration and useful defines.
StatusBytes SdkEvalSpiWriteFifo(uint8_t cNbBytes, uint8_t *pcBuffer)
Write data into TX FIFO.
void hal_spim_tx_rx(void *p_tx_data, uint32_t tx_len, void *p_rx_data, uint32_t rx_len)
Function to start communication.
StatusBytes SdkEvalSpiReadFifo(uint8_t cNbBytes, uint8_t *pcBuffer)
Read data from RX FIFO.
StatusBytes SdkEvalSpiReadRegisters(uint8_t cRegAddress, uint8_t cNbBytes, uint8_t *pcBuffer)
Read single or multiple registers.
S2LP Status. This definition represents the single field of the S2LP status returned on each SPI tran...
void SdkEvalSpiInit(void)
Write single or multiple registers.
StatusBytes SdkEvalSpiWriteRegisters(uint8_t cRegAddress, uint8_t cNbBytes, uint8_t *pcBuffer)
Write single or multiple registers.
void hal_spim_deinit()
Function to de-initialize the SPIM module.
Header file for low level S2LP SPI driver.
void SdkEvalSpiDeinit(void)
Deinitializes the SPI.
uint32_t hal_spim_is_busy()
Function to check if SIPM module is available or not.