aboutsummaryrefslogtreecommitdiffhomepage
path: root/workspace/ts100/inc/Settings.h
blob: f6ceae8bd52b9697726c02d992437715df68df36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Settings.h
 *
 *  Created on: 29 Sep 2016
 *      Author: Ralim
 *
 *      Houses the system settings and allows saving / restoring from flash
 */

#ifndef SETTINGS_H_
#define SETTINGS_H_
#include <stdint.h>
#include "stm32f10x_flash.h"
#define SETTINGSVERSION 0x08 /*Change this if you change the struct below to prevent people getting out of sync*/
//Motion Sensitivity
#define MOTION_HIGH 		(0x00)
#define MOTION_MED  		(0x10)
#define MOTION_LOW  		(0x20)
//Display Speeds
#define DISPLAYMODE_FAST 	(0x00)
#define DISPLAYMODE_MEDIUM 	(0x01)
#define DISPLAYMODE_SLOW	(0x02)
//Rounding Modes
#define ROUNDING_NONE			(0x00)
#define ROUNDING_FIVE			(0x01)
#define ROUNDING_TEN			(0x02)


/*
 * This struct must be a multiple of 2 bytes as it is saved / restored from flash in uint16_t chunks
 */
struct {
	uint32_t SolderingTemp; 		//current set point for the iron
	uint32_t SleepTemp; 			//temp to drop to in sleep
	uint8_t version;				//Used to track if a reset is needed on firmware upgrade
	uint8_t SleepTime; 				//minutes timeout to sleep
	uint8_t cutoutVoltage:5; 		//The voltage we cut out at for under voltage
	uint8_t movementEnabled:1;		//If movement is enabled
	uint8_t displayTempInF:1;		//If we need to convert the C reading to F
	uint8_t flipDisplay:1;			//If true we want to invert the display for lefties
	uint8_t sensitivity:6;			//Sensitivity of accelerometer
	uint8_t ShutdownTime:6;			//Time until unit shuts down if left alone
	uint8_t displayUpdateSpeed:2;	//How fast the display updates / temp showing mode
	uint8_t temperatureRounding:2;	//Rounding mode for the temperature
	uint16_t tempCalibration;		//Temperature calibration value
	uint16_t voltageDiv;			//Voltage divisor factor
} systemSettings;

void saveSettings();
void restoreSettings();
void resetSettings();
#endif /* SETTINGS_H_ */