Skip to content

Remove conditional compile from CatenaStm32L0 #99

Closed
@terrillmoore

Description

@terrillmoore

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().

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions