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

Remove conditional compile from CatenaStm32L0 #99

Closed
terrillmoore opened this issue Nov 24, 2018 · 1 comment
Closed

Remove conditional compile from CatenaStm32L0 #99

terrillmoore opened this issue Nov 24, 2018 · 1 comment
Assignees

Comments

@terrillmoore
Copy link
Member

We should never have #if within a class definition. But we have:

#if defined(ARDUINO_MCCI_CATENA_4801) || defined(ARDUINO_CATENA_4801)
APIN_VBAT_SENSE = A0,
#else
APIN_VBAT_SENSE = A3,
APIN_VBUS_SENSE = A4,
#endif

The pin definitions have to go either in the terminal board class, or in a common class for feathers and another for non-feathers (of which the 4801 is the first instance). If we want a common methods to get the battery and usb voltage, we need virtual methods in CatenaStm32L0.h, and then override them with concrete methods at the level where the appropriate definitions are in scope. So: in CatenaStmm32L0.h, we want:

virtual float ReadVbat(void) const = 0;
virtual float ReadVbus(void) const = 0;

For the 4801, we'll need to provide a dummy method that returns 0.0 for ReadVbus().

@chwon64
Copy link
Collaborator

chwon64 commented Nov 28, 2018

All changes are merged.

@chwon64 chwon64 closed this as completed Nov 28, 2018
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