Код: Выделить всё
typedef enum {
p0 = 0,
p1 = 1,
p2 = 2,
p3 = 3,
p4 = 4,
p5 = 5,
p6 = 6,
...
} PinName;
Код: Выделить всё
enum class : PinName {
PIN_SD_MOSI = p0,
PIN_SD_MISO = p4,
PIN_SD_SCK = p2,
PIN_SD_CSN = p6,
};
Код: Выделить всё
error: underlying type 'PinName' of '' must be an integral type
enum class : PinName {
^
Код: Выделить всё
error: no matching function for call to 'foo(, )'
foo(PIN_SD_MISO, PIN_SD_MOSI);
^
Есть ли у кого-нибудь идеи хорошего решения, прежде чем я сдамся и использую const PinName PIN_SD_MISO = p2;?
Подробнее здесь: https://stackoverflow.com/questions/343 ... o-a-c-enum
Мобильная версия