With the two-way comms on those it can actually read out the controller ID and then execute the correct code.
It's a hard balance with modules though - you don't want loads of modules from the point of view of maintenance, but at the same time you don't want to be using up precious RAM with code that you're never using.
I guess one option is to actually generate multiple files using some kind of preprocessor. In fact with minification and the closure compiler it'd be possible to do it just with IF statements...
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Interestingly, Espruino already has a similar 'do anything' implementation for parallel-interface LCDs, that's used on the 'HY' boards: https://github.com/espruino/Espruino/blob/master/libs/graphics/lcd_fsmc.c#L403
With the two-way comms on those it can actually read out the controller ID and then execute the correct code.
It's a hard balance with modules though - you don't want loads of modules from the point of view of maintenance, but at the same time you don't want to be using up precious RAM with code that you're never using.
I guess one option is to actually generate multiple files using some kind of preprocessor. In fact with minification and the closure compiler it'd be possible to do it just with IF statements...