Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move system functions to watch2 class #5

Open
atctwo opened this issue Dec 27, 2019 · 2 comments
Open

move system functions to watch2 class #5

atctwo opened this issue Dec 27, 2019 · 2 comments
Labels
long term todo major updates that will be done at some point, but will break everything os pertaining to the watch 2 system
Milestone

Comments

@atctwo
Copy link
Owner

atctwo commented Dec 27, 2019

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

  • the base class (watch2) contains non-hw specific methods and method stubs for hw specific stuff
    • contains things like the state machine and switchState()
    • method prototypes for hardware specific functions
  • the base class is inherited by hardware specific classes (eg: w2_esp32) which override hardware specific methods
    • these classes could be specific to microcontrollers (eg: esp32) or boards (eg: esp32 devkit)

when compiling the watch firmware, the user can change what class is instantiated (by changing one line of code) to target different systems

@atctwo atctwo added the long term todo major updates that will be done at some point, but will break everything label Dec 27, 2019
@atctwo
Copy link
Owner Author

atctwo commented Jan 2, 2020

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 e23c782 and 4c1a18f). they can be accessed thusly: watch2::switchState(2);

@atctwo
Copy link
Owner Author

atctwo commented Jan 16, 2020

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)

@atctwo atctwo added the os pertaining to the watch 2 system label May 2, 2020
@atctwo atctwo added this to the long term milestone May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
long term todo major updates that will be done at some point, but will break everything os pertaining to the watch 2 system
Projects
None yet
Development

No branches or pull requests

1 participant