Difference between revisions of "Rad1o"
(→mkfirmware.pl) |
(→mkfirmware.pl) |
||
Line 25: | Line 25: | ||
} | } | ||
− | Right after calling | + | Right after calling the <code>generated_init()</code> function from main, <code>nick_init()</code> is called again, defeating the purpose of doing it automatically. Apparently having these undocumented features causes predictable outcomes ;-). |
− | Also, some other init functions are called explicitly from the main function, like <code>inputInit</code>, <code>fsInit</code>, <code>lcdInit</code>, ... | + | Also, some other init functions are called explicitly from the main function, like <code>inputInit()</code>, <code>fsInit()</code>, <code>lcdInit()</code>, ... |
Some init functions will probably need to be called in a specific order, a functionality that the generated_init code does not provide (it does sort them alphabetically, but using that is probably wicked and unmaintainable). | Some init functions will probably need to be called in a specific order, a functionality that the generated_init code does not provide (it does sort them alphabetically, but using that is probably wicked and unmaintainable). |
Revision as of 22:40, 6 September 2015
Links
Firmware
Written down thoughts
Looking at the f1rmware of the rad1o, I must say that it is either poorly documented or I fail to find the documentation. I looked at the different apps, esp. rfapp, to see how to make one myself.
There is a menu system that has an auto-generated part, in the form of the file main.gen. How it works is undocumented afaik, so I need to look at the implementation. (see the mkfirmware.pl section)
mkfirmware.pl
(This is the result of reading the code, and may contain errors).
This script parses source code to extract init, tick and menu entries.
If a function is preceded with //#MENU parentmenu? menu
, the next function definition will be used as a handler function for that menu entry (parentmenu is optional).
Any function starting with the name init_
or tick_
will be remembered and called from a function generated_init
or generated_tick
, respectively.
One example where this is used is campapp/rgb_leds
. The function generated_init
in main.gen contains these lines:
inline void generated_init(void) { init_nick(); init_rgbLeds(); }
Right after calling the generated_init()
function from main, nick_init()
is called again, defeating the purpose of doing it automatically. Apparently having these undocumented features causes predictable outcomes ;-).
Also, some other init functions are called explicitly from the main function, like inputInit()
, fsInit()
, lcdInit()
, ...
Some init functions will probably need to be called in a specific order, a functionality that the generated_init code does not provide (it does sort them alphabetically, but using that is probably wicked and unmaintainable).