drivers/lis2dh12: add I2C mode#8419
Conversation
|
the initialization order for the i2c mode was broken (see #8446), fixed now. |
1d4de88 to
f54e0cc
Compare
908500d to
ee7592a
Compare
|
All dependencies are merged, ready for review and testing. |
MrKevinWeiss
left a comment
There was a problem hiding this comment.
Tested with thingy52.
I had to add PSEUDOMODULES += lis2dh12_i2c to the makefiles/pseudomodules.inc.mk but after that everything worked.
I took me a little while to figure out how to flash and term in but I think #11341 helps with that.
Tested with the test/driver_lis2dh12 and with examples/default, both work and have expected values.
Maybe also rebase and fix the conflicts.
Maybe you want to have a look at #10793 ? |
|
@haukepetersen mind to rebase? I happen to have a board with this very sensor here. |
|
|
||
| #ifndef MODULE_LIS2DH12_SPI | ||
| /* in the current state, the I2C driver expects the bus to be acquired | ||
| * before the init function is called, so we have to switch order */ |
| static int _init_bus(const lis2dh12_t *dev) | ||
| { | ||
| /* for I2C, we initialize the bus in master mode */ | ||
| if (i2c_init_master(BUS, BUS_CLK) != BUS_OK) { |
There was a problem hiding this comment.
This function does not exist anymore.
|
Because we need that driver anyway, I have taken the liberty to rebase this to master and adopt it to the changes in the i2c API. See #12290 for the updated version. |
Contribution description
The PR adapts the
lis2dh12driver to work also in I2C mode, which is the used configuration on thethingy52.Issues/PRs references
rebased on cpu/nrf52: optimized I2C driver #8385thingy52