mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 11:44:31 +00:00
WM8731: Return bool from reset() and low-level write()s.
This commit is contained in:
parent
da4bee6cc6
commit
f6e1e78e8a
@ -87,21 +87,21 @@ void WM8731::init() {
|
||||
headphone_mute();
|
||||
}
|
||||
|
||||
void WM8731::reset() {
|
||||
write(0x0f, 0);
|
||||
bool WM8731::reset() {
|
||||
return write(0x0f, 0);
|
||||
}
|
||||
|
||||
void WM8731::write(const Register reg) {
|
||||
write(toUType(reg), map.w[toUType(reg)]);
|
||||
bool WM8731::write(const Register reg) {
|
||||
return write(toUType(reg), map.w[toUType(reg)]);
|
||||
}
|
||||
|
||||
void WM8731::write(const address_t reg_address, const reg_t value) {
|
||||
bool WM8731::write(const address_t reg_address, const reg_t value) {
|
||||
const uint16_t word = (reg_address << 9) | value;
|
||||
const std::array<uint8_t, 2> values {
|
||||
static_cast<uint8_t>(word >> 8),
|
||||
static_cast<uint8_t>(word & 0xff),
|
||||
};
|
||||
bus.transmit(bus_address, values.data(), values.size());
|
||||
return bus.transmit(bus_address, values.data(), values.size());
|
||||
}
|
||||
|
||||
reg_t WM8731::read(const address_t reg_address) {
|
||||
|
@ -290,7 +290,7 @@ public:
|
||||
|
||||
void init();
|
||||
|
||||
void reset();
|
||||
bool reset();
|
||||
|
||||
void set_line_in_volume(const volume_t volume) {
|
||||
const auto normalized = line_in_gain_range.normalize(volume);
|
||||
@ -338,9 +338,9 @@ private:
|
||||
const I2C::address_t bus_address;
|
||||
RegisterMap map { default_after_reset };
|
||||
|
||||
void write(const Register reg);
|
||||
bool write(const Register reg);
|
||||
|
||||
void write(const address_t reg_address, const reg_t value);
|
||||
bool write(const address_t reg_address, const reg_t value);
|
||||
|
||||
void write(const LeftLineIn value);
|
||||
void write(const RightLineIn value);
|
||||
|
Loading…
Reference in New Issue
Block a user