fxos8701cq + fxas21002c: add support for I2C

This commit is contained in:
rfu
2020-05-04 09:49:23 +02:00
committed by Beat Küng
parent 09180b9d4a
commit 90c3819df5
32 changed files with 1193 additions and 297 deletions
+3 -2
View File
@@ -86,7 +86,7 @@ protected:
* @param The register to read.
* @return The value that was read.
*/
virtual uint8_t read_reg(unsigned reg); // This needs to be declared as virtual, because the
uint8_t read_reg(unsigned reg) override;
virtual uint16_t read_reg16(unsigned reg);
/**
@@ -94,6 +94,7 @@ protected:
*
* @param reg The register to write.
* @param value The new value to write.
* @return OK on success, negative errno otherwise.
*/
void write_reg(unsigned reg, uint8_t value);
int write_reg(unsigned reg, uint8_t value) override;
};
+2 -2
View File
@@ -130,7 +130,7 @@ BMI088::read_reg16(unsigned reg)
return (uint16_t)(cmd[1] << 8) | cmd[2];
}
void
int
BMI088::write_reg(unsigned reg, uint8_t value)
{
uint8_t cmd[2];
@@ -138,7 +138,7 @@ BMI088::write_reg(unsigned reg, uint8_t value)
cmd[0] = reg | DIR_WRITE;
cmd[1] = value;
transfer(cmd, nullptr, sizeof(cmd));
return transfer(cmd, nullptr, sizeof(cmd));
}
int