mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Moved to use EXTI to read button status
Temperature sensor appears to work (may need calibration work still)
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
#ifndef ANALOG_H_
|
||||
#define ANALOG_H_
|
||||
#include "stm32f10x.h"
|
||||
#include "S100V0_1.h"
|
||||
#include "Bios.h"
|
||||
extern volatile uint16_t ADC1ConvertedValue[2];
|
||||
|
||||
uint16_t Get_ADC1Value(uint8_t i);
|
||||
uint16_t readIronTemp(uint16_t calibration);
|
||||
|
||||
@@ -1,33 +1,25 @@
|
||||
/********************* (C) COPYRIGHT 2015 e-Design Co.,Ltd. ********************
|
||||
File Name : Bios.h
|
||||
Version : S100 APP Ver 2.11
|
||||
Description:
|
||||
Author : bure & Celery
|
||||
Data: 2015/08/03
|
||||
History:
|
||||
2015/08/03 ͳһ<CDB3><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*******************************************************************************/
|
||||
File Name : Bios.h
|
||||
Version : S100 APP Ver 2.11
|
||||
Description:
|
||||
Author : bure & Celery
|
||||
Data: 2015/08/03
|
||||
History:
|
||||
2015/08/03 ͳһ<CDB3><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __BIOS_H
|
||||
#define __BIOS_H
|
||||
|
||||
#include "stm32f10x.h"
|
||||
#include "S100V0_1.h"
|
||||
#include "Analog.h"
|
||||
extern volatile u32 gTime[];
|
||||
extern volatile uint32_t gHeat_cnt;
|
||||
inline void setIronTimer(uint32_t time) {
|
||||
gHeat_cnt = time;
|
||||
}
|
||||
|
||||
#define USB_DN_OUT() GPIOA->CRH = (GPIOA->CRH & 0xFFFF3FFF) | 0x00003000
|
||||
#define USB_DP_OUT() GPIOA->CRH = (GPIOA->CRH & 0xFFF3FFFF) | 0x00030000
|
||||
|
||||
#define USB_DN_EN() GPIOA->CRH = (GPIOA->CRH & 0xFFFFBFFF) | 0x0000B000
|
||||
#define USB_DP_EN() GPIOA->CRH = (GPIOA->CRH & 0xFFFBFFFF) | 0x000B0000
|
||||
|
||||
#define USB_DP_PD() GPIOA->CRH = (GPIOA->CRH & 0xFFF3FFFF) | 0x00030000
|
||||
|
||||
#define USB_DN_HIGH() GPIOA->BSRR = GPIO_Pin_11
|
||||
#define USB_DP_HIGH() GPIOA->BSRR = GPIO_Pin_12
|
||||
|
||||
#define USB_DN_LOW() GPIOA->BRR = GPIO_Pin_11
|
||||
#define USB_DP_LOW() GPIOA->BRR = GPIO_Pin_12
|
||||
|
||||
#define LOW 0
|
||||
#define HIGH 1
|
||||
@@ -35,7 +27,6 @@ extern volatile u32 gTime[];
|
||||
#define BLINK 1 // Bit0 : 0/1 <20><>ʾ/<2F><>˸״̬<D7B4><CCAC>־
|
||||
#define WAIT_TIMES 100000
|
||||
|
||||
|
||||
#define SECTOR_SIZE 512
|
||||
#define SECTOR_CNT 4096
|
||||
#define HEAT_T 200
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/********************* (C) COPYRIGHT 2015 e-Design Co.,Ltd. **********************
|
||||
File Name : CTRL.h
|
||||
Version : S100 APP Ver 2.11
|
||||
Description:
|
||||
Author : Celery
|
||||
Data: 2015/07/07
|
||||
History:
|
||||
2015/07/07 ͳһ<CDB3><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*******************************************************************************/
|
||||
#ifndef _CTRL_H
|
||||
#define _CTRL_H
|
||||
|
||||
#include "stm32f10x.h"
|
||||
#include "Bios.h"
|
||||
|
||||
#define TEMPSHOW_TIMER gTime[0]/*TEMPSHOW_TIMER*/
|
||||
#define HEATING_TIMER gTime[1]/*HEATING_TIMER*/
|
||||
#define ENTER_WAIT_TIMER gTime[2]/*ENTER_WAIT_TIMER*/
|
||||
#define EFFECTIVE_KEY_TIMER gTime[3]/*EFFECTIVE_KEY_TIMER*/
|
||||
#define LEAVE_WAIT_TIMER gTime[4]/*LEAVE_WAIT_TIMER*/
|
||||
#define G6_TIMER gTime[5]/*SWITCH_SHOW_TIMER*/
|
||||
#define UI_TIMER gTime[6]/*UI_TIMER */
|
||||
#define KD_TIMER gTime[7]/**/
|
||||
|
||||
///^^-- All the times in gTime are decremented by 1 if >0 by timer2 tick <bottom of bios.c>
|
||||
//------------------------------ ------------------------------------//
|
||||
#define KEY_ST(KEY_PIN) GPIO_ReadInputDataBit(GPIOA, KEY_PIN)
|
||||
#define NO_KEY 0x0 /*NO Keys pressed*/
|
||||
#define KEY_A 0x0100/*V1 key pressed*/
|
||||
#define KEY_B 0x0040/*V2 Key pressed*/
|
||||
#define KEY_CN 0X8000/*(Long key press)*/
|
||||
#define KEY_V3 (KEY_A|KEY_B)/*Both Keys pressed*/
|
||||
|
||||
typedef enum WORK_STATUS {
|
||||
IDLE = 1, //System is idle
|
||||
THERMOMETER, //Thermometer mode, basically reads sensor and shows temp
|
||||
SOLDERING_MODE, //Soldering Mode (Temp Controlled)
|
||||
WAIT, //System in wait state
|
||||
TEMP_SET, //Setting the soldering temp
|
||||
SETTINGS_MENU, // Show the user the settings menu
|
||||
USB_POWER, //USB Powered Mode
|
||||
MODE_CNG, //DFU mode i think??
|
||||
ALARM, //An alarm has been fired
|
||||
} WORK_STATUS;
|
||||
|
||||
typedef enum WARNING_STATUS {
|
||||
NORMAL_TEMP = 1, HIGH_TEMP, SEN_ERR, HIGH_VOLTAGE, LOW_VOLTAGE,
|
||||
} WARNING_STATUS;
|
||||
|
||||
typedef struct {
|
||||
u8 ver[16];
|
||||
s16 t_standby; // 200<30><30>C=1800 2520,<2C><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
||||
s16 t_work; // 350<35><30>C=3362, <20><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
||||
s16 t_step; //<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>
|
||||
u32 wait_time; //3*60*100 3 mintute
|
||||
u32 idle_time; //6*60*100 6 minute
|
||||
} DEVICE_INFO_SYS;
|
||||
|
||||
extern DEVICE_INFO_SYS device_info;
|
||||
void Set_PrevTemp(s16 Temp);
|
||||
u8 Get_CtrlStatus(void);
|
||||
void Set_CtrlStatus(u8 status);
|
||||
s16 Get_TempVal(void);
|
||||
u16 Get_HtFlag(void);
|
||||
void System_Init(void);
|
||||
void Pid_Init(void);
|
||||
u16 Pid_Realize(s16 temp);
|
||||
u32 Heating_Time(s16 temp, s16 wk_temp);
|
||||
void Status_Tran(void);
|
||||
#endif
|
||||
/******************************** END OF FILE *********************************/
|
||||
@@ -81,6 +81,8 @@ const u8 FONT[]={
|
||||
0x00,0x00,0x00,0x00,0x00,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*Y*/
|
||||
0x00,0x02,0x02,0x02,0xC2,0xE2,0x3A,0x0E,0x02,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x10,0x1C,0x17,0x11,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,/*Z*/
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/* */
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/********************* (C) COPYRIGHT 2015 e-Design Co.,Ltd. **********************
|
||||
File Name : CTRL.h
|
||||
Version : S100 APP Ver 2.11
|
||||
Description:
|
||||
Author : Celery
|
||||
Data: 2015/07/07
|
||||
History:
|
||||
2015/07/07 ͳһ<CDB3><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*******************************************************************************/
|
||||
#ifndef _HARDWARE_H
|
||||
#define _HARDWARE_H
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#define SI_COE 8//56
|
||||
#define SI_THRESHOLD 60
|
||||
|
||||
typedef enum VOL_CLASS {
|
||||
H_ALARM = 0,
|
||||
VOL_24,
|
||||
VOL_19,
|
||||
VOL_12,
|
||||
VOL_5,
|
||||
L_ALARM,
|
||||
} VOL_CLASS;
|
||||
|
||||
extern s32 gZerop_ad;
|
||||
extern u8 gCalib_flag;
|
||||
extern u32 gTurn_offv;
|
||||
|
||||
u32 Get_gKey(void);
|
||||
void Set_gKey(u32 key);
|
||||
void Set_LongKeyFlag(u32 flag);
|
||||
void Zero_Calibration(void);
|
||||
int Read_Vb(u8 flag);
|
||||
void Scan_Key(void);
|
||||
u32 Get_SlAvg(u32 avg_data);
|
||||
int Get_TempSlAvg(int avg_data);
|
||||
u32 Get_AvgAd(void);
|
||||
int Get_SensorTmp(void);
|
||||
u16 Get_ThermometerTemp(void);
|
||||
s16 Get_Temp(s16 wk_temp);
|
||||
void Clear_Watchdog(void);
|
||||
u32 Start_Watchdog(u32 ms);
|
||||
u8 Get_AlarmType(void);
|
||||
void Set_AlarmType(u8 type);
|
||||
u32 Get_CalFlag(void);
|
||||
#endif
|
||||
/******************************** END OF FILE *********************************/
|
||||
@@ -30,10 +30,25 @@ void TIM2_IRQHandler(void);
|
||||
void TIM3_IRQHandler(void);
|
||||
|
||||
extern volatile uint32_t system_Ticks;
|
||||
void delayMs(uint32_t ticks);
|
||||
volatile extern uint32_t lastKeyPress;
|
||||
volatile extern uint32_t lastMovement;
|
||||
|
||||
volatile extern uint16_t keyState;
|
||||
inline uint32_t millis() {
|
||||
return system_Ticks;
|
||||
}
|
||||
|
||||
inline uint32_t getLastButtonPress() {
|
||||
return lastKeyPress;
|
||||
}
|
||||
inline uint32_t getLastMovement(){
|
||||
return lastMovement;
|
||||
}
|
||||
|
||||
inline uint16_t getButtons() {
|
||||
return keyState;
|
||||
}
|
||||
void WWDG_IRQHandler(void);
|
||||
void PVD_IRQHandler(void);
|
||||
|
||||
|
||||
@@ -7,12 +7,10 @@
|
||||
|
||||
#ifndef MODES_H_
|
||||
#define MODES_H_
|
||||
#include "CTRL.h"
|
||||
#include "Hardware.h"
|
||||
#include "Interrupt.h"
|
||||
#include "S100V0_1.h"
|
||||
#include "Oled.h"
|
||||
uint32_t LastButtonPushTime;
|
||||
uint32_t LastMovementTime;
|
||||
|
||||
enum {
|
||||
STARTUP, //we are sitting on the prompt to push a button
|
||||
SOLDERING,
|
||||
@@ -25,10 +23,15 @@ enum {
|
||||
UVLO = 0, SLEEP_TEMP, SLEEP_TIME,
|
||||
|
||||
} settingsPage;
|
||||
|
||||
struct {
|
||||
uint32_t SolderingTemp; //current setpoint for the iron
|
||||
uint8_t SleepTime; //minutes to sleep
|
||||
uint32_t SleepTemp; //temp to drop to in sleep
|
||||
uint8_t cutoutVoltage; //X10 the voltage we cutout at for undervoltage
|
||||
uint8_t movementEnabled;
|
||||
} systemSettings;
|
||||
|
||||
void ProcessUI();
|
||||
void DrawUI();
|
||||
#endif /* MODES_H_ */
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#define DEVICEADDR_OLED 0x3c
|
||||
#include "stm32f10x.h"
|
||||
#include "Interrupt.h"
|
||||
void Sc_Pt(u8 Co);
|
||||
void Oled_DisplayOn(void);
|
||||
void Oled_DisplayOff(void);
|
||||
@@ -32,6 +33,7 @@ void Display_BG(void);
|
||||
void OLED_DrawString(char* string, uint8_t length);
|
||||
void OLED_DrawChar(char c, uint8_t x);
|
||||
void OLED_DrawTwoNumber(uint8_t in, uint8_t x);
|
||||
void OLED_DrawThreeNumber(uint16_t in, uint8_t x);
|
||||
|
||||
#endif
|
||||
/******************************** END OF FILE *********************************/
|
||||
|
||||
@@ -8,15 +8,19 @@
|
||||
#define MCU_TYPE "STM32F103T8"
|
||||
#define SCH_VER "2.46"
|
||||
|
||||
|
||||
#define SPIx SPI1
|
||||
//--------------------------- key Definitions ------------------------------//
|
||||
#define KEY1_PIN GPIO_Pin_9 //PA8
|
||||
#define KEY2_PIN GPIO_Pin_6 //PA6
|
||||
|
||||
#define KEY_A KEY1_PIN
|
||||
#define KEY_B KEY2_PIN
|
||||
#define BUT_A 0x01
|
||||
#define BUT_B 0x02
|
||||
#define BUT_AB BUT_A|BUT_B
|
||||
#define KEY_1 !(GPIOA->IDR & KEY1_PIN)
|
||||
#define KEY_2 !(GPIOA->IDR & KEY2_PIN)
|
||||
#define KEY_DFU KEY_1
|
||||
#define KEY_ON 0
|
||||
|
||||
#define I2C1_DMA_CHANNEL_TX DMA1_Channel6
|
||||
#define I2C1_DMA_CHANNEL_RX DMA1_Channel7
|
||||
@@ -27,7 +31,6 @@
|
||||
#define I2C1_DR_Address 0x40005410
|
||||
#define I2C2_DR_Address 0x40005810
|
||||
|
||||
|
||||
//--------------------------- OLED ------------------------------//
|
||||
#define OLED_RST_PIN GPIO_Pin_8 //PA9
|
||||
#define OLED_RST() GPIO_ResetBits(GPIOA, OLED_RST_PIN)
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/********************* (C) COPYRIGHT 2015 e-Design Co.,Ltd. **********************
|
||||
File Name : UI.h
|
||||
Version : S100 APP Ver 2.11
|
||||
Description:
|
||||
Author : Celery
|
||||
Data: 2015/07/07
|
||||
History:
|
||||
2015/07/07 ͳһ<CDB3><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*******************************************************************************/
|
||||
#ifndef _UI_H
|
||||
#define _UI_H
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
u32 Get_UpdataFlag(void);
|
||||
void Set_UpdataFlag(u32 Cont);
|
||||
void APP_Init(void);
|
||||
u32 Calculation_TWork(u8 Flag);
|
||||
void Temp_SetProc(void);
|
||||
void Display_Temp(u8 x, s16 Temp);
|
||||
void Show_Notice(void);
|
||||
void Show_Warning(void);
|
||||
void Show_MiniTS(void);
|
||||
void Show_TempDown(s16 Temp, s16 Dst_Temp);
|
||||
void Set_TemperatureShowFlag(u8 flag);
|
||||
s16 TemperatureShow_Change(u8 flag, s16 Tmp);
|
||||
u8 Get_TemperatureShowFlag(void);
|
||||
|
||||
void Show_Triangle(u8 empty, u8 fill);
|
||||
void Shift_Char(u8* ptr, u8 pos);
|
||||
void Show_Set(void);
|
||||
void Show_OrderChar(u8* ptr, u8 num, u8 width);
|
||||
u8 Reverse_Bin8(u8 data);
|
||||
void Show_ReverseChar(u8* ptr, u8 num, u8 width, u8 direction);
|
||||
u8 Show_TempReverse(u8 num, u8 width, u8 direction);
|
||||
void Show_HeatingIcon(u32 ht_flag, u16 active);
|
||||
void Display_Str(u8 x, char* str);
|
||||
void Display_Str10(u8 x, char* str);
|
||||
void Clear_Pervious(u16 data);
|
||||
void Print_Integer(s32 data, u8 posi);
|
||||
u8 Roll_Num(u16 Step, u8 Flag);
|
||||
void OLed_Display(void);
|
||||
void Show_Cal(u8 flag);
|
||||
void Show_Config(void);
|
||||
#endif
|
||||
/******************************** END OF FILE *********************************/
|
||||
Reference in New Issue
Block a user