1 //////////////////////////////////////////////////////////////////////////////
\r
3 // Filename: 113-13801.c
\r
7 // Author: Liu, Zemin
\r
10 //-----------------------------------------------------------------------------
\r
12 // Target: STM32F103C8
\r
13 // Tool chain: CodeSourcery G++
\r
15 // Descriptions: Main firmware for low-cost DSO kit
\r
16 // PCB: 109-13800-00C
\r
17 //-----------------------------------------------------------------------------
\r
20 //-----------------------------------------------------------------------------
\r
22 //-----------------------------------------------------------------------------
\r
23 // Revision History:
\r
26 ///////////////////////////////////////////////////////////////////////////////
\r
28 #include "stm32f10x.h"
\r
29 #include "stm32f10x_conf.h"
\r
34 #include "Command.h"
\r
37 #include "libdso138.h"
\r
48 // Check SW4 pin. If the pin is read LOW enter TEST mode
\r
49 tmp1 = (PB_Port & PB_Bits) | ~PB_Bits;
\r
50 if(!BitTest(tmp1, 0x8000)) {
\r
55 /* Unlock the Flash Program Erase controller */
\r
64 uputs((U8 *)"Uart1 Ok\n\r", USART1);
\r
75 PutsGenic(24, 120, (U8 *)"FW: 113-13801-037", clWhite, tmp1, &ASC8X16);
\r
76 PutsGenic(24, 140, (U8 *)LibVersion, clWhite, tmp1, &ASC8X16);
\r
77 PutsGenic(24, 180, (U8 *)"Booting...", clWhite, tmp1, &ASC8X16);
\r
82 NVIC_Configuration();
\r
86 // Uncomment the following line to disable display of scope panel
\r
87 // NoScopePanel = 1;
\r
90 // ============================
\r
91 // Note: Keep this section in the main loop for proper capture engine running
\r
92 // even scope panel display is disabled.
\r
96 tmp1 = GetDsoStatus();
\r
98 // --------------------------------------------------------
\r
99 if(BitTest(tmp1, DSO_NormalDisplay)) {
\r
101 // Add your diaplay codes here
\r
105 // --------------------------------------------------------
\r
112 // ============================
\r
115 if(BitTest(Keypad.Flags, (1 << KF_DoKeyScan))) {
\r
116 BitClr(Keypad.Flags, (1 << KF_DoKeyScan));
\r
121 if(Keypad.KeyCode) {
\r
122 // Process key code
\r
124 Keypad.KeyCode = 0;
\r
128 if(BitTest(tmp1, DSO_CaptureDone)) {
\r
129 UpdateDisp(Disp_Trace);
\r
130 tmp2 = GetTimebase();
\r
131 if(tmp2 <= TB_1ms) {
\r
132 // Start next capture
\r
136 // Lower capture rate
\r
143 if(BitTest(tmp1, DSO_Rolling)) {
\r