Move OLED LCD update to be DMA'ed
Start Cleaning up I2C HAL
This commit is contained in:
@@ -3467,48 +3467,7 @@ void HAL_I2C_EV_IRQHandler(I2C_HandleTypeDef *hi2c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Slave mode selected */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* ADDR set --------------------------------------------------------------*/
|
|
||||||
if(((sr1itflags & I2C_FLAG_ADDR) != RESET) && ((itsources & I2C_IT_EVT) != RESET))
|
|
||||||
{
|
|
||||||
I2C_Slave_ADDR(hi2c);
|
|
||||||
}
|
|
||||||
/* STOPF set --------------------------------------------------------------*/
|
|
||||||
else if(((sr1itflags & I2C_FLAG_STOPF) != RESET) && ((itsources & I2C_IT_EVT) != RESET))
|
|
||||||
{
|
|
||||||
I2C_Slave_STOPF(hi2c);
|
|
||||||
}
|
|
||||||
/* I2C in mode Transmitter -----------------------------------------------*/
|
|
||||||
else if((sr2itflags & I2C_FLAG_TRA) != RESET)
|
|
||||||
{
|
|
||||||
/* TXE set and BTF reset -----------------------------------------------*/
|
|
||||||
if(((sr1itflags & I2C_FLAG_TXE) != RESET) && ((itsources & I2C_IT_BUF) != RESET) && ((sr1itflags & I2C_FLAG_BTF) == RESET))
|
|
||||||
{
|
|
||||||
I2C_SlaveTransmit_TXE(hi2c);
|
|
||||||
}
|
|
||||||
/* BTF set -------------------------------------------------------------*/
|
|
||||||
else if(((sr1itflags & I2C_FLAG_BTF) != RESET) && ((itsources & I2C_IT_EVT) != RESET))
|
|
||||||
{
|
|
||||||
I2C_SlaveTransmit_BTF(hi2c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* I2C in mode Receiver --------------------------------------------------*/
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* RXNE set and BTF reset ----------------------------------------------*/
|
|
||||||
if(((sr1itflags & I2C_FLAG_RXNE) != RESET) && ((itsources & I2C_IT_BUF) != RESET) && ((sr1itflags & I2C_FLAG_BTF) == RESET))
|
|
||||||
{
|
|
||||||
I2C_SlaveReceive_RXNE(hi2c);
|
|
||||||
}
|
|
||||||
/* BTF set -------------------------------------------------------------*/
|
|
||||||
else if(((sr1itflags & I2C_FLAG_BTF) != RESET) && ((itsources & I2C_IT_EVT) != RESET))
|
|
||||||
{
|
|
||||||
I2C_SlaveReceive_BTF(hi2c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4280,7 +4280,7 @@ uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Period elapsed callback in non blocking mode
|
* @brief Period elapsed callback in non blocking mode
|
||||||
* @param htim : TIM handle
|
* @param htim : TIM handle
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ void waitForButtonPressOrTimeout(uint32_t timeout);
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc);
|
void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc);
|
||||||
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c);
|
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c);
|
||||||
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c);
|
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c);
|
||||||
@@ -36,6 +37,7 @@ void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c);
|
|||||||
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c);
|
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c);
|
||||||
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c);
|
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c);
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName );
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FRToSI2C::FRToSInit() {
|
void FRToSI2C::FRToSInit() {
|
||||||
I2CSemaphore = xSemaphoreCreateMutex();
|
I2CSemaphore = xSemaphoreCreateBinary();
|
||||||
xSemaphoreGive(I2CSemaphore);
|
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
|
//Get the mutex so we can use the I2C port
|
||||||
//Wait up to 1 second for the mutex
|
//Wait up to 1 second for the mutex
|
||||||
if ( xSemaphoreTake( I2CSemaphore, ( TickType_t ) 1000 ) == pdTRUE) {
|
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) {
|
!= HAL_OK) {
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
xSemaphoreGive(I2CSemaphore);
|
//xSemaphoreGive(I2CSemaphore);
|
||||||
} else {
|
} else {
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void printVoltage() {
|
|||||||
void GUIDelay() {
|
void GUIDelay() {
|
||||||
osDelay(66); // 15Hz
|
osDelay(66); // 15Hz
|
||||||
}
|
}
|
||||||
void gui_drawTipTemp() {
|
void gui_drawTipTemp(bool symbol) {
|
||||||
// Draw tip temp handling unit conversion & tolerance near setpoint
|
// Draw tip temp handling unit conversion & tolerance near setpoint
|
||||||
uint16_t Temp = getTipRawTemp(0);
|
uint16_t Temp = getTipRawTemp(0);
|
||||||
|
|
||||||
@@ -112,6 +112,12 @@ void gui_drawTipTemp() {
|
|||||||
// Temp = systemSettings.SolderingTemp;
|
// Temp = systemSettings.SolderingTemp;
|
||||||
|
|
||||||
lcd.printNumber(Temp, 3); // Draw the tip temp out finally
|
lcd.printNumber(Temp, 3); // Draw the tip temp out finally
|
||||||
|
if (symbol) {
|
||||||
|
if (systemSettings.temperatureInF)
|
||||||
|
lcd.print("F");
|
||||||
|
else
|
||||||
|
lcd.print("C");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ButtonState getButtonState() {
|
ButtonState getButtonState() {
|
||||||
/*
|
/*
|
||||||
@@ -473,18 +479,7 @@ static void gui_solderingMode() {
|
|||||||
|
|
||||||
lcd.setCursor(0, 8);
|
lcd.setCursor(0, 8);
|
||||||
lcd.print(SleepingTipAdvancedString);
|
lcd.print(SleepingTipAdvancedString);
|
||||||
uint16_t Temp = getTipRawTemp(0);
|
gui_drawTipTemp(true);
|
||||||
|
|
||||||
if (systemSettings.temperatureInF)
|
|
||||||
Temp = tipMeasurementToF(Temp);
|
|
||||||
else
|
|
||||||
Temp = tipMeasurementToC(Temp);
|
|
||||||
lcd.printNumber(Temp, 3);
|
|
||||||
if (systemSettings.temperatureInF)
|
|
||||||
lcd.print("F");
|
|
||||||
else
|
|
||||||
lcd.print("C");
|
|
||||||
|
|
||||||
lcd.print(" ");
|
lcd.print(" ");
|
||||||
printVoltage();
|
printVoltage();
|
||||||
lcd.drawChar('V');
|
lcd.drawChar('V');
|
||||||
@@ -495,13 +490,7 @@ static void gui_solderingMode() {
|
|||||||
gui_drawBatteryIcon();
|
gui_drawBatteryIcon();
|
||||||
|
|
||||||
lcd.drawChar(' '); // Space out gap between battery <-> temp
|
lcd.drawChar(' '); // Space out gap between battery <-> temp
|
||||||
if (systemSettings.temperatureInF) {
|
gui_drawTipTemp(true); // Draw current tip temp
|
||||||
gui_drawTipTemp(); // Draw current tip temp
|
|
||||||
lcd.drawSymbol(0); // deg F
|
|
||||||
} else {
|
|
||||||
gui_drawTipTemp(); // Draw current tip temp
|
|
||||||
lcd.drawSymbol(1); // deg C
|
|
||||||
}
|
|
||||||
|
|
||||||
// We draw boost arrow if boosting, or else gap temp <-> heat indicator
|
// We draw boost arrow if boosting, or else gap temp <-> heat indicator
|
||||||
if (boostModeOn)
|
if (boostModeOn)
|
||||||
@@ -519,14 +508,7 @@ static void gui_solderingMode() {
|
|||||||
lcd.drawSymbol(2);
|
lcd.drawSymbol(2);
|
||||||
else
|
else
|
||||||
lcd.drawChar(' ');
|
lcd.drawChar(' ');
|
||||||
|
gui_drawTipTemp(true); // Draw current tip temp
|
||||||
if (systemSettings.temperatureInF) {
|
|
||||||
gui_drawTipTemp(); // Draw current tip temp
|
|
||||||
lcd.drawSymbol(0); // deg F
|
|
||||||
} else {
|
|
||||||
gui_drawTipTemp(); // Draw current tip temp
|
|
||||||
lcd.drawSymbol(1); // deg C
|
|
||||||
}
|
|
||||||
|
|
||||||
lcd.drawChar(' '); // Space out gap between battery <-> temp
|
lcd.drawChar(' '); // Space out gap between battery <-> temp
|
||||||
|
|
||||||
@@ -800,7 +782,7 @@ void startGUITask(void const *argument) {
|
|||||||
}
|
}
|
||||||
//draw in the temp
|
//draw in the temp
|
||||||
lcd.setFont(0); //big font
|
lcd.setFont(0); //big font
|
||||||
gui_drawTipTemp(); // draw in the temp
|
gui_drawTipTemp(false); // draw in the temp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1054,7 +1036,6 @@ void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
|||||||
i2cDev.CpltCallback();
|
i2cDev.CpltCallback();
|
||||||
}
|
}
|
||||||
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
||||||
|
|
||||||
i2cDev.CpltCallback();
|
i2cDev.CpltCallback();
|
||||||
}
|
}
|
||||||
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c) {
|
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c) {
|
||||||
|
|||||||
Reference in New Issue
Block a user