8 years, 11 months ago.

Initializing pins of BLENano at runtime: Base class for DigitalIn, DigitalOut and AnalogIn needed

Hi,

I'm creating a firmware for BLENano with the mbed online IDE. I want to initialize pins of BLENano at runtime (I would like to configure them via Bluetooth), so I need a way to create an array or a map of generic pins. I searched within the mbed library for a superclass of DigitalIn, DigitalOut and AnalogIn classes and I found they all inherit from the same class "Base" (https://developer.mbed.org/users/screamer/code/mbed/file/aff670d0d510/Base.h).

This was great, so I immediately tried using the Base superclass in my code, to define my map

std::map <int, Base> initializedPins;

but unfortunately compilation failed with this message: - Identifier "Base" is undefined "std::map <int, Base> okPins

Even this simple assignment mbed::Base mytrimmer = new AnalogIn(P0_4);

fails with same message: - Identifier "Base" is undefined "Base mytrimmer = new AnalogIn(P0_4);

This should be a possible command in c++, isn't it? What am I missing? Why isn't the Base class defined?

Do you know of other ways to define an array of generic pins, which I can then initialize with different pin classes?

Thanks in advance, Giovanni.

Be the first to answer this question.