Add files via upload

This commit is contained in:
JYEtech
2017-05-07 20:48:04 -04:00
committed by GitHub
parent 994db1fc81
commit 29f25edd2f
20 changed files with 8020 additions and 0 deletions

180
113-15011.c Normal file
View File

@@ -0,0 +1,180 @@
//////////////////////////////////////////////////////////////////////////////
//
// Filename: 113-15011.c
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
// Descriptions: Main firmware for DSO Shell
// PCB: 109-15000-00D or later
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// ATTENTION:
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
#include "stm32f10x.h"
#include "stm32f10x_conf.h"
#include "Common.h"
#include "Board.h"
#include "Screen.h"
#include "Command.h"
#include "Eeprom.h"
#include "libdso150.h"
const U8 Model[12] = {"\n\rDSO Shell"};
const U8 MFG[16] = {"\n\rJYE Tech Ltd."};
const U8 Website[20] = {"\n\rWWW.JYETECH.COM\n\r"};
const U8 FWver[20] = {"FW: 113-15011-060"};
int main (void)
{
U16 tmp1, tmp2;
U32 tmp;
Clock_Init();
Port_Init();
/* Unlock the Flash Program Erase controller */
FLASH_Unlock();
/* EEPROM Init */
EE_Init();
USART1_Init();
ADC2_Init();
TFT_Init_Ili9341();
uputs((U8 *)Model, USART1);
uputs((U8 *)MFG, USART1);
uputs((U8 *)Website, USART1);
uputs((U8 *)FWver, USART1);
tmp = TFT_ReadID_Ili9341();
if((tmp & 0x0000FFFF) == 0x9341) {
// Found 9341 controller
TFT_Controller = 0x9341;
}
else {
TFT_Init_Ili9325();
TFT_Controller = 0x9325;
}
ClrScreen();
SysTick_Init();
TIM3_Init(); // Test signal
NVIC_Configuration();
tmp1 = clBlack;
FillRect(ScreenX0, ScreenY0, ScreenXsize, ScreenYsize, tmp1);
PutcGenic(24, 50, 0, clAqua, tmp1, &DSO_Shell);
PutcGenic(120, 52, 0, clAqua, tmp1, &ByJyetech);
PutcGenic(24, 75, 0, clAqua, tmp1, &Web);
PutsGenic(24, 100, (U8 *)FWver, clWhite, tmp1, &ASC8X16);
PutsGenic(24, 120, (U8 *)LibVersion, clWhite, tmp1, &ASC8X16);
AppInit();
BitClr(Keypad.Flags, (1 << KF_KeyHit));
tmp1 = 100;
while(tmp1) {
KeyScan();
Delay(65500);
tmp1--;
}
if(BitTest(Keypad.Flags, (1 << KF_KeyHit))) {
// Pause
BitClr(Keypad.Flags, (1 << KF_KeyHit));
while(!BitTest(Keypad.Flags, (1 << KF_KeyHit))) {
KeyScan();
}
}
tmp1 = clWhite;
FillRect(ScreenX0, ScreenY0, ScreenXsize, ScreenYsize, tmp1);
PutcGenic(20, 71, 0, clRed, tmp1, &DSOm);
PutcGenic(140, 70, 0, clBlue, tmp1, &Shell);
PutcGenic(24, 115, 0, clBlack, tmp1, &Web);
PutcGenic(20, 180, 0, clBlue, tmp1, &JYELogo);
PutcGenic(90, 178, 0, clBlue, tmp1, &Jinyuedianzi);
PutcGenic(90, 200, 0, clBlue, tmp1, &Jyetech);
// LED blinks twice
LedBlink();
UpdateDisp(Disp_Panel | Disp_Param);
GTimer = 1000;
GTimeout = 0;
// The main loop
while(1) {
DsoDisplay();
if(BitTest(AddOns, (1 << AO_MeasurementOn))) {
OnScreenDisplay();
}
if(BitTest(AddOns, (1 << AO_TestSigAmpDisp))) {
TestSigAmpDisplay();
}
if(GTimeout) {
GTimeout = 0;
StartCapture();
}
if(BitTest(Keypad.Flags, (1 << KF_DoKeyScan))) {
BitClr(Keypad.Flags, (1 << KF_DoKeyScan));
// Do key scan
KeyScan();
}
if(Keypad.KeyCode) {
// Process key code
KeyProc();
Keypad.KeyCode = 0;
}
tmp1 = GetDsoStatus();
if(GTimer == 0) {
if(BitTest(tmp1, DSO_CaptureDone)) {
Measurements();
UpdateDisp(Disp_Trace);
tmp2 = GetTimebase();
if(tmp2 <= TB_1ms) {
// Start next capture
StartCapture();
}
else {
// Lower capture rate
GTimer = 40;
}
}
}
if(BitTest(tmp1, DSO_Rolling)) {
Measurements();
Rolling();
}
}
}

1512
Board.c Normal file

File diff suppressed because it is too large Load Diff

996
Board.h Normal file
View File

@@ -0,0 +1,996 @@
//////////////////////////////////////////////////////////////////////////////
//
// Filename: Board.h
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech Ltd.
// Web: www.jyetech.com
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// Notes:
//
//
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
//
//
#ifndef Board_h
#define Board_h
#include "Common.h"
#include "stm32f10x.h"
//#include "stm32f10x_conf.h"
// TFT control ports
#define TFT_nRESET_Port GPIOB
#define TFT_nRESET_Bit 9
#define TFT_RS_Port GPIOC
#define TFT_RS_Bit 14
#define TFT_nCS_Port GPIOC
#define TFT_nCS_Bit 13
#define TFT_nWR_Port GPIOC
#define TFT_nWR_Bit 15
#define TFT_nRD_Port GPIOA
#define TFT_nRD_Bit 6
#define TFT_Port (GPIOB->ODR)
#define TFT_Port_In (GPIOB->IDR)
#define LED_Base GPIOA
#define LED_Port (GPIOA->ODR)
#define LED_Bit 15
#define Beep_Base (GPIOA)
#define Beep_Port (GPIOA->ODR)
#define Beep_Bit 15
#define I2C_SCL_Port GPIOB
#define I2C_SCL_Bit 10
#define I2C_SDA_Port GPIOB
#define I2C_SDA_Bit 11
// I2C Macros
#define SetSCL_H (I2C_SCL_Port->BSRR = 1 << I2C_SCL_Bit)
#define SetSCL_L (I2C_SCL_Port->BRR = 1 << I2C_SCL_Bit)
#define SetSDA_H (I2C_SDA_Port->BSRR = 1 << I2C_SDA_Bit)
#define SetSDA_L (I2C_SDA_Port->BRR = 1 << I2C_SDA_Bit)
#define GetSDA (BitTest(I2C_SDA_Port->IDR, (1 << I2C_SDA_Bit)))
// Pushbuttons and rotary encoder
#define PB_Port (GPIOB->IDR)
#define PB_Bits 0x00F8
#define ENC_Port (GPIOB->IDR)
#define ENC_Bits 0x0003
// VSen control
#define VSen_Port (GPIOA->ODR)
#define VSen_Bits 0x001E
// ILI9325 command registers
#define TFT_DriverOutputControl 0x0001
#define TFT_DrivingWaveControl 0x0002
#define TFT_EntryMode 0x0003
#define TFT_DisplayControl1 0x0007
#define TFT_DisplayControl2 0x0008
#define TFT_DisplayControl3 0x0009
#define TFT_DisplayControl4 0x000A
#define TFT_FrameMarkerPosition 0x000D
#define TFT_PowerControl1 0x0010
#define TFT_PowerControl2 0x0011
#define TFT_PowerControl3 0x0012
#define TFT_PowerControl4 0x0013
#define TFT_DramHAddress 0x0020
#define TFT_DramVAddress 0x0021
#define TFT_DramDataWrite 0x0022
#define TFT_DramDataRead 0x0022
#define TFT_VCOMH_Control 0x0029
#define TFT_FrameRateColor 0x002B
#define TFT_HAddressStart 0x0050
#define TFT_HAddressEnd 0x0051
#define TFT_VAddressStart 0x0052
#define TFT_VAddressEnd 0x0053
#define TFT_GateScanControl1 0x0060
#define TFT_GateScanControl2 0x0061
#define TFT_Panel_IF_Control1 0x0090
#define TFT_Panel_IF_Control2 0x0092
#define TFT_FAh_FEh_Enable 0x00FF
// ======== STM32 Register Constants =====================
// -------- Register address -----------------
// RCC registers
#define RCC_AHBENR (*((unsigned int *)(0x40021014)))
#define RCC_APB2ENR (*((unsigned int *)(0x40021018)))
#define RCC_APB1ENR (*((unsigned int *)(0x4002101C)))
// GPIO registers
#define GPIOA_CRL (*((unsigned int *)(0x40010800)))
#define GPIOA_BSRR (*((unsigned int *)(0x40010810)))
#define GPIOA_BRR (*((unsigned int *)(0x40010814)))
#define GPIOB_CRL (*((unsigned int *)(0x40010C00)))
#define GPIOB_CRH (*((unsigned int *)(0x40010C04)))
#define GPIOB_IDR (*((unsigned int *)(0x40010C08)))
#define GPIOB_ODR (*((unsigned int *)(0x40010C0C)))
#define GPIOB_BSRR (*((unsigned int *)(0x40010C10)))
#define GPIOB_BRR (*((unsigned int *)(0x40010C14)))
#define GPIOB_LCKR (*((unsigned int *)(0x40010C18)))
#define GPIOD_CRL (*((unsigned int *)(0x40011400)))
#define GPIOD_CRH (*((unsigned int *)(0x40011404)))
#define GPIOD_IDR (*((unsigned int *)(0x40011408)))
#define GPIOD_ODR (*((unsigned int *)(0x4001140C)))
#define GPIOD_BSRR (*((unsigned int *)(0x40011410)))
#define GPIOD_BRR (*((unsigned int *)(0x40011414)))
#define GPIOD_LCKR (*((unsigned int *)(0x40011418)))
#define GPIOE_CRL (*((unsigned int *)(0x40011800)))
#define GPIOE_CRH (*((unsigned int *)(0x40011804)))
#define GPIOE_IDR (*((unsigned int *)(0x40011808)))
#define GPIOE_ODR (*((unsigned int *)(0x4001180C)))
#define GPIOE_BSRR (*((unsigned int *)(0x40011810)))
#define GPIOE_BRR (*((unsigned int *)(0x40011814)))
#define GPIOE_LCKR (*((unsigned int *)(0x40011818)))
// FSMC registers
#define FSMC_BCR1 (*((U32 *)(0xA0000000)))
#define FSMC_BTR1 (*((U32 *)(0xA0000004)))
#define FSMC_BWTR1 (*((U32 *)(0xA0000104)))
#define FSMC_BCR2 (*((U32 *)(0xA0000008)))
#define FSMC_BTR2 (*((U32 *)(0xA000000C)))
#define FSMC_BWTR2 (*((U32 *)(0xA000010C)))
// ---------------- Bit fields ------------------------
// Clock control
//-- AHBENR
#define SDIOEN 10
#define FSMCEN 8
#define CRCEN 6
#define FLITFEN 4
#define SRAMEN 2
#define DMA2EN 1
#define DMA1EN 0
//-- APB1ENR
#define DACEN 29
#define PWREN 28
#define BKPEN 27
#define CANEN 25
#define USBEN 23
#define I2C2EN 22
#define I2C1EN 21
#define UART5EN 20
#define UART4EN 19
#define USART3EN 18
#define USART2EN 17
#define SPI3EN 15
#define SPI2EN 14
#define WWDGEN 11
#define TIM7EN 5
#define TIM6EN 4
#define TIM5EN 3
#define TIM4EN 2
#define TIM3EN 1
#define TIM2EN 0
//-- APB2ENR
#define ADC3EN 15
#define USART1EN 14
#define TIM8EN 13
#define SPI1EN 12
#define TIM1EN 11
#define ADC2EN 10
#define ADC1EN 9
#define IOPGEN 8
#define IOPFEN 7
#define IOPEEN 6
#define IOPDEN 5
#define IOPCEN 4
#define IOPBEN 3
#define IOPAEN 2
#define AFIOEN 0
// ---------------- Bit fields ------------------------
// Clock control
//
/******************** Bit definition for RCC_CR register ********************/
#define HSION 0 /*!< Internal High Speed clock enable */
#define HSIRDY 1 /*!< Internal High Speed clock ready flag */
#define HSITRIM 3 /*!< Internal High Speed clock trimming */
#define HSICAL 8 /*!< Internal High Speed clock Calibration */
#define HSEON 16 /*!< External High Speed clock enable */
#define HSERDY 17 /*!< External High Speed clock ready flag */
#define HSEBYP 18 /*!< External High Speed clock Bypass */
#define CSSON 19 /*!< Clock Security System enable */
#define PLLON 24 /*!< PLL enable */
#define PLLRDY 25 /*!< PLL clock ready flag */
/******************* Bit definition for RCC_CFGR register *******************/
/*!< SW configuration */
#define SW 0 /*!< SW[1:0] bits (System clock Switch) */
/*!< SWS configuration */
#define SWS 2 /*!< SWS[1:0] bits (System Clock Switch Status) */
/*!< HPRE configuration */
#define HPRE 4 /*!< HPRE[3:0] bits (AHB prescaler) */
/*!< PPRE1 configuration */
#define PPRE1 8 /*!< PRE1[2:0] bits (APB1 prescaler) */
/*!< PPRE2 configuration */
#define PPRE2 11 /*!< PRE2[2:0] bits (APB2 prescaler) */
/*!< ADCPPRE configuration */
#define ADCPRE 14 /*!< ADCPRE[1:0] bits (ADC prescaler) */
#define PLLSRC 16 /*!< PLL entry clock source */
#define PLLXTPRE 17 /*!< HSE divider for PLL entry */
/*!< PLLMUL configuration */
#define PLLMULL 18 /*!< PLLMUL[3:0] bits (PLL multiplication factor) */
#define USBPRE 22 /*!< USB Device prescaler */
/*!< MCO configuration */
#define MCO 24 /*!< MCO[2:0] bits (Microcontroller Clock Output) */
/*!<****************** Bit definition for RCC_CIR register ********************/
#define LSIRDYF 0 /*!< LSI Ready Interrupt flag */
#define LSERDYF 1 /*!< LSE Ready Interrupt flag */
#define HSIRDYF 2 /*!< HSI Ready Interrupt flag */
#define HSERDYF 3 /*!< HSE Ready Interrupt flag */
#define PLLRDYF 4 /*!< PLL Ready Interrupt flag */
#define CSSF 7 /*!< Clock Security System Interrupt flag */
#define LSIRDYIE 8 /*!< LSI Ready Interrupt Enable */
#define LSERDYIE 9 /*!< LSE Ready Interrupt Enable */
#define HSIRDYIE 10 /*!< HSI Ready Interrupt Enable */
#define HSERDYIE 11 /*!< HSE Ready Interrupt Enable */
#define PLLRDYIE 12 /*!< PLL Ready Interrupt Enable */
#define LSIRDYC 16 /*!< LSI Ready Interrupt Clear */
#define LSERDYC 17 /*!< LSE Ready Interrupt Clear */
#define HSIRDYC 18 /*!< HSI Ready Interrupt Clear */
#define HSERDYC 19 /*!< HSE Ready Interrupt Clear */
#define PLLRDYC 20 /*!< PLL Ready Interrupt Clear */
#define CSSC 23 /*!< Clock Security System Interrupt Clear */
/***************** Bit definition for RCC_APB2RSTR register *****************/
#define AFIORST 0 /*!< Alternate Function I/O reset */
#define IOPARST 2 /*!< I/O port A reset */
#define IOPBRST 3 /*!< I/O port B reset */
#define IOPCRST 4 /*!< I/O port C reset */
#define IOPDRST 5 /*!< I/O port D reset */
#define IOPERST 6 /*!< I/O port E reset */
#define IOPFRST 7 /*!< I/O port F reset */
#define IOPGRST 8 /*!< I/O port G reset */
#define ADC1RST 9 /*!< ADC 1 interface reset */
#define ADC2RST 10 /*!< ADC 2 interface reset */
#define TIM1RST 11 /*!< TIM1 Timer reset */
#define SPI1RST 12 /*!< SPI 1 reset */
#define TIM8RST 13 /*!< TIM8 Timer reset */
#define USART1RST 14 /*!< USART1 reset */
#define ADC3RST 15 /*!< ADC3 interface reset */
/***************** Bit definition for RCC_APB1RSTR register *****************/
#define TIM2RST 0 /*!< Timer 2 reset */
#define TIM3RST 1 /*!< Timer 3 reset */
#define TIM4RST 2 /*!< Timer 4 reset */
#define TIM5RST 3 /*!< Timer 5 reset */
#define TIM6RST 4 /*!< Timer 6 reset */
#define TIM7RST 5 /*!< Timer 7 reset */
#define WWDGRST 11 /*!< Window Watchdog reset */
#define SPI2RST 14 /*!< SPI 2 reset */
#define SPI3RST 15 /*!< SPI 3 reset */
#define USART2RST 17 /*!< USART 2 reset */
#define USART3RST 18 /*!< RUSART 3 reset */
#define UART4RST 19 /*!< UART 4 reset */
#define UART5RST 20 /*!< UART 5 reset */
#define I2C1RST 21 /*!< I2C 1 reset */
#define I2C2RST 22 /*!< I2C 2 reset */
#define USBRST 23 /*!< USB Device reset */
#define CAN1RST 25 /*!< CAN1 reset */
#define BKPRST 27 /*!< Backup interface reset */
#define PWRRST 28 /*!< Power interface reset */
#define DACRST 29 /*!< DAC interface reset */
/****************** Bit definition for RCC_AHBENR register ******************/
#define DMA1EN 0 /*!< DMA1 clock enable */
#define DMA2EN 1 /*!< DMA2 clock enable */
#define SRAMEN 2 /*!< SRAM interface clock enable */
#define FLITFEN 4 /*!< FLITF clock enable */
#define CRCEN 6 /*!< CRC clock enable */
#define FSMCEN 8 /*!< FSMC clock enable */
#define SDIOEN 10 /*!< SDIO clock enable */
/****************** Bit definition for RCC_APB2ENR register *****************/
#define AFIOEN 0 /*!< Alternate Function I/O clock enable */
#define IOPAEN 2 /*!< I/O port A clock enable */
#define IOPBEN 3 /*!< I/O port B clock enable */
#define IOPCEN 4 /*!< I/O port C clock enable */
#define IOPDEN 5 /*!< I/O port D clock enable */
#define IOPEEN 6 /*!< I/O port E clock enable */
#define IOPFEN 7 /*!< I/O port F clock enable */
#define IOPGEN 8 /*!< I/O port G clock enable */
#define ADC1EN 9 /*!< ADC 1 interface clock enable */
#define ADC2EN 10 /*!< ADC 2 interface clock enable */
#define TIM1EN 11 /*!< TIM1 Timer clock enable */
#define SPI1EN 12 /*!< SPI 1 clock enable */
#define TIM8EN 13 /*!< TIM8 Timer clock enable */
#define USART1EN 14 /*!< USART1 clock enable */
#define ADC3EN 15 /*!< DMA1 clock enable */
/***************** Bit definition for RCC_APB1ENR register ******************/
#define TIM2EN 0 /*!< Timer 2 clock enabled*/
#define TIM3EN 1 /*!< Timer 3 clock enable */
#define TIM4EN 2 /*!< Timer 4 clock enable */
#define TIM5EN 3 /*!< Timer 5 clock enable */
#define TIM6EN 4 /*!< Timer 6 clock enable */
#define TIM7EN 5 /*!< Timer 7 clock enable */
#define WWDGEN 11 /*!< Window Watchdog clock enable */
#define SPI2EN 14 /*!< SPI 2 clock enable */
#define SPI3EN 15 /*!< SPI 3 clock enable */
#define USART2EN 17 /*!< USART 2 clock enable */
#define USART3EN 18 /*!< USART 3 clock enable */
#define UART4EN 19 /*!< UART 4 clock enable */
#define UART5EN 20 /*!< UART 5 clock enable */
#define I2C1EN 21 /*!< I2C 1 clock enable */
#define I2C2EN 22 /*!< I2C 2 clock enable */
#define USBEN 23 /*!< USB Device clock enable */
#define CAN1EN 25 /*!< CAN1 clock enable */
#define BKPEN 27 /*!< Backup interface clock enable */
#define PWREN 28 /*!< Power interface clock enable */
#define DACEN 29 /*!< DAC interface clock enable */
/******************* Bit definition for RCC_BDCR register *******************/
#define LSEON 0 /*!< External Low Speed oscillator enable */
#define LSERDY 1 /*!< External Low Speed oscillator Ready */
#define LSEBYP 2 /*!< External Low Speed oscillator Bypass */
#define RTCSEL 8 /*!< RTCSEL[1:0] bits (RTC clock source selection) */
#define RTCEN 15 /*!< RTC clock enable */
#define BDRST 16 /*!< Backup domain software reset */
/******************* Bit definition for RCC_CSR register ********************/
#define LSION 0 /*!< Internal Low Speed oscillator enable */
#define LSIRDY 1 /*!< Internal Low Speed oscillator Ready */
#define RMVF 24 /*!< Remove reset flag */
#define PINRSTF 26 /*!< PIN reset flag */
#define PORRSTF 27 /*!< POR/PDR reset flag */
#define SFTRSTF 28 /*!< Software Reset flag */
#define IWDGRSTF 29 /*!< Independent Watchdog reset flag */
#define WWDGRSTF 30 /*!< Window watchdog reset flag */
#define LPWRRSTF 31 /*!< Low-Power reset flag */
/******************************************************************************/
/* */
/* TIM */
/* */
/******************************************************************************/
/******************* Bit definition for TIM_CR1 register ********************/
#define CEN 0 /*!<Counter enable */
#define UDIS 1 /*!<Update disable */
#define URS 2 /*!<Update request source */
#define OPM 3 /*!<One pulse mode */
#define DIR 4 /*!<Direction */
#define CMS 5 /*!<CMS[1:0] bits (Center-aligned mode selection) */
#define ARPE 7 /*!<Auto-reload preload enable */
#define CKD 8 /*!<CKD[1:0] bits (clock division) */
/******************* Bit definition for TIM_CR2 register ********************/
#define CCPC 0 /*!<Capture/Compare Preloaded Control */
#define CCUS 2 /*!<Capture/Compare Control Update Selection */
#define CCDS 3 /*!<Capture/Compare DMA Selection */
#define MMS 4 /*!<MMS[2:0] bits (Master Mode Selection) */
#define TI1S 7 /*!<TI1 Selection */
#define OIS1 8 /*!<Output Idle state 1 (OC1 output) */
#define OIS1N 9 /*!<Output Idle state 1 (OC1N output) */
#define OIS2 10 /*!<Output Idle state 2 (OC2 output) */
#define OIS2N 11 /*!<Output Idle state 2 (OC2N output) */
#define OIS3 12 /*!<Output Idle state 3 (OC3 output) */
#define OIS3N 13 /*!<Output Idle state 3 (OC3N output) */
#define OIS4 14 /*!<Output Idle state 4 (OC4 output) */
/******************* Bit definition for TIM_SMCR register *******************/
#define SMS 0 /*!<SMS[2:0] bits (Slave mode selection) */
#define TS 4 /*!<TS[2:0] bits (Trigger selection) */
#define MSM 7 /*!<Master/slave mode */
#define ETF 8 /*!<ETF[3:0] bits (External trigger filter) */
#define ETPS 12 /*!<ETPS[1:0] bits (External trigger prescaler) */
#define ECE 14 /*!<External clock enable */
#define ETP 15 /*!<External trigger polarity */
/******************* Bit definition for TIM_DIER register *******************/
#define UIE 0 /*!<Update interrupt enable */
#define CC1IE 1 /*!<Capture/Compare 1 interrupt enable */
#define CC2IE 2 /*!<Capture/Compare 2 interrupt enable */
#define CC3IE 3 /*!<Capture/Compare 3 interrupt enable */
#define CC4IE 4 /*!<Capture/Compare 4 interrupt enable */
#define COMIE 5 /*!<COM interrupt enable */
#define TIE 6 /*!<Trigger interrupt enable */
#define BIE 7 /*!<Break interrupt enable */
#define UDE 8 /*!<Update DMA request enable */
#define CC1DE 9 /*!<Capture/Compare 1 DMA request enable */
#define CC2DE 10 /*!<Capture/Compare 2 DMA request enable */
#define CC3DE 11 /*!<Capture/Compare 3 DMA request enable */
#define CC4DE 12 /*!<Capture/Compare 4 DMA request enable */
#define COMDE 13 /*!<COM DMA request enable */
#define TDE 14 /*!<Trigger DMA request enable */
/******************** Bit definition for TIM_SR register ********************/
#define UIF 0 /*!<Update interrupt Flag */
#define CC1IF 1 /*!<Capture/Compare 1 interrupt Flag */
#define CC2IF 2 /*!<Capture/Compare 2 interrupt Flag */
#define CC3IF 3 /*!<Capture/Compare 3 interrupt Flag */
#define CC4IF 4 /*!<Capture/Compare 4 interrupt Flag */
#define COMIF 5 /*!<COM interrupt Flag */
#define TIF 6 /*!<Trigger interrupt Flag */
#define BIF 7 /*!<Break interrupt Flag */
#define CC1OF 9 /*!<Capture/Compare 1 Overcapture Flag */
#define CC2OF 10 /*!<Capture/Compare 2 Overcapture Flag */
#define CC3OF 11 /*!<Capture/Compare 3 Overcapture Flag */
#define CC4OF 12 /*!<Capture/Compare 4 Overcapture Flag */
/******************* Bit definition for TIM_EGR register ********************/
#define UG 0 /*!<Update Generation */
#define CC1G 1 /*!<Capture/Compare 1 Generation */
#define CC2G 2 /*!<Capture/Compare 2 Generation */
#define CC3G 3 /*!<Capture/Compare 3 Generation */
#define CC4G 4 /*!<Capture/Compare 4 Generation */
#define COMG 5 /*!<Capture/Compare Control Update Generation */
#define TG 6 /*!<Trigger Generation */
#define BG 7 /*!<Break Generation */
/****************** Bit definition for TIM_CCMR1 register *******************/
#define CC1S 0 /*!<CC1S[1:0] bits (Capture/Compare 1 Selection) */
#define OC1FE 2 /*!<Output Compare 1 Fast enable */
#define OC1PE 3 /*!<Output Compare 1 Preload enable */
#define OC1M 4 /*!<OC1M[2:0] bits (Output Compare 1 Mode) */
#define OC1CE 7 /*!<Output Compare 1Clear Enable */
#define CC2S 8 /*!<CC2S[1:0] bits (Capture/Compare 2 Selection) */
#define OC2FE 10 /*!<Output Compare 2 Fast enable */
#define OC2PE 11 /*!<Output Compare 2 Preload enable */
#define OC2M 12 /*!<OC2M[2:0] bits (Output Compare 2 Mode) */
#define OC2CE 15 /*!<Output Compare 2 Clear Enable */
/*----------------------------------------------------------------------------*/
#define IC1PSC 2 /*!<IC1PSC[1:0] bits (Input Capture 1 Prescaler) */
#define IC1F 4 /*!<IC1F[3:0] bits (Input Capture 1 Filter) */
#define IC2PSC 10 /*!<IC2PSC[1:0] bits (Input Capture 2 Prescaler) */
#define IC2F 12 /*!<IC2F[3:0] bits (Input Capture 2 Filter) */
/****************** Bit definition for TIM_CCMR2 register *******************/
#define CC3S 0 /*!<CC3S[1:0] bits (Capture/Compare 3 Selection) */
#define OC3FE 2 /*!<Output Compare 3 Fast enable */
#define OC3PE 3 /*!<Output Compare 3 Preload enable */
#define OC3M 4 /*!<OC3M[2:0] bits (Output Compare 3 Mode) */
#define OC3CE 7 /*!<Output Compare 3 Clear Enable */
#define CC4S 8 /*!<CC4S[1:0] bits (Capture/Compare 4 Selection) */
#define OC4FE 10 /*!<Output Compare 4 Fast enable */
#define OC4PE 11 /*!<Output Compare 4 Preload enable */
#define OC4M 12 /*!<OC4M[2:0] bits (Output Compare 4 Mode) */
#define OC4CE 15 /*!<Output Compare 4 Clear Enable */
/*----------------------------------------------------------------------------*/
#define IC3PSC 2 /*!<IC3PSC[1:0] bits (Input Capture 3 Prescaler) */
#define IC3F 4 /*!<IC3F[3:0] bits (Input Capture 3 Filter) */
#define IC4PSC 10 /*!<IC4PSC[1:0] bits (Input Capture 4 Prescaler) */
#define IC4F 12 /*!<IC4F[3:0] bits (Input Capture 4 Filter) */
/******************* Bit definition for TIM_CCER register *******************/
#define CC1E 0 /*!<Capture/Compare 1 output enable */
#define CC1P 1 /*!<Capture/Compare 1 output Polarity */
#define CC1NE 2 /*!<Capture/Compare 1 Complementary output enable */
#define CC1NP 3 /*!<Capture/Compare 1 Complementary output Polarity */
#define CC2E 4 /*!<Capture/Compare 2 output enable */
#define CC2P 5 /*!<Capture/Compare 2 output Polarity */
#define CC2NE 6 /*!<Capture/Compare 2 Complementary output enable */
#define CC2NP 7 /*!<Capture/Compare 2 Complementary output Polarity */
#define CC3E 8 /*!<Capture/Compare 3 output enable */
#define CC3P 9 /*!<Capture/Compare 3 output Polarity */
#define CC3NE 10 /*!<Capture/Compare 3 Complementary output enable */
#define CC3NP 11 /*!<Capture/Compare 3 Complementary output Polarity */
#define CC4E 12 /*!<Capture/Compare 4 output enable */
#define CC4P 13 /*!<Capture/Compare 4 output Polarity */
/******************* Bit definition for TIM_BDTR register *******************/
#define DTG 0 /*!<DTG[0:7] bits (Dead-Time Generator set-up) */
#define LOCK 8 /*!<LOCK[1:0] bits (Lock Configuration) */
#define OSSI 10 /*!<Off-State Selection for Idle mode */
#define OSSR 11 /*!<Off-State Selection for Run mode */
#define BKE 12 /*!<Break enable */
//#define BKP 13 /*!<Break Polarity */
#define AOE 14 /*!<Automatic Output enable */
#define MOE 15 /*!<Main Output enable */
/******************* Bit definition for TIM_DCR register ********************/
#define DBA 0 /*!<DBA[4:0] bits (DMA Base Address) */
#define DBL 8 /*!<DBL[4:0] bits (DMA Burst Length) */
/******************* Bit definition for TIM_DMAR register *******************/
#define DMAB 0 /*!<DMA register for burst accesses */
/******************************************************************************/
/* */
/* SystemTick */
/* */
/******************************************************************************/
/***************** Bit definition for SysTick_CTRL register *****************/
#define SysTick_ENABLE 0 // ((uint32_t)0x00000001) /*!< Counter enable */
#define SysTick_TICKINT 1 // ((uint32_t)0x00000002) /*!< Counting down to 0 pends the SysTick handler */
#define SysTick_CLKSOURCE 2 // ((uint32_t)0x00000004) /*!< Clock source */
#define SysTick_COUNTFLAG 16 // ((uint32_t)0x00010000) /*!< Count Flag */
/***************** Bit definition for SysTick_LOAD register *****************/
#define SysTick_RELOAD 0 // ((uint32_t)0x00FFFFFF) /*!< Value to load into the SysTick Current Value Register when the counter reaches 0 */
/***************** Bit definition for SysTick_VAL register ******************/
#define SysTick_CURRENT 0 // ((uint32_t)0x00FFFFFF) /*!< Current value at the time the register is accessed */
/***************** Bit definition for SysTick_CALIB register ****************/
#define SysTick_TENMS 0 // ((uint32_t)0x00FFFFFF) /*!< Reload value to use for 10ms timing */
#define SysTick_SKEW 30 // ((uint32_t)0x40000000) /*!< Calibration value is not exactly 10 ms */
#define SysTick_NOREF 31 // ((uint32_t)0x80000000) /*!< The reference clock is not provided */
// GPIO port configuration constants
#define GPIO_Mode_In 0x00
#define GPIO_Mode_Out10M 0x01
#define GPIO_Mode_Out2M 0x02
#define GPIO_Mode_Out50M 0x03
#define GPIO_CNF_GP_PP 0x00
#define GPIO_CNF_GP_OD 0x04
#define GPIO_CNF_AF_PP 0x08
#define GPIO_CNF_AF_OD 0x0C
#define GPIO_CNF_AnalogIn 0x00
#define GPIO_CNF_Floating 0x04
#define GPIO_CNF_IPD 0x08
#define GPIO_CNF_IPU 0x08
/****************** Bit definition for FSMC_BCR registers *******************/
#define CBURSTRW 16 /*!<Write burst enable */
#define EXTMOD 14 /*!<Extended mode enable */
#define WAITEN 13 /*!<Wait enable bit */
#define WREN 12 /*!<Write enable bit */
#define WAITCFG 11 /*!<Wait timing configuration */
#define WRAPMOD 10 /*!<Wrapped burst mode support */
#define WAITPOL 9 /*!<Wait signal polarity bit */
#define BURSTEN 8 /*!<Burst enable bit */
#define FACCEN 6 /*!<Flash access enable */
#define MWID 4 /*!<MWID[1:0] bits (Memory data bus width) */
#define MTYP 2 /*!<MTYP[1:0] bits (Memory type) */
#define MUXEN 1 /*!<Address/data multiplexing enable bit */
#define MBKEN 0 /*!<Memory bank enable bit */
/****************** Bit definition for FSMC_BTR and FSMC_BWTR registers ******************/
#define ACCMOD 28 /*!<ACCMOD[1:0] bits (Access mode) */
#define DATLAT 24 /*!<DATLA[3:0] bits (Data latency) */
#define CLKDIV 20 /*!<CLKDIV[3:0] bits (Clock divide ratio) */
#define BUSTURN 16 /*!<BUSTURN[3:0] bits (Bus turnaround phase duration) */
#define DATAST 8 /*!<DATAST [3:0] bits (Data-phase duration) */
#define ADDHLD 4 /*!<ADDHLD[3:0] bits (Address-hold phase duration) */
#define ADDSET 0 /*!<ADDSET[3:0] bits (Address setup phase duration) */
/******************************************************************************/
/* */
/* Analog to Digital Converter */
/* */
/******************************************************************************/
/******************** Bit definition for ADC_SR register ********************/
#define AWD 0 /*!<Analog watchdog flag */
#define EOC 1 /*!<End of conversion */
#define JEOC 2 /*!<Injected channel end of conversion */
#define JSTRT 3 /*!<Injected channel Start flag */
#define STRT 4 /*!<Regular channel Start flag */
/******************* Bit definition for ADC_CR1 register ********************/
#define AWDCH 0 /*!<AWDCH[4:0] bits (Analog watchdog channel select bits) */
#define EOCIE 5 /*!<Interrupt enable for EOC */
#define AWDIE 6 /*!<AAnalog Watchdog interrupt enable */
#define JEOCIE 7 /*!<Interrupt enable for injected channels */
#define SCAN 8 /*!<Scan mode */
#define AWDSGL 9 /*!<Enable the watchdog on a single channel in scan mode */
#define JAUTO 10 /*!<Automatic injected group conversion */
#define DISCEN 11 /*!<Discontinuous mode on regular channels */
#define JDISCEN 12 /*!<Discontinuous mode on injected channels */
#define DISCNUM 13 /*!<DISCNUM[2:0] bits (Discontinuous mode channel count) */
#define DUALMOD 16 /*!<DUALMOD[3:0] bits (Dual mode selection) */
#define JAWDEN 22 /*!<Analog watchdog enable on injected channels */
#define AWDEN 23 /*!<Analog watchdog enable on regular channels */
/******************* Bit definition for ADC_CR2 register ********************/
#define ADON 0 // ((uint32_t)0x00000001) /*!<A/D Converter ON / OFF */
#define CONT 1 // ((uint32_t)0x00000002) /*!<Continuous Conversion */
#define CAL 2 // ((uint32_t)0x00000004) /*!<A/D Calibration */
#define RSTCAL 3 // ((uint32_t)0x00000008) /*!<Reset Calibration */
#define DMA 8 // ((uint32_t)0x00000100) /*!<Direct Memory access mode */
#define ALIGN 11 // ((uint32_t)0x00000800) /*!<Data Alignment */
#define JEXTSEL 12 // ((uint32_t)0x00007000) /*!<JEXTSEL[2:0] bits (External event select for injected group) */
#define JEXTTRIG 15 // ((uint32_t)0x00008000) /*!<External Trigger Conversion mode for injected channels */
#define EXTSEL 17 // ((uint32_t)0x000E0000) /*!<EXTSEL[2:0] bits (External Event Select for regular group) */
#define EXTTRIG 20 // ((uint32_t)0x00100000) /*!<External Trigger Conversion mode for regular channels */
#define JSWSTART 21 // ((uint32_t)0x00200000) /*!<Start Conversion of injected channels */
#define SWSTART 22 // ((uint32_t)0x00400000) /*!<Start Conversion of regular channels */
#define TSVREFE 23 // ((uint32_t)0x00800000) /*!<Temperature Sensor and VREFINT Enable */
/****************** Bit definition for ADC_SMPR1 register *******************/
#define SMP10 0 // ((uint32_t)0x00000007) /*!<SMP10[2:0] bits (Channel 10 Sample time selection) */
#define SMP11 3 // ((uint32_t)0x00000038) /*!<SMP11[2:0] bits (Channel 11 Sample time selection) */
#define SMP12 6 // ((uint32_t)0x000001C0) /*!<SMP12[2:0] bits (Channel 12 Sample time selection) */
#define SMP13 9 // ((uint32_t)0x00000E00) /*!<SMP13[2:0] bits (Channel 13 Sample time selection) */
#define SMP14 12 // ((uint32_t)0x00007000) /*!<SMP14[2:0] bits (Channel 14 Sample time selection) */
#define SMP15 15 // ((uint32_t)0x00038000) /*!<SMP15[2:0] bits (Channel 15 Sample time selection) */
#define SMP16 18 // ((uint32_t)0x001C0000) /*!<SMP16[2:0] bits (Channel 16 Sample time selection) */
#define SMP17 21 // ((uint32_t)0x00E00000) /*!<SMP17[2:0] bits (Channel 17 Sample time selection) */
/****************** Bit definition for ADC_SMPR2 register *******************/
#define SMP0 0 // ((uint32_t)0x00000007) /*!<SMP0[2:0] bits (Channel 0 Sample time selection) */
#define SMP1 3 // ((uint32_t)0x00000038) /*!<SMP1[2:0] bits (Channel 1 Sample time selection) */
#define SMP2 6 // ((uint32_t)0x000001C0) /*!<SMP2[2:0] bits (Channel 2 Sample time selection) */
#define SMP3 9 // ((uint32_t)0x00000E00) /*!<SMP3[2:0] bits (Channel 3 Sample time selection) */
#define SMP4 12 // ((uint32_t)0x00007000) /*!<SMP4[2:0] bits (Channel 4 Sample time selection) */
#define SMP5 15 // ((uint32_t)0x00038000) /*!<SMP5[2:0] bits (Channel 5 Sample time selection) */
#define SMP6 18 // ((uint32_t)0x001C0000) /*!<SMP6[2:0] bits (Channel 6 Sample time selection) */
#define SMP7 21 // ((uint32_t)0x00E00000) /*!<SMP7[2:0] bits (Channel 7 Sample time selection) */
#define SMP8 24 // ((uint32_t)0x07000000) /*!<SMP8[2:0] bits (Channel 8 Sample time selection) */
#define SMP9 27 // ((uint32_t)0x38000000) /*!<SMP9[2:0] bits (Channel 9 Sample time selection) */
/****************** Bit definition for ADC_JOFR1 register *******************/
#define ADC_JOFR1_JOFFSET1 ((uint16_t)0x0FFF) /*!<Data offset for injected channel 1 */
/****************** Bit definition for ADC_JOFR2 register *******************/
#define ADC_JOFR2_JOFFSET2 ((uint16_t)0x0FFF) /*!<Data offset for injected channel 2 */
/****************** Bit definition for ADC_JOFR3 register *******************/
#define ADC_JOFR3_JOFFSET3 ((uint16_t)0x0FFF) /*!<Data offset for injected channel 3 */
/****************** Bit definition for ADC_JOFR4 register *******************/
#define ADC_JOFR4_JOFFSET4 ((uint16_t)0x0FFF) /*!<Data offset for injected channel 4 */
/******************* Bit definition for ADC_HTR register ********************/
#define ADC_HTR_HT ((uint16_t)0x0FFF) /*!<Analog watchdog high threshold */
/******************* Bit definition for ADC_LTR register ********************/
#define ADC_LTR_LT ((uint16_t)0x0FFF) /*!<Analog watchdog low threshold */
/******************* Bit definition for ADC_SQR1 register *******************/
#define SQ13 0 // ((uint32_t)0x0000001F) /*!<SQ13[4:0] bits (13th conversion in regular sequence) */
#define SQ14 5 // ((uint32_t)0x000003E0) /*!<SQ14[4:0] bits (14th conversion in regular sequence) */
#define SQ15 10 // ((uint32_t)0x00007C00) /*!<SQ15[4:0] bits (15th conversion in regular sequence) */
#define SQ16 15 // ((uint32_t)0x000F8000) /*!<SQ16[4:0] bits (16th conversion in regular sequence) */
#define L 20 // ((uint32_t)0x00F00000) /*!<L[3:0] bits (Regular channel sequence length) */
/******************* Bit definition for ADC_SQR2 register *******************/
#define SQ7 0 // ((uint32_t)0x0000001F) /*!<SQ7[4:0] bits (7th conversion in regular sequence) */
#define SQ8 5 // ((uint32_t)0x000003E0) /*!<SQ8[4:0] bits (8th conversion in regular sequence) */
#define SQ9 10 // ((uint32_t)0x00007C00) /*!<SQ9[4:0] bits (9th conversion in regular sequence) */
#define SQ10 15 // ((uint32_t)0x000F8000) /*!<SQ10[4:0] bits (10th conversion in regular sequence) */
#define SQ11 20 // ((uint32_t)0x01F00000) /*!<SQ11[4:0] bits (11th conversion in regular sequence) */
#define SQ12 25 // ((uint32_t)0x3E000000) /*!<SQ12[4:0] bits (12th conversion in regular sequence) */
/******************* Bit definition for ADC_SQR3 register *******************/
#define SQ1 0 // ((uint32_t)0x0000001F) /*!<SQ1[4:0] bits (1st conversion in regular sequence) */
#define SQ2 5 // ((uint32_t)0x000003E0) /*!<SQ2[4:0] bits (2nd conversion in regular sequence) */
#define SQ3 10 // ((uint32_t)0x00007C00) /*!<SQ3[4:0] bits (3rd conversion in regular sequence) */
#define SQ4 15 // ((uint32_t)0x000F8000) /*!<SQ4[4:0] bits (4th conversion in regular sequence) */
#define SQ5 20 // ((uint32_t)0x01F00000) /*!<SQ5[4:0] bits (5th conversion in regular sequence) */
#define SQ6 25 // ((uint32_t)0x3E000000) /*!<SQ6[4:0] bits (6th conversion in regular sequence) */
/******************* Bit definition for ADC_JSQR register *******************/
#define JSQ1 0 // ((uint32_t)0x0000001F) /*!<JSQ1[4:0] bits (1st conversion in injected sequence) */
#define JSQ2 5 // ((uint32_t)0x000003E0) /*!<JSQ2[4:0] bits (2nd conversion in injected sequence) */
#define JSQ3 10 // ((uint32_t)0x00007C00) /*!<JSQ3[4:0] bits (3rd conversion in injected sequence) */
#define JSQ4 15 // ((uint32_t)0x000F8000) /*!<JSQ4[4:0] bits (4th conversion in injected sequence) */
#define JL 20 // ((uint32_t)0x00300000) /*!<JL[1:0] bits (Injected Sequence length) */
/******************* Bit definition for ADC_JDR1 register *******************/
#define ADC_JDR1_JDATA ((uint16_t)0xFFFF) /*!<Injected data */
/******************* Bit definition for ADC_JDR2 register *******************/
#define ADC_JDR2_JDATA ((uint16_t)0xFFFF) /*!<Injected data */
/******************* Bit definition for ADC_JDR3 register *******************/
#define ADC_JDR3_JDATA ((uint16_t)0xFFFF) /*!<Injected data */
/******************* Bit definition for ADC_JDR4 register *******************/
#define ADC_JDR4_JDATA ((uint16_t)0xFFFF) /*!<Injected data */
/******************** Bit definition for ADC_DR register ********************/
#define ADC_DR_DATA ((uint32_t)0x0000FFFF) /*!<Regular data */
#define ADC_DR_ADC2DATA ((uint32_t)0xFFFF0000) /*!<ADC2 data */
/******************* Bit definition for DMA_IFCR register *******************/
#define CGIF1 0 // /*!< Channel 1 Global interrupt clearr */
#define CTCIF1 1 // /*!< Channel 1 Transfer Complete clear */
#define CHTIF1 2 // /*!< Channel 1 Half Transfer clear */
#define CTEIF1 3 // /*!< Channel 1 Transfer Error clear */
#define CGIF2 4 // /*!< Channel 2 Global interrupt clear */
#define CTCIF2 5 // /*!< Channel 2 Transfer Complete clear */
#define CHTIF2 6 // /*!< Channel 2 Half Transfer clear */
#define CTEIF2 7 // /*!< Channel 2 Transfer Error clear */
#define CGIF3 8 // /*!< Channel 3 Global interrupt clear */
#define CTCIF3 9 // /*!< Channel 3 Transfer Complete clear */
#define CHTIF3 10 // /*!< Channel 3 Half Transfer clear */
#define CTEIF3 11 // /*!< Channel 3 Transfer Error clear */
#define CGIF4 12 // /*!< Channel 4 Global interrupt clear */
#define CTCIF4 13 // /*!< Channel 4 Transfer Complete clear */
#define CHTIF4 14 // /*!< Channel 4 Half Transfer clear */
#define CTEIF4 15 // /*!< Channel 4 Transfer Error clear */
#define CGIF5 16 // /*!< Channel 5 Global interrupt clear */
#define CTCIF5 17 // /*!< Channel 5 Transfer Complete clear */
#define CHTIF5 18 // /*!< Channel 5 Half Transfer clear */
#define CTEIF5 19 // /*!< Channel 5 Transfer Error clear */
#define CGIF6 20 // /*!< Channel 6 Global interrupt clear */
#define CTCIF6 21 // /*!< Channel 6 Transfer Complete clear */
#define CHTIF6 22 // /*!< Channel 6 Half Transfer clear */
#define CTEIF6 23 // /*!< Channel 6 Transfer Error clear */
#define CGIF7 24 // /*!< Channel 7 Global interrupt clear */
#define CTCIF7 25 // /*!< Channel 7 Transfer Complete clear */
#define CHTIF7 26 // /*!< Channel 7 Half Transfer clear */
#define CTEIF7 27 // /*!< Channel 7 Transfer Error clear */
/******************* Bit definition for DMA_CCRx register *******************/
#define EN 0 // /*!< Channel enable*/
#define TCIE 1 // /*!< Transfer complete interrupt enable */
#define HTIE 2 // /*!< Half Transfer interrupt enable */
#define TEIE 3 // /*!< Transfer error interrupt enable */
#define DIR 4 // /*!< Data transfer direction */
// 0: Read from peripheral
// 1: Read from memory
#define CIRC 5 // /*!< Circular mode */
// 0: Circular mode disabled
// 1: Circular mode enabled
#define PINC 6 // /*!< Peripheral increment mode */
// 0: Peripheral increment mode disabled
// 1: Peripheral increment mode enabled
#define MINC 7 // /*!< Memory increment mode */
// 0: Memory increment mode disabled
// 1: Memory increment mode enabled
#define PSIZE 8 // /*!< PSIZE[1:0] bits (Peripheral size) */
// 00: 8-bits
// 01: 16-bits
// 10: 32-bits
// 11: Reserved
#define MSIZE 10 // /*!< MSIZE[1:0] bits (Memory size) */
// 00: 8-bits
// 01: 16-bits
// 10: 32-bits
// 11: Reserved
#define PL 12 // /*!< PL[1:0] bits(Channel Priority level) */
// 00: Low
// 01: Medium
// 10: High
// 11: Very high
#define MEM2MEM 14 // /*!< Memory to memory mode */
/******************************************************************************/
/* */
/* Flash Controller */
/* */
/******************************************************************************/
/******************** Bit definition for Flash_SR register ********************/
// Bit 5 EOP: End of operation
// Set by hardware when a Flash operation (programming / erase) is completed. Reset by
// writing a 1
// Note: EOP is asserted at the end of each successful program or erase operation
// Bit 4 WRPRTERR: Write protection error
// Set by hardware when programming a write-protected address of the Flash memory.
// Reset by writing 1.
// Bit 3 Reserved, must be kept cleared.
// Bit 2 PGERR: Programming error
// Set by hardware when an address to be programmed contains a value different from
// '0xFFFF' before programming.
// Reset by writing 1.
// Note: The STRT bit in the FLASH_CR register should be reset before starting a programming
// operation.
// Bit 1 Reserved, must be kept cleared
// Bit 0 BSY: Busy
// This indicates that a Flash operation is in progress. This is set on the beginning of a Flash
// operation and reset when the operation finishes or when an error occurs.
#define Flash_SR_EOP 5
#define Flash_SR_WRPRTERR 4
//#define Flash_SR_Res 3
#define Flash_SR_PGERR 2
//#define Flash_SR_Res 1
#define Flash_SR_BSY 0
/******************** Bit definition for Flash_CR register ********************/
// Bits 31:13 Reserved, must be kept cleared.
// Bit 12 EOPIE: End of operation interrupt enable
// This bit enables the interrupt generation when the EOP bit in the FLASH_SR register goes
// to 1.
// 0: Interrupt generation disabled
// 1: Interrupt generation enabled
// Bit 11 Reserved, must be kept cleared
// Bit 10 ERRIE: Error interrupt enable
// This bit enables the interrupt generation on an FPEC error (when PGERR / WRPRTERR are
// set in the FLASH_SR register).
// 0: Interrupt generation disabled
// 1: Interrupt generation enabled
// Bit 9 OPTWRE: Option bytes write enable
// When set, the option bytes can be programmed. This bit is set on writing the correct key
// sequence to the FLASH_OPTKEYR register.
// This bit can be reset by software
// Bit 8 Reserved, must be kept cleared.
// Bit 7 LOCK: Lock
// Write to 1 only. When it is set, it indicates that the FPEC and FLASH_CR are locked. This bit
// is reset by hardware after detecting the unlock sequence.
// In the event of unsuccessful unlock operation, this bit remains set until the next reset.
// Bit 6 STRT: Start
// This bit triggers an ERASE operation when set. This bit is set only by software and reset
// when the BSY bit is reset.
// Bit 5 OPTER: Option byte erase
// Option byte erase chosen.
// Bit 4 OPTPG: Option byte programming
// Option byte programming chosen.
// Bit 3 Reserved, must be kept cleared.
// Bit 2 MER: Mass erase
// Erase of all user pages chosen.
// Bit 1 PER: Page erase
// Page Erase chosen.
// Bit 0 PG: Programming
// Flash programming chosen.
#define Flash_CR_EOPIE 12
#define Flash_CR_ERRIE 10
#define Flash_CR_OPTWRE 9
#define Flash_CR_LOCK 7
#define Flash_CR_STRT 6
#define Flash_CR_OPTER 5
#define Flash_CR_OPTPG 4
#define Flash_CR_MER 2
#define Flash_CR_PER 1
#define Flash_CR_PG 0
/******************** Bit definition for FLASH_OBR register ********************/
// Bits 31:26 Reserved, must be kept cleared.
// Bits 25:18 Data1
// Bits 17:10 Data0
// Bits 9:2 USER: User option bytes
// This contains the user option byte loaded by the OBL.
// Bits [9:5]: Not used (if these bits are written in the Flash option byte, they will be read in this
// register with no effect on the device.)
// Bit 4: nRST_STDBY
// Bit 3: nRST_STOP
// Bit 2: WDG_SW
// Bit 1 RDPRT: Read protection
// When set, this indicates that the Flash memory is read-protected.
// Note: This bit is read-only.
// Bit 0 OPTERR: Option byte error
// When set, this indicates that the loaded option byte and its complement do not match. The
// corresponding byte and its complement are read as 0xFF in the FLASH_OBR or
// FLASH_WRPR register.
// Note: This bit is read-only.
#define Flash_OBR_Data1 18
#define Flash_OBR_Data0 10
#define Flash_OBR_USER 2
#define Flash_OBR_nRST_STDBY 4
#define Flash_OBR_nRST_STOP 3
#define Flash_OBR_nRST_SW 2
#define Flash_OBR_RDPRT 1
#define Flash_OBR_OPTERR 0
#define Flash_KEY1 0x45670123
#define Flash_KEY2 0xCDEF89AB
#define I2C_QuadCycle 10
extern U16 GTimer;
extern U8 GTimeout;
extern U16 TimerKeyScan;
extern U16 TFT_Controller;
// ====================================================
// Macros
//
// ====================================================
// Function Prototype Declarations
//
void Clock_Init(void);
void Port_Init(void);
void USART1_Init(void);
void UartPutc(U8 ch, USART_TypeDef* USARTx);
void uputs(U8 *s, USART_TypeDef* USARTx);
void ADC2_Init(void);
U16 ADC_Poll(ADC_TypeDef * adc, U8 chn);
void TIM3_Init(void);
void TIM4_Init(void);
void SysTick_Init(void);
void TFT_Init_Ili9325(void);
void TFT_CmdWrite(U16 Reg, U16 Data);
void TFT_AccessGRAM(void);
void TFT_AccessGRAM_End(void);
U16 TFT_ReadID_Ili9325(void);
void TFT_Init_Ili9341(void);
void write_comm(U8 commport);
void write_data(U8 data);
U32 TFT_ReadID_Ili9341(void);
void assert_failed(U8 * file, U32 line);
void NVIC_Configuration(void);
void OutputVSen(void);
void I2C_Start(void);
void I2C_Stop(void);
void I2C_SendByte(U8 byte);
U8 I2C_RecvByte(void);
U8 I2C_CheckAck(void);
void I2C_Ack(void);
void I2C_Nak(void);
void I2C_ReSync(void);
void SetSDA_In(void);
void SetSDA_Out(void);
#endif // Board_h

1540
Command.c Normal file

File diff suppressed because it is too large Load Diff

205
Command.h Normal file
View File

@@ -0,0 +1,205 @@
//////////////////////////////////////////////////////////////////////////////
//
// Filename: Command.h
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// Notes:
//
//
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
//
//
#ifndef Command_h
#define Command_h
#include "Common.h"
// ============== Key Analysis Definitions =====================
typedef struct {
// Keypad processing variables
U16 Flags;
U16 KScanBuf;
U16 KScanCode;
U16 KeyCode;
U16 KeyParam;
U16 KeyCodeBuf;
U16 KCount; // Key debounce counter
U16 KDebounceVal; // Debounce timing length (number of scans)
U16 KHCount; // Key hold counter
U16 KTimeChk; // Key time check
U16 EncState;
} KEYPAD;
enum KeypadFlags {
KF_DoKeyScan = 0,
KF_PressDetected = 1,
KF_HoldDetected = 2,
KF_KeyHit = 3,
};
// -- Key-Event mapping
typedef struct {
U8 Keycode;
U8 Event;
}KeyEvent ;
// -- Key code conversion
typedef struct {
U16 ScanCode;
U8 Keycode;
}KeyMap ;
// --------------------------------------
// Keypad
typedef struct {
U16 ScanCode;
U8 KeyCode;
U8 KeyParam;
}KeyScanCode;
// -- Key Code Definitions
enum KeyCodes {
KC_void = 0,
KC_SW1,
KC_SW2,
KC_SW3,
KC_SW4,
KC_SW1H,
KC_SW2H,
KC_SW3H,
KC_SW4H,
KC_SW1_SW4,
KC_SW2_SW4,
KC_SW3_SW4,
KC_SW2_SW3,
KC_SW2_SW3H,
KC_ENC_CW,
KC_ENC_CCW,
KC_ENC_PB,
KC_ENC_PBH,
KC_PB_SW1,
KC_PB_SW2,
KC_PB_SW3,
KC_PB_SW4,
};
// Pushbutton processing parameters
#define NoKey 0xFFFF
#define KD_val 6 //
#define KD_val1 15 //
#define KH_val 90 //
#define KR_Time 3
// Add-ons
enum AddOn {
AO_MeasurementOn = 0,
AO_TestSigAmp = 1, // 0 - normal (3.3V), 1 - 0.1V
AO_TestSigAmpDisp = 2,
};
// Setting status
#define SettingStatus_Initialized 0xF3A5
#define VoltageReadingx0 205
#define VoltageReadingy0 20
#define FreqReadingx0 15
#define FreqReadingy0 20
#define TestSigAmpx0 15
#define TestSigAmpy0 (WWindowy0 + WWindowSizey - 20)
#define Flag_MeasurementOn 0
#define Flag_FreqValid 1
#define Flag_VoltValid 2
#define Flag_FreqAreaCleared 3
#define Waveform_START_ADDRESS ((uint32_t)0x0800E000)
#define Parameter_START_ADDRESS ((uint32_t)0x0800E800)
// ===========================================================
// Export variables
// ===========================================================
//
extern U16 AddOns;
extern KEYPAD Keypad;
extern S16 Vmax;
extern S16 Vmin;
extern S16 Vavr;
extern S16 Vpp;
extern S16 Vrms;
extern U8 ReadingStr[];
extern U8 MeasurementOn;
extern float Freq;
extern float Cycle;
extern float PW;
extern float Duty;
extern U16 Flags;
extern U16 FreqUnit;
extern U16 CycleUnit;
extern U16 FreqStrLen;
extern U16 CycleStrLen;
extern U16 PwStrLen;
extern U8 *UnitsStr[8];
// ===========================================================
// Function Declarations
// ===========================================================
//
void AppInit();
void LoadDefault(void);
void KeyScan(void);
void KeyConvert(KeyScanCode *KSCTab, U16 KSCode);
U8 KeyEventMap(U8 keycode, KeyEvent *kvmap);
void KeyProc(void);
void DoKeyOk(void);
void DoKeyInc(void);
void DoKeyDec(void);
void DoKeySel(void);
void DoKeyOkH(void);
void DoKeyIncH(void);
void DoKeyDecH(void);
void DoKeySelH(void);
void SelVertical(void);
void SelHorzontal(void);
void SelTrigger(void);
void VPosAlign(void);
void CenterHPos(void);
void CenterTrigLevel(void);
void LedBlink(void);
void LedBlink_Fast(void);
void TestMode(void);
void SaveWaveform(void);
void LoadWaveform(void);
void Measurements(void);
void OnScreenDisplay(void);
void TestSigAmpDisplay(void);
U8 *VoltToStr(S16 volt, U8 *strbuf);
U8 *BinToDecStr16(U16 binary, U8 *Str);
U8 *BinToDec32(U32 binary, U8 *Str);
U32 FindDec(U32 bin, U8 ind, U8 *str);
void DeZero(U8 *str, U8 num, U8 ch);
U8 *FloatToStr(float f, U8 width, U8 precision, U8 *str);
#endif

67
Common.c Normal file
View File

@@ -0,0 +1,67 @@
//////////////////////////////////////////////////////////////////////////////
//
// Filename: Common.c
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
//
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// Notes:
//
//
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
//
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include "Common.h"
void Delay(volatile U16 count)
{
while(count) {
count--;
}
}
// -------------------------------------------------------------------------
// Convert binary to hexical digit string. 'size' is in bytes.
//
U8* BinToHexStr(U32 bin, U8 *str, U8 size)
{
U8 tmp0;
size = 2 * size + 2;
*(str + size) = 0; // end of string
size--;
while(size >= 2) {
tmp0 = 0x0000000F & bin;
if(tmp0 <= 9) {
tmp0 |= 0x30;
}
else {
tmp0 += 0x37;
}
*(str + size) = tmp0;
bin >>= 4;
size--;
}
*(str + size--) = 'x';
*(str + size) = '0';
return str;
}

71
Common.h Normal file
View File

@@ -0,0 +1,71 @@
//////////////////////////////////////////////////////////////////////////////
//
// Filename: Common.h
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
//
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// Notes:
//
//
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef Common_h
#define Common_h
typedef unsigned char U8;
typedef signed char S8;
typedef unsigned short int U16;
typedef signed short int S16;
typedef unsigned long U32;
typedef signed long S32;
typedef void (*FuncPointer)(U8);
typedef void (*CmdFuncPointer)(void);
typedef void (*StateAction)(void);
// -- Control debug code generation
//#define _Debug_
// ============= Macro definitions ===========================
#define BitSet(word, bit_mask) ((word) |= (bit_mask))
#define BitClr(word, bit_mask) ((word) &= ~(bit_mask))
#define BitTest(word, bit_mask) ((word) & (bit_mask))
#define BitAnd(word, bit_mask) ((word) &= (bit_mask))
#define BitOr(word, bit_mask) ((word) |= (bit_mask))
#define BitXor(word, bit_mask) ((word) ^= (bit_mask))
#define Port_BitSet(port, bit_mask) (port->BSRR = bit_mask)
#define Port_BitClr(port, bit_mask) (port->BRR = bit_mask)
#define SetToLow(port, bit_mask) (port->BRR = bit_mask)
#define SetToHigh(port, bit_mask) (port->BSRR = bit_mask)
// ===========================================================
// Function Prototype Declarations
// ===========================================================
//
void Delay(U16 count);
U8* BinToHexStr(U32 bin, U8 *str, U8 size);
#endif // Common_h

644
Eeprom.c Normal file
View File

@@ -0,0 +1,644 @@
/**
******************************************************************************
* @file EEPROM_Emulation/src/eeprom.c
* @author MCD Application Team
* @version V3.1.0
* @date 07/27/2009
* @brief This file provides all the EEPROM emulation firmware functions.
******************************************************************************
* @copy
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
*/
/** @addtogroup EEPROM_Emulation
* @{
*/
/* Includes ------------------------------------------------------------------*/
#include "eeprom.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
FLASH_Status FlashStatus;
// Virtual address defined by the user: 0xFFFF value is prohibited
uint16_t VirtAddVarTab[NumbOfVar] = {
Addr_TimeBase,
Addr_HPos,
Addr_Vsen,
Addr_Cpl,
Addr_Vpos,
Addr_VPosOfs,
Addr_TrigMode,
Addr_TrigEdge,
Addr_TrigLvl,
Addr_TrigPos,
Addr_RecLen,
Addr_AddOns,
Addr_SettingStatus,
Addr_TftController,
Addr_VPosOfs00,
Addr_VPosOfs01,
Addr_VPosOfs02,
Addr_VPosOfs03,
Addr_VPosOfs04,
Addr_VPosOfs05,
Addr_VPosOfs06,
Addr_VPosOfs07,
Addr_VPosOfs08,
Addr_VPosOfs09,
Addr_VPosOfs10,
Addr_VPosOfs11,
};
/* Global variable used to store variable value in read sequence */
uint16_t DataVar = 0;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
static FLASH_Status EE_Format(void);
static uint16_t EE_FindValidPage(uint8_t Operation);
static uint16_t EE_VerifyPageFullWriteVariable(uint16_t VirtAddress, uint16_t Data);
static uint16_t EE_PageTransfer(uint16_t VirtAddress, uint16_t Data);
/**
* @brief Restore the pages to a known good state in case of page's status
* corruption after a power loss.
* @param None.
* @retval - Flash error code: on write Flash error
* - FLASH_COMPLETE: on success
*/
uint16_t EE_Init(void)
{
uint16_t PageStatus0 = 6, PageStatus1 = 6;
uint16_t VarIdx = 0;
uint16_t EepromStatus = 0, ReadStatus = 0;
int16_t x = -1;
uint16_t FlashStatus;
/* Get Page0 status */
PageStatus0 = (*(__IO uint16_t*)PAGE0_BASE_ADDRESS);
/* Get Page1 status */
PageStatus1 = (*(__IO uint16_t*)PAGE1_BASE_ADDRESS);
/* Check for invalid header states and repair if necessary */
switch (PageStatus0)
{
case ERASED:
if (PageStatus1 == VALID_PAGE) /* Page0 erased, Page1 valid */
{
/* Erase Page0 */
FlashStatus = FLASH_ErasePage(PAGE0_BASE_ADDRESS);
/* If erase operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
}
else if (PageStatus1 == RECEIVE_DATA) /* Page0 erased, Page1 receive */
{
/* Erase Page0 */
FlashStatus = FLASH_ErasePage(PAGE0_BASE_ADDRESS);
/* If erase operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Mark Page1 as valid */
FlashStatus = FLASH_ProgramHalfWord(PAGE1_BASE_ADDRESS, VALID_PAGE);
/* If program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
}
else /* First EEPROM access (Page0&1 are erased) or invalid state -> format EEPROM */
{
/* Erase both Page0 and Page1 and set Page0 as valid page */
FlashStatus = EE_Format();
/* If erase/program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
}
break;
case RECEIVE_DATA:
if (PageStatus1 == VALID_PAGE) /* Page0 receive, Page1 valid */
{
/* Transfer data from Page1 to Page0 */
for (VarIdx = 0; VarIdx < NumbOfVar; VarIdx++)
{
if (( *(__IO uint16_t*)(PAGE0_BASE_ADDRESS + 6)) == VirtAddVarTab[VarIdx])
{
x = VarIdx;
}
if (VarIdx != x)
{
/* Read the last variables' updates */
ReadStatus = EE_ReadVariable(VirtAddVarTab[VarIdx], &DataVar);
/* In case variable corresponding to the virtual address was found */
if (ReadStatus != 0x1)
{
/* Transfer the variable to the Page0 */
EepromStatus = EE_VerifyPageFullWriteVariable(VirtAddVarTab[VarIdx], DataVar);
/* If program operation was failed, a Flash error code is returned */
if (EepromStatus != FLASH_COMPLETE)
{
return EepromStatus;
}
}
}
}
/* Mark Page0 as valid */
FlashStatus = FLASH_ProgramHalfWord(PAGE0_BASE_ADDRESS, VALID_PAGE);
/* If program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Erase Page1 */
FlashStatus = FLASH_ErasePage(PAGE1_BASE_ADDRESS);
/* If erase operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
}
else if (PageStatus1 == ERASED) /* Page0 receive, Page1 erased */
{
/* Erase Page1 */
FlashStatus = FLASH_ErasePage(PAGE1_BASE_ADDRESS);
/* If erase operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Mark Page0 as valid */
FlashStatus = FLASH_ProgramHalfWord(PAGE0_BASE_ADDRESS, VALID_PAGE);
/* If program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
}
else /* Invalid state -> format eeprom */
{
/* Erase both Page0 and Page1 and set Page0 as valid page */
FlashStatus = EE_Format();
/* If erase/program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
}
break;
case VALID_PAGE:
if (PageStatus1 == VALID_PAGE) /* Invalid state -> format eeprom */
{
/* Erase both Page0 and Page1 and set Page0 as valid page */
FlashStatus = EE_Format();
/* If erase/program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
}
else if (PageStatus1 == ERASED) /* Page0 valid, Page1 erased */
{
/* Erase Page1 */
FlashStatus = FLASH_ErasePage(PAGE1_BASE_ADDRESS);
/* If erase operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
}
else /* Page0 valid, Page1 receive */
{
/* Transfer data from Page0 to Page1 */
for (VarIdx = 0; VarIdx < NumbOfVar; VarIdx++)
{
if ((*(__IO uint16_t*)(PAGE1_BASE_ADDRESS + 6)) == VirtAddVarTab[VarIdx])
{
x = VarIdx;
}
if (VarIdx != x)
{
/* Read the last variables' updates */
ReadStatus = EE_ReadVariable(VirtAddVarTab[VarIdx], &DataVar);
/* In case variable corresponding to the virtual address was found */
if (ReadStatus != 0x1)
{
/* Transfer the variable to the Page1 */
EepromStatus = EE_VerifyPageFullWriteVariable(VirtAddVarTab[VarIdx], DataVar);
/* If program operation was failed, a Flash error code is returned */
if (EepromStatus != FLASH_COMPLETE)
{
return EepromStatus;
}
}
}
}
/* Mark Page1 as valid */
FlashStatus = FLASH_ProgramHalfWord(PAGE1_BASE_ADDRESS, VALID_PAGE);
/* If program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Erase Page0 */
FlashStatus = FLASH_ErasePage(PAGE0_BASE_ADDRESS);
/* If erase operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
}
break;
default: /* Any other state -> format eeprom */
/* Erase both Page0 and Page1 and set Page0 as valid page */
FlashStatus = EE_Format();
/* If erase/program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
break;
}
return FLASH_COMPLETE;
}
/**
* @brief Returns the last stored variable data, if found, which correspond to
* the passed virtual address
* @param VirtAddress: Variable virtual address
* @param Data: Global variable contains the read variable value
* @retval Success or error status:
* - 0: if variable was found
* - 1: if the variable was not found
* - NO_VALID_PAGE: if no valid page was found.
*/
uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data)
{
uint16_t ValidPage = PAGE0;
uint16_t AddressValue = 0x5555, ReadStatus = 1;
uint32_t Address = 0x08010000, PageStartAddress = 0x08010000;
/* Get active Page for read operation */
ValidPage = EE_FindValidPage(READ_FROM_VALID_PAGE);
/* Check if there is no valid page */
if (ValidPage == NO_VALID_PAGE)
{
return NO_VALID_PAGE;
}
/* Get the valid Page start Address */
PageStartAddress = (uint32_t)(EEPROM_START_ADDRESS + (uint32_t)(ValidPage * PAGE_SIZE));
/* Get the valid Page end Address */
Address = (uint32_t)((EEPROM_START_ADDRESS - 2) + (uint32_t)((1 + ValidPage) * PAGE_SIZE));
/* Check each active page address starting from end */
while (Address > (PageStartAddress + 2))
{
/* Get the current location content to be compared with virtual address */
AddressValue = (*(__IO uint16_t*)Address);
/* Compare the read address with the virtual address */
if (AddressValue == VirtAddress)
{
/* Get content of Address-2 which is variable value */
*Data = (*(__IO uint16_t*)(Address - 2));
/* In case variable value is read, reset ReadStatus flag */
ReadStatus = 0;
break;
}
else
{
/* Next address location */
Address = Address - 4;
}
}
/* Return ReadStatus value: (0: variable exist, 1: variable doesn't exist) */
return ReadStatus;
}
/**
* @brief Writes/upadtes variable data in EEPROM.
* @param VirtAddress: Variable virtual address
* @param Data: 16 bit data to be written
* @retval Success or error status:
* - FLASH_COMPLETE: on success
* - PAGE_FULL: if valid page is full
* - NO_VALID_PAGE: if no valid page was found
* - Flash error code: on write Flash error
*/
uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data)
{
uint16_t Status = 0;
/* Write the variable virtual address and value in the EEPROM */
Status = EE_VerifyPageFullWriteVariable(VirtAddress, Data);
/* In case the EEPROM active page is full */
if (Status == PAGE_FULL)
{
/* Perform Page transfer */
Status = EE_PageTransfer(VirtAddress, Data);
}
/* Return last operation status */
return Status;
}
/**
* @brief Erases PAGE0 and PAGE1 and writes VALID_PAGE header to PAGE0
* @param None
* @retval Status of the last operation (Flash write or erase) done during
* EEPROM formating
*/
static FLASH_Status EE_Format(void)
{
FLASH_Status FlashStatus = FLASH_COMPLETE;
/* Erase Page0 */
FlashStatus = FLASH_ErasePage(PAGE0_BASE_ADDRESS);
/* If erase operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Set Page0 as valid page: Write VALID_PAGE at Page0 base address */
FlashStatus = FLASH_ProgramHalfWord(PAGE0_BASE_ADDRESS, VALID_PAGE);
/* If program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Erase Page1 */
FlashStatus = FLASH_ErasePage(PAGE1_BASE_ADDRESS);
/* Return Page1 erase operation status */
return FlashStatus;
}
/**
* @brief Find valid Page for write or read operation
* @param Operation: operation to achieve on the valid page.
* This parameter can be one of the following values:
* @arg READ_FROM_VALID_PAGE: read operation from valid page
* @arg WRITE_IN_VALID_PAGE: write operation from valid page
* @retval Valid page number (PAGE0 or PAGE1) or NO_VALID_PAGE in case
* of no valid page was found
*/
static uint16_t EE_FindValidPage(uint8_t Operation)
{
uint16_t PageStatus0 = 6, PageStatus1 = 6;
/* Get Page0 actual status */
PageStatus0 = (*(__IO uint16_t*)PAGE0_BASE_ADDRESS);
/* Get Page1 actual status */
PageStatus1 = (*(__IO uint16_t*)PAGE1_BASE_ADDRESS);
/* Write or read operation */
switch (Operation)
{
case WRITE_IN_VALID_PAGE: /* ---- Write operation ---- */
if (PageStatus1 == VALID_PAGE)
{
/* Page0 receiving data */
if (PageStatus0 == RECEIVE_DATA)
{
return PAGE0; /* Page0 valid */
}
else
{
return PAGE1; /* Page1 valid */
}
}
else if (PageStatus0 == VALID_PAGE)
{
/* Page1 receiving data */
if (PageStatus1 == RECEIVE_DATA)
{
return PAGE1; /* Page1 valid */
}
else
{
return PAGE0; /* Page0 valid */
}
}
else
{
return NO_VALID_PAGE; /* No valid Page */
}
case READ_FROM_VALID_PAGE: /* ---- Read operation ---- */
if (PageStatus0 == VALID_PAGE)
{
return PAGE0; /* Page0 valid */
}
else if (PageStatus1 == VALID_PAGE)
{
return PAGE1; /* Page1 valid */
}
else
{
return NO_VALID_PAGE ; /* No valid Page */
}
default:
return PAGE0; /* Page0 valid */
}
}
/**
* @brief Verify if active page is full and Writes variable in EEPROM.
* @param VirtAddress: 16 bit virtual address of the variable
* @param Data: 16 bit data to be written as variable value
* @retval Success or error status:
* - FLASH_COMPLETE: on success
* - PAGE_FULL: if valid page is full
* - NO_VALID_PAGE: if no valid page was found
* - Flash error code: on write Flash error
*/
static uint16_t EE_VerifyPageFullWriteVariable(uint16_t VirtAddress, uint16_t Data)
{
FLASH_Status FlashStatus = FLASH_COMPLETE;
uint16_t ValidPage = PAGE0;
uint32_t Address = 0x08010000, PageEndAddress = 0x080107FF;
/* Get valid Page for write operation */
ValidPage = EE_FindValidPage(WRITE_IN_VALID_PAGE);
/* Check if there is no valid page */
if (ValidPage == NO_VALID_PAGE)
{
return NO_VALID_PAGE;
}
/* Get the valid Page start Address */
Address = (uint32_t)(EEPROM_START_ADDRESS + (uint32_t)(ValidPage * PAGE_SIZE));
/* Get the valid Page end Address */
PageEndAddress = (uint32_t)((EEPROM_START_ADDRESS - 2) + (uint32_t)((1 + ValidPage) * PAGE_SIZE));
/* Check each active page address starting from begining */
while (Address < PageEndAddress)
{
/* Verify if Address and Address+2 contents are 0xFFFFFFFF */
if ((*(__IO uint32_t*)Address) == 0xFFFFFFFF)
{
/* Set variable data */
FlashStatus = FLASH_ProgramHalfWord(Address, Data);
/* If program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Set variable virtual address */
FlashStatus = FLASH_ProgramHalfWord(Address + 2, VirtAddress);
/* Return program operation status */
return FlashStatus;
}
else
{
/* Next address location */
Address = Address + 4;
}
}
/* Return PAGE_FULL in case the valid page is full */
return PAGE_FULL;
}
/**
* @brief Transfers last updated variables data from the full Page to
* an empty one.
* @param VirtAddress: 16 bit virtual address of the variable
* @param Data: 16 bit data to be written as variable value
* @retval Success or error status:
* - FLASH_COMPLETE: on success
* - PAGE_FULL: if valid page is full
* - NO_VALID_PAGE: if no valid page was found
* - Flash error code: on write Flash error
*/
static uint16_t EE_PageTransfer(uint16_t VirtAddress, uint16_t Data)
{
FLASH_Status FlashStatus = FLASH_COMPLETE;
uint32_t NewPageAddress = 0x080103FF, OldPageAddress = 0x08010000;
uint16_t ValidPage = PAGE0, VarIdx = 0;
uint16_t EepromStatus = 0, ReadStatus = 0;
/* Get active Page for read operation */
ValidPage = EE_FindValidPage(READ_FROM_VALID_PAGE);
if (ValidPage == PAGE1) /* Page1 valid */
{
/* New page address where variable will be moved to */
NewPageAddress = PAGE0_BASE_ADDRESS;
/* Old page address where variable will be taken from */
OldPageAddress = PAGE1_BASE_ADDRESS;
}
else if (ValidPage == PAGE0) /* Page0 valid */
{
/* New page address where variable will be moved to */
NewPageAddress = PAGE1_BASE_ADDRESS;
/* Old page address where variable will be taken from */
OldPageAddress = PAGE0_BASE_ADDRESS;
}
else
{
return NO_VALID_PAGE; /* No valid Page */
}
/* Set the new Page status to RECEIVE_DATA status */
FlashStatus = FLASH_ProgramHalfWord(NewPageAddress, RECEIVE_DATA);
/* If program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Write the variable passed as parameter in the new active page */
EepromStatus = EE_VerifyPageFullWriteVariable(VirtAddress, Data);
/* If program operation was failed, a Flash error code is returned */
if (EepromStatus != FLASH_COMPLETE)
{
return EepromStatus;
}
/* Transfer process: transfer variables from old to the new active page */
for (VarIdx = 0; VarIdx < NumbOfVar; VarIdx++)
{
if (VirtAddVarTab[VarIdx] != VirtAddress) /* Check each variable except the one passed as parameter */
{
/* Read the other last variable updates */
ReadStatus = EE_ReadVariable(VirtAddVarTab[VarIdx], &DataVar);
/* In case variable corresponding to the virtual address was found */
if (ReadStatus != 0x1)
{
/* Transfer the variable to the new active page */
EepromStatus = EE_VerifyPageFullWriteVariable(VirtAddVarTab[VarIdx], DataVar);
/* If program operation was failed, a Flash error code is returned */
if (EepromStatus != FLASH_COMPLETE)
{
return EepromStatus;
}
}
}
}
/* Erase the old Page: Set old Page status to ERASED status */
FlashStatus = FLASH_ErasePage(OldPageAddress);
/* If erase operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Set new Page status to VALID_PAGE status */
FlashStatus = FLASH_ProgramHalfWord(NewPageAddress, VALID_PAGE);
/* If program operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
/* Return last operation flash status */
return FlashStatus;
}
/**
* @}
*/
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/

113
Eeprom.h Normal file
View File

@@ -0,0 +1,113 @@
/**
******************************************************************************
* @file EEPROM_Emulation/inc/eeprom.h
* @author MCD Application Team
* @version V3.1.0
* @date 07/27/2009
* @brief This file contains all the functions prototypes for the EEPROM
* emulation firmware library.
******************************************************************************
* @copy
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __EEPROM_H
#define __EEPROM_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/* Exported constants --------------------------------------------------------*/
/* Define the STM32F10Xxx Flash page size depending on the used STM32 device */
#if defined (STM32F10X_LD) || defined (STM32F10X_MD)
#define PAGE_SIZE (uint16_t)0x400 /* Page size = 1KByte */
#elif defined (STM32F10X_HD) || defined (STM32F10X_CL)
#define PAGE_SIZE (uint16_t)0x800 /* Page size = 2KByte */
#endif
/* EEPROM start address in Flash */
#define EEPROM_START_ADDRESS ((uint32_t)0x0800F000) /* EEPROM emulation start address:
after 64KByte of used Flash memory */
/* Pages 0 and 1 base and end addresses */
#define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x000))
#define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1)))
#define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + PAGE_SIZE))
#define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (2 * PAGE_SIZE - 1)))
/* Used Flash pages for EEPROM emulation */
#define PAGE0 ((uint16_t)0x0000)
#define PAGE1 ((uint16_t)0x0001)
/* No valid page define */
#define NO_VALID_PAGE ((uint16_t)0x00AB)
/* Page status definitions */
#define ERASED ((uint16_t)0xFFFF) /* PAGE is empty */
#define RECEIVE_DATA ((uint16_t)0xEEEE) /* PAGE is marked to receive data */
#define VALID_PAGE ((uint16_t)0x0000) /* PAGE containing valid data */
/* Valid pages in read and write defines */
#define READ_FROM_VALID_PAGE ((uint8_t)0x00)
#define WRITE_IN_VALID_PAGE ((uint8_t)0x01)
/* Page full define */
#define PAGE_FULL ((uint8_t)0x80)
/* Variables' number */
#define NumbOfVar ((uint8_t)27)
/* Virtual address defined by the user: 0xFFFF value is prohibited */
extern uint16_t VirtAddVarTab[NumbOfVar];
// Define virtual EEPROM addresses to be used here
enum {
Addr_TimeBase = 0,
Addr_HPos,
Addr_Vsen,
Addr_Cpl,
Addr_Vpos,
Addr_VPosOfs,
Addr_TrigMode,
Addr_TrigEdge,
Addr_TrigLvl,
Addr_TrigPos,
Addr_RecLen,
Addr_AddOns,
Addr_SettingStatus,
Addr_TftController,
Addr_VPosOfs00, // for 20V/div
Addr_VPosOfs01, // for 10V/div
Addr_VPosOfs02, // for 5V/div
Addr_VPosOfs03, // for 2V/div
Addr_VPosOfs04, // for 1V/div
Addr_VPosOfs05, // for 0.5V/div
Addr_VPosOfs06, // for 0.2V/div
Addr_VPosOfs07, // for 0.1V/div
Addr_VPosOfs08, // for 50mV/div
Addr_VPosOfs09, // for 20mV/div
Addr_VPosOfs10, // for 10mV/div
Addr_VPosOfs11, // for 5mV/div
};
/* Exported types ------------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
uint16_t EE_Init(void);
uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data);
uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data);
#endif /* __EEPROM_H */
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/

617
Makefile Normal file
View File

@@ -0,0 +1,617 @@
#
# WinARM template makefile
#
#
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make program = Upload load-image to the device
#
# make filename.s = Just compile filename.c into the assembler code only
#
# make filename.o = Create object filename.o from filename.c (using CFLAGS)
#
# To rebuild project do "make clean" then "make all".
#
# This should work with just CS G++ lite installed (Win32 cmd as shell, cs-make, cs-rm)
# Tested with:
# - CS G++ 2009-Q1 (cs-make 3.81, cs-rm, cmd.exe), no MinGW or Cygwin tools in the $PATH
# - Cygwin (make 3.81, rm, bash 3.2.39)
# - MSYS/MinGW tools in $(PATH) (WinAVR\utils\bin)
# Toolchain prefix (i.e arm-elf- -> arm-elf-gcc.exe)
#TCHAIN_PREFIX = arm-eabi-
#TCHAIN_PREFIX = arm-elf-
TCHAIN_PREFIX = arm-none-eabi-
#REMOVE_CMD=rm
REMOVE_CMD=cs-rm
#FLASH_TOOL = OPENOCD
#FLASH_TOOL = LPC21ISP
#FLASH_TOOL = UVISION
# YES enables -mthumb option to flags for source-files listed
# in SRC and CPPSRC and -mthumb-interwork option for all source
USE_THUMB_MODE = YES
#USE_THUMB_MODE = NO
# MCU name, submodel and board
# - MCU used for compiler-option (-mcpu)
# - SUBMDL used for linker-script name (-T) and passed as define
# - BOARD just passed as define (optional)
MCU = cortex-m3
CHIP = STM32F10x_64k_20k
BOARD = JYE109-15000-00D
F_XTAL = 8000000
SYSCLOCK_CL = SYSCLK_FREQ_72MHz=72000000
# *** This example only supports "FLASH_RUN" ***
# RUN_MODE is passed as define and used for the linker-script filename,
# the user has to implement the necessary operations for
# the used mode(s) (i.e. no copy of .data, remapping)
# Create FLASH-Image
RUN_MODE=FLASH_RUN
# Create RAM-Image
#RUN_MODE=RAM_RUN
# Exception-vectors placement option is just passed as define,
# the user has to implement the necessary operations (i.e. remapping)
# Exception vectors in FLASH:
ifeq ($(RUN_MODE),RAM_RUN)
VECTOR_TABLE_LOCATION=VECT_TAB_RAM
else
VECTOR_TABLE_LOCATION=VECT_TAB_FLASH
endif
#VECTOR_TABLE_LOCATION=VECT_TAB_FLASH
# Exception vectors in RAM:
#VECTOR_TABLE_LOCATION=VECT_TAB_RAM
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
OUTDIR = $(RUN_MODE)
# Target file name (without extension).
TARGET = 113-15011-060
# Pathes to libraries
APPLIBDIR = ./Libraries
STMLIBDIR = $(APPLIBDIR)
STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver
STMSPDSRCDIR = $(STMSPDDIR)/src
STMSPDINCDIR = $(STMSPDDIR)/inc
CMSISDIR = $(STMLIBDIR)/CMSIS/CM3/CoreSupport
# List C source files here. (C dependencies are automatically generated.)
# use file-extension c for "c-only"-files
## Demo-Application:
SRC = 113-15011.c Board.c Common.c Screen.c Command.c stm32f10x_it.c Eeprom.c
## compiler-specific sources
#SRC += startup_stm32f10x_md_mthomas.c
## CMSIS for STM32
SRC += $(CMSISDIR)/core_cm3.c
SRC += $(CMSISDIR)/system_stm32f10x.c
## used parts of the STM-Library
SRC += $(STMSPDSRCDIR)/misc.c
SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c
SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c
SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c
SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c
#SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c
#SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c
#SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c
#SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c
#SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c
SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c
#SRC += $(STMSPDSRCDIR)/stm32f10x_fsmc.c
# List C source files here which must be compiled in ARM-Mode (no -mthumb).
# use file-extension c for "c-only"-files
SRCARM =
# List C++ source files here.
# use file-extension .cpp for C++-files (not .C)
#CPPSRC = main.cpp myclasses.cpp
#CPPSRC += mini_cpp.cpp
# List C++ source files here which must be compiled in ARM-Mode.
# use file-extension .cpp for C++-files (not .C)
#CPPSRCARM = $(TARGET).cpp
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC = startup_stm32f10x_md.S
# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM =
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
EXTRAINCDIRS = $(STMSPDINCDIR) $(CMSISDIR) $(FATSDDIR) $(MININIDIR) $(STMEEEMULINCDIR)
EXTRAINCDIRS += $(APPLIBDIR) $(SWIMSRCDIR)
EXTRAINCDIRS += C:/Engineering/SourceryCodeBenchLite/arm-none-eabi/include
EXTRAINCDIRS += ./Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x
# Extra libraries
# Each library-name must be seperated by a space.
# i.e. to link with libxyz.a, libabc.a and libefsl.a:
# EXTRA_LIBS = xyz abc efsl
# for newlib-lpc (file: libnewlibc-lpc.a):
# EXTRA_LIBS = newlib-lpc
EXTRA_LIBS = dso150
# Path to Linker-Scripts
LINKERSCRIPTPATH = .
LINKERSCRIPTINC = .
# List any extra directories to look for library files here.
# Also add directories where the linker should search for
# includes from linker-script to the list
# Each directory must be seperated by a space.
EXTRA_LIBDIRS = $(LINKERSCRIPTINC)
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
#OPT = s
OPT = 2
#OPT = 3
#OPT = 0
# Output format. (can be ihex or binary or both)
# binary to create a load-image in raw-binary format i.e. for SAM-BA,
# ihex to create a load-image in Intel hex format i.e. for lpc21isp
#LOADFORMAT = ihex
#LOADFORMAT = binary
LOADFORMAT = both
# Using the Atmel AT91_lib produces warnings with
# the default warning-levels.
# yes - disable these warnings
# no - keep default settings
#AT91LIBNOWARN = yes
AT91LIBNOWARN = no
# Debugging format.
#DEBUG = stabs
#DEBUG = dwarf-2
DEBUG = gdb
# Place project-specific -D (define) and/or
# -U options for C here.
CDEFS = -DSTM32F10X_MD
CDEFS += -DHSE_VALUE=$(F_XTAL)UL
CDEFS += -D$(SYSCLOCK_CL)
CDEFS += -DUSE_STDPERIPH_DRIVER
CDEFS += -DUSE_$(BOARD)
CDEFS += -DSTM32_SD_USE_DMA
CDEFS += -DSTARTUP_DELAY
# enable modifications in STM's libraries
CDEFS += -DMOD_MTHOMAS_STMLIB
# enable parameter-checking in STM's library
CDEFS += -DUSE_FULL_ASSERT
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
#ADEFS = -DUSE_IRQ_ASM_WRAPPER
ADEFS = -D__ASSEMBLY__
# Compiler flag to set the C Standard level.
# c89 - "ANSI" C
# gnu89 - c89 plus GCC extensions
# c99 - ISO C99 standard (not yet fully implemented)
# gnu99 - c99 plus GCC extensions
CSTANDARD = -std=gnu99
#-----
ifdef VECTOR_TABLE_LOCATION
CDEFS += -D$(VECTOR_TABLE_LOCATION)
ADEFS += -D$(VECTOR_TABLE_LOCATION)
endif
CDEFS += -D$(RUN_MODE) -D$(CHIP)
ADEFS += -D$(RUN_MODE) -D$(CHIP)
# Compiler flags.
ifeq ($(USE_THUMB_MODE),YES)
THUMB = -mthumb
THUMB_IW = -mthumb-interwork
else
THUMB =
THUMB_IW =
endif
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
#
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
CFLAGS = -g$(DEBUG)
CFLAGS += -O$(OPT)
CFLAGS += -mcpu=$(MCU) $(THUMB_IW)
CFLAGS += $(CDEFS)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
# when using ".ramfunc"s without longcall:
CFLAGS += -mlong-calls
# -mapcs-frame is important if gcc's interrupt attributes are used
# (at least from my eabi tests), not needed if assembler-wrapper is used
#CFLAGS += -mapcs-frame
#CFLAGS += -fomit-frame-pointer
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -fpromote-loop-indices
CFLAGS += -Wall -Wextra
CFLAGS += -Wimplicit -Wcast-align -Wpointer-arith
CFLAGS += -Wredundant-decls -Wshadow -Wcast-qual -Wcast-align
#CFLAGS += -pedantic
CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
# Compiler flags to generate dependency files:
CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d
# flags only for C
CONLYFLAGS += -Wnested-externs
CONLYFLAGS += $(CSTANDARD)
# flags only for C++ (arm-*-g++)
CPPFLAGS = -fno-rtti -fno-exceptions
CPPFLAGS =
# Assembler flags.
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlns: create listing
# -g$(DEBUG): have the assembler create line number information
ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp
ASFLAGS += $(ADEFS)
ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
ASFLAGS += -Wa,-g$(DEBUG)
ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
MATH_LIB = -lm
# Link with the GNU C++ stdlib.
CPLUSPLUS_LIB = -lstdc++
#CPLUSPLUS_LIB += -lsupc++
# Linker flags.
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
#not in CPP
#LDFLAGS += -nostartfiles
LDFLAGS += -lc
LDFLAGS += $(MATH_LIB)
LDFLAGS += -lc -lgcc
LDFLAGS += $(CPLUSPLUS_LIB)
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
#LDFLAGS += -u TIM1_CC_IRQHandler -u ADC1_2_IRQHandler -u DMA1_Channel1_IRQHandler
# Set linker-script name depending on selected run-mode and submodel name
ifeq ($(RUN_MODE),RAM_RUN)
LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(CHIP)_ram.ld
##LDFLAGS +=-T$(LINKERSCRIPTPATH)/sram.lds
else
LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(CHIP)_flash.ld
#LDFLAGS +=-T$(LINKERSCRIPTPATH)/stm32_flash.ld
#LDFLAGS +=-T$(LINKERSCRIPTPATH)/stm32f10x_flash_offset_1.ld
##LDFLAGS +=-T$(LINKERSCRIPTPATH)/flash.lds
endif
# ---------------------------------------------------------------------------
# Options for OpenOCD flash-programming
# see openocd.pdf/openocd.texi for further information
#
OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
# if OpenOCD is in the $PATH just set OPENOCDEXE=openocd
OOCD_EXE=./OpenOCD/bin/openocd
# debug level
OOCD_CL=-d0
#OOCD_CL=-d3
# interface and board/target settings (using the OOCD target-library here)
## OOCD_CL+=-f interface/jtagkey2.cfg -f target/stm32.cfg
OOCD_CL+=-f interface/jtagkey.cfg -f target/stm32.cfg
# initialize
OOCD_CL+=-c init
# enable "fast mode" - can be disabled for tests
OOCD_CL+=-c "fast enable"
# show the targets
OOCD_CL+=-c targets
# commands to prepare flash-write
OOCD_CL+= -c "reset halt"
# increase JTAG frequency a little bit - can be disabled for tests
OOCD_CL+= -c "jtag_khz 1200"
# flash-write and -verify
OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE)" -c "verify_image $(OOCD_LOADFILE)"
# reset target
OOCD_CL+=-c "reset run"
# terminate OOCD after programming
OOCD_CL+=-c shutdown
# ---------------------------------------------------------------------------
# Define programs and commands.
CC = $(TCHAIN_PREFIX)gcc
CPP = $(TCHAIN_PREFIX)g++
AR = $(TCHAIN_PREFIX)ar
OBJCOPY = $(TCHAIN_PREFIX)objcopy
OBJDUMP = $(TCHAIN_PREFIX)objdump
SIZE = $(TCHAIN_PREFIX)size
NM = $(TCHAIN_PREFIX)nm
REMOVE = $(REMOVE_CMD) -f
SHELL = sh
###COPY = cp
ifneq ($(or $(COMSPEC), $(ComSpec)),)
$(info COMSPEC detected $(COMSPEC) $(ComSpec))
ifeq ($(findstring cygdrive,$(shell env)),)
SHELL:=$(or $(COMSPEC),$(ComSpec))
SHELL_IS_WIN32=1
else
$(info cygwin detected)
endif
endif
$(info SHELL is $(SHELL))
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin, mode: $(RUN_MODE) --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after build:
MSG_LOAD_FILE = Creating load file:
MSG_EXTENDED_LISTING = Creating Extended Listing/Disassembly:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = ---- Linking :
MSG_COMPILING = ---- Compiling C :
MSG_COMPILING_ARM = ---- Compiling C ARM-only:
MSG_COMPILINGCPP = ---- Compiling C++ :
MSG_COMPILINGCPP_ARM = ---- Compiling C++ ARM-only:
MSG_ASSEMBLING = ---- Assembling:
MSG_ASSEMBLING_ARM = ---- Assembling ARM-only:
MSG_CLEANING = Cleaning project:
MSG_FORMATERROR = Can not handle output-format
MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now.
MSG_ASMFROMC = "Creating asm-File from C-Source:"
MSG_ASMFROMC_ARM = "Creating asm-File from C-Source (ARM-only):"
# List of all source files.
ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC)
# List of all source files without directory and file-extension.
ALLSRCBASE = $(notdir $(basename $(ALLSRC)))
# Define all object files.
ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE)))
# Define all listing files (used for make clean).
LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE)))
# Define all depedency-files (used for make clean).
DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE)))
# Default target.
#all: begin gccversion sizebefore build sizeafter finished end
all: begin createdirs gccversion build sizeafter finished end
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
ifeq ($(LOADFORMAT),ihex)
build: elf hex lss sym
else
ifeq ($(LOADFORMAT),binary)
build: elf bin lss sym
else
ifeq ($(LOADFORMAT),both)
build: elf hex bin lss sym
else
$(error "$(MSG_FORMATERROR) $(FORMAT)")
endif
endif
endif
# Create output directories.
ifdef SHELL_IS_WIN32
createdirs:
-@md $(OUTDIR) >NUL 2>&1 || echo "" >NUL
-@md $(OUTDIR)\dep >NUL 2>&1 || echo "" >NUL
else
createdirs:
-@mkdir $(OUTDIR) 2>/dev/null || echo "" >/dev/null
-@mkdir $(OUTDIR)/dep 2>/dev/null || echo "" >/dev/null
endif
# Eye candy.
begin:
@echo $(MSG_BEGIN)
finished:
## @echo $(MSG_ERRORS_NONE)
end:
@echo $(MSG_END)
# Display sizes of sections.
ELFSIZE = $(SIZE) -A $(OUTDIR)/$(TARGET).elf
##ELFSIZE = $(SIZE) --format=Berkeley --common $(OUTDIR)/$(TARGET).elf
sizebefore:
# @if [ -f $(OUTDIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
sizeafter:
# @if [ -f $(OUTDIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
@echo $(MSG_SIZE_AFTER)
$(ELFSIZE)
# Display compiler version information.
gccversion :
@$(CC) --version
# @echo $(ALLOBJ)
# Program the device.
ifeq ($(FLASH_TOOL),UVISION)
# Program the device with Keil's uVision (needs configured uVision-workspace).
program: $(OUTDIR)/$(TARGET).hex
@echo "Programming with uVision"
C:\Keil\uv3\Uv3.exe -f uvisionflash.Uv2 -ouvisionflash.txt
else
ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf
@echo "Programming with OPENOCD"
ifdef SHELL_IS_WIN32
$(subst /,\,$(OOCD_EXE)) $(OOCD_CL)
else
$(OOCD_EXE) $(OOCD_CL)
endif
else
# Program the device using lpc21isp (for NXP2k and ADuC UART bootloader)
program: $(OUTDIR)/$(TARGET).hex
@echo $(MSG_LPC21_RESETREMINDER)
-$(LPC21ISP) $(LPC21ISP_OPTIONS) $(LPC21ISP_FLASHFILE) $(LPC21ISP_PORT) $(LPC21ISP_BAUD) $(LPC21ISP_XTAL)
endif
endif
# Create final output file (.hex) from ELF output file.
%.hex: %.elf
@echo $(MSG_LOAD_FILE) $@
$(OBJCOPY) -O ihex $< $@
# Create final output file (.bin) from ELF output file.
%.bin: %.elf
@echo $(MSG_LOAD_FILE) $@
$(OBJCOPY) -O binary $< $@
# Create extended listing file/disassambly from ELF output file.
# using objdump testing: option -C
%.lss: %.elf
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S -C -r $< > $@
# $(OBJDUMP) -x -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(ALLOBJ)
%.elf: $(ALLOBJ)
@echo $(MSG_LINKING) $@
# use $(CC) for C-only projects or $(CPP) for C++-projects:
ifeq "$(strip $(CPPSRC)$(CPPARM))" ""
$(CC) $(THUMB) $(CFLAGS) $(ALLOBJ) --output $@ -nostartfiles $(LDFLAGS)
else
$(CPP) $(THUMB) $(CFLAGS) $(ALLOBJ) --output $@ $(LDFLAGS)
endif
# Assemble: create object files from assembler source files.
define ASSEMBLE_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
@echo "hallo"
@echo $(MSG_ASSEMBLING) $$< to $$@
$(CC) -c $(THUMB) $$(ASFLAGS) $$< -o $$@
endef
$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src))))
# Assemble: create object files from assembler source files. ARM-only
define ASSEMBLE_ARM_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
@echo $(MSG_ASSEMBLING_ARM) $$< to $$@
$(CC) -c $$(ASFLAGS) $$< -o $$@
endef
$(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src))))
# Compile: create object files from C source files.
define COMPILE_C_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
@echo $(MSG_COMPILING) $$< to $$@
$(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
endef
$(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src))))
# Compile: create object files from C source files. ARM-only
define COMPILE_C_ARM_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
@echo $(MSG_COMPILING_ARM) $$< to $$@
$(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
endef
$(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src))))
# Compile: create object files from C++ source files.
define COMPILE_CPP_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
@echo $(MSG_COMPILINGCPP) $$< to $$@
$(CC) -c $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $$< -o $$@
endef
$(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src))))
# Compile: create object files from C++ source files. ARM-only
define COMPILE_CPP_ARM_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
@echo $(MSG_COMPILINGCPP_ARM) $$< to $$@
$(CC) -c $$(CFLAGS) $$(CPPFLAGS) $$< -o $$@
endef
$(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src))))
# Compile: create assembler files from C source files. ARM/Thumb
$(SRC:.c=.s) : %.s : %.c
@echo $(MSG_ASMFROMC) $< to $@
$(CC) $(THUMB) -S $(CFLAGS) $(CONLYFLAGS) $< -o $@
# Compile: create assembler files from C source files. ARM only
$(SRCARM:.c=.s) : %.s : %.c
@echo $(MSG_ASMFROMC_ARM) $< to $@
$(CC) -S $(CFLAGS) $(CONLYFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list finished end
clean_list :
@echo $(MSG_CLEANING)
$(REMOVE) $(OUTDIR)/$(TARGET).map
$(REMOVE) $(OUTDIR)/$(TARGET).elf
$(REMOVE) $(OUTDIR)/$(TARGET).hex
$(REMOVE) $(OUTDIR)/$(TARGET).bin
$(REMOVE) $(OUTDIR)/$(TARGET).sym
$(REMOVE) $(OUTDIR)/$(TARGET).lss
$(REMOVE) $(ALLOBJ)
$(REMOVE) $(LSTFILES)
$(REMOVE) $(DEPFILES)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRCARM:.c=.s)
$(REMOVE) $(CPPSRC:.cpp=.s)
$(REMOVE) $(CPPSRCARM:.cpp=.s)
## Create object files directory - now done if special make target
##$(shell mkdir $(OBJDIR) 2>/dev/null)
# Include the dependency files.
##-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
-include $(wildcard dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex bin lss sym clean clean_list program createdirs

251
STM32F10x_64k_20k_flash.ld Normal file
View File

@@ -0,0 +1,251 @@
/*
Default linker script for STM32F10x_64K_20K
Copyright RAISONANCE S.A.S. 2008
*/
/* include the common STM32F10x sub-script */
/* Common part of the linker scripts for STM32 devices*/
/* default stack sizes.
These are used by the startup in order to allocate stacks for the different modes.
*/
__Stack_Size = 1024 ;
PROVIDE ( _Stack_Size = __Stack_Size ) ;
__Stack_Init = _estack - __Stack_Size ;
/*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/
PROVIDE ( _Stack_Init = __Stack_Init ) ;
/*
There will be a link error if there is not this amount of RAM free at the end.
*/
_Minimum_Stack_Size = 0x100 ;
/* include the memory spaces definitions sub-script */
/*
Linker subscript for STM32F10x definitions with 64K Flash and 20K RAM */
/* Memory Spaces Definitions */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}
/* higher address of the user mode stack */
_estack = 0x20005000;
/* include the sections management sub-script for FLASH mode */
/*
Common part of the linker scripts for STR71x devices in FLASH mode
(that is, the FLASH is seen at 0)
Copyright RAISONANCE 2005
You can use, modify and distribute thisfile freely, but without any waranty.
*/
/* Sections Definitions */
SECTIONS
{
/* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
.flashtext :
{
. = ALIGN(4);
*(.flashtext) /* Startup code */
. = ALIGN(4);
} >FLASH
/* the program code is stored in the .text section, which goes to Flash */
.text :
{
. = ALIGN(4);
*(.text) /* remaining code */
*(.text.*) /* remaining code */
*(.rodata) /* read-only data (constants) */
*(.rodata*)
*(.glue_7)
*(.glue_7t)
. = ALIGN(4);
_etext = .;
/* This is used by the startup in order to initialize the .data secion */
_sidata = _etext;
} >FLASH
/* This is the initialized data section
The program executes knowing that the data is in the RAM
but the loader puts the initial values in the FLASH (inidata).
It is one task of the startup to copy the initial values from FLASH to RAM. */
.data : AT ( _sidata )
{
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_sdata = . ;
*(.data)
*(.data.*)
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
} >RAM
/* This is the uninitialized data section */
.bss :
{
. = ALIGN(4);
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .;
*(.bss)
*(COMMON)
. = ALIGN(4);
/* This is used by the startup in order to initialize the .bss secion */
_ebss = . ;
} >RAM
PROVIDE ( end = _ebss );
PROVIDE ( _end = _ebss );
/* This is the user stack section
This is just to check that there is enough RAM left for the User mode stack
It should generate an error if it's full.
*/
._usrstack :
{
. = ALIGN(4);
_susrstack = . ;
. = . + _Minimum_Stack_Size ;
. = ALIGN(4);
_eusrstack = . ;
} >RAM
/* this is the FLASH Bank1 */
/* the C or assembly source must explicitly place the code or data there
using the "section" attribute */
.b1text :
{
*(.b1text) /* remaining code */
*(.b1rodata) /* read-only data (constants) */
*(.b1rodata*)
} >FLASHB1
/* this is the EXTMEM */
/* the C or assembly source must explicitly place the code or data there
using the "section" attribute */
/* EXTMEM Bank0 */
.eb0text :
{
*(.eb0text) /* remaining code */
*(.eb0rodata) /* read-only data (constants) */
*(.eb0rodata*)
} >EXTMEMB0
/* EXTMEM Bank1 */
.eb1text :
{
*(.eb1text) /* remaining code */
*(.eb1rodata) /* read-only data (constants) */
*(.eb1rodata*)
} >EXTMEMB1
/* EXTMEM Bank2 */
.eb2text :
{
*(.eb2text) /* remaining code */
*(.eb2rodata) /* read-only data (constants) */
*(.eb2rodata*)
} >EXTMEMB2
/* EXTMEM Bank0 */
.eb3text :
{
*(.eb3text) /* remaining code */
*(.eb3rodata) /* read-only data (constants) */
*(.eb3rodata*)
} >EXTMEMB3
/* after that it's only debugging information. */
/* remove the debugging information from the standard libraries */
DISCARD :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}

696
Screen.c Normal file
View File

@@ -0,0 +1,696 @@
//////////////////////////////////////////////////////////////////////////////
//
// Filename: Screen.c
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech Ltd.
// Web: www.jyetech.com
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// Notes:
//
//
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
//
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include "Common.h"
#include "Board.h"
#include "Screen.h"
// ==========================================================
// File Scope Variables
// ==========================================================
//
const U8 DSO_font[(112/8) * 35] = {
/*------------------------------------------------------------------------------
; 源文件 / 文字 : DSO
; 宽×高(像素): 110×56
------------------------------------------------------------------------------*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x00,0x00,0x03,0xFE,0x00,0x00,0x3F,0xFF,
0xFF,0x00,0x00,0x00,0xFF,0xFC,0x60,0x00,0x1F,0xFF,0xC0,0x00,0x3F,0xFF,0xFF,0xF0,
0x00,0x01,0xFC,0x1F,0xE0,0x00,0x7F,0x07,0xF0,0x00,0x07,0xFE,0x03,0xFC,0x00,0x03,
0xF0,0x0F,0xE0,0x00,0xFC,0x01,0xF8,0x00,0x01,0xFE,0x00,0xFF,0x00,0x07,0xF0,0x07,
0xE0,0x03,0xF8,0x00,0xFE,0x00,0x01,0xFE,0x00,0x7F,0x80,0x0F,0xE0,0x03,0xE0,0x07,
0xF8,0x00,0x7F,0x00,0x01,0xFE,0x00,0x3F,0xC0,0x0F,0xE0,0x01,0xE0,0x07,0xF0,0x00,
0x7F,0x80,0x01,0xFE,0x00,0x1F,0xE0,0x1F,0xE0,0x01,0xE0,0x0F,0xF0,0x00,0x3F,0x80,
0x01,0xFE,0x00,0x1F,0xE0,0x1F,0xE0,0x00,0xE0,0x1F,0xE0,0x00,0x3F,0xC0,0x01,0xFE,
0x00,0x0F,0xF0,0x1F,0xF0,0x00,0xE0,0x1F,0xE0,0x00,0x3F,0xC0,0x01,0xFE,0x00,0x0F,
0xF8,0x1F,0xF0,0x00,0xE0,0x3F,0xE0,0x00,0x3F,0xE0,0x01,0xFE,0x00,0x0F,0xF8,0x1F,
0xFC,0x00,0x60,0x3F,0xC0,0x00,0x1F,0xE0,0x01,0xFE,0x00,0x07,0xF8,0x1F,0xFF,0x00,
0x00,0x3F,0xC0,0x00,0x1F,0xE0,0x01,0xFE,0x00,0x07,0xFC,0x0F,0xFF,0xC0,0x00,0x7F,
0xC0,0x00,0x1F,0xF0,0x01,0xFE,0x00,0x07,0xFC,0x0F,0xFF,0xF8,0x00,0x7F,0xC0,0x00,
0x1F,0xF0,0x01,0xFE,0x00,0x07,0xFC,0x07,0xFF,0xFE,0x00,0x7F,0xC0,0x00,0x1F,0xF0,
0x01,0xFE,0x00,0x07,0xFC,0x03,0xFF,0xFF,0x80,0x7F,0xC0,0x00,0x1F,0xF0,0x01,0xFE,
0x00,0x07,0xFC,0x01,0xFF,0xFF,0xC0,0x7F,0xC0,0x00,0x1F,0xF0,0x01,0xFE,0x00,0x07,
0xFC,0x00,0x7F,0xFF,0xE0,0x7F,0xC0,0x00,0x1F,0xF0,0x01,0xFE,0x00,0x07,0xFC,0x00,
0x1F,0xFF,0xF0,0x7F,0xC0,0x00,0x1F,0xF0,0x01,0xFE,0x00,0x07,0xFC,0x00,0x03,0xFF,
0xF0,0x7F,0xC0,0x00,0x1F,0xF0,0x01,0xFE,0x00,0x07,0xFC,0x00,0x00,0x7F,0xF8,0x7F,
0xC0,0x00,0x1F,0xF0,0x01,0xFE,0x00,0x07,0xF8,0x30,0x00,0x1F,0xF8,0x3F,0xC0,0x00,
0x1F,0xE0,0x01,0xFE,0x00,0x07,0xF8,0x38,0x00,0x0F,0xF8,0x3F,0xC0,0x00,0x1F,0xE0,
0x01,0xFE,0x00,0x0F,0xF8,0x38,0x00,0x0F,0xF8,0x3F,0xE0,0x00,0x3F,0xE0,0x01,0xFE,
0x00,0x0F,0xF0,0x3C,0x00,0x07,0xF8,0x1F,0xE0,0x00,0x3F,0xC0,0x01,0xFE,0x00,0x0F,
0xE0,0x3C,0x00,0x07,0xF8,0x1F,0xE0,0x00,0x3F,0xC0,0x01,0xFE,0x00,0x1F,0xE0,0x3E,
0x00,0x07,0xF0,0x0F,0xF0,0x00,0x7F,0x80,0x01,0xFE,0x00,0x1F,0xC0,0x3E,0x00,0x07,
0xF0,0x0F,0xF0,0x00,0x7F,0x80,0x01,0xFE,0x00,0x3F,0x80,0x3F,0x00,0x07,0xF0,0x07,
0xF0,0x00,0x7F,0x00,0x01,0xFF,0x00,0x7E,0x00,0x3F,0x80,0x0F,0xE0,0x03,0xF8,0x00,
0xFE,0x00,0x03,0xFF,0x81,0xFC,0x00,0x3F,0xC0,0x1F,0xC0,0x00,0xFC,0x01,0xFC,0x00,
0x3F,0xFF,0xFF,0xE0,0x00,0x3B,0xF0,0x3F,0x80,0x00,0x7F,0x07,0xF0,0x00,0x3F,0xFF,
0xFF,0x00,0x00,0x30,0xFF,0xFE,0x00,0x00,0x1F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x1F,0xF0,0x00,0x00,0x03,0xFE,0x00,0x00
};
FONT DSOm = {
(U8*)DSO_font,
112,
35,
112,
35,
0
};
const U8 Shell_font[(120/8) * 36] = {
/*------------------------------------------------------------------------------
; 源文件 / 文字 : Shell
; 宽×高(像素): 119×57
------------------------------------------------------------------------------*/
0x00,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0xE0,0x0F,0x00,0x0F,0xE0,0x00,0x00,0x00,0x00,0x00,0x03,0xF8,0x0F,0xE0,0x03,0x00,
0x01,0xC0,0x0C,0x60,0x00,0x00,0x00,0x00,0x00,0x03,0x18,0x0C,0x60,0x0E,0x00,0x00,
0xE0,0x0C,0x60,0x00,0x00,0x00,0x00,0x00,0x03,0x18,0x0C,0x60,0x0C,0x00,0x00,0x70,
0x0C,0x60,0x00,0x00,0x00,0x00,0x00,0x03,0x18,0x0C,0x60,0x18,0x1F,0xF0,0x38,0x0C,
0x60,0x00,0x00,0x00,0x00,0x00,0x03,0x18,0x0C,0x60,0x18,0x70,0x1E,0x18,0x0C,0x60,
0x00,0x00,0x00,0x00,0x00,0x03,0x18,0x0C,0x60,0x30,0xC0,0x07,0x1C,0x0C,0x60,0x00,
0x00,0x00,0x00,0x00,0x03,0x18,0x0C,0x60,0x31,0x80,0x03,0x0C,0x0C,0x60,0x00,0x00,
0x00,0x00,0x00,0x03,0x18,0x0C,0x60,0x31,0x80,0x01,0x8C,0x0C,0x60,0x00,0x00,0x00,
0x00,0x00,0x03,0x18,0x0C,0x60,0x31,0x80,0x01,0xFC,0x0C,0x63,0xFC,0x00,0x00,0x7F,
0xC0,0x03,0x18,0x0C,0x60,0x31,0xC0,0x00,0x00,0x0C,0x6E,0x07,0x00,0x01,0xC0,0x70,
0x03,0x18,0x0C,0x60,0x30,0xE0,0x00,0x00,0x0C,0x78,0x03,0x80,0x07,0x00,0x1C,0x03,
0x18,0x0C,0x60,0x38,0x3C,0x00,0x00,0x0C,0x70,0x00,0xC0,0x0E,0x00,0x0E,0x03,0x18,
0x0C,0x60,0x18,0x07,0xE0,0x00,0x0C,0x60,0x00,0xC0,0x1C,0x00,0x07,0x03,0x18,0x0C,
0x60,0x1C,0x00,0x3E,0x00,0x0C,0xC7,0xF0,0x60,0x18,0x3F,0x83,0x03,0x18,0x0C,0x60,
0x0E,0x00,0x07,0x80,0x0C,0x1C,0x38,0x60,0x30,0xE0,0xE1,0x83,0x18,0x0C,0x60,0x03,
0x80,0x00,0xE0,0x0C,0x18,0x18,0x60,0x31,0x80,0x31,0x83,0x18,0x0C,0x60,0x00,0xF0,
0x00,0x38,0x0C,0x30,0x0C,0x60,0x31,0x80,0x31,0x83,0x18,0x0C,0x60,0x00,0x3F,0x00,
0x1C,0x0C,0x30,0x0C,0x60,0x63,0x00,0x18,0xC3,0x18,0x0C,0x60,0x00,0x01,0xF0,0x0C,
0x0C,0x60,0x0C,0x60,0x63,0x00,0x18,0xC3,0x18,0x0C,0x60,0x00,0x00,0x1C,0x0E,0x0C,
0x60,0x0C,0x60,0x63,0xFF,0xF8,0xC3,0x18,0x0C,0x60,0x00,0x00,0x07,0x06,0x0C,0x60,
0x0C,0x60,0x60,0x00,0x00,0xC3,0x18,0x0C,0x60,0x00,0x00,0x01,0x86,0x0C,0x60,0x0C,
0x60,0x60,0x00,0x00,0xC3,0x18,0x0C,0x60,0x7F,0x80,0x00,0xC6,0x0C,0x60,0x0C,0x60,
0x60,0x00,0x00,0xC3,0x18,0x0C,0x60,0x71,0x80,0x00,0xC6,0x0C,0x60,0x0C,0x60,0x63,
0xFF,0xFF,0xC3,0x18,0x0C,0x60,0x71,0xC0,0x00,0xC6,0x0C,0x60,0x0C,0x60,0x63,0x00,
0x00,0x03,0x18,0x0C,0x60,0x70,0xC0,0x01,0xC6,0x0C,0x60,0x0C,0x60,0x33,0x00,0x00,
0x03,0x18,0x0C,0x60,0x38,0x60,0x01,0x8C,0x0C,0x60,0x0C,0x60,0x31,0x80,0x00,0x03,
0x18,0x0C,0x60,0x38,0x38,0x0F,0x0C,0x0C,0x60,0x0C,0x60,0x30,0xE0,0x3F,0xC3,0x18,
0x0C,0x60,0x1C,0x0F,0xF8,0x1C,0x0C,0x60,0x0C,0x60,0x18,0x3F,0xF1,0x83,0x18,0x0C,
0x60,0x1E,0x00,0x00,0x18,0x0C,0x60,0x0C,0x60,0x1C,0x00,0x03,0x83,0x18,0x0C,0x60,
0x0F,0x00,0x00,0x70,0x0C,0x60,0x0C,0x60,0x0E,0x00,0x07,0x03,0x18,0x0C,0x60,0x03,
0x80,0x00,0xE0,0x0C,0x60,0x0C,0x60,0x07,0x00,0x0E,0x03,0x18,0x0C,0x60,0x01,0xF0,
0x07,0x80,0x0C,0x60,0x0C,0x60,0x01,0xC0,0x78,0x03,0x18,0x0C,0x60,0x00,0x3F,0xFC,
0x00,0x0F,0xE0,0x0F,0xE0,0x00,0x7F,0xC0,0x03,0xF8,0x0F,0xE0
};
FONT Shell = {
(U8*)Shell_font,
120,
36,
120,
36,
0
};
const U8 DSO_Shell_font[(88/8) * 12] = {
/*------------------------------------------------------------------------------
; 源文件 / 文字 : DSO Shell
; 宽×高(像素): 85×22
------------------------------------------------------------------------------*/
0xFF,0x80,0x7A,0x03,0xE0,0x00,0xF4,0xF0,0x00,0x1E,0xF0,0x38,0xE0,0xC6,0x0E,0x38,
0x01,0x8C,0x70,0x00,0x0E,0x70,0x38,0x71,0xC2,0x1C,0x1C,0x03,0x84,0x70,0x00,0x0E,
0x70,0x38,0x31,0xC2,0x18,0x0C,0x03,0x84,0x77,0x07,0x0E,0x70,0x38,0x39,0xE0,0x38,
0x0E,0x03,0xC0,0x7B,0x8D,0x8E,0x70,0x38,0x38,0xF8,0x38,0x0E,0x01,0xF0,0x73,0x9D,
0xCE,0x70,0x38,0x38,0x3E,0x38,0x0E,0x00,0x7C,0x73,0x9F,0xCE,0x70,0x38,0x39,0x0F,
0x38,0x0E,0x02,0x1E,0x73,0x9C,0x0E,0x70,0x38,0x39,0x07,0x18,0x0C,0x02,0x0E,0x73,
0x9C,0x0E,0x70,0x38,0x71,0x87,0x1C,0x1C,0x03,0x0E,0x73,0x9C,0x0E,0x70,0x38,0xE1,
0xC6,0x0E,0x38,0x03,0x8C,0x73,0x8E,0x4E,0x70,0xFF,0x81,0x3C,0x03,0xE0,0x02,0x78,
0xFB,0xC7,0x9F,0xF8
};
FONT DSO_Shell = {
(U8*)DSO_Shell_font,
88,
12,
88,
12,
0
};
#define ASC8X16_Use_Display_Char_Only
const U8 Font_ASC8X16[128*16] = {
#ifndef ASC8X16_Use_Display_Char_Only
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x00
0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x99,0x81,0x81,0x7E,0x00,0x00,0x00,0x00, //0x01
0x00,0x00,0x7E,0xFF,0xDB,0xFF,0xFF,0xC3,0xE7,0xFF,0xFF,0x7E,0x00,0x00,0x00,0x00, //0x02
0x00,0x00,0x00,0x00,0x6C,0xFE,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00, //0x03
0x00,0x00,0x00,0x00,0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00,0x00, //0x04
0x00,0x00,0x00,0x18,0x3C,0x3C,0xE7,0xE7,0xE7,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x05
0x00,0x00,0x00,0x18,0x3C,0x7E,0xFF,0xFF,0x7E,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x06
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, //0x07
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, //0x08
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00,0x00,0x00, //0x09
0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0xFF,0xFF,0xFF,0xFF, //0x0A
0x00,0x00,0x1E,0x0E,0x1A,0x32,0x78,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, //0x0B
0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00, //0x0C
0x00,0x00,0x3F,0x33,0x3F,0x30,0x30,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00,0x00,0x00, //0x0D
0x00,0x00,0x7F,0x63,0x7F,0x63,0x63,0x63,0x63,0x67,0xE7,0xE6,0xC0,0x00,0x00,0x00, //0x0E
0x00,0x00,0x00,0x18,0x18,0xDB,0x3C,0xE7,0x3C,0xDB,0x18,0x18,0x00,0x00,0x00,0x00, //0x0F
0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFE,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00, //0x10
0x00,0x02,0x06,0x0E,0x1E,0x3E,0xFE,0x3E,0x1E,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, //0x11
0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00, //0x12
0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00, //0x13
0x00,0x00,0x7F,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00, //0x14
0x00,0x7C,0xC6,0x60,0x38,0x6C,0xC6,0xC6,0x6C,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00, //0x15
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFE,0xFE,0x00,0x00,0x00,0x00, //0x16
0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, //0x17
0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, //0x18
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00, //0x19
0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0xFE,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, //0x1A
0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xFE,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, //0x1B
0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, //0x1C
0x00,0x00,0x00,0x00,0x00,0x28,0x6C,0xFE,0x6C,0x28,0x00,0x00,0x00,0x00,0x00,0x00, //0x1D
0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7C,0x7C,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00, //0x1E
0x00,0x00,0x00,0x00,0xFE,0xFE,0x7C,0x7C,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00, //0x1F
#endif
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x20' '
0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, //0x21'!'
0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x22'"'
0x00,0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00, //0x23'#'
0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06,0x06,0x86,0xC6,0x7C,0x18,0x18,0x00,0x00, //0x24'$'
0x00,0x00,0x00,0x00,0xC2,0xC6,0x0C,0x18,0x30,0x60,0xC6,0x86,0x00,0x00,0x00,0x00, //0x25'%'
0x00,0x00,0x38,0x6C,0x6C,0x38,0x76,0xDC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x26'&'
0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x27'''
0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00, //0x28'('
0x00,0x00,0x30,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x30,0x00,0x00,0x00,0x00, //0x29')'
0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00, //0x2A'*'
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, //0x2B'+'
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00, //0x2C','
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x2D'-'
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, //0x2E'.'
0x00,0x00,0x00,0x00,0x02,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00, //0x2F'/'
0x00,0x00,0x38,0x6C,0xC6,0xC6,0xD6,0xD6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00, //0x30'0'
0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00, //0x31'1'
0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00, //0x32'2'
0x00,0x00,0x7C,0xC6,0x06,0x06,0x3C,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x33'3'
0x00,0x00,0x0C,0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00, //0x34'4'
0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xFC,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x35'5'
0x00,0x00,0x38,0x60,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x36'6'
0x00,0x00,0xFE,0xC6,0x06,0x06,0x0C,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00, //0x37'7'
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x38'8'
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00, //0x39'9'
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, //0x3A':'
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00, //0x3B';'
0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00, //0x3C'<'
0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x3D'='
0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00, //0x3E'>'
0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, //0x3F'?'
0x00,0x00,0x00,0x7C,0xC6,0xC6,0xDE,0xDE,0xDE,0xDC,0xC0,0x7C,0x00,0x00,0x00,0x00, //0x40'@'
0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, //0x41'A'
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00, //0x42'B'
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00, //0x43'C'
0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00, //0x44'D'
0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, //0x45'E'
0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, //0x46'F'
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xDE,0xC6,0xC6,0x66,0x3A,0x00,0x00,0x00,0x00, //0x47'G'
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, //0x48'H'
0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x49'I'
0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, //0x4A'J'
0x00,0x00,0xE6,0x66,0x66,0x6C,0x78,0x78,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, //0x4B'K'
0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, //0x4C'L'
0x00,0x00,0xC6,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, //0x4D'M'
0x00,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, //0x4E'N'
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x4F'O'
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, //0x50'P'
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xDE,0x7C,0x0C,0x0E,0x00,0x00, //0x51'Q'
0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x6C,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, //0x52'R'
0x00,0x00,0x7C,0xC6,0xC6,0x60,0x38,0x0C,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x53'S'
0x00,0x00,0x7E,0x7E,0x5A,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x54'T'
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x55'U'
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x10,0x00,0x00,0x00,0x00, //0x56'V'
0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0xEE,0x6C,0x00,0x00,0x00,0x00, //0x57'W'
0x00,0x00,0xC6,0xC6,0x6C,0x7C,0x38,0x38,0x7C,0x6C,0xC6,0xC6,0x00,0x00,0x00,0x00, //0x58'X'
0x00,0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x59'Y'
0x00,0x00,0xFE,0xC6,0x86,0x0C,0x18,0x30,0x60,0xC2,0xC6,0xFE,0x00,0x00,0x00,0x00, //0x5A'Z'
0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00, //0x5B'['
0x00,0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, //0x5C'\'
0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00, //0x5D']'
0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x5E'^'
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, //0x5F'_'
0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x60'`'
0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x61'a'
0x00,0x00,0xE0,0x60,0x60,0x78,0x6C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00, //0x62'b'
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x63'c'
0x00,0x00,0x1C,0x0C,0x0C,0x3C,0x6C,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x64'd'
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x65'e'
0x00,0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, //0x66'f'
0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0xCC,0x78,0x00, //0x67'g'
0x00,0x00,0xE0,0x60,0x60,0x6C,0x76,0x66,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, //0x68'h'
0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x69'i'
0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00, //0x6A'j'
0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00, //0x6B'k'
0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x6C'l'
0x00,0x00,0x00,0x00,0x00,0xEC,0xFE,0xD6,0xD6,0xD6,0xD6,0xC6,0x00,0x00,0x00,0x00, //0x6D'm'
0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, //0x6E'n'
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x6F'o'
0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00, //0x70'p'
0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00, //0x71'q'
0x00,0x00,0x00,0x00,0x00,0xDC,0x76,0x66,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, //0x72'r'
0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x60,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x73's'
0x00,0x00,0x10,0x30,0x30,0xFC,0x30,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00, //0x74't'
0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x75'u'
0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00, //0x76'v'
0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0x6C,0x00,0x00,0x00,0x00, //0x77'w'
0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x38,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00, //0x78'x'
0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00, //0x79'y'
0x00,0x00,0x00,0x00,0x00,0xFE,0xCC,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, //0x7A'z'
0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00, //0x7B''
0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, //0x7C'|'
0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, //0x7D''
0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0x7E'~'
// 0x00,0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00,0x00,0x00,0x00,0x00, //0x7F''
0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7E,0x62,0x60,0x60,0xC0,
// 0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xC0,0x00,0x00,0x00, //0xE6 -- Greek (u)
#ifdef ASC8X16_USE_EXTEND_CHARACTER_SET
0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x0C,0x06,0x7C,0x00,0x00, //0x80
0x00,0x00,0xCC,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x81
0x00,0x0C,0x18,0x30,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x82
0x00,0x10,0x38,0x6C,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x83
0x00,0x00,0xCC,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x84
0x00,0x60,0x30,0x18,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x85
0x00,0x38,0x6C,0x38,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x86
0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00,0x00, //0x87
0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x88
0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x89
0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x8A
0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x8B
0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x8C
0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0x8D
0x00,0xC6,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, //0x8E
0x38,0x6C,0x38,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, //0x8F
0x18,0x30,0x60,0x00,0xFE,0x66,0x60,0x7C,0x60,0x60,0x66,0xFE,0x00,0x00,0x00,0x00, //0x90
0x00,0x00,0x00,0x00,0x00,0xCC,0x76,0x36,0x7E,0xD8,0xD8,0x6E,0x00,0x00,0x00,0x00, //0x91
0x00,0x00,0x3E,0x6C,0xCC,0xCC,0xFE,0xCC,0xCC,0xCC,0xCC,0xCE,0x00,0x00,0x00,0x00, //0x92
0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x93
0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x94
0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x95
0x00,0x30,0x78,0xCC,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x96
0x00,0x60,0x30,0x18,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0x97
0x00,0x00,0xC6,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00, //0x98
0x00,0xC6,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x99
0x00,0xC6,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0x9A
0x00,0x18,0x18,0x3C,0x66,0x60,0x60,0x60,0x66,0x3C,0x18,0x18,0x00,0x00,0x00,0x00, //0x9B
0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xE6,0xFC,0x00,0x00,0x00,0x00, //0x9C
0x00,0x00,0x66,0x66,0x3C,0x18,0x7E,0x18,0x7E,0x18,0x18,0x18,0x00,0x00,0x00,0x00, //0x9D
0x00,0xF8,0xCC,0xCC,0xF8,0xC4,0xCC,0xDE,0xCC,0xCC,0xCC,0xC6,0x00,0x00,0x00,0x00, //0x9E
0x00,0x0E,0x1B,0x18,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x18,0xD8,0x70,0x00,0x00, //0x9F
0x00,0x18,0x30,0x60,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0xA0
0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, //0xA1
0x00,0x18,0x30,0x60,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0xA2
0x00,0x18,0x30,0x60,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, //0xA3
0x00,0x00,0x76,0xDC,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, //0xA4
0x76,0xDC,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, //0xA5
0x00,0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xA6
0x00,0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xA7
0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xC0,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, //0xA8
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00, //0xA9
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00, //0xAA
0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x60,0xDC,0x86,0x0C,0x18,0x3E,0x00,0x00, //0xAB
0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x66,0xCE,0x9E,0x3E,0x06,0x06,0x00,0x00, //0xAC
0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00, //0xAD
0x00,0x00,0x00,0x00,0x00,0x36,0x6C,0xD8,0x6C,0x36,0x00,0x00,0x00,0x00,0x00,0x00, //0xAE
0x00,0x00,0x00,0x00,0x00,0xD8,0x6C,0x36,0x6C,0xD8,0x00,0x00,0x00,0x00,0x00,0x00, //0xAF
0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44, //0xB0
0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA, //0xB1
0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77, //0xB2
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xB3
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xB4
0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xB5
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xB6
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xB7
0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xB8
0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xB9
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xBA
0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xBB
0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xBC
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xBD
0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xBE
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xBF
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xC0
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xC1
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xC2
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xC3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xC4
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xC5
0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xC6
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xC7
0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xC8
0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xC9
0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xCA
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xCB
0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xCC
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xCD
0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xCE
0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xCF
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xD0
0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xD1
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xD2
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xD3
0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xD4
0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xD5
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xD6
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, //0xD7
0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xD8
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xD9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xDA
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, //0xDB
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, //0xDC
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0, //0xDD
0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, //0xDE
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xDF
0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0xD8,0xD8,0xD8,0xDC,0x76,0x00,0x00,0x00,0x00, //0xE0
0x00,0x00,0x78,0xCC,0xCC,0xCC,0xD8,0xCC,0xC6,0xC6,0xC6,0xCC,0x00,0x00,0x00,0x00, //0xE1
0x00,0x00,0xFE,0xC6,0xC6,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00, //0xE2
0x00,0x00,0x00,0x00,0xFE,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00, //0xE3
0x00,0x00,0x00,0xFE,0xC6,0x60,0x30,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, //0xE4
0x00,0x00,0x00,0x00,0x00,0x7E,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, //0xE5
0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xC0,0x00,0x00,0x00, //0xE6 -- (u) micro
0x00,0x00,0x00,0x00,0x76,0xDC,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, //0xE7
0x00,0x00,0x00,0x7E,0x18,0x3C,0x66,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, //0xE8
0x00,0x00,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00, //0xE9
0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x6C,0x6C,0x6C,0xEE,0x00,0x00,0x00,0x00, //0xEA
0x00,0x00,0x1E,0x30,0x18,0x0C,0x3E,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00, //0xEB
0x00,0x00,0x00,0x00,0x00,0x7E,0xDB,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00,0x00,0x00, //0xEC
0x00,0x00,0x00,0x03,0x06,0x7E,0xDB,0xDB,0xF3,0x7E,0x60,0xC0,0x00,0x00,0x00,0x00, //0xED
0x00,0x00,0x1C,0x30,0x60,0x60,0x7C,0x60,0x60,0x60,0x30,0x1C,0x00,0x00,0x00,0x00, //0xEE
0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, //0xEF
0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, //0xF0
0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, //0xF1
0x00,0x00,0x00,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00,0x00, //0xF2
0x00,0x00,0x00,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00,0x00, //0xF3
0x00,0x00,0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, //0xF4
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, //0xF5
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7E,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, //0xF6
0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00, //0xF7
0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xF8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xF9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xFA
0x00,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0xEC,0x6C,0x6C,0x3C,0x1C,0x00,0x00,0x00,0x00, //0xFB
0x00,0xD8,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xFC
0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0xFD
0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00,0x00, //0xFE
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 //0xFF
#endif
};
FONT ASC8X16 = {
(U8 *)Font_ASC8X16,
8,
16,
8,
16,
0x20
};
// ===== Function Definitions ==================
//
// ==========================================
// Clear screen
void ClrScreen(void)
{
FillRect(ScreenX0, ScreenY0, ScreenXsize, ScreenYsize, clBlack);
}
void SetWindow(U16 x, U16 xsize, U16 y, U16 ysize)
{
write_comm(0x2A);
write_data(x >> 8);
write_data(x);
x = x + xsize - 1;
write_data(x >> 8);
write_data(x);
write_comm(0x2B);
write_data(y >> 8);
write_data(y);
y = y + ysize - 1;
write_data(y >> 8);
write_data(y);
}
// ==========================================
// Fill rectangle area with given color
void FillRect_9325(S16 x, S16 y, S16 xsize, S16 ysize, U16 color)
{
U32 tmp;
// Set X start and end address
TFT_CmdWrite(TFT_VAddressStart, x);
TFT_CmdWrite(TFT_VAddressEnd, x + xsize - 1);
// Set Y start and end address
TFT_CmdWrite(TFT_HAddressStart, y);
TFT_CmdWrite(TFT_HAddressEnd, y + ysize - 1);
// Set data start address in GRAM
TFT_CmdWrite(TFT_DramHAddress, y);
TFT_CmdWrite(TFT_DramVAddress, x);
// Delay(200);
// Fill with bgcolor
TFT_AccessGRAM();
tmp = (U32)xsize * (U32)ysize;
// Set up to access Data Register (RS == 1)
SetToHigh(TFT_RS_Port, (1 << TFT_RS_Bit));
while(tmp) {
TFT_Port = (TFT_Port & 0xFF00) | (color >> 8);
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
TFT_Port = (TFT_Port & 0xFF00) | (color & 0x00FF);
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
tmp--;
}
// sei();
TFT_AccessGRAM_End();
// Set LCD_nCS high
// BitSet8(LCD_nCS_Port, (1 << LCD_nCS_Bit));
}
// Put at (x, y) a 15X16 character [ch] with [f_color] and [b_color]
//
void PutcGenic_9325(U16 x, U16 y, U8 ch, U16 fgcolor, U16 bgcolor, FONT *font)
{
U8 tmp, tmp2;
U16 tmp1, tmp3;
U8 *ptmp;
// Font address
ptmp = (U8 *)font->Array + (ch - font->IndexOfs) * ((font->Xsize + 7)/8) * font->Ysize;
// Set X start and end address
TFT_CmdWrite(TFT_VAddressStart, x);
TFT_CmdWrite(TFT_VAddressEnd, x + font->Xsize - 1);
// Set Y start and end address
TFT_CmdWrite(TFT_HAddressStart, y);
TFT_CmdWrite(TFT_HAddressEnd, y + font->Ysize - 1);
// Set data start address in GRAM
TFT_CmdWrite(TFT_DramVAddress, x);
TFT_CmdWrite(TFT_DramHAddress, y);
TFT_AccessGRAM();
// Set up to access Data Register (RS == 1)
SetToHigh(TFT_RS_Port, (1 << TFT_RS_Bit));
tmp1 = (font->Xsize * font->Ysize)/8;
while(tmp1) {
tmp = *ptmp;
tmp2 = 8;
while(tmp2) {
tmp3 = (tmp & 0x80) ? fgcolor : bgcolor;
TFT_Port = (TFT_Port & 0xFF00) | (tmp3 >> 8);
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
TFT_Port = (TFT_Port & 0xFF00) | (tmp3 & 0x00FF);
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
tmp <<= 1;
tmp2--;
}
ptmp++;
tmp1--;
}
TFT_AccessGRAM_End();
}
// ==========================================
// Fill rectangle area with given color
void FillRect_9341(S16 x, S16 y, S16 xsize, S16 ysize, U16 color)
{
U32 tmp;
SetWindow(x, xsize, y, ysize);
// Delay(200);
SetToLow(TFT_nCS_Port, (1 << TFT_nCS_Bit));
SetToLow(TFT_RS_Port, (1 << TFT_RS_Bit));
// Delay(2);
TFT_Port = (TFT_Port & 0xFF00) | 0x2C;
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
tmp = (U32)xsize * (U32)ysize;
// Set up to access Index Register (RS == 1)
SetToHigh(TFT_RS_Port, (1 << TFT_RS_Bit));
while(tmp) {
TFT_Port = (TFT_Port & 0xFF00) | (color >> 8);
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
TFT_Port = (TFT_Port & 0xFF00) | (color & 0x00FF);
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
tmp--;
}
// Set TFT_nCS high
SetToHigh(TFT_nCS_Port, (1 << TFT_nCS_Bit));
}
// Put at (x, y) a 15X16 character [ch] with [f_color] and [b_color]
//
void PutcGenic_9341(U16 x, U16 y, U8 ch, U16 fgcolor, U16 bgcolor, FONT *font)
{
U8 tmp, tmp2;
U16 tmp1, tmp3;
U8 *ptmp;
// Font address
ptmp = (U8 *)font->Array + (ch - font->IndexOfs) * ((font->Xsize + 7)/8) * font->Ysize;
SetWindow(x, font->Xsize, y, font->Ysize);
SetToLow(TFT_nCS_Port, (1 << TFT_nCS_Bit));
SetToLow(TFT_RS_Port, (1 << TFT_RS_Bit));
// Delay(2);
TFT_Port = (TFT_Port & 0xFF00) | 0x2C;
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_RS_Port, (1 << TFT_RS_Bit));
tmp1 = (font->Xsize * font->Ysize)/8;
while(tmp1) {
tmp = *ptmp;
tmp2 = 8;
while(tmp2) {
tmp3 = (tmp & 0x80) ? fgcolor : bgcolor;
TFT_Port = (TFT_Port & 0xFF00) | (tmp3 >> 8);
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
TFT_Port = (TFT_Port & 0xFF00) | (tmp3 & 0x00FF);
SetToLow(TFT_nWR_Port, (1 << TFT_nWR_Bit));
SetToHigh(TFT_nWR_Port, (1 << TFT_nWR_Bit));
tmp <<= 1;
tmp2--;
}
ptmp++;
tmp1--;
}
SetToHigh(TFT_nCS_Port, (1 << TFT_nCS_Bit));
}
void FillRect(S16 x, S16 y, S16 xsize, S16 ysize, U16 color)
{
if(TFT_Controller == 0x9341) {
FillRect_9341(x, y, xsize, ysize, color);
}
else {
FillRect_9325(x, y, xsize, ysize, color);
}
}
void PutsGenic(U16 x, U16 y, U8 *str, U16 fgcolor, U16 bgcolor, FONT *font)
{
U8 tmp;
if(TFT_Controller == 0x9341) {
while((tmp = *str++)) {
PutcGenic_9341(x, y, tmp, fgcolor, bgcolor, font);
x += font->CharPitch;
if(x >= ScreenXsize) {
y += font->LinePitch;
x = 0;
}
}
}
else {
while((tmp = *str++)) {
PutcGenic_9325(x, y, tmp, fgcolor, bgcolor, font);
x += font->CharPitch;
if(x >= ScreenXsize) {
y += font->LinePitch;
x = 0;
}
}
}
}
void PutcGenic(U16 x, U16 y, U8 ch, U16 fgcolor, U16 bgcolor, FONT *font)
{
if(TFT_Controller == 0x9341) {
PutcGenic_9341(x, y, ch, fgcolor, bgcolor, font);
}
else {
PutcGenic_9325(x, y, ch, fgcolor, bgcolor, font);
}
}

141
Screen.h Normal file
View File

@@ -0,0 +1,141 @@
//////////////////////////////////////////////////////////////////////////////
//
// Filename: Board.h
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech Ltd.
// Web: www.jyetech.com
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// Notes:
//
//
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef Screen_h
#define Screen_h
#include "Common.h"
// ------------ Display parameters -----------------------
// Overall display parameters
#define ScreenX0 0
#define ScreenY0 0
#define ScreenXsize 320
#define ScreenYsize 240
#define Rbits 0 // Red bits position
#define Gbits 5 // Green bits position
#define Bbits 11 // Blue bits position
#define RGB(R, G, B) (((R >> 3) << Rbits) | ((G >> 2) << Gbits) | ((B >> 3) << Bbits))
enum COLOR{
clBlack = RGB(0, 0, 0),
clWhite = RGB(255, 255, 255),
clRed = RGB(255, 0, 0),
clGreen = RGB(0, 255, 0),
clBlue = RGB(0, 0, 255),
clYellow = RGB(255, 255, 0),
clGainsboro = RGB(220, 220, 220),
clNavy = RGB(0, 0, 128),
clAqua = RGB(0, 255, 255),
clHotpink = RGB(255, 105, 180),
clOrange = RGB(255, 165, 0),
clDeepskyblue = RGB(0, 191, 255),
clDimgray = RGB(105, 105, 105),
cllightsalmon = RGB(255, 160, 122),
cllightcoral = RGB(240, 128, 128),
clpaleturquoise = RGB(175, 238, 238),
clturquoise = RGB(64, 224, 208),
clViolet = RGB(238, 130, 238),
clGray1 = RGB(90, 90, 90),
clGray2 = RGB(220, 220, 220),
clGray3 = RGB(240, 240, 240),
clDarkgray = RGB(169, 169, 169),
clSkyblue = RGB(135, 206, 235),
clChocolate = RGB(210, 105, 30),
clMediumseagreen = RGB(60, 179, 113),
clPeachpuff = RGB(255, 218, 185),
clSeagreen = RGB(46, 139, 87),
clBG1 = clGainsboro,
clActiveItem1 = clAqua,
clActiveItem2 = clturquoise,
clBtnBG1 = clOrange,
clBtnBG2 = clBlue,
clBtnBG3 = clGainsboro,
clBtnBG4 = clSkyblue,
clBtnBG5 = clRed,
clBtnFG1 = clBlack,
clBtnFG2 = clWhite,
clCh1 = clYellow,
clTB = clGreen,
clTrigger = clHotpink,
clCursorT = clMediumseagreen,
clCursorV = clOrange,
clCursorActive = clAqua,
clMeasurement = clGray3,
} ;
typedef struct {
U8 *Array;
U16 Xsize;
U8 Ysize;
U16 CharPitch;
U8 LinePitch;
U8 IndexOfs;
} FONT;
// Display Panel
// =======================================================
// Display parameters
#define WWindowx0 10
#define WWindowy0 17
#define WWindowSizex 300
#define WWindowSizey 200
#define WDsize 300 // Wave display size
#define HBarSize 140 // HPos indicator length
// ===========================================================
// Declarations of external variables
// ===========================================================
//
extern FONT DSOm;
extern FONT Shell;
extern FONT DSO_Shell;
extern FONT ASC8X16;
// ===========================================================
// Function Prototype Declarations
// ===========================================================
//
void ClrScreen(void);
void SetWindow(U16 x, U16 xsize, U16 y, U16 ysize);
void FillRect(S16 x, S16 y, S16 xsize, S16 ysize, U16 color);
void PutcGenic(U16 x, U16 y, U8 ch, U16 fgcolor, U16 bgcolor, FONT *font);
void PutsGenic(U16 x, U16 y, U8 *str, U16 fgcolor, U16 bgcolor, FONT *font);
#endif

BIN
libdso150.a Normal file

Binary file not shown.

244
libdso150.h Normal file
View File

@@ -0,0 +1,244 @@
//////////////////////////////////////////////////////////////////////////////
//
// Filename: libdso138.h
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech Ltd.
// Web: www.jyetech.com
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// Notes:
//
//
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
#ifndef libdso150_h
#define libdso150_h
//#include "Common.h"
#include "Screen.h"
// =======================================================
#define SampleBufSizeMax 0x400
#define VPosMax 500
#define VPosMin -500
#define VSenMax VS_5mV
#define VSenMin VS_20V
#define CplMax CP_GND
#define CplMin CP_DC
#define TBMax TB_10us
#define TBMin TB_500s
#define TrigModeMax TM_Single
#define TrigModeMin TM_Auto
#define TrigEdgeMax TE_Rising
#define TrigEdgeMin TE_Falling
#define TrigLvlMax 1200
#define TrigLvlMin -1200
#define TrigPosMax SampleBufSizeMax
#define TrigPosMin 0
#define TrigSenMax 100
#define TrigSenMin 0
#define RecLenMax SampleBufSizeMax
#define RecLenMin 512
#define SampleMidValue 0x800 // For 1.65V bias
#define WWindowMidValue (SampleMidValue >> 2)
// =======================================================
// Scope control type definitions
// =======================================================
//
// -- Time base type
enum TimeBase {
// TB_min,
TB_Custom = 0,
TB_500s,
TB_200s,
TB_100s,
TB_50s,
TB_20s,
TB_10s,
TB_5s,
TB_2s,
TB_1s,
TB_05s,
TB_02s,
TB_01s,
TB_50ms,
TB_20ms,
TB_10ms,
TB_5ms,
TB_2ms,
TB_1ms,
TB_05ms,
TB_02ms,
TB_01ms,
TB_50us,
TB_20us,
TB_10us,
TB_5us,
TB_2us,
TB_1us,
TB_05us,
TB_02us,
TB_01us,
TB_50ns,
TB_20ns,
TB_10ns,
// TB_max
};
// -- Trig Mode type
enum TrigMode {
TM_Auto,
TM_Normal,
TM_Single,
TM_Max
};
// -- Trig Edge type
enum TrigEdge {
TE_Falling,
TE_Rising,
};
// -- V sensitivity type
typedef enum {
VS_UnCal = 0,
VS_50V,
VS_20V,
VS_10V,
VS_5V,
VS_2V,
VS_1V,
VS_05V,
VS_02V,
VS_01V,
VS_50mV,
VS_20mV,
VS_10mV,
VS_5mV,
VS_Last
}TY_VSen ;
// -- Coupling type
enum Couple{
CP_DC,
CP_AC,
CP_GND
};
enum FocusType {
FC_VSen = 0,
FC_Timebase,
FC_TrigMode,
FC_TrigEdge,
FC_TrigLvl,
FC_HPos,
FC_VPos,
FC_Max
};
enum DsoStatus {
DSO_CaptureDone = 0x0001,
DSO_Trigged = 0x0002,
DSO_Hold = 0x0004,
DSO_Rolling = 0x0008,
DSO_NormalDisplay = 0x0080,
};
enum DispUpdateFlags {
Disp_Panel = 0x0001,
Disp_Param = 0x0002,
Disp_Trace = 0x0004,
Disp_None = 0x0008,
Disp_TrState = 0x0010, // Display trigger state
};
// =====================================
// Exported variables
//
extern U16 *SampleBuf;
extern U16 *CurrentSample;
extern const U8 LibVersion[];
extern FONT JYELogo;
extern FONT Jinyuedianzi;
extern FONT Jyetech;
extern FONT Web;
extern FONT ByJyetech;
// -- Function Prototypes --
void DSO_Init(void);
void StartCapture(void);
void StopCapture(void);
U16 GetDsoStatus(void);
void SetHold(void);
void ClrHold(void);
void UpdateTimebase(void);
void Rolling(void);
S8 SetVSen(S8 vsen);
S8 SetCpl(S8 cpl);
S16 SetVPos(S16 vpos);
S8 SetTimeBase(S8 timebase);
S16 SetHPos(S16 hpos);
S8 SetTrigMode(S8 trigmode);
S8 SetTrigEdge(S8 trigslope);
S16 SetTrigLvl(S16 triglvl);
S16 SetTrigPos(S16 trigpos);
S16 SetTrigSen(S16 trigsen);
U16 SetRecLen(U16 reclen);
S16 SetVPosOfs(S16 ofs);
S8 GetVSen(void);
S8 GetCpl(void);
S16 GetVPos(void);
S8 GetTimebase(void);
S16 GetHPos(void);
S8 GetTrigMode(void);
S8 GetTrigEdge(void);
S16 GetTrigLvl(void);
S16 GetTrigPos(void);
S16 GetTrigSen(void);
U16 GetRecLen(void);
S16 GetVPosOfs(void);
void DsoDisplay(void);
void UpdateDisp(U16 disp);
void CancelDisp(U16 disp);
U8 SetFocus(U8 focus);
U8 GetFocus(void);
S16 GetAverage(void);
#endif

76
readme.txt Normal file
View File

@@ -0,0 +1,76 @@
=================================
DSO Shell (DSO150) Source Codes
Ver: 113-15011-060
(C) JYE Tech Ltd. All right reserved
Web: www.jyetech.com
Forum: www.jyetech.com/forum
Email: jyetek@gmail.com
=================================
1. Contents
-----------
Files contained in this package include:
1 ) 113-15011.c -- The main program
2 ) Board.c -- Functions for initialization and lower level operation
3 ) Board.h -- Header file
4 ) Command.c -- Functions for key command analysis and execution
5 ) Command.h -- Header file
6 ) Common.c -- Basic type definitions and general functions
7 ) Common.h -- Header file
8 ) Eeprom.c -- Emulation of EEPROM
9 ) Eeprom.h -- Header file
10 ) stm32f103_it.c -- Interrupt handlers
11 ) stm32f103_it.h -- Header file
12 ) Screen.c -- Functions for screen related operations
13 ) Screen.h -- Header file
14 ) libdso150.a -- Library of DSO150 core
15 ) libdso150.h -- Header file
16 ) stm32f10x_conf.h -- Configuration file
17 ) startup_stm32f10x_md.S -- Start-up file
18 ) makefile -- Makefile for building the project
19 ) STM32F10x_64k_20k_flash.ld -- Linker script
20 ) readme.txt -- This file.
21 ) Libraries(folder) -- Libraries for STM32F10x MCUs
2. How To Build
---------------
The project was developped under CodeSourcery G++ Lite. Under Windows environment please follow the steps below to build the project:
1 ) Download Code Sourcery G++ Lite from http://www.mentor.com/. Install it and have environment variables setup properly as instructed in the accompanied documents.
2 ) Unzip all files in this package to a folder.
3 ) Open a command line window under Windows. Switch to the folder that contains the unzipped files with "CD" commands. Type and execute "cs-make" from the folder.
3. Support
----------
There is no technical support for questions related to the source codes. However, users are welcome to present their questions to and seek helps in JYE Tech Forum (http://www.jyetech.com/forum).
4. Limitations
----------
The library libdso150.a only runs on DSO Shell or equivalent boards. It may not run on other boards.
5. License
----------
DSO Shell source codes are free software and open for education, research, and
commercial developments under license policy of the following terms.
Copyright (C)2017 JYE Tech Ltd., All right reserved
1 ) DSO Shell source codes are free software and there is NO WARRANTY.
2 ) You can use, modify, and redistribute it for personal, non-profit, or commercial product UNDER YOUR OWN RESPONSIBILITY.
3 ) Redistributions of source codes must retain the above copyright notice.
6. Revision History
-------------------
Version Date Summary
--------------------------------
0.60 2017.05.10 First release.

357
startup_stm32f10x_md.S Normal file
View File

@@ -0,0 +1,357 @@
/**
******************************************************************************
* @file startup_stm32f10x_md.s
* @author MCD Application Team
* @version V3.3.0
* @date 04/16/2010
* @brief STM32F10x Medium Density Devices vector table for RIDE7 toolchain.
* This module performs:
* - Set the initial SP
* - Set the initial PC == Reset_Handler,
* - Set the vector table entries with the exceptions ISR address
* - Configure the clock system
* - Branches to main in the C library (which eventually
* calls main()).
* After Reset the Cortex-M3 processor is in Thread mode,
* priority is Privileged, and the Stack is set to Main.
*******************************************************************************
* @copy
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
*/
.syntax unified
.cpu cortex-m3
.fpu softvfp
.thumb
.global g_pfnVectors
.global Default_Handler
/* start address for the initialization values of the .data section.
defined in linker script */
.word _sidata
/* start address for the .data section. defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss
.equ BootRAM, 0xF108F85F
/**
* @brief This is the code that gets called when the processor first
* starts execution following a reset event. Only the absolutely
* necessary set is performed, after which the application
* supplied main() routine is called.
* @param None
* @retval : None
*/
.section .text.Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
/* Copy the data segment initializers from flash to SRAM */
movs r1, #0
b LoopCopyDataInit
CopyDataInit:
ldr r3, =_sidata
ldr r3, [r3, r1]
str r3, [r0, r1]
adds r1, r1, #4
LoopCopyDataInit:
ldr r0, =_sdata
ldr r3, =_edata
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2], #4
LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss
/* Call the clock system intitialization function.*/
bl SystemInit
/* Call the application's entry point.*/
bl main
bx lr
.size Reset_Handler, .-Reset_Handler
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
* @param None
* @retval None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
/******************************************************************************
*
* The minimal vector table for a Cortex M3. Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*
******************************************************************************/
.section .isr_vector,"a",%progbits
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word MemManage_Handler
.word BusFault_Handler
.word UsageFault_Handler
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word DebugMon_Handler
.word 0
.word PendSV_Handler
.word SysTick_Handler
.word WWDG_IRQHandler
.word PVD_IRQHandler
.word TAMPER_IRQHandler
.word RTC_IRQHandler
.word FLASH_IRQHandler
.word RCC_IRQHandler
.word EXTI0_IRQHandler
.word EXTI1_IRQHandler
.word EXTI2_IRQHandler
.word EXTI3_IRQHandler
.word EXTI4_IRQHandler
.word DMA1_Channel1_IRQHandler
.word DMA1_Channel2_IRQHandler
.word DMA1_Channel3_IRQHandler
.word DMA1_Channel4_IRQHandler
.word DMA1_Channel5_IRQHandler
.word DMA1_Channel6_IRQHandler
.word DMA1_Channel7_IRQHandler
.word ADC1_2_IRQHandler
.word USB_HP_CAN1_TX_IRQHandler
.word USB_LP_CAN1_RX0_IRQHandler
.word CAN1_RX1_IRQHandler
.word CAN1_SCE_IRQHandler
.word EXTI9_5_IRQHandler
.word TIM1_BRK_IRQHandler
.word TIM1_UP_IRQHandler
.word TIM1_TRG_COM_IRQHandler
.word TIM1_CC_IRQHandler
.word TIM2_IRQHandler
.word TIM3_IRQHandler
.word TIM4_IRQHandler
.word I2C1_EV_IRQHandler
.word I2C1_ER_IRQHandler
.word I2C2_EV_IRQHandler
.word I2C2_ER_IRQHandler
.word SPI1_IRQHandler
.word SPI2_IRQHandler
.word USART1_IRQHandler
.word USART2_IRQHandler
.word USART3_IRQHandler
.word EXTI15_10_IRQHandler
.word RTCAlarm_IRQHandler
.word USBWakeUp_IRQHandler
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word BootRAM /* @0x108. This is for boot in RAM mode for
STM32F10x Medium Density devices. */
/*******************************************************************************
*
* Provide weak aliases for each Exception handler to the Default_Handler.
* As they are weak aliases, any function with the same name will override
* this definition.
*
*******************************************************************************/
.weak NMI_Handler
.thumb_set NMI_Handler,Default_Handler
.weak HardFault_Handler
.thumb_set HardFault_Handler,Default_Handler
.weak MemManage_Handler
.thumb_set MemManage_Handler,Default_Handler
.weak BusFault_Handler
.thumb_set BusFault_Handler,Default_Handler
.weak UsageFault_Handler
.thumb_set UsageFault_Handler,Default_Handler
.weak SVC_Handler
.thumb_set SVC_Handler,Default_Handler
.weak DebugMon_Handler
.thumb_set DebugMon_Handler,Default_Handler
.weak PendSV_Handler
.thumb_set PendSV_Handler,Default_Handler
.weak SysTick_Handler
.thumb_set SysTick_Handler,Default_Handler
.weak WWDG_IRQHandler
.thumb_set WWDG_IRQHandler,Default_Handler
.weak PVD_IRQHandler
.thumb_set PVD_IRQHandler,Default_Handler
.weak TAMPER_IRQHandler
.thumb_set TAMPER_IRQHandler,Default_Handler
.weak RTC_IRQHandler
.thumb_set RTC_IRQHandler,Default_Handler
.weak FLASH_IRQHandler
.thumb_set FLASH_IRQHandler,Default_Handler
.weak RCC_IRQHandler
.thumb_set RCC_IRQHandler,Default_Handler
.weak EXTI0_IRQHandler
.thumb_set EXTI0_IRQHandler,Default_Handler
.weak EXTI1_IRQHandler
.thumb_set EXTI1_IRQHandler,Default_Handler
.weak EXTI2_IRQHandler
.thumb_set EXTI2_IRQHandler,Default_Handler
.weak EXTI3_IRQHandler
.thumb_set EXTI3_IRQHandler,Default_Handler
.weak EXTI4_IRQHandler
.thumb_set EXTI4_IRQHandler,Default_Handler
.weak DMA1_Channel1_IRQHandler
.thumb_set DMA1_Channel1_IRQHandler,Default_Handler
.weak DMA1_Channel2_IRQHandler
.thumb_set DMA1_Channel2_IRQHandler,Default_Handler
.weak DMA1_Channel3_IRQHandler
.thumb_set DMA1_Channel3_IRQHandler,Default_Handler
.weak DMA1_Channel4_IRQHandler
.thumb_set DMA1_Channel4_IRQHandler,Default_Handler
.weak DMA1_Channel5_IRQHandler
.thumb_set DMA1_Channel5_IRQHandler,Default_Handler
.weak DMA1_Channel6_IRQHandler
.thumb_set DMA1_Channel6_IRQHandler,Default_Handler
.weak DMA1_Channel7_IRQHandler
.thumb_set DMA1_Channel7_IRQHandler,Default_Handler
.weak ADC1_2_IRQHandler
.thumb_set ADC1_2_IRQHandler,Default_Handler
.weak USB_HP_CAN1_TX_IRQHandler
.thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
.weak USB_LP_CAN1_RX0_IRQHandler
.thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
.weak CAN1_RX1_IRQHandler
.thumb_set CAN1_RX1_IRQHandler,Default_Handler
.weak CAN1_SCE_IRQHandler
.thumb_set CAN1_SCE_IRQHandler,Default_Handler
.weak EXTI9_5_IRQHandler
.thumb_set EXTI9_5_IRQHandler,Default_Handler
.weak TIM1_BRK_IRQHandler
.thumb_set TIM1_BRK_IRQHandler,Default_Handler
.weak TIM1_UP_IRQHandler
.thumb_set TIM1_UP_IRQHandler,Default_Handler
.weak TIM1_TRG_COM_IRQHandler
.thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler
.weak TIM1_CC_IRQHandler
.thumb_set TIM1_CC_IRQHandler,Default_Handler
.weak TIM2_IRQHandler
.thumb_set TIM2_IRQHandler,Default_Handler
.weak TIM3_IRQHandler
.thumb_set TIM3_IRQHandler,Default_Handler
.weak TIM4_IRQHandler
.thumb_set TIM4_IRQHandler,Default_Handler
.weak I2C1_EV_IRQHandler
.thumb_set I2C1_EV_IRQHandler,Default_Handler
.weak I2C1_ER_IRQHandler
.thumb_set I2C1_ER_IRQHandler,Default_Handler
.weak I2C2_EV_IRQHandler
.thumb_set I2C2_EV_IRQHandler,Default_Handler
.weak I2C2_ER_IRQHandler
.thumb_set I2C2_ER_IRQHandler,Default_Handler
.weak SPI1_IRQHandler
.thumb_set SPI1_IRQHandler,Default_Handler
.weak SPI2_IRQHandler
.thumb_set SPI2_IRQHandler,Default_Handler
.weak USART1_IRQHandler
.thumb_set USART1_IRQHandler,Default_Handler
.weak USART2_IRQHandler
.thumb_set USART2_IRQHandler,Default_Handler
.weak USART3_IRQHandler
.thumb_set USART3_IRQHandler,Default_Handler
.weak EXTI15_10_IRQHandler
.thumb_set EXTI15_10_IRQHandler,Default_Handler
.weak RTCAlarm_IRQHandler
.thumb_set RTCAlarm_IRQHandler,Default_Handler
.weak USBWakeUp_IRQHandler
.thumb_set USBWakeUp_IRQHandler,Default_Handler
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/

77
stm32f10x_conf.h Normal file
View File

@@ -0,0 +1,77 @@
/**
******************************************************************************
* @file FSMC/SRAM/stm32f10x_conf.h
* @author MCD Application Team
* @version V3.3.0
* @date 04/16/2010
* @brief Library configuration file.
******************************************************************************
* @copy
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_CONF_H
#define __STM32F10x_CONF_H
/* Includes ------------------------------------------------------------------*/
/* Uncomment the line below to enable peripheral header file inclusion */
/* #include "stm32f10x_adc.h" */
/* #include "stm32f10x_bkp.h" */
/* #include "stm32f10x_can.h" */
/* #include "stm32f10x_cec.h" */
/* #include "stm32f10x_crc.h" */
/* #include "stm32f10x_dac.h" */
/* #include "stm32f10x_dbgmcu.h" */
/* #include "stm32f10x_dma.h" */
//#include "stm32f10x_exti.h"
#include "stm32f10x_flash.h"
#include "stm32f10x_fsmc.h"
#include "stm32f10x_gpio.h"
/* #include "stm32f10x_i2c.h" */
/* #include "stm32f10x_iwdg.h" */
/* #include "stm32f10x_pwr.h" */
#include "stm32f10x_rcc.h"
/* #include "stm32f10x_rtc.h" */
/* #include "stm32f10x_sdio.h" */
#include "stm32f10x_spi.h"
#include "stm32f10x_tim.h"
#include "stm32f10x_usart.h"
/* #include "stm32f10x_wwdg.h" */
#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Uncomment the line below to expanse the "assert_param" macro in the
Standard Peripheral Library drivers code */
#define USE_FULL_ASSERT 1
/* Exported macro ------------------------------------------------------------*/
#ifdef USE_FULL_ASSERT
/**
* @brief The assert_param macro is used for function's parameters check.
* @param expr: If expr is false, it calls assert_failed function
* which reports the name of the source file and the source
* line number of the call that failed.
* If expr is true, it returns no value.
* @retval None
*/
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
// void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
#endif /* __STM32F10x_CONF_H */
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/

184
stm32f10x_it.c Normal file
View File

@@ -0,0 +1,184 @@
/**
******************************************************************************
* @file FSMC/SRAM/stm32f10x_it.c
* @author MCD Application Team
* @version V3.3.0
* @date 04/16/2010
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @copy
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_it.h"
#include "Common.h"
#include "Board.h"
#include "Command.h"
#include "libdso150.h"
//#include "FSM.h"
/** @addtogroup STM32F10x_StdPeriph_Examples
* @{
*/
/** @addtogroup FSMC_SRAM
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M3 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSV_Handler exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
// Key scan
if(--TimerKeyScan == 0) {
TimerKeyScan = 2; // 2ms
BitSet(Keypad.Flags, (1 << KF_DoKeyScan));
}
// General timer
if(GTimer) {
GTimer--;
if(GTimer == 0) {
GTimeout = 1;
}
}
}
void USART1_IRQHandler(void)
{
}
/******************************************************************************/
/* STM32F10x Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f10x_xx.s). */
/******************************************************************************/
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/

49
stm32f10x_it.h Normal file
View File

@@ -0,0 +1,49 @@
/**
******************************************************************************
* @file FSMC/SRAM/stm32f10x_it.h
* @author MCD Application Team
* @version V3.3.0
* @date 04/16/2010
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @copy
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_IT_H
#define __STM32F10x_IT_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void TIM3_IRQHandler(void);
void USART1_IRQHandler(void);
#endif /* __STM32F10x_IT_H */
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/