New logging and more (#446)
- `TT_LOG_*` macros are replaced by `Logger` via `#include<Tactility/Logger.h>` - Changed default timezone to Europe/Amsterdam - Fix for logic bug in unPhone hardware - Fix for init/deinit in DRV2605 driver - Other fixes - Removed optimization that broke unPhone (disabled the moving of heap-related functions to flash)
This commit is contained in:
committed by
GitHub
parent
719f7bcece
commit
f620255c41
@@ -1,16 +1,33 @@
|
||||
#include "Drv2605.h"
|
||||
|
||||
#include <Tactility/Check.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
static const auto LOGGER = tt::Logger("DRV2605");
|
||||
|
||||
Drv2605::Drv2605(i2c_port_t port, bool autoPlayStartupBuzz) : I2cDevice(port, ADDRESS), autoPlayStartupBuzz(autoPlayStartupBuzz) {
|
||||
if (!init()) {
|
||||
LOGGER.error("Failed to initialize DRV2605");
|
||||
tt_crash();
|
||||
}
|
||||
|
||||
if (autoPlayStartupBuzz) {
|
||||
setWaveFormForBuzz();
|
||||
startPlayback();
|
||||
}
|
||||
}
|
||||
|
||||
bool Drv2605::init() {
|
||||
uint8_t status;
|
||||
if (!readRegister8(static_cast<uint8_t>(Register::Status), status)) {
|
||||
TT_LOG_E(TAG, "Failed to read status");
|
||||
LOGGER.error("Failed to read status");
|
||||
return false;
|
||||
}
|
||||
status >>= 5;
|
||||
|
||||
ChipId chip_id = static_cast<ChipId>(status);
|
||||
if (chip_id != ChipId::DRV2604 && chip_id != ChipId::DRV2604L && chip_id != ChipId::DRV2605 && chip_id != ChipId::DRV2605L) {
|
||||
TT_LOG_E(TAG, "Unknown chip id %02x", chip_id);
|
||||
LOGGER.error("Unknown chip id {:02x}", static_cast<uint8_t>(chip_id));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,7 +42,7 @@ bool Drv2605::init() {
|
||||
|
||||
uint8_t feedback;
|
||||
if (!readRegister(Register::Feedback, feedback)) {
|
||||
TT_LOG_E(TAG, "Failed to read feedback");
|
||||
LOGGER.error("Failed to read feedback");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user