1
0
forked from me/IronOS

Move OLED LCD update to be DMA'ed

Start Cleaning up I2C HAL
This commit is contained in:
Ben V. Brown
2018-05-06 18:56:38 +10:00
parent bf1fa74d72
commit 1fef2fb53a
5 changed files with 18 additions and 76 deletions

View File

@@ -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();
}