You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Kevin Townsend <ke...@adafruit.com.INVALID> on 2018/07/08 21:42:20 UTC
I2C Device Simulation
I pushed out a simple PR to add I2C stubs for the simulator
(https://github.com/apache/mynewt-core/pull/1251), but the end goal is
to try to simulate specific sensors via callbacks as naturally as
possible to transparently switch between sim and HW targets.
There needs to be some sort of callback system added to the sim
hal_i2c.c code where you can register a specific I2C address, and
redirect the read/write/probe calls up to the sensor driver package,
where they can be implemented as drivername_sim.c or something like
that. This should keep the code relatively clean, and the simulation
code is held in an appropriate package.
Are there any specific suggestions on what would be the best way to
handle this, though, either implementing the registration and callbacks
or perhaps another solution I'm not seeing here? There currently isn't a
good example in the codebase of simulating an actual sensor or external
device, and I think it would make a good addition to the project to show
how you can model a specific IC in the simulator.
Kevin