[riot-notifications] [RIOT-OS/RIOT] drivers/pcd8544: Use uint8_t instead of char for byte represenatation (#11451)
notifications at github.com
Fri Apr 26 00:23:11 CEST 2019
### Contribution description
This PR is related to PR #11352, where I suggest to add support for Linux' `/dev/spidev` devices to the native cpu. [As mentioned in that PR](https://github.com/RIOT-OS/RIOT/pull/11352#issuecomment-486231452), enabling SPI causes the `tests/driver_pcd8544` test to be run with the gnu toolchain for the first time. This build fails in Murdock ([Logfile](https://ci.riot-os.org/RIOT-OS/RIOT/11352/fb4c52747487659a540d72eb760e0ae66d420beb/output/compile/tests/driver_pcd8544/native:gnu.txt)), because `char` is signed by default on this platform. The PCD8544 driver uses `char` arrays to pass raw bytes around instead of the platform-independent `uint8_t` version.
I suggest to change the occurrences of `char` where applicable to `uint8_t`. For all platforms with SPI support this should not change the behavior (they don't create warnings now, so I assume they all use unsigned `char`s by default). However, building for Linux should then work, as the literals in the definition of the `_riot` array then is in a valid range.
As far as I could see, the driver isn't used anywhere else in the repository but in the corresponding test. So this shouldn't break anything else, but applications using the driver might notice the API change of `pcd8544_write_img(...)`.
### Testing procedure
I haven't got the hardware at hand to run a real test against the display controller, but I tried to build the `tests/driver_pcd8544` for some architectures (e.g. `arduino-atmega2560` for AVR, `feather-m0` for ARM, `esp32-wroom-32` for xtensa) before and after the change to verify that they still compile and no warnings of incompatible types are shown.
To verify that this will solve the CI build issue in #11532, I tried merging my [spi_native](https://github.com/fhessel/RIOT/tree/native_spi) branch and the content of this PR on the current master branch and build the test with `BOARD=native`, which then also succeeded.
### Issues/PRs references
Required for PR #11352
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* drivers/pcd8544: replace char by uint8_t for bytes
-- File Changes --
M drivers/include/pcd8544.h (4)
M drivers/pcd8544/pcd8544.c (8)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications