Split modules out into separate files, and implemented verification

feature/yukon
ZodiusInfuser 2023-08-02 23:42:11 +01:00
rodzic 193211b772
commit 2fd696790b
24 zmienionych plików z 561 dodań i 174 usunięć

Wyświetl plik

@ -28,27 +28,30 @@ int main() {
y.change_logging(3);
// Initialise the servo
y.init();
while (!tud_cdc_connected()) {
sleep_ms(100);
}
sleep_ms(1000);
printf("tud_cdc_connected()\n");
y.find_slots_with_module(LEDStripModule::info());
y.find_slots_with_module(DualSwitchedModule::info());
y.find_slots_with_module(BenchPowerModule::info());
//y.detect_module(Yukon::SLOT1);
//y.detect_module(Yukon::SLOT2);
//y.detect_module(Yukon::SLOT3);
//y.detect_module(Yukon::SLOT4);
//y.detect_module(Yukon::SLOT5);
//y.detect_module(Yukon::SLOT6);
try {
// Initialise the servo
y.init();
while (!tud_cdc_connected()) {
sleep_ms(100);
}
sleep_ms(1000);
printf("tud_cdc_connected()\n");
LEDStripModule strip;
//y.find_slots_with_module(LEDStripModule::info());
//y.find_slots_with_module(DualSwitchedModule::info());
//y.find_slots_with_module(BenchPowerModule::info());
y.register_with_slot(&strip, 2);
y.initialise_modules();
//y.detect_module(Yukon::SLOT1);
//y.detect_module(Yukon::SLOT2);
//y.detect_module(Yukon::SLOT3);
//y.detect_module(Yukon::SLOT4);
//y.detect_module(Yukon::SLOT5);
//y.detect_module(Yukon::SLOT6);
y.enable_main_output();
while(!y.is_boot_pressed()) {

Wyświetl plik

@ -0,0 +1,27 @@
#pragma once
#include "modules/common.hpp"
#include "modules/led_strip/led_strip.hpp"
#include "modules/quad_servo/quad_servo_direct.hpp"
#include "modules/quad_servo/quad_servo_reg.hpp"
#include "modules/big_motor/big_motor.hpp"
#include "modules/dual_motor/dual_motor.hpp"
#include "modules/dual_switched/dual_switched.hpp"
#include "modules/bench_power/bench_power.hpp"
//#include "modules/audio_amp/audio_amp.hpp"
#include "modules/proto/proto.hpp"
namespace pimoroni {
const ModuleInfo KNOWN_MODULES[] = {
LEDStripModule::info(),
QuadServoDirectModule::info(),
QuadServoRegModule::info(),
BigMotorModule::info(),
DualMotorModule::info(),
DualSwitchedModule::info(),
BenchPowerModule::info(),
//AudioAmpModule::info(),
ProtoPotModule::info(),
};
}

Wyświetl plik

@ -0,0 +1,13 @@
#include "audio_amp.hpp"
namespace pimoroni {
// | ADC1 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |
// |-------|-------|-------|-------|----------------------|-----------------------------|
// | FLOAT | 0 | 1 | 1 | [Proposed] Audio Amp | |
bool AudioAmpModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
// return adc_level == ADC_FLOAT && slow1 == LOW && slow2 == HIGH && slow3 == HIGH;
return adc_level == ADC_FLOAT && slow1 == HIGH && slow2 == HIGH && slow3 == HIGH;
}
}

Wyświetl plik

@ -0,0 +1,24 @@
#pragma once
#include "../common.hpp"
namespace pimoroni {
class AudioAmpModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Audio Amp";
}
virtual std::string instance_name() {
return AudioAmpModule::name();
}
INFO_FUNC(AudioAmpModule)
};
}

Wyświetl plik

@ -0,0 +1,14 @@
#include "bench_power.hpp"
namespace pimoroni {
// | ADC1 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |
// |-------|-------|-------|-------|----------------------|-----------------------------|
// | LOW | 1 | 0 | 0 | Bench Power | |
// | FLOAT | 1 | 0 | 0 | Bench Power | When V+ is discharging |
// FLOAT address included as may not be able to rely on the ADC level being low
bool BenchPowerModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return slow1 == HIGH && slow2 == LOW && slow3 == LOW;
}
}

Wyświetl plik

@ -0,0 +1,24 @@
#pragma once
#include "../common.hpp"
namespace pimoroni {
class BenchPowerModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Bench Power";
}
virtual std::string instance_name() {
return BenchPowerModule::name();
}
INFO_FUNC(BenchPowerModule)
};
}

Wyświetl plik

@ -0,0 +1,13 @@
#include "big_motor.hpp"
namespace pimoroni {
// | ADC1 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |
// |-------|-------|-------|-------|----------------------|-----------------------------|
// | LOW | 0 | 0 | 1 | Big Motor | Not in fault |
// | LOW | 0 | 1 | 1 | Big Motor | In fault |
bool BigMotorModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return adc_level == ADC_LOW && slow1 == LOW && slow3 == HIGH;
}
}

Wyświetl plik

@ -0,0 +1,24 @@
#pragma once
#include "../common.hpp"
namespace pimoroni {
class BigMotorModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Big Motor";
}
virtual std::string instance_name() {
return BigMotorModule::name();
}
INFO_FUNC(BigMotorModule)
};
}

Wyświetl plik

@ -0,0 +1,49 @@
#pragma once
#include "pico/stdlib.h"
#include <typeindex>
#include <string>
namespace pimoroni {
enum ADC {
ADC_LOW = 0,
ADC_HIGH = 1,
ADC_FLOAT = 2,
ADC_ANY = 3
};
enum IO {
LOW = false,
HIGH = true
};
class YukonModule {
public:
//static const std::string NAME = "Unnamed";
static constexpr float ROOM_TEMP = 273.15f + 25.0f;
static constexpr float RESISTOR_AT_ROOM_TEMP = 10000.0f;
static constexpr float BETA = 3435;
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return false;
}
virtual std::string instance_name() = 0;
};
typedef bool (*module_callback)(uint, bool, bool, bool) ;
struct ModuleInfo {
std::type_index type;
std::string name;
module_callback is_module;
};
#define INFO_FUNC(module_name) \
static ModuleInfo info() { \
return { typeid(module_name), module_name::name(), &module_name::is_module }; \
}
}

Wyświetl plik

@ -0,0 +1,13 @@
#include "dual_motor.hpp"
namespace pimoroni {
// | ADC1 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |
// |-------|-------|-------|-------|----------------------|-----------------------------|
// | HIGH | 1 | 1 | 1 | Dual Motor | |
// | HIGH | 0 | 1 | 1 | Dual Motor | |
bool DualMotorModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return adc_level == ADC_HIGH && slow2 == HIGH && slow3 == HIGH;
}
}

Wyświetl plik

@ -0,0 +1,24 @@
#pragma once
#include "../common.hpp"
namespace pimoroni {
class DualMotorModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Dual Motor";
}
virtual std::string instance_name() {
return DualMotorModule::name();
}
INFO_FUNC(DualMotorModule)
};
}

Wyświetl plik

@ -0,0 +1,12 @@
#include "dual_switched.hpp"
namespace pimoroni {
// | ADC1 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |
// |-------|-------|-------|-------|----------------------|-----------------------------|
// | FLOAT | 1 | 0 | 1 | Dual Switched Output | |
bool DualSwitchedModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return adc_level == ADC_FLOAT && slow1 == HIGH && slow2 == LOW && slow3 == HIGH;
}
}

Wyświetl plik

@ -0,0 +1,24 @@
#pragma once
#include "../common.hpp"
namespace pimoroni {
class DualSwitchedModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Dual Switched Output";
}
virtual std::string instance_name() {
return DualSwitchedModule::name();
}
INFO_FUNC(DualSwitchedModule)
};
}

Wyświetl plik

@ -0,0 +1,12 @@
#include "led_strip.hpp"
namespace pimoroni {
// | ADC1 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |
// |-------|-------|-------|-------|----------------------|-----------------------------|
// | LOW | 1 | 1 | 1 | LED Strip | |
bool LEDStripModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return adc_level == ADC_LOW && slow1 == HIGH && slow2 == HIGH && slow3 == HIGH;
}
}

Wyświetl plik

@ -0,0 +1,24 @@
#pragma once
#include "../common.hpp"
namespace pimoroni {
class LEDStripModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "LED Strip";
}
virtual std::string instance_name() {
return LEDStripModule::name() + " (NeoPixel)";
}
INFO_FUNC(LEDStripModule)
};
}

Wyświetl plik

@ -0,0 +1,18 @@
#include "proto.hpp"
namespace pimoroni {
// | ADC1 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |
// |-------|-------|-------|-------|----------------------|-----------------------------|
// | LOW | 1 | 1 | 0 | Proto Potentiometer | Pot in low position |
// | FLOAT | 1 | 1 | 0 | Proto Potentiometer | Pot in middle position |
// | HIGH | 1 | 1 | 0 | Proto Potentiometer | Pot in high position |
bool ProtoPotModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return slow1 == HIGH && slow2 == HIGH && slow3 == LOW;
}
bool ProtoPotModule2::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return slow1 == HIGH && slow2 == HIGH && slow3 == LOW;
}
}

Wyświetl plik

@ -0,0 +1,41 @@
#pragma once
#include "../common.hpp"
namespace pimoroni {
class ProtoPotModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Proto Potentiometer";
}
virtual std::string instance_name() {
return ProtoPotModule::name();
}
INFO_FUNC(ProtoPotModule)
};
class ProtoPotModule2 : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Proto Potentiometer 2";
}
virtual std::string instance_name() {
return ProtoPotModule2::name();
}
INFO_FUNC(ProtoPotModule2)
};
}

Wyświetl plik

@ -0,0 +1,14 @@
#include "quad_servo_direct.hpp"
namespace pimoroni {
// | ADC1 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |
// |-------|-------|-------|-------|----------------------|-----------------------------|
// | LOW | 0 | 0 | 0 | Quad Servo Direct | A1 input near 0V |
// | FLOAT | 0 | 0 | 0 | Quad Servo Direct | A1 input between 0 and 3.3V |
// | HIGH | 0 | 0 | 0 | Quad Servo Direct | A1 input near 3.3V |
bool QuadServoDirectModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return slow1 == LOW && slow2 == LOW && slow3 == LOW;
}
}

Wyświetl plik

@ -0,0 +1,24 @@
#pragma once
#include "../common.hpp"
namespace pimoroni {
class QuadServoDirectModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Quad Servo Direct";
}
virtual std::string instance_name() {
return QuadServoDirectModule::name();
}
INFO_FUNC(QuadServoDirectModule)
};
}

Wyświetl plik

@ -0,0 +1,12 @@
#include "quad_servo_reg.hpp"
namespace pimoroni {
// | ADC1 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |
// |-------|-------|-------|-------|----------------------|-----------------------------|
// | FLOAT | 0 | 1 | 0 | Quad Servo Regulated | |
bool QuadServoRegModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return adc_level == ADC_FLOAT && slow1 == LOW && slow2 == HIGH && slow3 == LOW;
}
}

Wyświetl plik

@ -0,0 +1,24 @@
#pragma once
#include "../common.hpp"
namespace pimoroni {
class QuadServoRegModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Quad Servo Regulated";
}
virtual std::string instance_name() {
return QuadServoRegModule::name();
}
INFO_FUNC(QuadServoRegModule)
};
}

Wyświetl plik

@ -2,6 +2,15 @@ add_library(yukon INTERFACE)
target_sources(yukon INTERFACE
${CMAKE_CURRENT_LIST_DIR}/yukon.cpp
${CMAKE_CURRENT_LIST_DIR}/modules/led_strip/led_strip.cpp
${CMAKE_CURRENT_LIST_DIR}/modules/quad_servo/quad_servo_direct.cpp
${CMAKE_CURRENT_LIST_DIR}/modules/quad_servo/quad_servo_reg.cpp
${CMAKE_CURRENT_LIST_DIR}/modules/big_motor/big_motor.cpp
${CMAKE_CURRENT_LIST_DIR}/modules/dual_motor/dual_motor.cpp
${CMAKE_CURRENT_LIST_DIR}/modules/dual_switched/dual_switched.cpp
${CMAKE_CURRENT_LIST_DIR}/modules/bench_power/bench_power.cpp
${CMAKE_CURRENT_LIST_DIR}/modules/audio_amp/audio_amp.cpp
${CMAKE_CURRENT_LIST_DIR}/modules/proto/proto.cpp
)
target_include_directories(yukon INTERFACE ${CMAKE_CURRENT_LIST_DIR})

Wyświetl plik

@ -91,33 +91,6 @@ namespace pimoroni {
10, // ADC2_TEMP_ADDR (0b1010)
};
bool LEDStripModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return adc_level == ADC_LOW && slow1 == HIGH && slow2 == HIGH && slow3 == HIGH;
}
bool DualMotorModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return adc_level == ADC_HIGH && slow2 == HIGH && slow3 == HIGH;
}
bool DualSwitchedModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return adc_level == ADC_FLOAT && slow1 == HIGH && slow2 == LOW && slow3 == HIGH;
}
bool BenchPowerModule::is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return slow1 == HIGH && slow2 == LOW && slow3 == LOW;
}
//module_callback Yukon::KNOWN_MODULES[] = {&LEDStripModule::is_module, &DualMotorModule::is_module};
//const std::type_index Yukon::KNOWN_MODULES[] = {typeid(LEDStripModule), typeid(DualMotorModule)};
const ModuleInfo Yukon::KNOWN_MODULES[] = {
LEDStripModule::info(),
DualMotorModule::info(),
DualSwitchedModule::info(),
BenchPowerModule::info()
};
const TCA Yukon::MAIN_EN = {0, 6};
const TCA Yukon::USER_SW = {0, 7};
@ -304,20 +277,12 @@ namespace pimoroni {
return slot_ids;
}
void Yukon::register_with_slot(Module* module, uint slot_id) {
if(is_main_output()) {
throw std::runtime_error("Cannot register modules with slots whilst the main output is active\n");
}
void Yukon::register_with_slot(YukonModule* module, uint slot_id) {
SLOT slot = __check_slot(slot_id);
if(slot_assignments[slot] == nullptr)
slot_assignments[slot] = module;
else
throw std::invalid_argument("The selected slot is already populated\n");
register_with_slot(module, slot);
}
void Yukon::register_with_slot(Module* module, SLOT slot) {
void Yukon::register_with_slot(YukonModule* module, SLOT slot) {
if(is_main_output()) {
throw std::runtime_error("Cannot register modules with slots whilst the main output is active\n");
}
@ -331,17 +296,8 @@ namespace pimoroni {
}
void Yukon::deregister_slot(uint slot_id) {
if(is_main_output()) {
throw std::runtime_error("Cannot deregister module slots whilst the main output is active\n");
}
SLOT slot = __check_slot(slot_id);
Module* module = slot_assignments[slot];
if(module != nullptr) {
//module.deregister() //TODO
slot_assignments[slot] = nullptr;
}
deregister_slot(slot);
}
void Yukon::deregister_slot(SLOT slot) {
@ -351,7 +307,7 @@ namespace pimoroni {
slot = __check_slot(slot);
Module* module = slot_assignments[slot];
YukonModule* module = slot_assignments[slot];
if(module != nullptr) {
//module.deregister() //TODO
slot_assignments[slot] = nullptr;
@ -429,12 +385,100 @@ namespace pimoroni {
void __expand_slot_list(std::vector<SLOT> slot_list) {
}
void __verify_modules(bool allow_unregistered, bool allow_undetected, bool allow_discrepencies, bool allow_no_modules) {
void Yukon::__verify_modules(bool allow_unregistered, bool allow_undetected, bool allow_discrepencies, bool allow_no_modules) {
//TODO Take the allowed parameters and expand them into slot lists that are easier to compare against
//allow_unregistered = self.__expand_slot_list(allow_unregistered)
//allow_undetected = self.__expand_slot_list(allow_undetected)
//allow_discrepencies = self.__expand_slot_list(allow_discrepencies)
bool raise_unregistered = false;
bool raise_undetected = false;
bool raise_discrepency = false;
uint8_t unregistered_slots = 0;
for(auto it = slot_assignments.begin(); it != slot_assignments.end(); it++) {
SLOT slot = it->first;
YukonModule* module = it->second;
logging.info("[Slot" + std::to_string(slot.ID) + "] ");
const ModuleInfo* detected = __detect_module(slot);
if(detected == nullptr) {
if(module != nullptr) {
logging.info("No module detected! Expected a '" + module->instance_name() + "' module.\n");
if(!allow_undetected) {//if slot not in allow_undetected:
raise_undetected = true;
}
}
else {
logging.info("Module slot is empty.\n");
unregistered_slots += 1;
}
}
else {
if(module != nullptr) {
if(std::type_index(typeid(*module)) == detected->type) {
logging.info("'" + module->instance_name() + "' module detected and registered.\n");
}
else {
logging.info("Module discrepency! Expected a '" + module->instance_name() + "}' module, but detected a '" + detected->name + "' module.\n");
if(!allow_discrepencies) { //if slot not in allow_discrepencies:
raise_discrepency = true;
}
}
}
else {
logging.info("'" + detected->name + "' module detected but not registered.\n");
if(!allow_unregistered) { //if slot not in allow_unregistered:
raise_unregistered = true;
}
unregistered_slots += 1;
}
}
}
if(!allow_no_modules && unregistered_slots == NUM_SLOTS) {
throw VerificationError("No modules have been registered with Yukon. At least one module needs to be registered to enable the output\n");
}
if(raise_discrepency) {
throw VerificationError("Detected a different combination of modules than what was registered with Yukon. Please check the modules attached to your board and the program you are running.\n");
}
if(raise_undetected) {
throw VerificationError("Some or all modules registered with Yukon have not been detected. Please check that the modules are correctly attached to your board or disable this warning.");
}
if(raise_unregistered) {
throw VerificationError("Detected modules that have not been registered with Yukon, which could behave unexpectedly when connected to power. Please remove these modules or disable this warning.");
}
logging.info("\n"); // New line
}
void initialise_modules(bool allow_unregistered = false, bool allow_undetected = false, bool allow_discrepencies = false, bool allow_no_modules = false) {
void Yukon::initialise_modules(bool allow_unregistered, bool allow_undetected, bool allow_discrepencies, bool allow_no_modules) {
if(is_main_output()) {
throw std::runtime_error("Cannot verify modules whilst the main output is active\n");
}
logging.info("> Verifying modules\n");
__verify_modules(allow_unregistered, allow_undetected, allow_discrepencies, allow_no_modules);
logging.info("> Initialising modules\n");
for(auto it = slot_assignments.begin(); it != slot_assignments.end(); it++) {
SLOT slot = it->first;
YukonModule* module = it->second;
if(module != nullptr) {
logging.info("[Slot" + std::to_string(slot.ID) + " '" + module->instance_name() + "'] Initialising ... ");
//TODO module.initialise(slot, self.read_slot_adc1, self.read_slot_adc2)
logging.info("done\n");
}
}
logging.info("\n"); // New line
}
bool Yukon::is_pressed(uint button) {

Wyświetl plik

@ -6,101 +6,9 @@
#include "errors.hpp"
#include <list>
#include <iostream>
#include <typeindex>
#include "modules.hpp"
namespace pimoroni {
class YukonModule {
public:
//static const std::string NAME = "Unnamed";
static constexpr float ROOM_TEMP = 273.15f + 25.0f;
static constexpr float RESISTOR_AT_ROOM_TEMP = 10000.0f;
static constexpr float BETA = 3435;
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3) {
return false;
}
};
enum ADC {
ADC_LOW = 0,
ADC_HIGH = 1,
ADC_FLOAT = 2,
ADC_ANY = 3
};
enum IO {
LOW = false,
HIGH = true
};
typedef bool (*module_callback)(uint, bool, bool, bool) ;
struct ModuleInfo {
std::type_index type;
std::string name;
module_callback is_module;
};
#define INFO_FUNC(module_name) \
static ModuleInfo info() { \
return { typeid(module_name), module_name::name(), &module_name::is_module }; \
}
class LEDStripModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "LED Strip";
}
INFO_FUNC(LEDStripModule)
};
class DualMotorModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Dual Motor";
}
INFO_FUNC(DualMotorModule)
};
class DualSwitchedModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Dual Switched Output";
}
INFO_FUNC(DualSwitchedModule)
};
class BenchPowerModule : public YukonModule {
public:
//static const std::string NAME = "Unnamed";
static bool is_module(uint adc_level, bool slow1, bool slow2, bool slow3);
static std::string name() {
return "Bench Power";
}
INFO_FUNC(BenchPowerModule)
};
struct TCA {
uint CHIP;
uint GPIO;
@ -124,11 +32,6 @@ namespace pimoroni {
}
};
class Module {
uint type;
};
enum LoggingLevel {
LOG_NONE = 0,
@ -224,8 +127,6 @@ namespace pimoroni {
static constexpr float DETECTION_ADC_LOW = 0.1f;
static constexpr float DETECTION_ADC_HIGH = 3.2f;
//static module_callback KNOWN_MODULES[];
static const ModuleInfo KNOWN_MODULES[];
private:
I2C i2c;
TCA9555 tca0;
@ -237,7 +138,7 @@ namespace pimoroni {
float current_limit;
float temperature_limit;
logger logging;
std::map<SLOT, Module*> slot_assignments;
std::map<SLOT, YukonModule*> slot_assignments;
void* monitor_action_callback;
struct Readings {
@ -291,8 +192,8 @@ namespace pimoroni {
std::vector<uint> find_slots_with_module(ModuleInfo module_type);
void register_with_slot(Module* module, uint slot_id);
void register_with_slot(Module* module, SLOT slot);
void register_with_slot(YukonModule* module, uint slot_id);
void register_with_slot(YukonModule* module, SLOT slot);
void deregister_slot(uint slot_id);
void deregister_slot(SLOT slot);