-
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: bme680.c:42:39: error: use of GNU empty initializer extension bme680_t *bme680_devs[BME680_NUMOF] = { }; ^ Signed-off-by: Gilles DOFFE <[email protected]>
- <stdbool.h> is missing for bool type definition. - "container.h" is missing for ARRAY_SIZE macro definition. Signed-off-by: Gilles DOFFE <[email protected]>
Fix: drivers/include/hm330x.h:66:12: error: missing binary operator before token "(" Signed-off-by: Gilles DOFFE <[email protected]>
Fix: drivers/lsm6dsxx/include/lsm6dsxx_internal.h:148:47: error: binary constants are a C2X feature or GCC extension Signed-off-by: Gilles DOFFE <[email protected]>
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 <[email protected]>
Fix: error: format ‘%p’ expects argument of type ‘void *’ and: error: ISO C forbids empty initializer braces [-Werror=pedantic] Signed-off-by: Gilles DOFFE <[email protected]>
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 <[email protected]>
Fix: error: format ‘%p’ expects argument of type ‘void *’ Signed-off-by: Gilles DOFFE <[email protected]>
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 <[email protected]>
Fix: error: ISO C forbids empty initializer braces [-Werror=pedantic] Signed-off-by: Gilles DOFFE <[email protected]>
Signed-off-by: Gilles DOFFE <[email protected]>
Signed-off-by: Gilles DOFFE <[email protected]>
Fix: error: overflow in conversion from ‘int’ to ‘char’ changes value from ‘255’ to ‘-1’ [-Werror=overflow] Signed-off-by: Gilles DOFFE <[email protected]>
Signed-off-by: Gilles DOFFE <[email protected]>
Fix: error: ISO C forbids empty initializer braces [-Werror=pedantic] Signed-off-by: Gilles DOFFE <[email protected]>
Signed-off-by: Gilles DOFFE <[email protected]>
Signed-off-by: Gilles DOFFE <[email protected]>
Fix: error: binary constants are a C2X feature or GCC extension Signed-off-by: Gilles DOFFE <[email protected]>
Fix: error: ISO C forbids empty initializer braces [-Werror=pedantic] Signed-off-by: Gilles DOFFE <[email protected]>
Signed-off-by: Gilles DOFFE <[email protected]>
Give priority to RIOT_APPLICATION macro over __linux__ and __WIN32__ ones. Signed-off-by: Gilles DOFFE <[email protected]>
Signed-off-by: Gilles DOFFE <[email protected]>
size_t size is changing according to architecture. Fix diplay to 32 bits unsigned integer. Signed-off-by: Gilles DOFFE <[email protected]>
Fix: drivers/sht2x/include/sht2x_params.h:134:50: error: missing binary operator before token "(" Signed-off-by: Gilles DOFFE <[email protected]>
Signed-off-by: Gilles DOFFE <[email protected]>
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 <[email protected]>
Signed-off-by: Gilles DOFFE <[email protected]>
5345352
to
2720856
Compare
\ No newline at end of file | ||
+// *INDENT-ON* | ||
+ | ||
-- |
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.
Why are you 'fixing' this? This just makes the package harder to maintain.
I'm surprised by all the churn. Try a rebase - we are no longer building |
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