Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/Modulino.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ class Module : public Printable {
operator bool() {
return address < 0x7F;
}
uint8_t getAddress() const {
return address;
}
static HardwareI2C* getWire() {
return Modulino._wire;
}
Expand Down Expand Up @@ -526,14 +529,16 @@ extern ModulinoColor WHITE;

class ModulinoMovement : public Module {
public:
ModulinoMovement(ModulinoHubPort* hubPort = nullptr)
: Module(0xFF, "MOVEMENT", hubPort) {}
ModulinoMovement(uint8_t address = 0x6A, ModulinoHubPort* hubPort = nullptr)
: Module(address, "MOVEMENT", hubPort) {}
ModulinoMovement(ModulinoHubPort* hubPort, uint8_t address = 0x6A)
: Module(address, "MOVEMENT", hubPort) {}
bool begin() {
if (hubPort != nullptr) {
hubPort->select();
}
if (_imu == nullptr) {
_imu = new LSM6DSOXClass(*((TwoWire*)getWire()), 0x6A);
_imu = new LSM6DSOXClass(*((TwoWire*)getWire()), getAddress());
}
initialized = _imu->begin();
__increaseI2CPriority();
Expand Down
Loading