uint8_t I_Read8(uint8_t I_address, uint8_t *I_data){
uint8_t txIBuffer[2] = {(I_address | 0x80), 0x00};
uint8_t rxIBuffer[2];
HAL_GPIO_WritePin(I_SPI2_CS_GPIO_Port, I_SPI2_CS_Pin, GPIO_PIN_RESET);
uint8_t status_I = (HAL_SPI_TransmitReceive(&hspi2, txIBuffer, rxIBuffer, 2, HAL_MAX_DELAY) == HAL_OK);
HAL_GPIO_WritePin(I_SPI2_CS_GPIO_Port, I_SPI2_CS_Pin, GPIO_PIN_SET);
*I_data = rxIBuffer[1];
return status_I;
}
uint8_t I_Write8(uint8_t I_address, uint8_t I_data){
uint8_t txIBuffer[2] = {I_address, I_data};
HAL_GPIO_WritePin(I_SPI2_CS_GPIO_Port, I_SPI2_CS_Pin, GPIO_PIN_RESET);
uint8_t status_I = (HAL_SPI_Transmit(&hspi2, txIBuffer, 2, HAL_MAX_DELAY) == HAL_OK);
HAL_GPIO_WritePin(I_SPI2_CS_GPIO_Port, I_SPI2_CS_Pin, GPIO_PIN_SET);
return status_I;
}