mcci-catena / Catena-Arduino-Platform

Arduino platform library for MCCI Catena IoT Systems
MIT License
12 stars 11 forks source link

Remove conditional compile from CatenaStm32L0 #99

Closed terrillmoore closed 5 years ago

terrillmoore commented 5 years ago

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

https://github.com/mcci-catena/Catena-Arduino-Platform/blob/04e0d4610bd51fb12038ac7e6fa36ea7cc66dd61/src/CatenaStm32L0.h#L72-L77

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 commented 5 years ago

All changes are merged.