mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Split I2C + startup logo
This commit is contained in:
@@ -41,6 +41,10 @@ void unstick_I2C();
|
|||||||
|
|
||||||
//Reboot the IC when things go seriously wrong
|
//Reboot the IC when things go seriously wrong
|
||||||
void reboot();
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
27
workspace/TS100/Core/BSP/Miniware/logo.cpp
Normal file
27
workspace/TS100/Core/BSP/Miniware/logo.cpp
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -8,12 +8,15 @@
|
|||||||
#include "BSP.h"
|
#include "BSP.h"
|
||||||
#include "Setup.h"
|
#include "Setup.h"
|
||||||
#include "Pins.h"
|
#include "Pins.h"
|
||||||
|
#include "FRTosI2C.hpp"
|
||||||
void preRToSInit() {
|
void preRToSInit() {
|
||||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick.
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick.
|
||||||
*/
|
*/
|
||||||
HAL_Init();
|
HAL_Init();
|
||||||
Setup_HAL(); // Setup all the HAL objects
|
Setup_HAL(); // Setup all the HAL objects
|
||||||
|
FRToSI2C::init(&hi2c1);
|
||||||
HAL_Delay(50);
|
HAL_Delay(50);
|
||||||
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
|
||||||
HAL_Delay(50);
|
HAL_Delay(50);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,14 @@
|
|||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
#include "cmsis_os.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 {
|
class FRToSI2C {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
uint8_t temperatureInF :1; // Should the temp be in F or C (true is F)
|
uint8_t temperatureInF :1; // Should the temp be in F or C (true is F)
|
||||||
#endif
|
#endif
|
||||||
uint8_t descriptionScrollSpeed :1; // Description scroll speed
|
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 voltageDiv; // Voltage divisor factor
|
||||||
uint16_t BoostTemp; // Boost mode set point for the iron
|
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 powerLimitEnable; // Allow toggling of power limit without changing value
|
||||||
uint8_t powerLimit; // Maximum power iron allowed to output
|
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
|
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
|
uint8_t ReverseButtonTempChangeEnabled; // Change the plus and minus button assigment
|
||||||
@@ -70,5 +70,5 @@ void saveSettings();
|
|||||||
bool restoreSettings();
|
bool restoreSettings();
|
||||||
uint8_t lookupVoltageLevel(uint8_t level);
|
uint8_t lookupVoltageLevel(uint8_t level);
|
||||||
void resetSettings();
|
void resetSettings();
|
||||||
bool showBootLogoIfavailable();
|
|
||||||
#endif /* SETTINGS_H_ */
|
#endif /* SETTINGS_H_ */
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ int main(void) {
|
|||||||
preRToSInit();
|
preRToSInit();
|
||||||
|
|
||||||
setTipX10Watts(0); // force tip off
|
setTipX10Watts(0); // force tip off
|
||||||
FRToSI2C::init(&hi2c1);
|
|
||||||
OLED::initialize(); // start up the LCD
|
OLED::initialize(); // start up the LCD
|
||||||
OLED::setFont(0); // default to bigger font
|
OLED::setFont(0); // default to bigger font
|
||||||
// Testing for which accelerometer is mounted
|
// Testing for which accelerometer is mounted
|
||||||
@@ -86,28 +85,5 @@ int main(void) {
|
|||||||
|
|
||||||
/* Start scheduler */
|
/* Start scheduler */
|
||||||
osKernelStart();
|
osKernelStart();
|
||||||
|
|
||||||
/* We should never get here as control is now taken by the scheduler */
|
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user