diff --git a/workspace/TS100/Core/BSP/Miniware/BSP.cpp b/workspace/TS100/Core/BSP/Miniware/BSP.cpp index 591f005c..da79b46f 100644 --- a/workspace/TS100/Core/BSP/Miniware/BSP.cpp +++ b/workspace/TS100/Core/BSP/Miniware/BSP.cpp @@ -1,5 +1,6 @@ //BSP mapping functions +#include #include "BSP.h" #include "Setup.h" #include "history.hpp" @@ -212,41 +213,6 @@ uint8_t getButtonB() { 1 : 0; } -/* - * Catch the IRQ that says that the conversion is done on the temperature - * readings coming in Once these have come in we can unblock the PID so that it - * runs again - */ -void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *hadc) { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - if (hadc == &hadc1) { - if (pidTaskNotification) { - vTaskNotifyGiveFromISR(pidTaskNotification, - &xHigherPriorityTaskWoken); - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); - } - } -} -void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { - FRToSI2C::CpltCallback(); -} -void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { - FRToSI2C::CpltCallback(); -} -void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { - FRToSI2C::CpltCallback(); -} -void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) { - - FRToSI2C::CpltCallback(); -} -void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) { - - FRToSI2C::CpltCallback(); -} -void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { - FRToSI2C::CpltCallback(); -} void reboot() { NVIC_SystemReset(); } diff --git a/workspace/TS100/Core/BSP/Miniware/IRQ.cpp b/workspace/TS100/Core/BSP/Miniware/IRQ.cpp new file mode 100644 index 00000000..eac8cdbc --- /dev/null +++ b/workspace/TS100/Core/BSP/Miniware/IRQ.cpp @@ -0,0 +1,43 @@ +/* + * IRQ.c + * + * Created on: 30 May 2020 + * Author: Ralim + */ + +#include "IRQ.h" +/* + * Catch the IRQ that says that the conversion is done on the temperature + * readings coming in Once these have come in we can unblock the PID so that it + * runs again + */ +void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *hadc) { + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + if (hadc == &hadc1) { + if (pidTaskNotification) { + vTaskNotifyGiveFromISR(pidTaskNotification, + &xHigherPriorityTaskWoken); + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + } + } +} +void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { + FRToSI2C::CpltCallback(); +} +void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { + FRToSI2C::CpltCallback(); +} +void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { + FRToSI2C::CpltCallback(); +} +void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) { + + FRToSI2C::CpltCallback(); +} +void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) { + + FRToSI2C::CpltCallback(); +} +void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { + FRToSI2C::CpltCallback(); +} diff --git a/workspace/TS100/Core/BSP/Miniware/IRQ.h b/workspace/TS100/Core/BSP/Miniware/IRQ.h new file mode 100644 index 00000000..09d79c36 --- /dev/null +++ b/workspace/TS100/Core/BSP/Miniware/IRQ.h @@ -0,0 +1,31 @@ +/* + * Irqs.h + * + * Created on: 30 May 2020 + * Author: Ralim + */ + +#ifndef BSP_MINIWARE_IRQ_H_ +#define BSP_MINIWARE_IRQ_H_ + +#include "BSP.h" +#include "stm32f1xx_hal.h" +#include "I2C_Wrapper.hpp" +#include "Setup.h" +#include "main.hpp" + +#ifdef __cplusplus +extern "C" { +#endif +void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *hadc); +void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c); +void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c); +void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c); +void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c); +void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c); +void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c); + +#ifdef __cplusplus +} +#endif +#endif /* BSP_MINIWARE_IRQ_H_ */ diff --git a/workspace/TS100/Core/Inc/main.hpp b/workspace/TS100/Core/Inc/main.hpp index 37bc9816..606d920b 100644 --- a/workspace/TS100/Core/Inc/main.hpp +++ b/workspace/TS100/Core/Inc/main.hpp @@ -11,13 +11,6 @@ extern bool settingsWereReset; extern "C" { #endif -void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *hadc); -void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c); -void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c); -void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c); -void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c); -void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c); -void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c); void vApplicationStackOverflowHook(xTaskHandle *pxTask, signed portCHAR *pcTaskName); diff --git a/workspace/TS100/Core/Src/main.cpp b/workspace/TS100/Core/Src/main.cpp index 9d5e19f4..3141a5d2 100644 --- a/workspace/TS100/Core/Src/main.cpp +++ b/workspace/TS100/Core/Src/main.cpp @@ -38,11 +38,11 @@ int main(void) { preRToSInit(); setTipX10Watts(0); // force tip off + resetWatchdog(); OLED::initialize(); // start up the LCD OLED::setFont(0); // default to bigger font // Testing for which accelerometer is mounted resetWatchdog(); - resetWatchdog(); settingsWereReset = restoreSettings(); // load the settings from flash if (MMA8652FC::detect()) { PCBVersion = 1; @@ -72,11 +72,11 @@ int main(void) { PIDTaskStackSize, PIDTaskBuffer, &PIDTaskControlBlock); PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL); - if (PCBVersion < 3) { - osThreadStaticDef(MOVTask, startMOVTask, osPriorityNormal, 0, - MOVTaskStackSize, MOVTaskBuffer, &MOVTaskControlBlock); - MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL); - } + osThreadStaticDef(MOVTask, startMOVTask, osPriorityNormal, 0, + MOVTaskStackSize, MOVTaskBuffer, &MOVTaskControlBlock); + MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL); + + resetWatchdog(); /* Start scheduler */ osKernelStart();