Fillout settings functions
Settings menu works Movement working & TMP calibrated Tip reading sensibily Accuracy seems ok Trimmed down overshoot by biasing integral Saving to flash working, detailed idle Sleep mode Description scrolls Building for DFU working Motion detection update Use manual alg instead, using highpass filter, then sum current change vs rolling average Re-shuffle the pwm code organisation
This commit is contained in:
86
workspace/TS100/src/MMA8652FC.cpp
Normal file
86
workspace/TS100/src/MMA8652FC.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* MMA8652FC.cpp
|
||||
*
|
||||
* Created on: 31Aug.,2017
|
||||
* Author: Ben V. Brown
|
||||
*/
|
||||
|
||||
#include <MMA8652FC.hpp>
|
||||
|
||||
MMA8652FC::MMA8652FC(I2C_HandleTypeDef* i2cHandle) {
|
||||
i2c = i2cHandle;
|
||||
}
|
||||
|
||||
void MMA8652FC::I2C_RegisterWrite(uint8_t reg, uint8_t data) {
|
||||
|
||||
HAL_I2C_Mem_Write(i2c, MMA8652FC_I2C_ADDRESS, reg, I2C_MEMADD_SIZE_8BIT, &data, 1, 0xFFFF);
|
||||
}
|
||||
|
||||
uint8_t MMA8652FC::I2C_RegisterRead(uint8_t reg) {
|
||||
uint8_t tx_data[1];
|
||||
HAL_I2C_Mem_Read(i2c, MMA8652FC_I2C_ADDRESS, reg, I2C_MEMADD_SIZE_8BIT, tx_data, 1, 0xFFFF);
|
||||
|
||||
return tx_data[0];
|
||||
}
|
||||
void MMA8652FC::initalize() {
|
||||
//send all the init commands to the unit
|
||||
I2C_RegisterWrite(CTRL_REG2, 0); //Normal mode
|
||||
I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
|
||||
HAL_Delay(2); // ~1ms delay
|
||||
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X, Y, Z axis, latch disabled
|
||||
|
||||
I2C_RegisterWrite(PL_CFG_REG, 0x40); //Enable the orientation detection
|
||||
I2C_RegisterWrite(PL_COUNT_REG, 200); //200 count debounce
|
||||
I2C_RegisterWrite(PL_BF_ZCOMP_REG, 0b01000111); //Set the threshold to 42 degrees
|
||||
I2C_RegisterWrite(P_L_THS_REG, 0b10011100); //Up the trip angles
|
||||
I2C_RegisterWrite( CTRL_REG4, 0x01 | (1 << 4)); // Enable dataready interrupt & orientation interrupt
|
||||
I2C_RegisterWrite( CTRL_REG5, 0x01); // Route data ready interrupts to INT1 ->PB5 ->EXTI5, leaving orientation routed to INT2
|
||||
I2C_RegisterWrite( CTRL_REG2, 0x12); //Set maximum resolution oversampling
|
||||
I2C_RegisterWrite( XYZ_DATA_CFG_REG, (1 << 4)); //select high pass filtered data
|
||||
I2C_RegisterWrite( HP_FILTER_CUTOFF_REG, 0x03); //select high pass filtered data
|
||||
|
||||
I2C_RegisterWrite( CTRL_REG1, 0x19); // ODR=12 Hz, Active mode
|
||||
|
||||
}
|
||||
|
||||
void MMA8652FC::setSensitivity(uint8_t threshold, uint8_t filterTime) {
|
||||
uint8_t sens = 9 * 2 + 17;
|
||||
sens -= 2 * threshold;
|
||||
I2C_RegisterWrite( CTRL_REG1, 0); // sleep mode
|
||||
I2C_RegisterWrite(FF_MT_THS_REG, (sens & 0x7F)); // Set accumulation threshold
|
||||
I2C_RegisterWrite(FF_MT_COUNT_REG, filterTime); // Set debounce threshold
|
||||
I2C_RegisterWrite( CTRL_REG1, 0x31); // ODR=12 Hz, Active mode
|
||||
|
||||
}
|
||||
|
||||
bool MMA8652FC::getOrientation() {
|
||||
//First read the PL_STATUS register
|
||||
uint8_t plStatus = I2C_RegisterRead(PL_STATUS_REG);
|
||||
plStatus >>= 1; //We don't need the up/down bit
|
||||
plStatus &= 0x03; //mask to the two lower bits
|
||||
//0 == left handed
|
||||
//1 == right handed
|
||||
|
||||
return !plStatus;
|
||||
}
|
||||
void MMA8652FC::getAxisReadings(int16_t *x, int16_t *y, int16_t *z) {
|
||||
uint8_t temp = 0;
|
||||
HAL_I2C_Mem_Read(i2c, MMA8652FC_I2C_ADDRESS, OUT_X_MSB_REG, I2C_MEMADD_SIZE_8BIT, (uint8_t*) &temp, 1, 0xFFFF);
|
||||
(*x) = temp;
|
||||
(*x) <<= 8;
|
||||
HAL_I2C_Mem_Read(i2c, MMA8652FC_I2C_ADDRESS, OUT_X_LSB_REG, I2C_MEMADD_SIZE_8BIT, (uint8_t*) &temp, 1, 0xFFFF);
|
||||
(*x) |= temp;
|
||||
|
||||
HAL_I2C_Mem_Read(i2c, MMA8652FC_I2C_ADDRESS, OUT_Y_MSB_REG, I2C_MEMADD_SIZE_8BIT, (uint8_t*) &temp, 1, 0xFFFF);
|
||||
(*y) = temp;
|
||||
(*y) <<= 8;
|
||||
HAL_I2C_Mem_Read(i2c, MMA8652FC_I2C_ADDRESS, OUT_Y_LSB_REG, I2C_MEMADD_SIZE_8BIT, (uint8_t*) &temp, 1, 0xFFFF);
|
||||
(*y) |= temp;
|
||||
|
||||
HAL_I2C_Mem_Read(i2c, MMA8652FC_I2C_ADDRESS, OUT_Z_MSB_REG, I2C_MEMADD_SIZE_8BIT, (uint8_t*) &temp, 1, 0xFFFF);
|
||||
(*z) = temp;
|
||||
(*z) <<= 8;
|
||||
HAL_I2C_Mem_Read(i2c, MMA8652FC_I2C_ADDRESS, OUT_Z_LSB_REG, I2C_MEMADD_SIZE_8BIT, (uint8_t*) &temp, 1, 0xFFFF);
|
||||
(*z) |= temp;
|
||||
|
||||
}
|
||||
243
workspace/TS100/src/OLED.cpp
Normal file
243
workspace/TS100/src/OLED.cpp
Normal file
@@ -0,0 +1,243 @@
|
||||
/*
|
||||
* OLED.cpp
|
||||
*
|
||||
* Created on: 29Aug.,2017
|
||||
* Author: Ben V. Brown
|
||||
*/
|
||||
|
||||
#include <OLED.hpp>
|
||||
#include <string.h>
|
||||
/*Setup params for the OLED screen*/
|
||||
/*http://www.displayfuture.com/Display/datasheet/controller/SSD1307.pdf*/
|
||||
/*All commands are prefixed with 0x80*/
|
||||
/*Data packets are prefixed with 0x40*/
|
||||
const uint8_t configLength = 50;
|
||||
uint8_t OLED_Setup_Array[] = { /**/
|
||||
0x80, 0xAE,/*Display off*/
|
||||
0x80, 0xD5,/*Set display clock divide ratio / osc freq*/
|
||||
0x80, 0x52,/*Divide ratios*/
|
||||
0x80, 0xA8,/*Set Multiplex Ratio*/
|
||||
0x80, 0x0E, /*16 == max brightness,39==dimmest*/
|
||||
0x80, 0xC0,/*Set COM Scan direction*/
|
||||
0x80, 0xD3,/*Set vertical Display offset*/
|
||||
0x80, 0x00,/*0 Offset*/
|
||||
0x80, 0x40,/*Set Display start line to 0*/
|
||||
0x80, 0xA0,/*Set Segment remap to normal*/
|
||||
0x80, 0x8D,/*Charge Pump*/
|
||||
0x80, 0x14,/*Charge Pump settings*/
|
||||
0x80, 0xDA,/*Set VCOM Pins hardware config*/
|
||||
0x80, 0x02,/*Combination 2*/
|
||||
0x80, 0x81,/*Contrast*/
|
||||
0x80, 0x33,/*^51*/
|
||||
0x80, 0xD9,/*Set pre-charge period*/
|
||||
0x80, 0xF1,/*Pre charge period*/
|
||||
0x80, 0xDB,/*Adjust VCOMH regulator ouput*/
|
||||
0x80, 0x30,/*VCOM level*/
|
||||
0x80, 0xA4,/*Enable the display GDDR*/
|
||||
0x80, 0XA6,/*Normal display*/
|
||||
0x80, 0x20,/*Memory Mode*/
|
||||
0x80, 0x00,/*Wrap memory*/
|
||||
0x80, 0xAF /*Display on*/
|
||||
};
|
||||
//Setup based on the SSD1307 and modified for the SSD1306
|
||||
|
||||
OLED::OLED(I2C_HandleTypeDef* i2cHandle) {
|
||||
i2c = i2cHandle;
|
||||
cursor_x = cursor_y = 0;
|
||||
currentFont = FONT_12;
|
||||
fontWidth = 12;
|
||||
inLeftHandedMode = false;
|
||||
firstStripPtr = &screenBuffer[13];
|
||||
secondStripPtr = &screenBuffer[13 + 96];
|
||||
fontHeight = 16;
|
||||
fontWidth = 12;
|
||||
displayOffset = 0;
|
||||
displayOnOffState = true;
|
||||
|
||||
}
|
||||
|
||||
void OLED::initialize() {
|
||||
HAL_Delay(5);
|
||||
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
|
||||
HAL_Delay(5);
|
||||
//Send the setup settings
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, configLength, 0xFFFF);
|
||||
//displayOnOff(true);
|
||||
|
||||
screenBuffer[0] = 0x80;
|
||||
screenBuffer[1] = 0x21;
|
||||
screenBuffer[2] = 0x80;
|
||||
screenBuffer[3] = inLeftHandedMode ? 0 : 32;
|
||||
screenBuffer[4] = 0x80;
|
||||
screenBuffer[5] = inLeftHandedMode ? 95 : 0x7F;
|
||||
|
||||
screenBuffer[6] = 0x80;//Set pages to rollover after 2
|
||||
screenBuffer[7] = 0x22;
|
||||
screenBuffer[8] = 0x80;
|
||||
screenBuffer[9] = 0x00;
|
||||
screenBuffer[10] = 0x80;
|
||||
screenBuffer[11] = 0x01;
|
||||
|
||||
screenBuffer[12] = 0x40;
|
||||
|
||||
}
|
||||
|
||||
//Write out the buffer to the OLEd & call any rendering objects
|
||||
void OLED::refresh() {
|
||||
screenBuffer[12] = 0x40; // Ensure it never gets overwritten
|
||||
screenBuffer[3] = inLeftHandedMode ? 0 : 32;
|
||||
screenBuffer[5] = inLeftHandedMode ? 95 : 0x7F; // It rolls over when it exceeds this number (this is last writable column)
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, screenBuffer, 12 + 96 * 2 + 1, 0xFFFF);
|
||||
|
||||
}
|
||||
|
||||
void OLED::drawChar(char c) {
|
||||
//prints a char to the screen
|
||||
if (c == '\n')
|
||||
cursor_y += fontHeight;
|
||||
if (c < ' ')
|
||||
return;
|
||||
uint8_t* charPointer;
|
||||
c -= ' ';
|
||||
//Fonts are offset to start at the space char.
|
||||
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * c);
|
||||
if (cursor_x >= 0)
|
||||
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
|
||||
cursor_x += fontWidth;
|
||||
}
|
||||
|
||||
void OLED::displayOnOff(bool on) {
|
||||
|
||||
if (on != displayOnOffState) {
|
||||
uint8_t data[6] = { 0x80, 0X8D, 0x80, 0X14, 0x80, 0XAF }; //on
|
||||
if (!on) {
|
||||
data[3] = 0x10;
|
||||
data[5] = 0xAE;
|
||||
}
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, data, 6, 0xFFFF);
|
||||
displayOnOffState = on;
|
||||
}
|
||||
}
|
||||
|
||||
void OLED::setRotation(bool leftHanded) {
|
||||
if (inLeftHandedMode != leftHanded) {
|
||||
//send command struct again with changes
|
||||
if (leftHanded == 1) {
|
||||
OLED_Setup_Array[11] = 0xC8; //c1?
|
||||
OLED_Setup_Array[19] = 0xA1;
|
||||
} else if (leftHanded == 0) {
|
||||
OLED_Setup_Array[11] = 0xC0;
|
||||
OLED_Setup_Array[19] = 0xA0;
|
||||
}
|
||||
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, 50, 0xFFFF);
|
||||
inLeftHandedMode = leftHanded;
|
||||
}
|
||||
}
|
||||
|
||||
//print a string to the current cursor location
|
||||
void OLED::print(const char* str) {
|
||||
while (str[0]) {
|
||||
drawChar(str[0]);
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
||||
void OLED::setCursor(int16_t x, int16_t y) {
|
||||
cursor_x = x;
|
||||
cursor_y = y;
|
||||
}
|
||||
|
||||
void OLED::setFont(uint8_t fontNumber) {
|
||||
if (fontNumber == 1) {
|
||||
//small font
|
||||
currentFont = ASCII6x8;
|
||||
fontHeight = 8;
|
||||
fontWidth = 6;
|
||||
} else if (fontNumber == 2) {
|
||||
currentFont = ExtraFontChars;
|
||||
fontHeight = 16;
|
||||
fontWidth = 12;
|
||||
} else {
|
||||
currentFont = FONT_12;
|
||||
fontHeight = 16;
|
||||
fontWidth = 12;
|
||||
}
|
||||
}
|
||||
|
||||
void OLED::drawImage(const uint8_t* buffer, uint8_t x, uint8_t width) {
|
||||
drawArea(x, 0, width, 16, buffer);
|
||||
}
|
||||
|
||||
//maximum places is 5
|
||||
void OLED::printNumber(uint16_t number, uint8_t places) {
|
||||
char buffer[6];
|
||||
buffer[5] = 0; //null
|
||||
if (places == 5) {
|
||||
buffer[4] = '0' + number % 10;
|
||||
number /= 10;
|
||||
} else
|
||||
buffer[4] = 0;
|
||||
|
||||
if (places > 3) {
|
||||
buffer[3] = '0' + number % 10;
|
||||
number /= 10;
|
||||
} else
|
||||
buffer[3] = 0;
|
||||
|
||||
if (places > 2) {
|
||||
buffer[2] = '0' + number % 10;
|
||||
number /= 10;
|
||||
} else
|
||||
buffer[2] = 0;
|
||||
|
||||
if (places > 1) {
|
||||
buffer[1] = '0' + number % 10;
|
||||
number /= 10;
|
||||
} else
|
||||
buffer[1] = 0;
|
||||
buffer[0] = '0' + number % 10;
|
||||
number /= 10;
|
||||
print(buffer);
|
||||
}
|
||||
|
||||
void OLED::clearScreen() {
|
||||
memset(firstStripPtr, 0, 96);
|
||||
memset(secondStripPtr, 0, 96);
|
||||
}
|
||||
|
||||
bool OLED::getRotation() {
|
||||
return inLeftHandedMode;
|
||||
}
|
||||
void OLED::drawBattery(uint8_t state) {
|
||||
if (state > 10)
|
||||
state = 10;
|
||||
drawSymbol(3 + state);
|
||||
}
|
||||
void OLED::drawSymbol(uint8_t symbolID) {
|
||||
//draw a symbol to the current cursor location
|
||||
setFont(2);
|
||||
drawChar(' ' + symbolID); // space offset is in all fonts, so we pad it here and remove it later
|
||||
setFont(0);
|
||||
}
|
||||
|
||||
//Draw an area, but y must be aligned on 0/8 offset
|
||||
void OLED::drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t* ptr) {
|
||||
// Splat this from x->x+wide in two strides
|
||||
if (x < 0)
|
||||
return; //cutoffleft
|
||||
if ((x + wide) > 96)
|
||||
return; //cutoff right
|
||||
if (y == 0) {
|
||||
//Splat first line of data
|
||||
for (uint8_t xx = 0; xx < (wide); xx++) {
|
||||
firstStripPtr[xx + x] = ptr[xx];
|
||||
}
|
||||
}
|
||||
if (y == 8 || height == 16) {
|
||||
// Splat the second line
|
||||
for (uint8_t xx = 0; xx < wide; xx++) {
|
||||
secondStripPtr[x + xx] = ptr[xx + (height == 16 ? wide : 0)];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
81
workspace/TS100/src/Settings.cpp
Normal file
81
workspace/TS100/src/Settings.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Settings.c
|
||||
*
|
||||
* Created on: 29 Sep 2016
|
||||
* Author: Ralim
|
||||
*
|
||||
* This file holds the users settings and saves / restores them to the devices flash
|
||||
*/
|
||||
|
||||
#include "Settings.h"
|
||||
#define FLASH_ADDR (0x8000000|0xBC00)/*Flash start OR'ed with the maximum amount of flash - 1024 bytes*/
|
||||
|
||||
systemSettingsType systemSettings;
|
||||
|
||||
void saveSettings() {
|
||||
//First we erase the flash
|
||||
FLASH_EraseInitTypeDef pEraseInit;
|
||||
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
|
||||
pEraseInit.Banks = FLASH_BANK_1;
|
||||
pEraseInit.NbPages = 1;
|
||||
pEraseInit.PageAddress = FLASH_ADDR;
|
||||
uint32_t failingAddress = 0;
|
||||
HAL_FLASH_Unlock();
|
||||
HAL_FLASHEx_Erase(&pEraseInit, &failingAddress);
|
||||
//^ Erase the page of flash (1024 bytes on this platform)
|
||||
//erased the chunk
|
||||
//now we program it
|
||||
uint16_t *data = (uint16_t*) &systemSettings;
|
||||
for (uint8_t i = 0; i < (sizeof(systemSettings) / 2); i++) {
|
||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, FLASH_ADDR + (i * 2), data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void restoreSettings() {
|
||||
//We read the flash
|
||||
uint16_t *data = (uint16_t*) &systemSettings;
|
||||
for (uint8_t i = 0; i < (sizeof(systemSettings) / 2); i++) {
|
||||
data[i] = *(uint16_t *) (FLASH_ADDR + (i * 2));
|
||||
}
|
||||
//if the version is correct were done
|
||||
//if not we reset and save
|
||||
if (systemSettings.version != SETTINGSVERSION) {
|
||||
//probably not setup
|
||||
resetSettings();
|
||||
}
|
||||
|
||||
}
|
||||
//Lookup function for cutoff setting -> X10 voltage
|
||||
/*
|
||||
* 0=DC
|
||||
* 1=3S
|
||||
* 2=4S
|
||||
* 3=5S
|
||||
* 4=6S
|
||||
*/
|
||||
uint8_t lookupVoltageLevel(uint8_t level) {
|
||||
if (level == 0)
|
||||
return 100; //10V since iron does not function effectively below this
|
||||
else
|
||||
return (level * 33) + (33 * 2);
|
||||
}
|
||||
void resetSettings() {
|
||||
|
||||
systemSettings.SleepTemp = 150; //Temperature the iron sleeps at - default 150.0 C
|
||||
systemSettings.SleepTime = 6; //How many seconds/minutes we wait until going to sleep - default 1 min
|
||||
systemSettings.SolderingTemp = 320; //Default soldering temp is 320.0 C
|
||||
systemSettings.cutoutSetting = 0; //default to no cut-off voltage
|
||||
systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades
|
||||
systemSettings.advancedScreens = 1; //Do we show detailed screens?
|
||||
systemSettings.OrientationMode = 2; //Default to automatic
|
||||
systemSettings.sensitivity = 8; //Default high sensitivity
|
||||
systemSettings.voltageDiv = 144; //Default divider from schematic
|
||||
systemSettings.ShutdownTime = 30; //How many minutes until the unit turns itself off
|
||||
systemSettings.boostModeEnabled = 0; //Default to safe, with no boost mode
|
||||
systemSettings.BoostTemp = 420; //default to 400C
|
||||
systemSettings.powerDisplay = 0; //default to power display being off
|
||||
systemSettings.autoStartMode = 0; //Auto start off for safety
|
||||
systemSettings.coolingTempBlink = 0; //Blink the temperature on the cooling screen when its > 50C
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
364
workspace/TS100/src/Setup.c
Normal file
364
workspace/TS100/src/Setup.c
Normal file
@@ -0,0 +1,364 @@
|
||||
/*
|
||||
* Setup.c
|
||||
*
|
||||
* Created on: 29Aug.,2017
|
||||
* Author: Ben V. Brown
|
||||
*/
|
||||
#include "Setup.h"
|
||||
ADC_HandleTypeDef hadc1;
|
||||
DMA_HandleTypeDef hdma_adc1;
|
||||
|
||||
I2C_HandleTypeDef hi2c1;
|
||||
DMA_HandleTypeDef hdma_i2c1_rx;
|
||||
DMA_HandleTypeDef hdma_i2c1_tx;
|
||||
|
||||
IWDG_HandleTypeDef hiwdg;
|
||||
TIM_HandleTypeDef htim2;
|
||||
TIM_HandleTypeDef htim3;
|
||||
|
||||
uint16_t ADCReadings[64]; //room for 32 lots of the pair of readings
|
||||
|
||||
//Functions
|
||||
void SystemClock_Config(void);
|
||||
static void MX_ADC1_Init(void);
|
||||
static void MX_I2C1_Init(void);
|
||||
static void MX_IWDG_Init(void);
|
||||
static void MX_TIM3_Init(void);
|
||||
static void MX_TIM2_Init(void);
|
||||
static void MX_DMA_Init(void);
|
||||
static void MX_GPIO_Init(void);
|
||||
|
||||
void Setup_HAL() {
|
||||
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
MX_I2C1_Init();
|
||||
MX_ADC1_Init();
|
||||
MX_TIM3_Init();
|
||||
MX_TIM2_Init();
|
||||
MX_IWDG_Init();
|
||||
|
||||
HAL_ADC_Start_DMA(&hadc1, (uint32_t*) ADCReadings, 64);
|
||||
HAL_ADCEx_InjectedStart(&hadc1); //enable injected readings
|
||||
}
|
||||
|
||||
//channel 0 -> temperature sensor, 1-> VIN
|
||||
uint16_t getADC(uint8_t channel) {
|
||||
uint32_t sum = 0;
|
||||
for (uint8_t i = 0; i < 32; i++)
|
||||
sum += ADCReadings[channel + (i * 2)];
|
||||
return sum >> 3;
|
||||
}
|
||||
|
||||
/** System Clock Configuration
|
||||
*/
|
||||
void SystemClock_Config(void) {
|
||||
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInit;
|
||||
|
||||
/**Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_LSI;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.HSICalibrationValue = 16;
|
||||
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
/**Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV16;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
|
||||
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
|
||||
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV2;
|
||||
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
|
||||
|
||||
/**Configure the Systick interrupt time
|
||||
*/
|
||||
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
|
||||
|
||||
/**Configure the Systick
|
||||
*/
|
||||
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
|
||||
|
||||
/* SysTick_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0);
|
||||
}
|
||||
|
||||
/* ADC1 init function */
|
||||
static void MX_ADC1_Init(void) {
|
||||
|
||||
ADC_ChannelConfTypeDef sConfig;
|
||||
ADC_InjectionConfTypeDef sConfigInjected;
|
||||
|
||||
/**Common config
|
||||
*/
|
||||
hadc1.Instance = ADC1;
|
||||
hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
|
||||
hadc1.Init.ContinuousConvMode = ENABLE;
|
||||
hadc1.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc1.Init.NbrOfConversion = 2;
|
||||
HAL_ADC_Init(&hadc1);
|
||||
|
||||
/**Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_7;
|
||||
sConfig.Rank = 1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
|
||||
HAL_ADC_ConfigChannel(&hadc1, &sConfig);
|
||||
|
||||
/**Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_9;
|
||||
sConfig.Rank = 2;
|
||||
HAL_ADC_ConfigChannel(&hadc1, &sConfig);
|
||||
|
||||
/**Configure Injected Channel
|
||||
*/
|
||||
sConfigInjected.InjectedChannel = ADC_CHANNEL_8;
|
||||
sConfigInjected.InjectedRank = 1;
|
||||
sConfigInjected.InjectedNbrOfConversion = 4;
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_71CYCLES_5;
|
||||
sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
|
||||
sConfigInjected.AutoInjectedConv = DISABLE;
|
||||
sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
|
||||
sConfigInjected.InjectedOffset = 0;
|
||||
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
|
||||
sConfigInjected.InjectedRank = 2;
|
||||
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
|
||||
sConfigInjected.InjectedRank = 3;
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_55CYCLES_5;
|
||||
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
|
||||
sConfigInjected.InjectedRank = 4;
|
||||
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
|
||||
|
||||
}
|
||||
|
||||
/* I2C1 init function */
|
||||
static void MX_I2C1_Init(void) {
|
||||
|
||||
hi2c1.Instance = I2C1;
|
||||
hi2c1.Init.ClockSpeed = 100000;
|
||||
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
|
||||
hi2c1.Init.OwnAddress1 = 0;
|
||||
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||
hi2c1.Init.OwnAddress2 = 0;
|
||||
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||
HAL_I2C_Init(&hi2c1);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
|
||||
|
||||
}
|
||||
|
||||
/* IWDG init function */
|
||||
static void MX_IWDG_Init(void) {
|
||||
|
||||
hiwdg.Instance = IWDG;
|
||||
hiwdg.Init.Prescaler = IWDG_PRESCALER_256;
|
||||
hiwdg.Init.Reload = 4095;
|
||||
HAL_IWDG_Init(&hiwdg);
|
||||
|
||||
}
|
||||
|
||||
/* TIM3 init function */
|
||||
static void MX_TIM3_Init(void) {
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig;
|
||||
TIM_MasterConfigTypeDef sMasterConfig;
|
||||
TIM_OC_InitTypeDef sConfigOC;
|
||||
|
||||
htim3.Instance = TIM3;
|
||||
htim3.Init.Prescaler = 1;
|
||||
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim3.Init.Period = 100;
|
||||
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; //2mhz
|
||||
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
HAL_TIM_Base_Init(&htim3);
|
||||
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig);
|
||||
|
||||
HAL_TIM_PWM_Init(&htim3);
|
||||
|
||||
HAL_TIM_OC_Init(&htim3);
|
||||
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig);
|
||||
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
sConfigOC.Pulse = 50;
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
|
||||
HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1);
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
/**TIM3 GPIO Configuration
|
||||
PB4 ------> TIM3_CH1
|
||||
*/
|
||||
GPIO_InitStruct.Pin = PWM_Out_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(PWM_Out_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
__HAL_AFIO_REMAP_TIM3_PARTIAL()
|
||||
;
|
||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
|
||||
|
||||
}
|
||||
/* TIM3 init function */
|
||||
static void MX_TIM2_Init(void) {
|
||||
/*
|
||||
* We use the channel 1 to trigger the ADC at end of PWM period
|
||||
* And we use the channel 4 as the PWM modulation source using Interrupts
|
||||
* */
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig;
|
||||
TIM_MasterConfigTypeDef sMasterConfig;
|
||||
TIM_OC_InitTypeDef sConfigOC;
|
||||
|
||||
//Timer 2 is fairly slow as its being used to run the PWM and trigger the ADC in the PWM off time.
|
||||
htim2.Instance = TIM2;
|
||||
htim2.Init.Prescaler = 2000;
|
||||
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim2.Init.Period = 120;
|
||||
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; //2mhz
|
||||
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
HAL_TIM_Base_Init(&htim2);
|
||||
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig);
|
||||
|
||||
HAL_TIM_PWM_Init(&htim2);
|
||||
HAL_TIM_OC_Init(&htim2);
|
||||
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);
|
||||
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
sConfigOC.Pulse = 110;
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
|
||||
HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1);
|
||||
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
sConfigOC.Pulse = 0;
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
|
||||
HAL_TIM_OC_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_4);
|
||||
|
||||
HAL_TIM_Base_Start_IT(&htim2);
|
||||
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
|
||||
HAL_TIM_PWM_Start_IT(&htim2, TIM_CHANNEL_4);
|
||||
HAL_NVIC_EnableIRQ(TIM2_IRQn);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable DMA controller clock
|
||||
*/
|
||||
static void MX_DMA_Init(void) {
|
||||
/* DMA controller clock enable */
|
||||
__HAL_RCC_DMA1_CLK_ENABLE()
|
||||
;
|
||||
|
||||
/* DMA interrupt init */
|
||||
/* DMA1_Channel1_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
|
||||
/* DMA1_Channel6_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
|
||||
/* DMA1_Channel7_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
|
||||
|
||||
}
|
||||
|
||||
/** Configure pins as
|
||||
* Analog
|
||||
* Input
|
||||
* Output
|
||||
* EVENT_OUT
|
||||
* EXTI
|
||||
* Free pins are configured automatically as Analog
|
||||
PB0 ------> ADCx_IN8
|
||||
PB1 ------> ADCx_IN9
|
||||
*/
|
||||
static void MX_GPIO_Init(void) {
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE()
|
||||
;
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
;
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
;
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_RESET);
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
/*Configure GPIO pins : PD0 PD1 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PA0 PA1 PA2 PA3
|
||||
PA4 PA5 PA10 PA15 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_10
|
||||
| GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_15;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
//Set PA 11 and PA 12 to GND to stop usb detection
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pins : KEY_B_Pin KEY_A_Pin */
|
||||
GPIO_InitStruct.Pin = KEY_B_Pin | KEY_A_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : TIP_TEMP_Pin VIN_Pin PB2 */
|
||||
GPIO_InitStruct.Pin = TIP_TEMP_Pin | VIN_Pin | GPIO_PIN_2;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : OLED_RESET_Pin */
|
||||
GPIO_InitStruct.Pin = OLED_RESET_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(OLED_RESET_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : INT_Orientation_Pin INT_Movement_Pin */
|
||||
GPIO_InitStruct.Pin = INT_Orientation_Pin | INT_Movement_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP; //Technically the IMU is P-P but safer to pullup (very tiny current cost)
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/*Configure peripheral I/O remapping */
|
||||
__HAL_AFIO_REMAP_PD01_ENABLE();
|
||||
//^ remap XTAL so that pins can be analog (all input buffers off).
|
||||
// reduces power consumption
|
||||
|
||||
}
|
||||
39
workspace/TS100/src/Translation.c
Normal file
39
workspace/TS100/src/Translation.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Translation.c
|
||||
*
|
||||
* Created on: 31Aug.,2017
|
||||
* Author: Ben V. Brown
|
||||
*/
|
||||
|
||||
const char* SettingsLongNames[12] =
|
||||
{
|
||||
/*These are all the help text for all the settings.*/
|
||||
/*All must start with 6 spaces so they come on screen nicely.*/
|
||||
"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>",
|
||||
"Sleep Temperature <C>",
|
||||
"Sleep Timeout <Minutes>",
|
||||
"Shutdown Timeout <Minutes>",
|
||||
"Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>",
|
||||
"Display detailed information in a smaller font.",
|
||||
"Display Orientation <A. Automatic L. Left Handed R. Right Handed>",
|
||||
"Enable front key enters boost mode 450C mode when soldering",
|
||||
"Temperature when in \"boost\" mode",
|
||||
"Automatically starts the iron into soldering on power up. T=Soldering, S= Sleep mode,F=Off",
|
||||
"Blink the temperature on the cooling screen while the tip is still hot.",
|
||||
"Reset all settings",
|
||||
};
|
||||
|
||||
const char* SettingsShortNames[12] = {
|
||||
"PWRSC ",
|
||||
"STMP ",
|
||||
"STME ",
|
||||
"SHTME ",
|
||||
"MSENSE ",
|
||||
"ADVDSP ",
|
||||
"DSPROT ",
|
||||
"BOOST ",
|
||||
"BTMP ",
|
||||
"ASTART ",
|
||||
"CLBLNK ",
|
||||
"RESET? "
|
||||
};
|
||||
52
workspace/TS100/src/freertos.c
Normal file
52
workspace/TS100/src/freertos.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* File Name : freertos.c
|
||||
* Description : Code for freertos applications
|
||||
******************************************************************************
|
||||
* This notice applies to any and all portions of this file
|
||||
* that are not between comment pairs USER CODE BEGIN and
|
||||
* USER CODE END. Other portions of this file, whether
|
||||
* inserted by the user or by software development tools
|
||||
* are owned by their respective copyright owners.
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
196
workspace/TS100/src/gui.cpp
Normal file
196
workspace/TS100/src/gui.cpp
Normal file
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* gui.cpp
|
||||
*
|
||||
* Created on: 3Sep.,2017
|
||||
* Author: Ben V. Brown
|
||||
*/
|
||||
|
||||
#include "gui.h"
|
||||
|
||||
static void settings_setInputVRange(void);
|
||||
static void settings_displayInputVRange(void);
|
||||
static void settings_setSleepTemp(void);
|
||||
static void settings_displaySleepTemp(void);
|
||||
static void settings_setSleepTime(void);
|
||||
static void settings_displaySleepTime(void);
|
||||
static void settings_setShutdownTime(void);
|
||||
static void settings_displayShutdownTime(void);
|
||||
static void settings_setSensitivity(void);
|
||||
static void settings_displaySensitivity(void);
|
||||
static void settings_setAdvancedScreens(void);
|
||||
static void settings_displayAdvancedScreens(void);
|
||||
static void settings_setDisplayRotation(void);
|
||||
static void settings_displayDisplayRotation(void);
|
||||
static void settings_setBoostModeEnabled(void);
|
||||
static void settings_displayBoostModeEnabled(void);
|
||||
static void settings_setBoostTemp(void);
|
||||
static void settings_displayBoostTemp(void);
|
||||
static void settings_setAutomaticStartMode(void);
|
||||
static void settings_displayAutomaticStartMode(void);
|
||||
static void settings_setCoolingBlinkEnabled(void);
|
||||
static void settings_displayCoolingBlinkEnabled(void);
|
||||
static void settings_setResetSettings(void);
|
||||
static void settings_displayResetSettings(void);
|
||||
|
||||
|
||||
|
||||
bool settingsResetRequest=false;
|
||||
const menuitem settingsMenu[] = { /*Struct used for all settings options in the settings menu*/
|
||||
{ (const char*) SettingsLongNames[0], { settings_setInputVRange }, { settings_displayInputVRange } },/*Voltage input*/
|
||||
{ (const char*) SettingsLongNames[1], { settings_setSleepTemp }, { settings_displaySleepTemp } }, /*Sleep Temp*/
|
||||
{ (const char*) SettingsLongNames[2], { settings_setSleepTime }, { settings_displaySleepTime } }, /*Sleep Time*/
|
||||
{ (const char*) SettingsLongNames[3], { settings_setShutdownTime }, { settings_displayShutdownTime } }, /*Shutdown Time*/
|
||||
{ (const char*) SettingsLongNames[4], { settings_setSensitivity }, { settings_displaySensitivity } },/* Motion Sensitivity*/
|
||||
{ (const char*) SettingsLongNames[4], { settings_setAdvancedScreens }, { settings_displayAdvancedScreens } },/* Advanced screens*/
|
||||
{ (const char*) SettingsLongNames[6], { settings_setDisplayRotation }, { settings_displayDisplayRotation } }, /**/
|
||||
{ (const char*) SettingsLongNames[7], { settings_setBoostModeEnabled }, { settings_displayBoostModeEnabled } }, /**/
|
||||
{ (const char*) SettingsLongNames[8], { settings_setBoostTemp }, { settings_displayBoostTemp } }, /**/
|
||||
{ (const char*) SettingsLongNames[9], { settings_setAutomaticStartMode }, { settings_displayAutomaticStartMode } },/**/
|
||||
{ (const char*) SettingsLongNames[10], { settings_setCoolingBlinkEnabled }, { settings_displayCoolingBlinkEnabled } }, /**/
|
||||
{ (const char*) SettingsLongNames[11], { settings_setResetSettings }, { settings_displayResetSettings } }, /**/
|
||||
{ NULL, { NULL }, { NULL } } //end of menu marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void settings_setInputVRange(void) {
|
||||
systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5;
|
||||
}
|
||||
static void settings_displayInputVRange(void) {
|
||||
lcd.print(SettingsShortNames[0]);
|
||||
if (systemSettings.cutoutSetting) {
|
||||
lcd.drawChar('0' + 2 + systemSettings.cutoutSetting);
|
||||
lcd.drawChar('S');
|
||||
} else {
|
||||
lcd.print("DC");
|
||||
}
|
||||
}
|
||||
|
||||
static void settings_setSleepTemp(void) {
|
||||
systemSettings.SleepTemp += 10;
|
||||
if (systemSettings.SleepTemp > 300)
|
||||
systemSettings.SleepTemp = 50;
|
||||
}
|
||||
static void settings_displaySleepTemp(void) {
|
||||
lcd.print(SettingsShortNames[1]);
|
||||
lcd.printNumber(systemSettings.SleepTemp, 3);
|
||||
}
|
||||
static void settings_setSleepTime(void) {
|
||||
++systemSettings.SleepTime; //Go up 1 minute at a time
|
||||
if (systemSettings.SleepTime > 16)
|
||||
systemSettings.SleepTime = 1; //can't set time over 30 mins
|
||||
//Remember that ^ is the time of no movement
|
||||
}
|
||||
static void settings_displaySleepTime(void) {
|
||||
lcd.print(SettingsShortNames[2]);
|
||||
if (systemSettings.SleepTime < 6) {
|
||||
lcd.printNumber(systemSettings.SleepTime * 10, 2);
|
||||
lcd.drawChar('S');
|
||||
} else {
|
||||
lcd.printNumber(systemSettings.SleepTime - 5, 2);
|
||||
lcd.drawChar('M');
|
||||
}
|
||||
}
|
||||
static void settings_setShutdownTime(void) {
|
||||
++systemSettings.ShutdownTime;
|
||||
if (systemSettings.ShutdownTime > 60)
|
||||
systemSettings.ShutdownTime = 0; //wrap to off
|
||||
}
|
||||
static void settings_displayShutdownTime(void) {
|
||||
lcd.print(SettingsShortNames[3]);
|
||||
lcd.printNumber(systemSettings.ShutdownTime, 2);
|
||||
}
|
||||
static void settings_setSensitivity(void) {
|
||||
systemSettings.sensitivity++;
|
||||
systemSettings.sensitivity = systemSettings.sensitivity % 10;
|
||||
}
|
||||
static void settings_displaySensitivity(void) {
|
||||
lcd.print(SettingsShortNames[4]);
|
||||
lcd.printNumber(systemSettings.sensitivity, 1);
|
||||
}
|
||||
|
||||
static void settings_setAdvancedScreens(void) {
|
||||
systemSettings.advancedScreens = !systemSettings.advancedScreens;
|
||||
}
|
||||
static void settings_displayAdvancedScreens(void) {
|
||||
lcd.print(SettingsShortNames[5]);
|
||||
if (systemSettings.advancedScreens)
|
||||
lcd.drawChar('T');
|
||||
else
|
||||
lcd.drawChar('F');
|
||||
}
|
||||
static void settings_setDisplayRotation(void) {
|
||||
systemSettings.OrientationMode++;
|
||||
systemSettings.OrientationMode = systemSettings.OrientationMode % 3;
|
||||
}
|
||||
static void settings_displayDisplayRotation(void) {
|
||||
lcd.print(SettingsShortNames[6]);
|
||||
switch (systemSettings.OrientationMode) {
|
||||
case 0:
|
||||
lcd.drawChar('R');
|
||||
break;
|
||||
case 1:
|
||||
lcd.drawChar('L');
|
||||
break;
|
||||
case 2:
|
||||
lcd.drawChar('A');
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
static void settings_setBoostModeEnabled(void) {
|
||||
systemSettings.boostModeEnabled = !systemSettings.boostModeEnabled;
|
||||
}
|
||||
static void settings_displayBoostModeEnabled(void) {
|
||||
lcd.print(SettingsShortNames[7]);
|
||||
if (systemSettings.boostModeEnabled)
|
||||
lcd.drawChar('T');
|
||||
else
|
||||
lcd.drawChar('F');
|
||||
}
|
||||
static void settings_setBoostTemp(void) {
|
||||
systemSettings.BoostTemp += 10; //Go up 10C at a time
|
||||
if (systemSettings.BoostTemp > 450)
|
||||
systemSettings.BoostTemp = 250; //loop back at 250
|
||||
}
|
||||
static void settings_displayBoostTemp(void) {
|
||||
lcd.print(SettingsShortNames[8]);
|
||||
lcd.printNumber(systemSettings.BoostTemp, 3);
|
||||
}
|
||||
static void settings_setAutomaticStartMode(void) {
|
||||
systemSettings.autoStartMode++;
|
||||
systemSettings.autoStartMode %= 2;
|
||||
}
|
||||
static void settings_displayAutomaticStartMode(void) {
|
||||
lcd.print(SettingsShortNames[9]);
|
||||
switch (systemSettings.autoStartMode) {
|
||||
case 0:
|
||||
lcd.drawChar('F');
|
||||
break;
|
||||
case 1:
|
||||
lcd.drawChar('T');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
static void settings_setCoolingBlinkEnabled(void) {
|
||||
systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink;
|
||||
}
|
||||
static void settings_displayCoolingBlinkEnabled(void) {
|
||||
lcd.print(SettingsShortNames[10]);
|
||||
if (systemSettings.coolingTempBlink)
|
||||
lcd.drawChar('T');
|
||||
else
|
||||
lcd.drawChar('F');
|
||||
}
|
||||
static void settings_setResetSettings(void) {
|
||||
settingsResetRequest = !settingsResetRequest;
|
||||
}
|
||||
static void settings_displayResetSettings(void) {
|
||||
lcd.print(SettingsShortNames[11]);
|
||||
if (settingsResetRequest)
|
||||
lcd.drawChar('T');
|
||||
else
|
||||
lcd.drawChar('F');
|
||||
}
|
||||
33
workspace/TS100/src/gui.h
Normal file
33
workspace/TS100/src/gui.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* gui.h
|
||||
*
|
||||
* Created on: 3Sep.,2017
|
||||
* Author: Ben V. Brown
|
||||
*/
|
||||
|
||||
#ifndef GUI_H_
|
||||
#define GUI_H_
|
||||
|
||||
//GUI holds the menu structure and all its methods for the menu itself
|
||||
|
||||
#include "main.hpp"
|
||||
#include "Settings.h"
|
||||
#include "Translation.h"
|
||||
//Declarations for all the methods for the settings menu (at end of this file)
|
||||
|
||||
|
||||
//Wrapper for holding a function pointer
|
||||
typedef struct state_func_t {
|
||||
void (*func)(void);
|
||||
} state_func;
|
||||
|
||||
//Struct for holding the function pointers and descriptions
|
||||
typedef struct {
|
||||
const char *description;
|
||||
const state_func incrementHandler;
|
||||
const state_func draw;
|
||||
} menuitem;
|
||||
|
||||
extern bool settingsResetRequest;
|
||||
extern const menuitem settingsMenu[];
|
||||
#endif /* GUI_H_ */
|
||||
121
workspace/TS100/src/hardware.c
Normal file
121
workspace/TS100/src/hardware.c
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* hardware.c
|
||||
*
|
||||
* Created on: 2Sep.,2017
|
||||
* Author: Ben V. Brown
|
||||
*/
|
||||
|
||||
//These are all the functions for interacting with the hardware
|
||||
|
||||
#include "hardware.h"
|
||||
volatile uint16_t PWMSafetyTimer = 0;
|
||||
|
||||
uint16_t getHandleTemperature() {
|
||||
// We return the current handle temperature in X10 C
|
||||
// TMP36 in handle, 0.5V offset and then 10mV per deg C (0.75V @ 25C for example)
|
||||
// STM32 = 4096 count @ 3.3V input -> But
|
||||
// We oversample by 32/(2^3) = 4 times oversampling
|
||||
// Therefore 16384 is the 3.3V input, so 0.201416015625 mV per count
|
||||
// So we need to subtract an offset of 0.5V to center on 0C (2482 counts)
|
||||
//
|
||||
uint16_t result = getADC(0);
|
||||
if (result < 2482)
|
||||
return 0;
|
||||
result -= 2482;
|
||||
result /= 5; //convert to X10 C
|
||||
return result;
|
||||
|
||||
}
|
||||
uint16_t tipMeasurementToC(uint16_t raw) {
|
||||
return (raw / 33) - 16;
|
||||
//Surprisingly that appears to be a fairly good linear best fit
|
||||
}
|
||||
uint16_t ctoTipMeasurement(uint16_t temp) {
|
||||
return (temp + 16) * 33;
|
||||
}
|
||||
uint16_t getTipInstantTemperature() {
|
||||
uint16_t sum = 0;
|
||||
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_1);
|
||||
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_2);
|
||||
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_3);
|
||||
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_4);
|
||||
return sum;
|
||||
|
||||
}
|
||||
uint16_t getTipRawTemp(uint8_t instant) {
|
||||
#define filterDepth1 2
|
||||
#define filterDepth2 8
|
||||
static uint16_t filterLayer1[filterDepth1];
|
||||
static uint16_t filterLayer2[filterDepth2];
|
||||
static uint8_t index = 0;
|
||||
static uint8_t indexFilter = 0;
|
||||
|
||||
if (instant) {
|
||||
uint16_t itemp = getTipInstantTemperature();
|
||||
filterLayer1[index] = itemp;
|
||||
index = (index + 1) % filterDepth1;
|
||||
uint32_t total = 0;
|
||||
for (uint8_t i = 0; i < filterDepth1; i++)
|
||||
total += filterLayer1[i];
|
||||
|
||||
return total / filterDepth1;
|
||||
} else {
|
||||
uint32_t total = 0;
|
||||
for (uint8_t i = 0; i < filterDepth1; i++)
|
||||
total += filterLayer1[i];
|
||||
filterLayer2[indexFilter] = total / filterDepth1;
|
||||
indexFilter = (indexFilter + 1) % filterDepth2;
|
||||
total = 0;
|
||||
for (uint8_t i = 0; i < filterDepth2; i++)
|
||||
total += filterLayer2[i];
|
||||
|
||||
return total / filterDepth2;
|
||||
}
|
||||
}
|
||||
uint16_t getInputVoltageX10() {
|
||||
//ADC maximum is 16384 == 3.3V at input == 28V at VIN
|
||||
//Therefore we can divide down from there
|
||||
//Ideal term is 57.69.... 58 is quite close
|
||||
return getADC(1) / 58;
|
||||
}
|
||||
void setTipPWM(uint8_t pulse) {
|
||||
PWMSafetyTimer = 100; //This is decremented in the handler for PWM so that the tip pwm is disabled if the PID task is not scheduled often enough.
|
||||
if (pulse > 100)
|
||||
pulse = 100;
|
||||
if (pulse) {
|
||||
htim2.Instance->CCR4 = pulse;
|
||||
} else {
|
||||
htim2.Instance->CCR4 = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Thse are called by the HAL after the corresponding events from the system timers.
|
||||
|
||||
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
|
||||
//Period has elapsed
|
||||
if (htim->Instance == TIM2) {
|
||||
//we want to turn on the output again
|
||||
PWMSafetyTimer--; //We decrement this safety value so that lockups in the scheduler will not cause the PWM to become locked in an active driving state.
|
||||
//While we could assume this could never happened, its a small price for increased safety
|
||||
if (htim2.Instance->CCR4 && PWMSafetyTimer) {
|
||||
htim3.Instance->CCR1 = 50;
|
||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
|
||||
} else {
|
||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
|
||||
htim3.Instance->CCR1 = 0;
|
||||
}
|
||||
} else if (htim->Instance == TIM1) {
|
||||
HAL_IncTick();
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) {
|
||||
if (htim->Instance == TIM2) {
|
||||
//This was a pulse event
|
||||
if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) {
|
||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
|
||||
htim3.Instance->CCR1 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
849
workspace/TS100/src/main.cpp
Normal file
849
workspace/TS100/src/main.cpp
Normal file
@@ -0,0 +1,849 @@
|
||||
// By Ben V. Brown - V2.0 of the TS100 firmware
|
||||
#include <main.hpp>
|
||||
#include <MMA8652FC.hpp>
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "OLED.hpp"
|
||||
#include "Settings.h"
|
||||
#include "Translation.h"
|
||||
#include "string.h"
|
||||
#include "gui.h"
|
||||
#include "stdlib.h"
|
||||
//C++ objects
|
||||
OLED lcd(&hi2c1);
|
||||
MMA8652FC accel(&hi2c1);
|
||||
|
||||
//File local variables
|
||||
uint16_t currentlyActiveTemperatureTarget = 0;
|
||||
uint32_t lastMovementTime = 0;
|
||||
uint32_t lastButtonTime = 0;
|
||||
|
||||
// FreeRTOS variables
|
||||
osThreadId GUITaskHandle;
|
||||
osThreadId PIDTaskHandle;
|
||||
osThreadId ROTTaskHandle;
|
||||
osThreadId MOVTaskHandle;
|
||||
SemaphoreHandle_t rotationChangedSemaphore = NULL;
|
||||
SemaphoreHandle_t accelDataAvailableSemaphore = NULL;
|
||||
|
||||
void startGUITask(void const * argument);
|
||||
void startPIDTask(void const * argument);
|
||||
void startMOVTask(void const * argument);
|
||||
void startRotationTask(void const * argument);
|
||||
// End FreeRTOS
|
||||
|
||||
//Main inits hardware then hands over to the FreeRTOS kernel
|
||||
int main(void) {
|
||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||
HAL_Init();
|
||||
Setup_HAL(); //Setup all the HAL objects
|
||||
setTipPWM(0);
|
||||
lcd.initialize(); //start up the LCD
|
||||
lcd.setFont(0); //default to bigger font
|
||||
accel.initalize(); //this sets up the I2C registers and loads up the default settings
|
||||
lcd.clearScreen(); //Ensure the buffer starts clean
|
||||
lcd.setCursor(0, 0); //Position the cursor at the 0,0 (top left)
|
||||
lcd.setFont(1); //small font
|
||||
lcd.print((char*) "V2.00"); //Print version number
|
||||
lcd.setCursor(0, 8); //second line
|
||||
lcd.print(__DATE__); //print the compile date
|
||||
lcd.refresh();
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
HAL_Delay(500);
|
||||
restoreSettings(); //load the settings from flash
|
||||
showBootLogoIfavailable();
|
||||
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
/* Create the thread(s) */
|
||||
/* definition and creation of GUITask */
|
||||
osThreadDef(GUITask, startGUITask, osPriorityBelowNormal, 0, 512);
|
||||
GUITaskHandle = osThreadCreate(osThread(GUITask), NULL);
|
||||
|
||||
/* definition and creation of PIDTask */
|
||||
osThreadDef(PIDTask, startPIDTask, osPriorityHigh, 0, 256);
|
||||
PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL);
|
||||
|
||||
/* definition and creation of ROTTask */
|
||||
osThreadDef(ROTTask, startRotationTask, osPriorityLow, 0, 256);
|
||||
ROTTaskHandle = osThreadCreate(osThread(ROTTask), NULL);
|
||||
/* definition and creation of MOVTask */
|
||||
osThreadDef(MOVTask, startMOVTask, osPriorityNormal, 0, 256);
|
||||
MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL);
|
||||
|
||||
/* Create the objects*/
|
||||
rotationChangedSemaphore = xSemaphoreCreateBinary(); // Used to unlock rotation thread
|
||||
accelDataAvailableSemaphore = xSemaphoreCreateBinary(); // Used to unlock the movement thread
|
||||
/* Start scheduler */
|
||||
osKernelStart();
|
||||
|
||||
/* We should never get here as control is now taken by the scheduler */
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
enum ButtonState {
|
||||
BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
|
||||
BUTTON_F_SHORT = 1, /* User has pressed the front button*/
|
||||
BUTTON_B_SHORT = 2, /* User has pressed the back button*/
|
||||
BUTTON_F_LONG = 4, /* User is holding the front button*/
|
||||
BUTTON_B_LONG = 8, /* User is holding the back button*/
|
||||
BUTTON_BOTH = 16, /* User has pressed both buttons*/
|
||||
|
||||
/*
|
||||
* Note:
|
||||
* Pressed means press + release, we trigger on a full \__/ pulse
|
||||
* holding means it has gone low, and been low for longer than filter time
|
||||
*/
|
||||
};
|
||||
ButtonState getButtonState() {
|
||||
/*
|
||||
* Read in the buttons and then determine if a state change needs to occur
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the previous state was 00 Then we want to latch the new state if different & update time
|
||||
* If the previous state was !00 Then we want to search if we trigger long press (buttons still down), or if release we trigger press (downtime>filter)
|
||||
*/
|
||||
static uint8_t previousState = 0;
|
||||
static uint32_t previousStateChange = 0;
|
||||
const uint16_t timeout = 400;
|
||||
uint8_t currentState;
|
||||
currentState = (HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ? 1 : 0) << 0;
|
||||
currentState |= (HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ? 1 : 0) << 1;
|
||||
|
||||
if (currentState)
|
||||
lastButtonTime = HAL_GetTick();
|
||||
if (currentState == previousState) {
|
||||
if (currentState == 0)
|
||||
return BUTTON_NONE;
|
||||
if ((HAL_GetTick() - previousStateChange) > timeout) {
|
||||
// User has been holding the button down
|
||||
// We want to send a buttong is held message
|
||||
if (currentState == 0x01)
|
||||
return BUTTON_F_LONG;
|
||||
else if (currentState == 0x02)
|
||||
return BUTTON_B_LONG;
|
||||
else
|
||||
return BUTTON_NONE; // Both being held case, we dont long hold this
|
||||
} else
|
||||
return BUTTON_NONE;
|
||||
} else {
|
||||
// A change in button state has occurred
|
||||
ButtonState retVal = BUTTON_NONE;
|
||||
if (currentState) {
|
||||
//User has pressed a button down (nothing done on down)
|
||||
|
||||
} else {
|
||||
// User has released buttons
|
||||
// If they previously had the buttons down we want to check if they were < long hold and trigger a press
|
||||
if ((HAL_GetTick() - previousStateChange) < timeout) {
|
||||
// The user didn't hold the button for long
|
||||
// So we send button press
|
||||
|
||||
if (previousState == 0x01)
|
||||
retVal = BUTTON_F_SHORT;
|
||||
else if (previousState == 0x02)
|
||||
retVal = BUTTON_B_SHORT;
|
||||
else
|
||||
retVal = BUTTON_BOTH; // Both being held case
|
||||
}
|
||||
|
||||
}
|
||||
previousState = currentState;
|
||||
previousStateChange = HAL_GetTick();
|
||||
return retVal;
|
||||
}
|
||||
return BUTTON_NONE;
|
||||
}
|
||||
|
||||
static void waitForButtonPress() {
|
||||
//we are just lazy and sleep until user confirms button press
|
||||
//This also eats the button press event!
|
||||
for (;;) {
|
||||
ButtonState buttons = getButtonState();
|
||||
if (buttons)
|
||||
return;
|
||||
osDelay(100);
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//returns true if undervoltage has occured
|
||||
static bool checkVoltageForExit() {
|
||||
uint16_t v = getInputVoltageX10();
|
||||
if ((v < lookupVoltageLevel(systemSettings.cutoutSetting))) {
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
if (systemSettings.advancedScreens) {
|
||||
lcd.setFont(1);
|
||||
lcd.print("Undervoltage");
|
||||
lcd.setCursor(0, 8);
|
||||
lcd.print("Input V: ");
|
||||
lcd.printNumber(getInputVoltageX10() / 10, 2);
|
||||
lcd.drawChar('.');
|
||||
lcd.printNumber(getInputVoltageX10() % 10, 1);
|
||||
lcd.print("V");
|
||||
|
||||
} else {
|
||||
lcd.setFont(0);
|
||||
lcd.print("DC LOW");
|
||||
}
|
||||
|
||||
lcd.refresh();
|
||||
currentlyActiveTemperatureTarget = 0;
|
||||
waitForButtonPress();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gui_solderingTempAdjust() {
|
||||
uint32_t lastChange = HAL_GetTick();
|
||||
currentlyActiveTemperatureTarget = 0;
|
||||
for (;;) {
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.clearScreen();
|
||||
lcd.setFont(0);
|
||||
ButtonState buttons = getButtonState();
|
||||
if (buttons)
|
||||
lastChange = HAL_GetTick();
|
||||
switch (buttons) {
|
||||
case BUTTON_NONE:
|
||||
//stay
|
||||
break;
|
||||
case BUTTON_BOTH:
|
||||
//exit
|
||||
return;
|
||||
break;
|
||||
case BUTTON_B_LONG:
|
||||
|
||||
break;
|
||||
case BUTTON_F_LONG:
|
||||
|
||||
break;
|
||||
case BUTTON_F_SHORT:
|
||||
if (lcd.getRotation()) {
|
||||
systemSettings.SolderingTemp += 10; //add 10C
|
||||
if (systemSettings.SolderingTemp > 450)
|
||||
systemSettings.SolderingTemp = 450;
|
||||
} else {
|
||||
systemSettings.SolderingTemp -= 10; //sub 10C
|
||||
if (systemSettings.SolderingTemp <= 50)
|
||||
systemSettings.SolderingTemp = 50;
|
||||
}
|
||||
break;
|
||||
case BUTTON_B_SHORT:
|
||||
if (!lcd.getRotation()) {
|
||||
systemSettings.SolderingTemp += 10; //add 10C
|
||||
if (systemSettings.SolderingTemp > 450)
|
||||
systemSettings.SolderingTemp = 450;
|
||||
} else {
|
||||
systemSettings.SolderingTemp -= 10; //sub 10C
|
||||
if (systemSettings.SolderingTemp <= 50)
|
||||
systemSettings.SolderingTemp = 50;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (HAL_GetTick() - lastChange > 1500)
|
||||
return; // exit if user just doesn't press anything for a bit
|
||||
lcd.drawChar('<');
|
||||
lcd.drawChar(' ');
|
||||
lcd.printNumber(systemSettings.SolderingTemp, 3);
|
||||
lcd.drawSymbol(1);
|
||||
lcd.drawChar('>');
|
||||
lcd.refresh();
|
||||
osDelay(10);
|
||||
}
|
||||
}
|
||||
static void gui_settingsMenu() {
|
||||
//Draw the settings menu and provide iteration support etc
|
||||
uint8_t currentScreen = 0;
|
||||
uint32_t autoRepeatTimer = 0;
|
||||
settingsResetRequest = false;
|
||||
bool earlyExit = false;
|
||||
uint32_t descriptionStart = 0;
|
||||
while ((settingsMenu[currentScreen].description != NULL) && earlyExit == false) {
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
if (HAL_GetTick() - lastButtonTime < 4000) {
|
||||
settingsMenu[currentScreen].draw.func();
|
||||
descriptionStart = 0;
|
||||
} else {
|
||||
//Draw description
|
||||
//draw string starting from descriptionOffset
|
||||
lcd.setFont(0);
|
||||
int16_t maxOffset = strlen(settingsMenu[currentScreen].description);
|
||||
if (!descriptionStart)
|
||||
descriptionStart = HAL_GetTick();
|
||||
int16_t descriptionOffset = ((HAL_GetTick() - descriptionStart) / 150) % maxOffset;
|
||||
lcd.setCursor(12 * (7 - descriptionOffset), 0);
|
||||
lcd.print(settingsMenu[currentScreen].description);
|
||||
}
|
||||
ButtonState buttons = getButtonState();
|
||||
if (descriptionStart)
|
||||
buttons = BUTTON_NONE;
|
||||
switch (buttons) {
|
||||
case BUTTON_BOTH:
|
||||
earlyExit = true; //will make us exit next loop
|
||||
break;
|
||||
case BUTTON_F_SHORT:
|
||||
//increment
|
||||
settingsMenu[currentScreen].incrementHandler.func();
|
||||
break;
|
||||
case BUTTON_B_SHORT:
|
||||
currentScreen++;
|
||||
break;
|
||||
case BUTTON_F_LONG:
|
||||
if (HAL_GetTick() - autoRepeatTimer > 200) {
|
||||
settingsMenu[currentScreen].incrementHandler.func();
|
||||
autoRepeatTimer = HAL_GetTick();
|
||||
}
|
||||
break;
|
||||
case BUTTON_B_LONG:
|
||||
if (HAL_GetTick() - autoRepeatTimer > 200) {
|
||||
currentScreen++;
|
||||
autoRepeatTimer = HAL_GetTick();
|
||||
}
|
||||
break;
|
||||
case BUTTON_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
lcd.refresh(); //update the LCD
|
||||
osDelay(20); //pause for a sec
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
|
||||
}
|
||||
if (settingsResetRequest)
|
||||
resetSettings();
|
||||
else
|
||||
saveSettings();
|
||||
}
|
||||
static void gui_showTipTempWarning() {
|
||||
for (;;) {
|
||||
uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0));
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
if (systemSettings.advancedScreens) {
|
||||
lcd.setFont(1);
|
||||
lcd.print("WARNING! TIP HOT!");
|
||||
lcd.setCursor(0, 8);
|
||||
lcd.print("Tip Temp: ");
|
||||
lcd.printNumber(tipTemp, 3);
|
||||
lcd.print("C");
|
||||
} else {
|
||||
lcd.setFont(0);
|
||||
|
||||
lcd.print("WARN!");
|
||||
lcd.printNumber(tipTemp, 3);
|
||||
}
|
||||
if (systemSettings.coolingTempBlink) {
|
||||
if (HAL_GetTick() % 500 < 250)
|
||||
lcd.clearScreen();
|
||||
}
|
||||
lcd.refresh();
|
||||
ButtonState buttons = getButtonState();
|
||||
if (buttons == BUTTON_B_SHORT || buttons == BUTTON_F_SHORT || buttons == BUTTON_BOTH)
|
||||
return;
|
||||
if (tipTemp < 30)
|
||||
return;
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
osDelay(200);
|
||||
}
|
||||
|
||||
}
|
||||
static int gui_SolderingSleepingMode() {
|
||||
//Drop to sleep temperature and display until movement or button press
|
||||
|
||||
for (;;) {
|
||||
ButtonState buttons = getButtonState();
|
||||
if (buttons)
|
||||
return 0;
|
||||
if ((HAL_GetTick() - lastMovementTime < 1000) || (HAL_GetTick() - lastButtonTime < 1000))
|
||||
return 0; //user moved or pressed a button, go back to soldering
|
||||
if (checkVoltageForExit())
|
||||
return 1; //return non-zero on error
|
||||
|
||||
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.SleepTemp);
|
||||
//draw the lcd
|
||||
uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0));
|
||||
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
if (systemSettings.advancedScreens) {
|
||||
lcd.setFont(1);
|
||||
lcd.print("Sleeping...");
|
||||
lcd.setCursor(0, 8);
|
||||
lcd.print("Tip:");
|
||||
lcd.printNumber(tipTemp, 3);
|
||||
lcd.print(" VIN:");
|
||||
lcd.printNumber(getInputVoltageX10() / 10, 2);
|
||||
lcd.drawChar('.');
|
||||
lcd.printNumber(getInputVoltageX10() % 10, 1);
|
||||
lcd.print("V");
|
||||
} else {
|
||||
lcd.setFont(0);
|
||||
lcd.print("SLEEP");
|
||||
lcd.printNumber(tipTemp, 3);
|
||||
}
|
||||
if (lastMovementTime)
|
||||
if (((uint32_t) (HAL_GetTick() - lastMovementTime))
|
||||
> (uint32_t) (systemSettings.ShutdownTime * 60 * 1000)) {
|
||||
//shutdown
|
||||
currentlyActiveTemperatureTarget = 0;
|
||||
return 1; //we want to exit soldering mode
|
||||
}
|
||||
lcd.refresh();
|
||||
osDelay(100);
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
|
||||
}
|
||||
}
|
||||
static void gui_solderingMode() {
|
||||
/*
|
||||
* * Soldering (gui_solderingMode)
|
||||
* -> Main loop where we draw temp, and animations
|
||||
* --> User presses buttons and they goto the temperature adjust screen
|
||||
* ---> Display the current setpoint temperature
|
||||
* ---> Use buttons to change forward and back on temperature
|
||||
* ---> Both buttons or timeout for exiting
|
||||
* --> Long hold front button to enter boost mode
|
||||
* ---> Just temporarily sets the system into the alternate temperature for PID control
|
||||
* --> Long hold back button to exit
|
||||
* --> Double button to exit
|
||||
*/
|
||||
bool boostModeOn = false;
|
||||
uint32_t sleepThres = 0;
|
||||
if (systemSettings.SleepTime < 6)
|
||||
sleepThres = systemSettings.SleepTime * 10 * 1000;
|
||||
else
|
||||
sleepThres = (systemSettings.SleepTime - 5) * 60 * 1000;
|
||||
for (;;) {
|
||||
uint16_t tipTemp = getTipRawTemp(0);
|
||||
|
||||
ButtonState buttons = getButtonState();
|
||||
switch (buttons) {
|
||||
case BUTTON_NONE:
|
||||
//stay
|
||||
boostModeOn = false;
|
||||
break;
|
||||
case BUTTON_BOTH:
|
||||
//exit
|
||||
return;
|
||||
break;
|
||||
case BUTTON_B_LONG:
|
||||
return; //exit on back long hold
|
||||
break;
|
||||
case BUTTON_F_LONG:
|
||||
//if boost mode is enabled turn it on
|
||||
if (systemSettings.boostModeEnabled)
|
||||
boostModeOn = true;
|
||||
break;
|
||||
case BUTTON_F_SHORT:
|
||||
case BUTTON_B_SHORT: {
|
||||
uint16_t oldTemp = systemSettings.SolderingTemp;
|
||||
gui_solderingTempAdjust(); //goto adjust temp mode
|
||||
if (oldTemp != systemSettings.SolderingTemp) {
|
||||
saveSettings(); //only save on change
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
//else we update the screen information
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.clearScreen();
|
||||
lcd.setFont(0);
|
||||
if (tipTemp > 16300) {
|
||||
lcd.print("BAD TIP");
|
||||
lcd.refresh();
|
||||
currentlyActiveTemperatureTarget = 0;
|
||||
waitForButtonPress();
|
||||
return;
|
||||
} else {
|
||||
lcd.printNumber(tipMeasurementToC(tipTemp), 3);
|
||||
lcd.drawSymbol(1);
|
||||
if (boostModeOn)
|
||||
lcd.drawSymbol(2);
|
||||
//6 gap
|
||||
lcd.drawChar(' ');
|
||||
//7 battery
|
||||
if (systemSettings.cutoutSetting) {
|
||||
//User is on a lithium battery
|
||||
//we need to calculate which of the 10 levels they are on
|
||||
uint8_t cellCount = systemSettings.cutoutSetting + 2;
|
||||
uint16_t cellV = getInputVoltageX10() / cellCount;
|
||||
//Should give us approx cell voltage X10
|
||||
//Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
|
||||
if (cellV < 33)
|
||||
cellV = 33;
|
||||
cellV -= 33; //Should leave us a number of 0-9
|
||||
if (cellV > 9)
|
||||
cellV = 9;
|
||||
lcd.drawBattery(cellV + 1);
|
||||
}
|
||||
//8 ^V indicators
|
||||
|
||||
}
|
||||
// Draw heating/cooling symbols
|
||||
|
||||
//Update the setpoints for the temperature
|
||||
if (boostModeOn)
|
||||
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.BoostTemp);
|
||||
else
|
||||
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.SolderingTemp);
|
||||
|
||||
//Undervoltage test
|
||||
if (checkVoltageForExit()) {
|
||||
return;
|
||||
}
|
||||
|
||||
lcd.refresh();
|
||||
if (systemSettings.sensitivity)
|
||||
if (HAL_GetTick() - lastMovementTime > sleepThres && HAL_GetTick() - lastButtonTime > sleepThres) {
|
||||
if (gui_SolderingSleepingMode())
|
||||
return; //If the function returns non-0 then exit
|
||||
}
|
||||
osDelay(100);
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* StartGUITask function */
|
||||
void startGUITask(void const * argument) {
|
||||
/*
|
||||
* Main program states:
|
||||
*
|
||||
* * Soldering (gui_solderingMode)
|
||||
* -> Main loop where we draw temp, and animations
|
||||
* --> User presses buttons and they goto the temperature adjust screen
|
||||
* ---> Display the current setpoint temperature
|
||||
* ---> Use buttons to change forward and back on temperature
|
||||
* ---> Both buttons or timeout for exiting
|
||||
* --> Long hold front button to enter boost mode
|
||||
* ---> Just temporarily sets the system into the alternate temperature for PID control
|
||||
* --> Long hold back button to exit
|
||||
* --> Double button to exit
|
||||
* * Settings Menu (gui_settingsMenu)
|
||||
* -> Show setting name
|
||||
* --> If no button press for > 3 Seconds, scroll description
|
||||
* -> If user presses back button, adjust the setting
|
||||
* -> Currently the same as 1.x (future to make more depth based)
|
||||
*/
|
||||
|
||||
uint8_t animationStep = 0;
|
||||
uint8_t tempWarningState = 0;
|
||||
if (systemSettings.autoStartMode) {
|
||||
//jump directly to the autostart mode
|
||||
if (systemSettings.autoStartMode == 1)
|
||||
gui_solderingMode();
|
||||
}
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
osDelay(1000);
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
|
||||
/*for (;;) {
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.setFont(1);
|
||||
lcd.printNumber(lastMovementTime, 5);
|
||||
lcd.refresh();
|
||||
osDelay(100);
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
|
||||
}*/
|
||||
//^ Kept here for a way to block this thread
|
||||
for (;;) {
|
||||
ButtonState buttons = getButtonState();
|
||||
switch (buttons) {
|
||||
case BUTTON_NONE:
|
||||
//Do nothing
|
||||
break;
|
||||
case BUTTON_BOTH:
|
||||
//pressing both is ignored for now
|
||||
break;
|
||||
//Long presses are ignored for now
|
||||
case BUTTON_B_LONG:
|
||||
break;
|
||||
case BUTTON_F_LONG:
|
||||
gui_solderingTempAdjust();
|
||||
saveSettings();
|
||||
break;
|
||||
case BUTTON_F_SHORT:
|
||||
lcd.setFont(0);
|
||||
lcd.displayOnOff(true); //turn lcd on
|
||||
gui_solderingMode(); //enter soldering mode
|
||||
tempWarningState = 0; //make sure warning can show
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
osDelay(500);
|
||||
break;
|
||||
case BUTTON_B_SHORT:
|
||||
lcd.setFont(0);
|
||||
lcd.displayOnOff(true); //turn lcd on
|
||||
gui_settingsMenu(); //enter the settings menu
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
osDelay(500);
|
||||
//tempWarningState=0;//make sure warning can show
|
||||
break;
|
||||
}
|
||||
currentlyActiveTemperatureTarget = 0; //ensure tip is off
|
||||
|
||||
if (systemSettings.sensitivity) {
|
||||
if ((HAL_GetTick() - lastMovementTime) > 60000 && (HAL_GetTick() - lastButtonTime) > 60000)
|
||||
lcd.displayOnOff(false); // turn lcd off when no movement
|
||||
else if (HAL_GetTick() - lastMovementTime < 1000 || HAL_GetTick() - lastButtonTime < 1000) /*Use short time for test, and prevent lots of I2C writes for no need*/
|
||||
lcd.displayOnOff(true); //turn lcd back on
|
||||
|
||||
}
|
||||
uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0));
|
||||
if (tipTemp > 600)
|
||||
tipTemp = 0;
|
||||
if (tipTemp > 50) {
|
||||
if (tempWarningState == 0) {
|
||||
currentlyActiveTemperatureTarget = 0; //ensure tip is off
|
||||
gui_showTipTempWarning();
|
||||
tempWarningState = 1;
|
||||
}
|
||||
} else
|
||||
tempWarningState = 0;
|
||||
// Clear the lcd buffer
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
if (systemSettings.advancedScreens) {
|
||||
lcd.setFont(1);
|
||||
if (tipTemp > 470) {
|
||||
lcd.print("Tip Disconnected!");
|
||||
} else {
|
||||
lcd.print("Tip:");
|
||||
lcd.printNumber(tipTemp, 3);
|
||||
lcd.print(" ");
|
||||
lcd.print("Set:");
|
||||
lcd.printNumber(systemSettings.SolderingTemp, 3);
|
||||
}
|
||||
lcd.setCursor(0, 8);
|
||||
lcd.print("Input V: ");
|
||||
lcd.printNumber(getInputVoltageX10() / 10, 2);
|
||||
lcd.drawChar('.');
|
||||
lcd.printNumber(getInputVoltageX10() % 10, 1);
|
||||
lcd.print("V");
|
||||
|
||||
} else {
|
||||
lcd.setFont(0);
|
||||
|
||||
if (animationStep & 0x80) {
|
||||
if (animationStep & 0x08)
|
||||
lcd.drawArea(0, 0, 96, 8, Iron_RightArrow_UP);
|
||||
else
|
||||
lcd.drawArea(0, 0, 96, 8, Iron_RightArrow_DOWN);
|
||||
|
||||
lcd.drawArea(0, 8, 96, 8, Iron_Base);
|
||||
} else {
|
||||
if (animationStep & 0x08)
|
||||
lcd.drawArea(0, 0, 96, 8, Iron_LeftArrow_UP);
|
||||
else
|
||||
lcd.drawArea(0, 0, 96, 8, Iron_LeftArrow_DOWN);
|
||||
lcd.drawArea(0, 8, 96, 8, Iron_Base);
|
||||
}
|
||||
}
|
||||
|
||||
lcd.refresh();
|
||||
animationStep++;
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
osDelay(80);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* StartPIDTask function */
|
||||
void startPIDTask(void const * argument) {
|
||||
/*
|
||||
* We take the current tip temperature & evaluate the next step for the tip control PWM
|
||||
* Tip temperature is measured by getTipTemperature(1) so we get instant result
|
||||
* This comes in Cx10 format
|
||||
* We then control the tip temperature to aim for the setpoint in the settings struct
|
||||
*
|
||||
*/
|
||||
int32_t integralCount = 0;
|
||||
int32_t derivativeLastValue = 0;
|
||||
int32_t kp, ki, kd, kb;
|
||||
int32_t backoffOverflow = 0;
|
||||
kp = 20;
|
||||
ki = 50;
|
||||
kd = 40;
|
||||
kb = 0;
|
||||
const int32_t itermMax = 40;
|
||||
for (;;) {
|
||||
uint16_t rawTemp = getTipRawTemp(1); //get instantaneous reading
|
||||
if (currentlyActiveTemperatureTarget) {
|
||||
//Compute the PID loop in here
|
||||
//Because our values here are quite large for all measurements (0-16k ~= 33 counts per C)
|
||||
//P I & D are divisors, so inverse logic applies (beware)
|
||||
|
||||
int32_t rawTempError = currentlyActiveTemperatureTarget - rawTemp;
|
||||
int32_t ierror = (rawTempError / ki);
|
||||
integralCount += ierror;
|
||||
if (integralCount > (itermMax / 2))
|
||||
integralCount = itermMax / 2; //prevent too much lead
|
||||
else if (integralCount < -itermMax)
|
||||
integralCount = itermMax;
|
||||
|
||||
int32_t dInput = (rawTemp - derivativeLastValue);
|
||||
|
||||
/*Compute PID Output*/
|
||||
int32_t output = (rawTempError / kp);
|
||||
if (ki)
|
||||
output += integralCount;
|
||||
if (kd)
|
||||
output -= (dInput / kd);
|
||||
if (kb)
|
||||
output -= backoffOverflow / kb;
|
||||
|
||||
if (output > 100) {
|
||||
backoffOverflow = output;
|
||||
output = 100; //saturate
|
||||
} else if (output < 0) {
|
||||
backoffOverflow = output;
|
||||
output = 0;
|
||||
} else
|
||||
backoffOverflow = 0;
|
||||
|
||||
setTipPWM(output);
|
||||
} else {
|
||||
setTipPWM(0); //disable the output driver if the output is set to be off elsewhere
|
||||
integralCount = 0;
|
||||
backoffOverflow = 0;
|
||||
}
|
||||
derivativeLastValue = rawTemp; //store for next loop
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
osDelay(10); // 100 Hz temp loop
|
||||
}
|
||||
}
|
||||
#define MOVFilter 4
|
||||
void startMOVTask(void const * argument) {
|
||||
osDelay(4000); //wait for accel to stabilize
|
||||
int16_t datax[MOVFilter];
|
||||
int16_t datay[MOVFilter];
|
||||
int16_t dataz[MOVFilter];
|
||||
uint8_t currentPointer = 0;
|
||||
memset(datax, 0, MOVFilter);
|
||||
memset(datay, 0, MOVFilter);
|
||||
memset(dataz, 0, MOVFilter);
|
||||
int16_t tx, ty, tz;
|
||||
int32_t avgx, avgy, avgz;
|
||||
|
||||
for (;;) {
|
||||
int32_t threshold = 550 + (9 * 50);
|
||||
threshold -= systemSettings.sensitivity * 50;
|
||||
accel.getAxisReadings(&tx, &ty, &tz);
|
||||
|
||||
datax[currentPointer] = tx;
|
||||
datay[currentPointer] = ty;
|
||||
dataz[currentPointer] = tz;
|
||||
currentPointer = (currentPointer + 1) % MOVFilter;
|
||||
|
||||
//Only run the actual processing if the sensitivity is set (aka we are enabled)
|
||||
if (systemSettings.sensitivity) {
|
||||
//calculate averages
|
||||
avgx = avgy = avgz = 0;
|
||||
for (uint8_t i = 0; i < MOVFilter; i++) {
|
||||
avgx += datax[i];
|
||||
avgy += datay[i];
|
||||
avgz += dataz[i];
|
||||
}
|
||||
avgx /= MOVFilter;
|
||||
avgy /= MOVFilter;
|
||||
avgz /= MOVFilter;
|
||||
|
||||
//So now we have averages, we want to look if these are different by more than the threshold
|
||||
int32_t error = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz));
|
||||
|
||||
if (error > threshold) {
|
||||
lastMovementTime = HAL_GetTick();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
osDelay(10);
|
||||
|
||||
}
|
||||
}
|
||||
/* StartRotationTask function */
|
||||
void startRotationTask(void const * argument) {
|
||||
/*
|
||||
* This task is used to manage rotation of the LCD screen & button re-mapping
|
||||
*
|
||||
*/
|
||||
osDelay(1000); //wait for accel to stabilize
|
||||
HAL_NVIC_SetPriority(EXTI3_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI3_IRQn);
|
||||
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
|
||||
//^ We hold off enabling these until now to ensure the semaphore is available to be used first
|
||||
switch (systemSettings.OrientationMode) {
|
||||
case 0:
|
||||
lcd.setRotation(false);
|
||||
break;
|
||||
case 1:
|
||||
lcd.setRotation(true);
|
||||
break;
|
||||
case 2:
|
||||
lcd.setRotation(false);
|
||||
break;
|
||||
}
|
||||
for (;;) {
|
||||
if ( xSemaphoreTake( rotationChangedSemaphore, portMAX_DELAY ) == pdTRUE
|
||||
|| (HAL_GPIO_ReadPin(INT_Orientation_GPIO_Port, INT_Orientation_Pin) == GPIO_PIN_RESET)) {
|
||||
// a rotation event has occured
|
||||
bool rotation = accel.getOrientation();
|
||||
if (systemSettings.OrientationMode == 2)
|
||||
lcd.setRotation(rotation); // link the data through
|
||||
}
|
||||
osDelay(300);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Handler called by HAL when a EXTI occurs, but after IRQ bit is cleared
|
||||
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
||||
static signed long xHigherPriorityTaskWoken;
|
||||
if (GPIO_Pin == INT_Orientation_Pin) {
|
||||
xSemaphoreGiveFromISR(rotationChangedSemaphore, &xHigherPriorityTaskWoken);
|
||||
} else if (GPIO_Pin == INT_Movement_Pin) {
|
||||
//New data is available for reading from the unit
|
||||
//xSemaphoreGiveFromISR(accelDataAvailableSemaphore, &xHigherPriorityTaskWoken);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#define FLASH_LOGOADDR (0x8000000|0xB800) /*second last page of flash set aside for logo image*/
|
||||
|
||||
void showBootLogoIfavailable() {
|
||||
//check if the header is there (0xAA,0x55,0xF0,0x0D)
|
||||
//If so display logo
|
||||
uint16_t temp[98];
|
||||
|
||||
for (uint8_t i = 0; i < (98); i++) {
|
||||
temp[i] = *(uint16_t *) (FLASH_LOGOADDR + (i * 2));
|
||||
}
|
||||
uint8_t temp8[98 * 2];
|
||||
for (uint8_t i = 0; i < 98; i++) {
|
||||
temp8[i * 2] = temp[i] >> 8;
|
||||
temp8[i * 2 + 1] = temp[i] & 0xFF;
|
||||
|
||||
}
|
||||
|
||||
if (temp8[0] != 0xAA)
|
||||
return;
|
||||
if (temp8[1] != 0x55)
|
||||
return;
|
||||
if (temp8[2] != 0xF0)
|
||||
return;
|
||||
if (temp8[3] != 0x0D)
|
||||
return;
|
||||
|
||||
lcd.drawArea(0, 0, 96, 16, (uint8_t*) (temp8 + 4));
|
||||
lcd.refresh();
|
||||
|
||||
}
|
||||
137
workspace/TS100/src/stm32f1xx_hal_msp.c
Normal file
137
workspace/TS100/src/stm32f1xx_hal_msp.c
Normal file
@@ -0,0 +1,137 @@
|
||||
#include <hardware.h>
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "Setup.h"
|
||||
/**
|
||||
* Initializes the Global MSP.
|
||||
*/
|
||||
void HAL_MspInit(void) {
|
||||
__HAL_RCC_AFIO_CLK_ENABLE()
|
||||
;
|
||||
|
||||
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
|
||||
|
||||
/* System interrupt init*/
|
||||
/* MemoryManagement_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0);
|
||||
/* BusFault_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0);
|
||||
/* UsageFault_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0);
|
||||
/* SVCall_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0);
|
||||
/* DebugMonitor_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0);
|
||||
/* PendSV_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0);
|
||||
/* SysTick_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0);
|
||||
|
||||
/**NOJTAG: JTAG-DP Disabled and SW-DP Enabled
|
||||
*/
|
||||
__HAL_AFIO_REMAP_SWJ_NOJTAG()
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc) {
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
if (hadc->Instance == ADC1) {
|
||||
__HAL_RCC_ADC1_CLK_ENABLE()
|
||||
;
|
||||
/**ADC1 GPIO Configuration
|
||||
PA7 ------> ADC1_IN7
|
||||
PB0 ------> ADC1_IN8
|
||||
PB1 ------> ADC1_IN9
|
||||
*/
|
||||
GPIO_InitStruct.Pin = TMP36_INPUT_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
HAL_GPIO_Init(TMP36_INPUT_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = TIP_TEMP_Pin | VIN_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* ADC1 DMA Init */
|
||||
/* ADC1 Init */
|
||||
hdma_adc1.Instance = DMA1_Channel1;
|
||||
hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_adc1.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
||||
hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||
hdma_adc1.Init.Mode = DMA_CIRCULAR;
|
||||
hdma_adc1.Init.Priority = DMA_PRIORITY_VERY_HIGH;
|
||||
HAL_DMA_Init(&hdma_adc1);
|
||||
|
||||
__HAL_LINKDMA(hadc, DMA_Handle, hdma_adc1);
|
||||
|
||||
/* ADC1 interrupt Init */
|
||||
HAL_NVIC_SetPriority(ADC1_2_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c) {
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
if (hi2c->Instance == I2C1) {
|
||||
/**I2C1 GPIO Configuration
|
||||
PB6 ------> I2C1_SCL
|
||||
PB7 ------> I2C1_SDA
|
||||
*/
|
||||
GPIO_InitStruct.Pin = SCL_Pin | SDA_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_I2C1_CLK_ENABLE()
|
||||
;
|
||||
|
||||
/* I2C1 DMA Init */
|
||||
/* I2C1_RX Init */
|
||||
hdma_i2c1_rx.Instance = DMA1_Channel7;
|
||||
hdma_i2c1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_i2c1_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_i2c1_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_i2c1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_i2c1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_i2c1_rx.Init.Mode = DMA_NORMAL;
|
||||
hdma_i2c1_rx.Init.Priority = DMA_PRIORITY_LOW;
|
||||
HAL_DMA_Init(&hdma_i2c1_rx);
|
||||
|
||||
__HAL_LINKDMA(hi2c, hdmarx, hdma_i2c1_rx);
|
||||
|
||||
/* I2C1_TX Init */
|
||||
hdma_i2c1_tx.Instance = DMA1_Channel6;
|
||||
hdma_i2c1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||
hdma_i2c1_tx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_i2c1_tx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_i2c1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_i2c1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_i2c1_tx.Init.Mode = DMA_NORMAL;
|
||||
hdma_i2c1_tx.Init.Priority = DMA_PRIORITY_LOW;
|
||||
HAL_DMA_Init(&hdma_i2c1_tx);
|
||||
|
||||
__HAL_LINKDMA(hi2c, hdmatx, hdma_i2c1_tx);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base) {
|
||||
if (htim_base->Instance == TIM3) {
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_TIM3_CLK_ENABLE()
|
||||
;
|
||||
} else if (htim_base->Instance == TIM2) {
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_TIM2_CLK_ENABLE()
|
||||
;
|
||||
}
|
||||
}
|
||||
158
workspace/TS100/src/stm32f1xx_hal_timebase_TIM.c
Normal file
158
workspace/TS100/src/stm32f1xx_hal_timebase_TIM.c
Normal file
@@ -0,0 +1,158 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_hal_timebase_TIM.c
|
||||
* @brief HAL time base based on the hardware TIM.
|
||||
******************************************************************************
|
||||
* This notice applies to any and all portions of this file
|
||||
* that are not between comment pairs USER CODE BEGIN and
|
||||
* USER CODE END. Other portions of this file, whether
|
||||
* inserted by the user or by software development tools
|
||||
* are owned by their respective copyright owners.
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "stm32f1xx_hal_tim.h"
|
||||
/** @addtogroup STM32F7xx_HAL_Examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup HAL_TimeBase
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
TIM_HandleTypeDef htim1;
|
||||
uint32_t uwIncrementState = 0;
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief This function configures the TIM1 as a time base source.
|
||||
* The time source is configured to have 1ms time base with a dedicated
|
||||
* Tick interrupt priority.
|
||||
* @note This function is called automatically at the beginning of program after
|
||||
* reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig().
|
||||
* @param TickPriority: Tick interrupt priorty.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
{
|
||||
RCC_ClkInitTypeDef clkconfig;
|
||||
uint32_t uwTimclock = 0;
|
||||
uint32_t uwPrescalerValue = 0;
|
||||
uint32_t pFLatency;
|
||||
|
||||
/*Configure the TIM1 IRQ priority */
|
||||
HAL_NVIC_SetPriority(TIM1_UP_IRQn, TickPriority ,0);
|
||||
|
||||
/* Enable the TIM1 global Interrupt */
|
||||
HAL_NVIC_EnableIRQ(TIM1_UP_IRQn);
|
||||
|
||||
/* Enable TIM1 clock */
|
||||
__HAL_RCC_TIM1_CLK_ENABLE();
|
||||
|
||||
/* Get clock configuration */
|
||||
HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
|
||||
|
||||
/* Compute TIM1 clock */
|
||||
uwTimclock = HAL_RCC_GetPCLK2Freq();
|
||||
|
||||
/* Compute the prescaler value to have TIM1 counter clock equal to 1MHz */
|
||||
uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000) - 1);
|
||||
|
||||
/* Initialize TIM1 */
|
||||
htim1.Instance = TIM1;
|
||||
|
||||
/* Initialize TIMx peripheral as follow:
|
||||
+ Period = [(TIM1CLK/1000) - 1]. to have a (1/1000) s time base.
|
||||
+ Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock.
|
||||
+ ClockDivision = 0
|
||||
+ Counter direction = Up
|
||||
*/
|
||||
htim1.Init.Period = (1000000 / 1000) - 1;
|
||||
htim1.Init.Prescaler = uwPrescalerValue;
|
||||
htim1.Init.ClockDivision = 0;
|
||||
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
if(HAL_TIM_Base_Init(&htim1) == HAL_OK)
|
||||
{
|
||||
/* Start the TIM time Base generation in interrupt mode */
|
||||
return HAL_TIM_Base_Start_IT(&htim1);
|
||||
}
|
||||
|
||||
/* Return function status */
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Suspend Tick increment.
|
||||
* @note Disable the tick increment by disabling TIM1 update interrupt.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SuspendTick(void)
|
||||
{
|
||||
/* Disable TIM1 update Interrupt */
|
||||
__HAL_TIM_DISABLE_IT(&htim1, TIM_IT_UPDATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resume Tick increment.
|
||||
* @note Enable the tick increment by Enabling TIM1 update interrupt.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ResumeTick(void)
|
||||
{
|
||||
/* Enable TIM1 Update interrupt */
|
||||
__HAL_TIM_ENABLE_IT(&htim1, TIM_IT_UPDATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
104
workspace/TS100/src/stm32f1xx_it.c
Normal file
104
workspace/TS100/src/stm32f1xx_it.c
Normal file
@@ -0,0 +1,104 @@
|
||||
// This is the stock standard STM interrupt file full of handlers
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_it.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "Setup.h"
|
||||
|
||||
extern TIM_HandleTypeDef htim1; //used for the systick
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex-M3 Processor Interruption and Exception Handlers */
|
||||
/******************************************************************************/
|
||||
|
||||
void NMI_Handler(void) {
|
||||
|
||||
}
|
||||
|
||||
//We have the assembly for a breakpoint trigger here to halt the system when a debugger is connected
|
||||
// Hardfault handler, often a screwup in the code
|
||||
void HardFault_Handler(void) {
|
||||
while (1) {
|
||||
asm("bkpt");
|
||||
}
|
||||
}
|
||||
|
||||
// Memory management unit had an error
|
||||
void MemManage_Handler(void) {
|
||||
while (1) {
|
||||
asm("bkpt");
|
||||
}
|
||||
}
|
||||
|
||||
// Prefetcher or busfault occured
|
||||
void BusFault_Handler(void) {
|
||||
while (1) {
|
||||
asm("bkpt");
|
||||
}
|
||||
}
|
||||
|
||||
void UsageFault_Handler(void) {
|
||||
while (1) {
|
||||
asm("bkpt");
|
||||
}
|
||||
}
|
||||
|
||||
void DebugMon_Handler(void) {
|
||||
}
|
||||
|
||||
// Systick is used by FreeRTOS tick
|
||||
void SysTick_Handler(void) {
|
||||
osSystickHandler();
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* STM32F1xx Peripheral Interrupt Handlers */
|
||||
/* Add here the Interrupt Handlers for the used peripherals. */
|
||||
/* For the available peripheral interrupt handler names, */
|
||||
/* please refer to the startup file. */
|
||||
/******************************************************************************/
|
||||
|
||||
// DMA used to move the ADC readings into system ram
|
||||
void DMA1_Channel1_IRQHandler(void) {
|
||||
HAL_DMA_IRQHandler(&hdma_adc1);
|
||||
}
|
||||
|
||||
// DMA used for transmitting I2C packets
|
||||
void DMA1_Channel6_IRQHandler(void) {
|
||||
HAL_DMA_IRQHandler(&hdma_i2c1_tx);
|
||||
}
|
||||
|
||||
//DMA used for receiving I2C packets
|
||||
void DMA1_Channel7_IRQHandler(void) {
|
||||
HAL_DMA_IRQHandler(&hdma_i2c1_rx);
|
||||
}
|
||||
|
||||
//ADC interrupt used for DMA
|
||||
void ADC1_2_IRQHandler(void) {
|
||||
HAL_ADC_IRQHandler(&hadc1);
|
||||
}
|
||||
|
||||
//Timer 1 has overflowed, used for HAL ticks
|
||||
void TIM1_UP_IRQHandler(void) {
|
||||
HAL_TIM_IRQHandler(&htim1);
|
||||
|
||||
}
|
||||
//Timer 3 is used for the PWM output to the tip
|
||||
void TIM3_IRQHandler(void) {
|
||||
HAL_TIM_IRQHandler(&htim3);
|
||||
}
|
||||
|
||||
//Timer 2 is used for co-ordination of PWM & ADC
|
||||
void TIM2_IRQHandler(void) {
|
||||
HAL_TIM_IRQHandler(&htim2);
|
||||
}
|
||||
//EXTI 3 is triggered via the accelerometer on orientation change
|
||||
void EXTI3_IRQHandler(void) {
|
||||
|
||||
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3);
|
||||
}
|
||||
//EXTI 5 is triggered via the accelerometer on movement
|
||||
void EXTI9_5_IRQHandler(void) {
|
||||
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_5);
|
||||
|
||||
}
|
||||
204
workspace/TS100/src/syscalls.c
Normal file
204
workspace/TS100/src/syscalls.c
Normal file
@@ -0,0 +1,204 @@
|
||||
/**
|
||||
*****************************************************************************
|
||||
**
|
||||
** File : syscalls.c
|
||||
**
|
||||
** Abstract : System Workbench Minimal System calls file
|
||||
**
|
||||
** For more information about which c-functions
|
||||
** need which of these lowlevel functions
|
||||
** please consult the Newlib libc-manual
|
||||
**
|
||||
** Environment : System Workbench for MCU
|
||||
**
|
||||
** Distribution: The file is distributed <20>as is,<2C> without any warranty
|
||||
** of any kind.
|
||||
**
|
||||
*****************************************************************************
|
||||
**
|
||||
** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2>
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without modification,
|
||||
** are permitted provided that the following conditions are met:
|
||||
** 1. Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer in the documentation
|
||||
** and/or other materials provided with the distribution.
|
||||
** 3. Neither the name of Ac6 nor the names of its contributors
|
||||
** may be used to endorse or promote products derived from this software
|
||||
** without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes */
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
|
||||
|
||||
/* Variables */
|
||||
//#undef errno
|
||||
extern int errno;
|
||||
extern int __io_putchar(int ch) __attribute__((weak));
|
||||
extern int __io_getchar(void) __attribute__((weak));
|
||||
|
||||
register char * stack_ptr asm("sp");
|
||||
|
||||
char *__env[1] = { 0 };
|
||||
char **environ = __env;
|
||||
|
||||
|
||||
/* Functions */
|
||||
void initialise_monitor_handles()
|
||||
{
|
||||
}
|
||||
|
||||
int _getpid(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _kill(int pid, int sig)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void _exit (int status)
|
||||
{
|
||||
_kill(status, -1);
|
||||
while (1) {} /* Make sure we hang here */
|
||||
}
|
||||
|
||||
int _read (int file, char *ptr, int len)
|
||||
{
|
||||
int DataIdx;
|
||||
|
||||
for (DataIdx = 0; DataIdx < len; DataIdx++)
|
||||
{
|
||||
*ptr++ = __io_getchar();
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int _write(int file, char *ptr, int len)
|
||||
{
|
||||
int DataIdx;
|
||||
|
||||
for (DataIdx = 0; DataIdx < len; DataIdx++)
|
||||
{
|
||||
__io_putchar(*ptr++);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
caddr_t _sbrk(int incr)
|
||||
{
|
||||
extern char end asm("end");
|
||||
static char *heap_end;
|
||||
char *prev_heap_end;
|
||||
|
||||
if (heap_end == 0)
|
||||
heap_end = &end;
|
||||
|
||||
prev_heap_end = heap_end;
|
||||
if (heap_end + incr > stack_ptr)
|
||||
{
|
||||
// write(1, "Heap and stack collision\n", 25);
|
||||
// abort();
|
||||
errno = ENOMEM;
|
||||
return (caddr_t) -1;
|
||||
}
|
||||
|
||||
heap_end += incr;
|
||||
|
||||
return (caddr_t) prev_heap_end;
|
||||
}
|
||||
|
||||
int _close(int file)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int _fstat(int file, struct stat *st)
|
||||
{
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _isatty(int file)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _lseek(int file, int ptr, int dir)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _open(char *path, int flags, ...)
|
||||
{
|
||||
/* Pretend like we always fail */
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _wait(int *status)
|
||||
{
|
||||
errno = ECHILD;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _unlink(char *name)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _times(struct tms *buf)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _stat(char *file, struct stat *st)
|
||||
{
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _link(char *old, char *new)
|
||||
{
|
||||
errno = EMLINK;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _fork(void)
|
||||
{
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _execve(char *name, char **argv, char **env)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
312
workspace/TS100/src/system_stm32f1xx.c
Normal file
312
workspace/TS100/src/system_stm32f1xx.c
Normal file
@@ -0,0 +1,312 @@
|
||||
// This file was automatically generated by the STM Cube software
|
||||
// And as such, is BSD licneced from STM
|
||||
#include "stm32f1xx.h"
|
||||
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE 8000000U /*!< Default value of the Internal oscillator in Hz.
|
||||
This value can be provided and adapted by the user application. */
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
/*!< Uncomment the following line if you need to use external SRAM */
|
||||
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
|
||||
/* #define DATA_IN_ExtSRAM */
|
||||
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
|
||||
|
||||
#define VECT_TAB_OFFSET 0x00004000U /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x200. */
|
||||
//We offset this by 0x4000 to because of the bootloader
|
||||
/*******************************************************************************
|
||||
* Clock Definitions
|
||||
*******************************************************************************/
|
||||
#if defined(STM32F100xB) ||defined(STM32F100xE)
|
||||
uint32_t SystemCoreClock = 24000000U; /*!< System Clock Frequency (Core Clock) */
|
||||
#else /*!< HSI Selected as System Clock source */
|
||||
uint32_t SystemCoreClock = 64000000U; /*!< System Clock Frequency (Core Clock) */
|
||||
#endif
|
||||
|
||||
const uint8_t AHBPrescTable[16U] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||
const uint8_t APBPrescTable[8U] = {0, 0, 0, 0, 1, 2, 3, 4};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Setup the microcontroller system
|
||||
* Initialize the Embedded Flash Interface, the PLL and update the
|
||||
* SystemCoreClock variable.
|
||||
* @note This function should be used only after reset.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SystemInit (void)
|
||||
{
|
||||
/* Reset the RCC clock configuration to the default reset state(for debug purpose) */
|
||||
/* Set HSION bit */
|
||||
RCC->CR |= 0x00000001U;
|
||||
|
||||
/* Reset SW, HPRE, PPRE1, PPRE2, ADCPRE and MCO bits */
|
||||
#if !defined(STM32F105xC) && !defined(STM32F107xC)
|
||||
RCC->CFGR &= 0xF8FF0000U;
|
||||
#else
|
||||
RCC->CFGR &= 0xF0FF0000U;
|
||||
#endif /* STM32F105xC */
|
||||
|
||||
/* Reset HSEON, CSSON and PLLON bits */
|
||||
RCC->CR &= 0xFEF6FFFFU;
|
||||
|
||||
/* Reset HSEBYP bit */
|
||||
RCC->CR &= 0xFFFBFFFFU;
|
||||
|
||||
/* Reset PLLSRC, PLLXTPRE, PLLMUL and USBPRE/OTGFSPRE bits */
|
||||
RCC->CFGR &= 0xFF80FFFFU;
|
||||
|
||||
#if defined(STM32F105xC) || defined(STM32F107xC)
|
||||
/* Reset PLL2ON and PLL3ON bits */
|
||||
RCC->CR &= 0xEBFFFFFFU;
|
||||
|
||||
/* Disable all interrupts and clear pending bits */
|
||||
RCC->CIR = 0x00FF0000U;
|
||||
|
||||
/* Reset CFGR2 register */
|
||||
RCC->CFGR2 = 0x00000000U;
|
||||
#elif defined(STM32F100xB) || defined(STM32F100xE)
|
||||
/* Disable all interrupts and clear pending bits */
|
||||
RCC->CIR = 0x009F0000U;
|
||||
|
||||
/* Reset CFGR2 register */
|
||||
RCC->CFGR2 = 0x00000000U;
|
||||
#else
|
||||
/* Disable all interrupts and clear pending bits */
|
||||
RCC->CIR = 0x009F0000U;
|
||||
#endif /* STM32F105xC */
|
||||
|
||||
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
|
||||
#ifdef DATA_IN_ExtSRAM
|
||||
SystemInit_ExtMemCtl();
|
||||
#endif /* DATA_IN_ExtSRAM */
|
||||
#endif
|
||||
|
||||
#ifdef VECT_TAB_SRAM
|
||||
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */
|
||||
#else
|
||||
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update SystemCoreClock variable according to Clock Register Values.
|
||||
* The SystemCoreClock variable contains the core clock (HCLK), it can
|
||||
* be used by the user application to setup the SysTick timer or configure
|
||||
* other parameters.
|
||||
*
|
||||
* @note Each time the core clock (HCLK) changes, this function must be called
|
||||
* to update SystemCoreClock variable value. Otherwise, any configuration
|
||||
* based on this variable will be incorrect.
|
||||
*
|
||||
* @note - The system frequency computed by this function is not the real
|
||||
* frequency in the chip. It is calculated based on the predefined
|
||||
* constant and the selected clock source:
|
||||
*
|
||||
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
|
||||
*
|
||||
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
|
||||
*
|
||||
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
|
||||
* or HSI_VALUE(*) multiplied by the PLL factors.
|
||||
*
|
||||
* (*) HSI_VALUE is a constant defined in stm32f1xx.h file (default value
|
||||
* 8 MHz) but the real value may vary depending on the variations
|
||||
* in voltage and temperature.
|
||||
*
|
||||
* (**) HSE_VALUE is a constant defined in stm32f1xx.h file (default value
|
||||
* 8 MHz or 25 MHz, depending on the product used), user has to ensure
|
||||
* that HSE_VALUE is same as the real frequency of the crystal used.
|
||||
* Otherwise, this function may have wrong result.
|
||||
*
|
||||
* - The result of this function could be not correct when using fractional
|
||||
* value for HSE crystal.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SystemCoreClockUpdate (void)
|
||||
{
|
||||
uint32_t tmp = 0U, pllmull = 0U, pllsource = 0U;
|
||||
|
||||
#if defined(STM32F105xC) || defined(STM32F107xC)
|
||||
uint32_t prediv1source = 0U, prediv1factor = 0U, prediv2factor = 0U, pll2mull = 0U;
|
||||
#endif /* STM32F105xC */
|
||||
|
||||
#if defined(STM32F100xB) || defined(STM32F100xE)
|
||||
uint32_t prediv1factor = 0U;
|
||||
#endif /* STM32F100xB or STM32F100xE */
|
||||
|
||||
/* Get SYSCLK source -------------------------------------------------------*/
|
||||
tmp = RCC->CFGR & RCC_CFGR_SWS;
|
||||
|
||||
switch (tmp)
|
||||
{
|
||||
case 0x00U: /* HSI used as system clock */
|
||||
SystemCoreClock = HSI_VALUE;
|
||||
break;
|
||||
case 0x04U: /* HSE used as system clock */
|
||||
SystemCoreClock = HSE_VALUE;
|
||||
break;
|
||||
case 0x08U: /* PLL used as system clock */
|
||||
|
||||
/* Get PLL clock source and multiplication factor ----------------------*/
|
||||
pllmull = RCC->CFGR & RCC_CFGR_PLLMULL;
|
||||
pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
|
||||
|
||||
#if !defined(STM32F105xC) && !defined(STM32F107xC)
|
||||
pllmull = ( pllmull >> 18U) + 2U;
|
||||
|
||||
if (pllsource == 0x00U)
|
||||
{
|
||||
/* HSI oscillator clock divided by 2 selected as PLL clock entry */
|
||||
SystemCoreClock = (HSI_VALUE >> 1U) * pllmull;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(STM32F100xB) || defined(STM32F100xE)
|
||||
prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1U;
|
||||
/* HSE oscillator clock selected as PREDIV1 clock entry */
|
||||
SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull;
|
||||
#else
|
||||
/* HSE selected as PLL clock entry */
|
||||
if ((RCC->CFGR & RCC_CFGR_PLLXTPRE) != (uint32_t)RESET)
|
||||
{/* HSE oscillator clock divided by 2 */
|
||||
SystemCoreClock = (HSE_VALUE >> 1U) * pllmull;
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemCoreClock = HSE_VALUE * pllmull;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
pllmull = pllmull >> 18U;
|
||||
|
||||
if (pllmull != 0x0DU)
|
||||
{
|
||||
pllmull += 2U;
|
||||
}
|
||||
else
|
||||
{ /* PLL multiplication factor = PLL input clock * 6.5 */
|
||||
pllmull = 13U / 2U;
|
||||
}
|
||||
|
||||
if (pllsource == 0x00U)
|
||||
{
|
||||
/* HSI oscillator clock divided by 2 selected as PLL clock entry */
|
||||
SystemCoreClock = (HSI_VALUE >> 1U) * pllmull;
|
||||
}
|
||||
else
|
||||
{/* PREDIV1 selected as PLL clock entry */
|
||||
|
||||
/* Get PREDIV1 clock source and division factor */
|
||||
prediv1source = RCC->CFGR2 & RCC_CFGR2_PREDIV1SRC;
|
||||
prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1U;
|
||||
|
||||
if (prediv1source == 0U)
|
||||
{
|
||||
/* HSE oscillator clock selected as PREDIV1 clock entry */
|
||||
SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull;
|
||||
}
|
||||
else
|
||||
{/* PLL2 clock selected as PREDIV1 clock entry */
|
||||
|
||||
/* Get PREDIV2 division factor and PLL2 multiplication factor */
|
||||
prediv2factor = ((RCC->CFGR2 & RCC_CFGR2_PREDIV2) >> 4U) + 1U;
|
||||
pll2mull = ((RCC->CFGR2 & RCC_CFGR2_PLL2MUL) >> 8U) + 2U;
|
||||
SystemCoreClock = (((HSE_VALUE / prediv2factor) * pll2mull) / prediv1factor) * pllmull;
|
||||
}
|
||||
}
|
||||
#endif /* STM32F105xC */
|
||||
break;
|
||||
|
||||
default:
|
||||
SystemCoreClock = HSI_VALUE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Compute HCLK clock frequency ----------------*/
|
||||
/* Get HCLK prescaler */
|
||||
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4U)];
|
||||
/* HCLK clock frequency */
|
||||
SystemCoreClock >>= tmp;
|
||||
}
|
||||
|
||||
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
|
||||
/**
|
||||
* @brief Setup the external memory controller. Called in startup_stm32f1xx.s
|
||||
* before jump to __main
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
#ifdef DATA_IN_ExtSRAM
|
||||
/**
|
||||
* @brief Setup the external memory controller.
|
||||
* Called in startup_stm32f1xx_xx.s/.c before jump to main.
|
||||
* This function configures the external SRAM mounted on STM3210E-EVAL
|
||||
* board (STM32 High density devices). This SRAM will be used as program
|
||||
* data memory (including heap and stack).
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SystemInit_ExtMemCtl(void)
|
||||
{
|
||||
__IO uint32_t tmpreg;
|
||||
/*!< FSMC Bank1 NOR/SRAM3 is used for the STM3210E-EVAL, if another Bank is
|
||||
required, then adjust the Register Addresses */
|
||||
|
||||
/* Enable FSMC clock */
|
||||
RCC->AHBENR = 0x00000114U;
|
||||
|
||||
/* Delay after an RCC peripheral clock enabling */
|
||||
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN);
|
||||
|
||||
/* Enable GPIOD, GPIOE, GPIOF and GPIOG clocks */
|
||||
RCC->APB2ENR = 0x000001E0U;
|
||||
|
||||
/* Delay after an RCC peripheral clock enabling */
|
||||
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPDEN);
|
||||
|
||||
(void)(tmpreg);
|
||||
|
||||
/* --------------- SRAM Data lines, NOE and NWE configuration ---------------*/
|
||||
/*---------------- SRAM Address lines configuration -------------------------*/
|
||||
/*---------------- NOE and NWE configuration --------------------------------*/
|
||||
/*---------------- NE3 configuration ----------------------------------------*/
|
||||
/*---------------- NBL0, NBL1 configuration ---------------------------------*/
|
||||
|
||||
GPIOD->CRL = 0x44BB44BBU;
|
||||
GPIOD->CRH = 0xBBBBBBBBU;
|
||||
|
||||
GPIOE->CRL = 0xB44444BBU;
|
||||
GPIOE->CRH = 0xBBBBBBBBU;
|
||||
|
||||
GPIOF->CRL = 0x44BBBBBBU;
|
||||
GPIOF->CRH = 0xBBBB4444U;
|
||||
|
||||
GPIOG->CRL = 0x44BBBBBBU;
|
||||
GPIOG->CRH = 0x444B4B44U;
|
||||
|
||||
/*---------------- FSMC Configuration ---------------------------------------*/
|
||||
/*---------------- Enable FSMC Bank1_SRAM Bank ------------------------------*/
|
||||
|
||||
FSMC_Bank1->BTCR[4U] = 0x00001091U;
|
||||
FSMC_Bank1->BTCR[5U] = 0x00110212U;
|
||||
}
|
||||
#endif /* DATA_IN_ExtSRAM */
|
||||
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
10
workspace/TS100/src/uRender.cpp
Normal file
10
workspace/TS100/src/uRender.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* uRender.cpp
|
||||
*
|
||||
* Created on: 30Aug.,2017
|
||||
* Author: Ben V. Brown
|
||||
*/
|
||||
|
||||
#include <uRender.hpp>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user