kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Renamed configure to reset, moved TCA_IO to own file, fixed destructor issue with switched module
rodzic
fae28fe140
commit
fb7742a8c8
|
@ -12,6 +12,10 @@ namespace pimoroni {
|
|||
direction(out, pull_up, pull_down);
|
||||
};
|
||||
|
||||
IO::~IO() {
|
||||
gpio_deinit(pin);
|
||||
}
|
||||
|
||||
bool IO::direction() {
|
||||
return gpio_is_dir_out(pin);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace pimoroni {
|
|||
public:
|
||||
IO(uint pin);
|
||||
IO(uint pin, bool out, bool pull_up = false, bool pull_down = false);
|
||||
~IO();
|
||||
bool direction();
|
||||
void direction(bool out, bool pull_up = false, bool pull_down = false);
|
||||
void to_output(bool val);
|
||||
|
|
|
@ -2,7 +2,9 @@ set(DRIVER_NAME tca9555)
|
|||
add_library(${DRIVER_NAME} INTERFACE)
|
||||
|
||||
target_sources(${DRIVER_NAME} INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/${DRIVER_NAME}.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/${DRIVER_NAME}.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/tca_io.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
#include "tca_io.hpp"
|
||||
|
||||
namespace pimoroni {
|
||||
TCA_IO::TCA_IO(TCA pin, TCAAccessor& accessor) :
|
||||
pin(pin),
|
||||
accessor(accessor) {
|
||||
to_input();
|
||||
};
|
||||
|
||||
TCA_IO::TCA_IO(TCA pin, TCAAccessor& accessor, bool out) :
|
||||
pin(pin),
|
||||
accessor(accessor) {
|
||||
direction(out);
|
||||
};
|
||||
|
||||
TCA_IO::~TCA_IO() {
|
||||
to_input();
|
||||
}
|
||||
|
||||
bool TCA_IO::direction() {
|
||||
return accessor.get_slow_config(pin);
|
||||
}
|
||||
|
||||
void TCA_IO::direction(bool out) {
|
||||
accessor.set_slow_config(pin, out);
|
||||
}
|
||||
|
||||
void TCA_IO::to_output(bool val) {
|
||||
value(val);
|
||||
direction(GPIO_OUT);
|
||||
}
|
||||
|
||||
void TCA_IO::to_input() {
|
||||
direction(GPIO_IN);
|
||||
value(false);
|
||||
}
|
||||
|
||||
bool TCA_IO::value() {
|
||||
if(direction()) {
|
||||
return accessor.get_slow_output(pin);
|
||||
}
|
||||
else {
|
||||
return accessor.get_slow_input(pin);
|
||||
}
|
||||
}
|
||||
|
||||
void TCA_IO::value(bool val) {
|
||||
accessor.set_slow_output(pin, val);
|
||||
}
|
||||
|
||||
};
|
|
@ -0,0 +1,40 @@
|
|||
#pragma once
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
namespace pimoroni {
|
||||
|
||||
struct TCA {
|
||||
uint CHIP;
|
||||
uint GPIO;
|
||||
};
|
||||
|
||||
class TCAAccessor {
|
||||
public:
|
||||
virtual bool get_slow_input(TCA gpio) = 0;
|
||||
virtual bool get_slow_output(TCA gpio) = 0;
|
||||
virtual bool get_slow_config(TCA gpio) = 0;
|
||||
virtual bool get_slow_polarity(TCA gpio) = 0;
|
||||
|
||||
virtual void set_slow_output(TCA gpio, bool value) = 0;
|
||||
virtual void set_slow_config(TCA gpio, bool output) = 0;
|
||||
virtual void set_slow_polarity(TCA gpio, bool polarity) = 0;
|
||||
};
|
||||
|
||||
class TCA_IO {
|
||||
public:
|
||||
TCA_IO(TCA pin, TCAAccessor& accessor);
|
||||
TCA_IO(TCA pin, TCAAccessor& accessor, bool out);
|
||||
~TCA_IO();
|
||||
bool direction();
|
||||
void direction(bool out);
|
||||
void to_output(bool val);
|
||||
void to_input();
|
||||
bool value();
|
||||
void value(bool val);
|
||||
private:
|
||||
TCA pin;
|
||||
TCAAccessor& accessor;
|
||||
};
|
||||
|
||||
}
|
|
@ -74,11 +74,11 @@ namespace pimoroni {
|
|||
std::string message;
|
||||
|
||||
public:
|
||||
VerificationError(std::string msg) : message(msg) {
|
||||
VerificationError(std::string msg) : message("VerificationError: " + msg) {
|
||||
}
|
||||
|
||||
virtual const char* what() const noexcept {
|
||||
return ("VerificationError: " + message).c_str();
|
||||
return message.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace pimoroni {
|
|||
}
|
||||
|
||||
AudioAmpModule::~AudioAmpModule() {
|
||||
logging.debug("[AudioAmpModule] Destructor\n");
|
||||
}
|
||||
|
||||
std::string AudioAmpModule::name() {
|
||||
|
@ -41,7 +42,8 @@ namespace pimoroni {
|
|||
YukonModule::initialise(slot, accessor);
|
||||
}
|
||||
|
||||
void AudioAmpModule::configure() {
|
||||
void AudioAmpModule::reset() {
|
||||
logging.debug("[AudioAmpModule] Resetting\n");
|
||||
CHECK_INITIALISED
|
||||
slow_sda->to_output(true);
|
||||
slow_scl->to_output(true);
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace pimoroni {
|
|||
public:
|
||||
virtual std::string name();
|
||||
virtual void initialise(const SLOT& slot, SlotAccessor& accessor);
|
||||
virtual void configure();
|
||||
virtual void reset();
|
||||
|
||||
//--------------------------------------------------
|
||||
void enable();
|
||||
|
|
|
@ -24,9 +24,11 @@ namespace pimoroni {
|
|||
}
|
||||
|
||||
BenchPowerModule::~BenchPowerModule() {
|
||||
logging.debug("[BenchPowerModule] Destructor Started\n");
|
||||
delete(voltage_pwm);
|
||||
delete(power_en);
|
||||
delete(power_good);
|
||||
logging.debug("[BenchPowerModule] Destructor Done\n");
|
||||
}
|
||||
|
||||
std::string BenchPowerModule::name() {
|
||||
|
@ -45,7 +47,8 @@ namespace pimoroni {
|
|||
YukonModule::initialise(slot, accessor);
|
||||
}
|
||||
|
||||
void BenchPowerModule::configure() {
|
||||
void BenchPowerModule::reset() {
|
||||
logging.debug("[BenchPowerModule] Resetting\n");
|
||||
CHECK_INITIALISED
|
||||
// Calculate a suitable pwm wrap period for this frequency
|
||||
uint32_t period; uint32_t div256;
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace pimoroni {
|
|||
public:
|
||||
virtual std::string name();
|
||||
virtual void initialise(const SLOT& slot, SlotAccessor& accessor);
|
||||
virtual void configure();
|
||||
virtual void reset();
|
||||
|
||||
//--------------------------------------------------
|
||||
void enable();
|
||||
|
|
|
@ -24,10 +24,12 @@ namespace pimoroni {
|
|||
}
|
||||
|
||||
BigMotorModule::~BigMotorModule() {
|
||||
logging.debug("[BigMotorModule] Destructor Started\n");
|
||||
delete(motor);
|
||||
delete(encoder);
|
||||
delete(motor_en);
|
||||
delete(motor_nfault);
|
||||
logging.debug("[BigMotorModule] Destructor Done\n");
|
||||
}
|
||||
|
||||
std::string BigMotorModule::name() {
|
||||
|
@ -46,7 +48,8 @@ namespace pimoroni {
|
|||
YukonModule::initialise(slot, accessor);
|
||||
}
|
||||
|
||||
void BigMotorModule::configure() {
|
||||
void BigMotorModule::reset() {
|
||||
logging.debug("[DualSwitchedModule] Resetting\n");
|
||||
CHECK_INITIALISED
|
||||
motor->disable_all();
|
||||
motor->decay_mode(0, SLOW_DECAY);
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace pimoroni {
|
|||
public:
|
||||
virtual std::string name();
|
||||
virtual void initialise(const SLOT& slot, SlotAccessor& accessor);
|
||||
virtual void configure();
|
||||
virtual void reset();
|
||||
|
||||
//--------------------------------------------------
|
||||
void enable();
|
||||
|
|
|
@ -1,54 +1,7 @@
|
|||
#include "common.hpp"
|
||||
#include "../logging.hpp"
|
||||
|
||||
namespace pimoroni {
|
||||
TCA_IO::TCA_IO(TCA pin, TCAAccessor& accessor) :
|
||||
pin(pin),
|
||||
accessor(accessor) {
|
||||
to_input();
|
||||
};
|
||||
|
||||
TCA_IO::TCA_IO(TCA pin, TCAAccessor& accessor, bool out) :
|
||||
pin(pin),
|
||||
accessor(accessor) {
|
||||
direction(out);
|
||||
};
|
||||
|
||||
//TCA_IO::~TCA_IO() {
|
||||
// to_input();
|
||||
//}
|
||||
|
||||
bool TCA_IO::direction() {
|
||||
return accessor.get_slow_config(pin);
|
||||
}
|
||||
|
||||
void TCA_IO::direction(bool out) {
|
||||
accessor.set_slow_config(pin, out);
|
||||
}
|
||||
|
||||
void TCA_IO::to_output(bool val) {
|
||||
value(val);
|
||||
direction(GPIO_OUT);
|
||||
}
|
||||
|
||||
void TCA_IO::to_input() {
|
||||
direction(GPIO_IN);
|
||||
value(false);
|
||||
}
|
||||
|
||||
bool TCA_IO::value() {
|
||||
if(direction()) {
|
||||
return accessor.get_slow_output(pin);
|
||||
}
|
||||
else {
|
||||
return accessor.get_slow_input(pin);
|
||||
}
|
||||
}
|
||||
|
||||
void TCA_IO::value(bool val) {
|
||||
accessor.set_slow_output(pin, val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
YukonModule::YukonModule() :
|
||||
slot(),
|
||||
|
@ -61,14 +14,31 @@ namespace pimoroni {
|
|||
//self.__monitor_action_callback = None
|
||||
}
|
||||
|
||||
YukonModule::~YukonModule() {
|
||||
logging.debug("[YukonModule] Destructor Started\n");
|
||||
if(is_initialised()) {
|
||||
// Modules make use of IO and TCA_IO classes for pin control then the below changes are redundant
|
||||
gpio_deinit(slot.FAST1);
|
||||
gpio_deinit(slot.FAST2);
|
||||
gpio_deinit(slot.FAST3);
|
||||
gpio_deinit(slot.FAST4);
|
||||
__accessor->set_slow_config(slot.SLOW1, false);
|
||||
__accessor->set_slow_config(slot.SLOW2, false);
|
||||
__accessor->set_slow_config(slot.SLOW3, false);
|
||||
|
||||
__accessor->deregister(*this);
|
||||
}
|
||||
logging.debug("[YukonModule] Destructor Done\n");
|
||||
}
|
||||
|
||||
void YukonModule::initialise(const SLOT& slot, SlotAccessor& accessor) {
|
||||
// Record the slot we are in, and the ADC functions to call
|
||||
this->slot = slot;
|
||||
this->__accessor = &accessor;
|
||||
initialised = true;
|
||||
|
||||
// Configure any objects created during initialisation
|
||||
configure();
|
||||
// Put any objects created during initialisation into a known state
|
||||
reset();
|
||||
}
|
||||
|
||||
bool YukonModule::is_initialised() {
|
||||
|
@ -76,6 +46,7 @@ namespace pimoroni {
|
|||
}
|
||||
|
||||
void YukonModule::deregister() {
|
||||
logging.debug("[YukonModule] Deregistering\n");
|
||||
initialised = false;
|
||||
__accessor = nullptr;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include <typeindex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "tca_io.hpp"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdexcept>
|
||||
namespace pimoroni {
|
||||
#include <string>
|
||||
#include <typeindex>
|
||||
#include <vector>
|
||||
|
||||
struct TCA {
|
||||
uint CHIP;
|
||||
uint GPIO;
|
||||
};
|
||||
namespace pimoroni {
|
||||
|
||||
struct SLOT {
|
||||
uint ID;
|
||||
|
@ -43,41 +41,16 @@ namespace pimoroni {
|
|||
HIGH = true
|
||||
};
|
||||
|
||||
class TCAAccessor {
|
||||
public:
|
||||
virtual bool get_slow_input(TCA gpio) = 0;
|
||||
virtual bool get_slow_output(TCA gpio) = 0;
|
||||
virtual bool get_slow_config(TCA gpio) = 0;
|
||||
virtual bool get_slow_polarity(TCA gpio) = 0;
|
||||
|
||||
virtual void set_slow_output(TCA gpio, bool value) = 0;
|
||||
virtual void set_slow_config(TCA gpio, bool output) = 0;
|
||||
virtual void set_slow_polarity(TCA gpio, bool polarity) = 0;
|
||||
};
|
||||
class YukonModule; // Forward declaration
|
||||
|
||||
class SlotAccessor : public TCAAccessor {
|
||||
public:
|
||||
virtual float read_slot_adc1(SLOT slot) = 0;
|
||||
virtual float read_slot_adc2(SLOT slot) = 0;
|
||||
};
|
||||
|
||||
class TCA_IO {
|
||||
public:
|
||||
TCA_IO(TCA pin, TCAAccessor& accessor);
|
||||
TCA_IO(TCA pin, TCAAccessor& accessor, bool out);
|
||||
//~TCA_IO();
|
||||
bool direction();
|
||||
void direction(bool out);
|
||||
void to_output(bool val);
|
||||
void to_input();
|
||||
bool value();
|
||||
void value(bool val);
|
||||
private:
|
||||
TCA pin;
|
||||
TCAAccessor& accessor;
|
||||
virtual void deregister(YukonModule& module) = 0;
|
||||
};
|
||||
|
||||
|
||||
typedef bool (&func_is_module)(uint, bool, bool, bool);
|
||||
|
||||
struct ModuleType {
|
||||
|
@ -112,6 +85,7 @@ namespace pimoroni {
|
|||
//--------------------------------------------------
|
||||
public:
|
||||
YukonModule();
|
||||
virtual ~YukonModule();
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
|
@ -122,11 +96,11 @@ namespace pimoroni {
|
|||
virtual std::string name() = 0;
|
||||
|
||||
// Initialise the module once it has been assigned a slot
|
||||
// Any overriding function must call this at its end
|
||||
// Any overriding function must call this parent function at its end
|
||||
virtual void initialise(const SLOT& slot, SlotAccessor& accessor);
|
||||
|
||||
// Override this to configure the module once initialised, or return it to a default state (called from initialise)
|
||||
virtual void configure() {}
|
||||
// Override this to put the module into a known state
|
||||
virtual void reset() {}
|
||||
|
||||
//--------------------------------------------------
|
||||
bool is_initialised();
|
||||
|
|
|
@ -25,10 +25,12 @@ namespace pimoroni {
|
|||
}
|
||||
|
||||
DualMotorModule::~DualMotorModule() {
|
||||
logging.debug("[DualMotorModule] Destructor Started\n");
|
||||
delete(motors);
|
||||
delete(motors_decay);
|
||||
delete(motors_toff);
|
||||
delete(motors_en);
|
||||
logging.debug("[DualMotorModule] Destructor Done\n");
|
||||
}
|
||||
|
||||
std::string DualMotorModule::name() {
|
||||
|
@ -48,7 +50,8 @@ namespace pimoroni {
|
|||
YukonModule::initialise(slot, accessor);
|
||||
}
|
||||
|
||||
void DualMotorModule::configure() {
|
||||
void DualMotorModule::reset() {
|
||||
logging.debug("[DualMotorModule] Resetting\n");
|
||||
CHECK_INITIALISED
|
||||
motors->disable_all();
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace pimoroni {
|
|||
public:
|
||||
virtual std::string name();
|
||||
virtual void initialise(const SLOT& slot, SlotAccessor& accessor);
|
||||
virtual void configure();
|
||||
virtual void reset();
|
||||
|
||||
//--------------------------------------------------
|
||||
void enable();
|
||||
|
|
|
@ -18,17 +18,23 @@ namespace pimoroni {
|
|||
halt_on_not_pgood(halt_on_not_pgood),
|
||||
last_pgood1(false),
|
||||
last_pgood2(false) {
|
||||
//sw_output(nullptr, nullptr), TODO
|
||||
//sw_enable(nullptr, nullptr) {
|
||||
sw_output[0] = nullptr;
|
||||
sw_output[1] = nullptr;
|
||||
sw_enable[0] = nullptr;
|
||||
sw_enable[1] = nullptr;
|
||||
power_good[0] = nullptr;
|
||||
power_good[1] = nullptr;
|
||||
}
|
||||
|
||||
DualSwitchedModule::~DualSwitchedModule() {
|
||||
logging.debug("[DualSwitchedModule] Destructor Started\n");
|
||||
delete(sw_output[0]);
|
||||
delete(sw_output[1]);
|
||||
delete(sw_enable[0]);
|
||||
delete(sw_enable[1]);
|
||||
delete(power_good[0]);
|
||||
delete(power_good[1]);
|
||||
logging.debug("[DualSwitchedModule] Destructor Done\n");
|
||||
}
|
||||
|
||||
std::string DualSwitchedModule::name() {
|
||||
|
@ -39,8 +45,8 @@ namespace pimoroni {
|
|||
// Create the switch and power control pin objects
|
||||
sw_output[0] = new IO(slot.FAST1);
|
||||
sw_output[1] = new IO(slot.FAST3);
|
||||
sw_enable[0] = new IO(slot.FAST1);
|
||||
sw_enable[1] = new IO(slot.FAST3);
|
||||
sw_enable[0] = new IO(slot.FAST2);
|
||||
sw_enable[1] = new IO(slot.FAST4);
|
||||
power_good[0] = new TCA_IO(slot.SLOW1, accessor);
|
||||
power_good[1] = new TCA_IO(slot.SLOW3, accessor);
|
||||
|
||||
|
@ -48,7 +54,8 @@ namespace pimoroni {
|
|||
YukonModule::initialise(slot, accessor);
|
||||
}
|
||||
|
||||
void DualSwitchedModule::configure() {
|
||||
void DualSwitchedModule::reset() {
|
||||
logging.debug("[DualSwitchedModule] Resetting\n");
|
||||
CHECK_INITIALISED
|
||||
sw_output[0]->to_output(false);
|
||||
sw_output[1]->to_output(false);
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace pimoroni {
|
|||
public:
|
||||
virtual std::string name();
|
||||
virtual void initialise(const SLOT& slot, SlotAccessor& accessor);
|
||||
virtual void configure();
|
||||
virtual void reset();
|
||||
|
||||
//--------------------------------------------------
|
||||
void enable(uint output);
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace pimoroni {
|
|||
}
|
||||
|
||||
LEDStripModule::~LEDStripModule() {
|
||||
logging.debug("[LEDStripModule] Destructor Started\n");
|
||||
if(strip_type == NEOPIXEL) {
|
||||
if(ws_pixels != nullptr) {
|
||||
ws_pixels->stop();
|
||||
|
@ -39,6 +40,7 @@ namespace pimoroni {
|
|||
}
|
||||
delete(power_good);
|
||||
delete(power_en);
|
||||
logging.debug("[LEDStripModule] Destructor Done\n");
|
||||
}
|
||||
|
||||
std::string LEDStripModule::name() {
|
||||
|
@ -77,7 +79,8 @@ namespace pimoroni {
|
|||
YukonModule::initialise(slot, accessor);
|
||||
}
|
||||
|
||||
void LEDStripModule::configure() {
|
||||
void LEDStripModule::reset() {
|
||||
logging.debug("[LEDStripModule] Resetting\n");
|
||||
CHECK_INITIALISED
|
||||
power_en->to_output(false);
|
||||
power_good->to_input(true, false);
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace pimoroni {
|
|||
public:
|
||||
virtual std::string name();
|
||||
virtual void initialise(const SLOT& slot, SlotAccessor& accessor);
|
||||
virtual void configure();
|
||||
virtual void reset();
|
||||
|
||||
//--------------------------------------------------
|
||||
void enable();
|
||||
|
|
|
@ -17,9 +17,6 @@ namespace pimoroni {
|
|||
YukonModule() {
|
||||
}
|
||||
|
||||
ProtoPotModule::~ProtoPotModule() {
|
||||
}
|
||||
|
||||
std::string ProtoPotModule::name() {
|
||||
return ProtoPotModule::NAME;
|
||||
}
|
||||
|
@ -48,9 +45,6 @@ namespace pimoroni {
|
|||
const_c = (pu * pu) + (2 * pu) + 1;
|
||||
}
|
||||
|
||||
ProtoPotModule2::~ProtoPotModule2() {
|
||||
}
|
||||
|
||||
std::string ProtoPotModule2::name() {
|
||||
return ProtoPotModule2::NAME;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace pimoroni {
|
|||
//--------------------------------------------------
|
||||
public:
|
||||
ProtoPotModule();
|
||||
virtual ~ProtoPotModule();
|
||||
virtual ~ProtoPotModule() {}
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
|
@ -69,7 +69,7 @@ namespace pimoroni {
|
|||
//--------------------------------------------------
|
||||
public:
|
||||
ProtoPotModule2(float pot_resistance);
|
||||
virtual ~ProtoPotModule2();
|
||||
virtual ~ProtoPotModule2() {}
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "quad_servo_direct.hpp"
|
||||
#include "../../logging.hpp"
|
||||
|
||||
namespace pimoroni {
|
||||
|
||||
|
@ -19,7 +20,9 @@ namespace pimoroni {
|
|||
}
|
||||
|
||||
QuadServoDirectModule::~QuadServoDirectModule() {
|
||||
logging.debug("[QuadServoDirectModule] Destructor Started\n");
|
||||
delete(servos);
|
||||
logging.debug("[QuadServoDirectModule] Destructor Done\n");
|
||||
}
|
||||
|
||||
std::string QuadServoDirectModule::name() {
|
||||
|
@ -34,7 +37,9 @@ namespace pimoroni {
|
|||
YukonModule::initialise(slot, accessor);
|
||||
}
|
||||
|
||||
void QuadServoDirectModule::configure() {
|
||||
void QuadServoDirectModule::reset() {
|
||||
logging.debug("[QuadServoDirectModule] Resetting\n");
|
||||
CHECK_INITIALISED
|
||||
servos->disable_all();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace pimoroni {
|
|||
public:
|
||||
virtual std::string name();
|
||||
virtual void initialise(const SLOT& slot, SlotAccessor& accessor);
|
||||
virtual void configure();
|
||||
virtual void reset();
|
||||
|
||||
//--------------------------------------------------
|
||||
float read_adc1();
|
||||
|
|
|
@ -22,9 +22,11 @@ namespace pimoroni {
|
|||
}
|
||||
|
||||
QuadServoRegModule::~QuadServoRegModule() {
|
||||
logging.debug("[QuadServoRegModule] Destructor Started\n");
|
||||
delete(servos);
|
||||
delete(power_en);
|
||||
delete(power_good);
|
||||
logging.debug("[QuadServoRegModule] Destructor Done\n");
|
||||
}
|
||||
|
||||
std::string QuadServoRegModule::name() {
|
||||
|
@ -43,7 +45,8 @@ namespace pimoroni {
|
|||
YukonModule::initialise(slot, accessor);
|
||||
}
|
||||
|
||||
void QuadServoRegModule::configure() {
|
||||
void QuadServoRegModule::reset() {
|
||||
logging.debug("[QuadServoRegModule] Resetting\n");
|
||||
CHECK_INITIALISED
|
||||
servos->disable_all();
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
public:
|
||||
virtual std::string name();
|
||||
virtual void initialise(const SLOT& slot, SlotAccessor& accessor);
|
||||
virtual void configure();
|
||||
virtual void reset();
|
||||
|
||||
//--------------------------------------------------
|
||||
void enable();
|
||||
|
|
Ładowanie…
Reference in New Issue