Files
gt3b/README.internal

99 lines
2.8 KiB
Plaintext

This is alternative firmware for model radio FlySky FS-TH9X 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
- wakeups task CALC during SYNC signal
timer_interrupt
- timer2 overflow
- every 5ms
- increments time from start
- count LCD blink time and wakeups task LCD
- handles buzzer
- wakeups task INPUT
- 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 of ADC values and key matrix
- is waked up from timer every 5ms
CALC
- is computing values for each servo and sync signal
- is waked up from ppm interrupt during sync signal generation
- also nedded to wakeup after changing number of PPM channels in MENU
MENU
- is main program handling keys, menus, lcd
- is waked up from timer when menu_delay expired
- is waked up from INPUT task when
- buttons state changed
- MENU task wanted ADC values (for calibrate) or battery voltage
- 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 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_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