-
Notifications
You must be signed in to change notification settings - Fork 75
/
README.internal
103 lines (73 loc) · 2.97 KB
/
README.internal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
This is alternative firmware for model radio FlySky FS-GT3B/C and clones.
This software comes with absolutely NO-WARRANTY.
It is programmed with using possibilities of hardware, using timers,
interrupts and cooperative multitasking (this is because it is much
simplier to program it then).
It was written for Cosmic C compiler and will need changes to support
other compilers.
There are 2 interrupts used:
ppm_interrupt
- timer3 update interrupt
- sets values for next servo channel to timer
timer_interrupt
- timer2 overflow
- every 1ms
read ADC values
increment ppm_timer
start new PPM frame with servo pulses
wakeups CALC task few ms before start of new PPM frame
- every 5ms
- increments time from start
- count LCD blink time and wakeups task LCD
- handles buzzer
- wakeups task INPUT
- wakeups task MENU when it wants ADC values (calibrate, ...),
this is done every 40ms
- handles task MENU delay and wakeups this task
There are 4 tasks:
LCD
- is doing actual write to LCD controller
- is waked up by lcd_update(), lcd_clear()
- is waked up from timer to do automatic blinking
INPUT
- is doing reading key matrix and some ADC checks
- is waked up from timer every 5ms
CALC
- is computing values for each servo and sync signal
- is waked up from timer few ms before new PPM frame starts
MENU
- is main program handling keys, menus, lcd
- is waked up from timer when menu_delay expired or when ADC values needed
- is waked up from INPUT task when
- buttons state changed
- status of battery low changed
Files:
stm8.h - macros for STM8 handling
gt3b.h - global common values
vector.c,h - table of interrupt vectors
task.c,h - cooperative multitasking
buzzer.c,h - buzzer
eeprom.c,h - eeprom read/write
timer.c,h - timer 1ms, 5ms
input.c,h - INPUT task, reading ADC and keys
lcd.c,h - LCD task, writing to LCD controller, blinking
ppm.c,h - generating of PPM signal
main.c,h - initialize all and call MENU task
config.c,h - global and model configuration
menu.c,h - MENU task, handling keys, menus, lcd
menu_common.c - common menu routines
menu_global.c - global config menus are here
menu_popup.c - handling of trims/keys, showing value
menu_service.c- calibrate and key-test menus
menu_key.c - settings mapping of keys
menu_mix.c - setting of mixes (4WS, DIG, ...)
calc.c,h - CALC task, calculate PPM values
Only last 3 files (more menus counted as one) are used to implement what
means what button and how it changes signal for servos. Other files are
sort of libraries (or it can be viewed as a little operating system :-)
To compile it at windows:
- cd to directory with sources
- set variable TOOLSET to path to Cosmic C compiler (set TOOLSET=...)
- if more than 3 channels needed, set variable CHANNELS to number 3..8
- run compile.bat
- file gt3b.s19 is newly compiled firmware ready to load to radio