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

ADC mutex #66

Open
ginge opened this issue Sep 3, 2018 · 1 comment
Open

ADC mutex #66

ginge opened this issue Sep 3, 2018 · 1 comment

Comments

@ginge
Copy link
Collaborator

ginge commented Sep 3, 2018

In snowy, the ADC is used for multiple things, including ambient light and battery level.

There is no mutex protecting this resource. In fact, there is no common agreed way to talk to ADC

  • Create mutex in suitable rebbleos file.
  • implement in ambient and power

Additionally:

  • ADC init has a "commoninit" for the ADCs as a whole. currently this init lives in snowy_power.c. It should be in main.c/adc.c
  • ADC init is done by each hw thread. ambient will init with it's preferred setting, then adc will do the same. Change both drivers to do a full re-init of their preferred settings and sample times before using the module.
  • re-enable ambient
@AnotherOctopus
Copy link
Contributor

So how I interpreted implementing this is bulbing out _adc_init and _read_adc into a new file called snowy_adc.c/h in the snowy directory, and then implementing a new file called adc.c in rcore, which handles the calls to the hardware and handles the mutex. Then an ambient.c and an implemented battery.c make calls to the adc.c for hardware access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants