Open atctwo opened 4 years ago
my concern is how to support different devices that do one function, but have different libraries. for example, one board may have an mpu6050 and another may have an icm-20948. apps would be written to support a library for one device, but probably not both. there isn't really an easy way to provide a device agnostic peripheral library (like drivers on an operating system)
for now, all of the system functions and global variables have been moved to a dedicated namespace called watch2 (in commits e23c7825933bb45143cc10d945009c2260a3aef0 and 4c1a18fd564713461ae7b4715f465ce7659611d1). they can be accessed thusly: watch2::switchState(2);
instead of doing the inheritance thing, i could adapt an approach like the ones that libretro and littlevgl take. the watch2 system could be platform agnostic, and there could be ports that provide platform specific stuff. instead of creating a subclass that inherits from the watch2 thing, the main file could include the watch2 system, and pass functions to it (more like littlevgl)
at the moment, all the system functions are defined in one file (watch2.ino), and things are specifically targeted to the esp32. at some point, the functions should be moved to a class system. for example:![image](https://user-images.githubusercontent.com/22917824/71528764-67a37000-28d9-11ea-8565-4b6b56624ac4.png)
switchState()
when compiling the watch firmware, the user can change what class is instantiated (by changing one line of code) to target different systems