mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Update debug info
Change pin configs Clean up some code
This commit is contained in:
@@ -14,7 +14,6 @@ FRToSI2C::FRToSI2C(I2C_HandleTypeDef* i2chandle) {
|
||||
|
||||
void FRToSI2C::CpltCallback() {
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
if (I2CSemaphore) {
|
||||
xSemaphoreGiveFromISR(I2CSemaphore, &xHigherPriorityTaskWoken);
|
||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||
@@ -34,10 +33,13 @@ void FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t MemAddress,
|
||||
//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) {
|
||||
HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData,
|
||||
Size, 5000);
|
||||
if (HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData,
|
||||
Size, 5000) != HAL_OK) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
xSemaphoreGive(I2CSemaphore);
|
||||
|
||||
} else {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,10 +58,14 @@ void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
|
||||
//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) {
|
||||
HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData,
|
||||
Size, 5000);
|
||||
if (HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize,
|
||||
pData, Size, 5000) != HAL_OK) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
xSemaphoreGive(I2CSemaphore);
|
||||
|
||||
} else {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -81,8 +87,13 @@ 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) {
|
||||
HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
|
||||
if (HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000)
|
||||
!= HAL_OK) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
xSemaphoreGive(I2CSemaphore);
|
||||
} else {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user