-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cpu/native: introduce periph_i2c_mock #20430
base: master
Are you sure you want to change the base?
Conversation
c94e3ff
to
e5e81d1
Compare
865c036
to
f66aa4c
Compare
There's still a build error left, and I'd appreciated if the mocking part was somehow shown / tested. I've done both, but can't push directly to this branch, but you can pick the commits from cogip#1. |
fc45e56
to
333dc02
Compare
Thx for patches @chrysn . Applied and tested: > i2c_write_bytes 0 10 0 0 1 0 1 2
i2c_write_bytes 0 10 0 0 1 0 1 2
Command: i2c_write_bytes(0, 0x0a, 0x00, [0x00, 0x01, 0x00, 0x01, 0x02])
Mock write intercepted; this write of 5 byte(s) is still ignored.
Success: i2c_0 wrote 5 bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, let's go with this.
The failing test appears to expose an issue with the si1133 driver (missing includes), can you fix that in passing?
done 🤞 |
Awesome, thanks! |
Fix: at24cxxx.c:206:12: error: ‘check’ may be used uninitialized [...] Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: drivers/include/hm330x.h:66:12: error: missing binary operator before token "(" Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: drivers/lsm6dsxx/include/lsm6dsxx_internal.h:148:47: error: binary constants are a C2X feature or GCC extension Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: drivers/include/mtd_at24cxxx.h:49:1: error: initializer element is not constant [-Werror=pedantic] 49 | (mtd_at24cxxx_t) { \ | ^ Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: error: format ‘%p’ expects argument of type ‘void *’ and: error: ISO C forbids empty initializer braces [-Werror=pedantic] Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
The pcf857x_gpio_write() is also returning void as pcf857x_gpio_* functions. This fixes following errors using native architecture: RIOT/drivers/pcf857x/pcf857x.c:319:12: error: ISO C forbids ‘return’ with expression, in function returning void [-Werror=pedantic] 319 | return pcf857x_gpio_write(dev, pin, 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: error: format ‘%p’ expects argument of type ‘void *’ Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: error: ISO C forbids empty initializer braces [-Werror=pedantic] and: error: ISO C requires a translation unit to contain at least one declaration [-Werror,-Wempty-translation-unit] Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: error: ISO C forbids empty initializer braces [-Werror=pedantic] Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: error: overflow in conversion from ‘int’ to ‘char’ changes value from ‘255’ to ‘-1’ [-Werror=overflow] Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: error: ISO C forbids empty initializer braces [-Werror=pedantic] Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: error: binary constants are a C2X feature or GCC extension Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: error: ISO C forbids empty initializer braces [-Werror=pedantic] Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Add a dummy variable to fix following error: error: empty union is a GNU extension [-Werror,-Wgnu-empty-struct] Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Give priority to RIOT_APPLICATION macro over __linux__ and __WIN32__ ones. Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
size_t size is changing according to architecture. Fix diplay to 32 bits unsigned integer. Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Fix: drivers/sht2x/include/sht2x_params.h:134:50: error: missing binary operator before token "(" Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
This fixes following errors using native architecture: RIOT/drivers/pca9685/pca9685.c:42:15: error: format ‘%p’ expects argument of type ‘void *’, but argument 5 has type ‘const pca9685_params_t *’ [-Werror=format=] Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Thx for review. I'm not a fan of big squash but I could squash per file it is ok for you @maribu ? |
Ideally the resulting commits should all contain a collection of strongly related changes with a single intent. There is a lot of interpretation room and it is pretty subjective how fine-grained commits should be. I personally try to look at this from the "revert" perspective: In case a regression sneeks in that cannot easily be fixed, what would be sensible units for reverting? Note: At the current ponty in the release cycle this will likely not get merged, but has to wait for the release branch to fork of. That should be done soonish. Afterwards this can be merged. |
Contribution description
This allows I2C emulation on native architecture in the same way than periph_gpio_mock.
All I2C function from this driver are set as weak to be easily overridden in each application.
Testing procedure