mirror of
https://github.com/semerad/gt3b.git
synced 2026-03-25 19:37:02 +01:00
092bd3b3aca1c8d219a2da248ef0eff4ab6fa130
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:
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
calc.c,h - CALC task, calculate PPM values
Only last 3 files 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 :-)
Description
Languages
C
98.2%
Batchfile
1.1%
Shell
0.5%
Makefile
0.2%