Update debug info

Change pin configs
Clean up some code
This commit is contained in:
Ben V. Brown
2018-05-06 18:01:34 +10:00
parent 1ae8b2f216
commit bf1fa74d72
12 changed files with 242 additions and 269 deletions

View File

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