diff options
author | Ben V. Brown <[email protected]> | 2020-05-29 23:07:59 +1000 |
---|---|---|
committer | Ben V. Brown <[email protected]> | 2020-05-29 23:07:59 +1000 |
commit | a32e245789de59835ee13f2ed66716e5eab527df (patch) | |
tree | 0d81ba67d9d04b0b24b36c62a0952bb9632bc558 | |
parent | d2dacf990c80335315764f393addd200c88fe18a (diff) | |
download | IronOS-a32e245789de59835ee13f2ed66716e5eab527df.tar.gz IronOS-a32e245789de59835ee13f2ed66716e5eab527df.zip |
Split I2C + startup logo
-rw-r--r-- | workspace/TS100/Core/BSP/BSP.h | 4 | ||||
-rw-r--r-- | workspace/TS100/Core/BSP/Miniware/logo.cpp | 27 | ||||
-rw-r--r-- | workspace/TS100/Core/BSP/Miniware/preRTOS.cpp (renamed from workspace/TS100/Core/BSP/Miniware/preRTOS.c) | 3 | ||||
-rw-r--r-- | workspace/TS100/Core/Drivers/FRToSI2C.hpp | 8 | ||||
-rw-r--r-- | workspace/TS100/Core/Inc/Settings.h | 6 | ||||
-rw-r--r-- | workspace/TS100/Core/Src/main.cpp | 24 |
6 files changed, 45 insertions, 27 deletions
diff --git a/workspace/TS100/Core/BSP/BSP.h b/workspace/TS100/Core/BSP/BSP.h index e86f941b..82895a79 100644 --- a/workspace/TS100/Core/BSP/BSP.h +++ b/workspace/TS100/Core/BSP/BSP.h @@ -41,6 +41,10 @@ void unstick_I2C(); //Reboot the IC when things go seriously wrong
void reboot();
+
+//If the user has programmed in a bootup logo, draw it to the screen from flash
+//Returns 1 if the logo was printed so that the unit waits for the timeout or button
+uint8_t showBootLogoIfavailable();
#ifdef __cplusplus
}
#endif
diff --git a/workspace/TS100/Core/BSP/Miniware/logo.cpp b/workspace/TS100/Core/BSP/Miniware/logo.cpp new file mode 100644 index 00000000..f71df93d --- /dev/null +++ b/workspace/TS100/Core/BSP/Miniware/logo.cpp @@ -0,0 +1,27 @@ +/*
+ * logo.c
+ *
+ * Created on: 29 May 2020
+ * Author: Ralim
+ */
+
+#include "BSP.h"
+#include "OLED.hpp"
+// Second last page of flash set aside for logo image.
+#define FLASH_LOGOADDR (0x8000000 | 0xF800)
+
+// Logo header signature.
+#define LOGO_HEADER_VALUE 0xF00DAA55
+
+uint8_t showBootLogoIfavailable() {
+// Do not show logo data if signature is not found.
+ if (LOGO_HEADER_VALUE
+ != *(reinterpret_cast<const uint32_t*>(FLASH_LOGOADDR))) {
+ return 0;
+ }
+
+ OLED::drawAreaSwapped(0, 0, 96, 16, (uint8_t*) (FLASH_LOGOADDR + 4));
+ OLED::refresh();
+ return 1;
+}
+
diff --git a/workspace/TS100/Core/BSP/Miniware/preRTOS.c b/workspace/TS100/Core/BSP/Miniware/preRTOS.cpp index 384ec9ad..107eb6a5 100644 --- a/workspace/TS100/Core/BSP/Miniware/preRTOS.c +++ b/workspace/TS100/Core/BSP/Miniware/preRTOS.cpp @@ -8,12 +8,15 @@ #include "BSP.h"
#include "Setup.h"
#include "Pins.h"
+#include "FRTosI2C.hpp"
void preRToSInit() {
/* Reset of all peripherals, Initializes the Flash interface and the Systick.
*/
HAL_Init();
Setup_HAL(); // Setup all the HAL objects
+ FRToSI2C::init(&hi2c1);
HAL_Delay(50);
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
HAL_Delay(50);
+
}
diff --git a/workspace/TS100/Core/Drivers/FRToSI2C.hpp b/workspace/TS100/Core/Drivers/FRToSI2C.hpp index efc11d74..550ae076 100644 --- a/workspace/TS100/Core/Drivers/FRToSI2C.hpp +++ b/workspace/TS100/Core/Drivers/FRToSI2C.hpp @@ -10,6 +10,14 @@ #include "stm32f1xx_hal.h"
#include "cmsis_os.h"
+/*
+ * Wrapper class to work with the device I2C bus
+ *
+ * This provides mutex protection of the peripheral
+ * Also allows hardware to use DMA should it want to
+ *
+ *
+ */
class FRToSI2C {
public:
diff --git a/workspace/TS100/Core/Inc/Settings.h b/workspace/TS100/Core/Inc/Settings.h index cde51fc4..21d4b35d 100644 --- a/workspace/TS100/Core/Inc/Settings.h +++ b/workspace/TS100/Core/Inc/Settings.h @@ -42,7 +42,7 @@ typedef struct { uint8_t temperatureInF :1; // Should the temp be in F or C (true is F) #endif uint8_t descriptionScrollSpeed :1; // Description scroll speed - uint8_t KeepAwakePulse; // Keep Awake pulse power in 0.1 watts (10 = 1Watt) + uint8_t KeepAwakePulse; // Keep Awake pulse power in 0.1 watts (10 = 1Watt) uint16_t voltageDiv; // Voltage divisor factor uint16_t BoostTemp; // Boost mode set point for the iron @@ -51,7 +51,7 @@ typedef struct { uint8_t powerLimitEnable; // Allow toggling of power limit without changing value uint8_t powerLimit; // Maximum power iron allowed to output - + uint16_t TipGain; // uV/C * 10, it can be used to convert tip thermocouple voltage to temperateture TipV/TipGain = TipTemp uint8_t ReverseButtonTempChangeEnabled; // Change the plus and minus button assigment @@ -70,5 +70,5 @@ void saveSettings(); bool restoreSettings(); uint8_t lookupVoltageLevel(uint8_t level); void resetSettings(); -bool showBootLogoIfavailable(); + #endif /* SETTINGS_H_ */ diff --git a/workspace/TS100/Core/Src/main.cpp b/workspace/TS100/Core/Src/main.cpp index ed12e0bf..539f4a61 100644 --- a/workspace/TS100/Core/Src/main.cpp +++ b/workspace/TS100/Core/Src/main.cpp @@ -43,7 +43,6 @@ int main(void) { preRToSInit(); setTipX10Watts(0); // force tip off - FRToSI2C::init(&hi2c1); OLED::initialize(); // start up the LCD OLED::setFont(0); // default to bigger font // Testing for which accelerometer is mounted @@ -86,28 +85,5 @@ int main(void) { /* Start scheduler */ osKernelStart(); - /* We should never get here as control is now taken by the scheduler */ - while (1) { - } -} - - -// Second last page of flash set aside for logo image. -#define FLASH_LOGOADDR (0x8000000 | 0xF800) - -// Logo header signature. -#define LOGO_HEADER_VALUE 0xF00DAA55 - -bool showBootLogoIfavailable() { -// Do not show logo data if signature is not found. - if (LOGO_HEADER_VALUE - != *(reinterpret_cast<const uint32_t*>(FLASH_LOGOADDR))) { - return false; - } - - OLED::drawAreaSwapped(0, 0, 96, 16, (uint8_t*) (FLASH_LOGOADDR + 4)); - OLED::refresh(); - return true; } - |