Recently I've been reading into topic of test driven development and decided to give it a go with a sensor driver I need. Sensor uses SPI interface and I will implement this driver on STM32F415 processor with help of CubeMX for project generation. After generating project, I have access to HAL SPI functions such as this:
HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout)
I would create a header file called 'sensor_hall.h', put this SPI function declaration in it and then generate a mock of this header using CMock.
My questions are, is this a valid approach? Should I introduce more abstraction to this? And how to deal with the first argument, pointer to SPI struct when mocking?