Move OLED LCD update to be DMA'ed
Start Cleaning up I2C HAL
This commit is contained in:
@@ -73,7 +73,7 @@ void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
|
||||
}
|
||||
|
||||
void FRToSI2C::FRToSInit() {
|
||||
I2CSemaphore = xSemaphoreCreateMutex();
|
||||
I2CSemaphore = xSemaphoreCreateBinary();
|
||||
xSemaphoreGive(I2CSemaphore);
|
||||
}
|
||||
|
||||
@@ -87,11 +87,11 @@ void FRToSI2C::Transmit(uint16_t DevAddress, uint8_t* pData, uint16_t Size) {
|
||||
//Get the mutex so we can use the I2C port
|
||||
//Wait up to 1 second for the mutex
|
||||
if ( xSemaphoreTake( I2CSemaphore, ( TickType_t ) 1000 ) == pdTRUE) {
|
||||
if (HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000)
|
||||
if (HAL_I2C_Master_Transmit_DMA(i2c, DevAddress, pData, Size)
|
||||
!= HAL_OK) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
xSemaphoreGive(I2CSemaphore);
|
||||
//xSemaphoreGive(I2CSemaphore);
|
||||
} else {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user