Skip to content
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

drivers/saul: use const qualifier for data to write #18043

Merged
merged 1 commit into from
May 23, 2022

Conversation

maribu
Copy link
Member

@maribu maribu commented May 2, 2022

Contribution description

Basically

- typedef int(*saul_write_t)(const void *dev, phydat_t *data);
+ typedef int(*saul_write_t)(const void *dev, const phydat_t *data);

This makes life easier when calling e.g. saul_reg_write() with data stored in flash.

As now the signatures for reading and writing differ (in that const qualifier only), saul_notsup() is split into saul_write_notsup() and saul_read_notsup(). However, one is implemented as a symbol alias of the other, so that ROM consumption remains unchanged.

Testing procedure

The binaries generated prior and after this PR should not be changed.

This PR

$ BOARD=samr21-xpro RIOT_CI_BUILD=1 make -C examples/saul
make: Entering directory '/home/maribu/Repos/software/RIOT/examples/saul'
Building application "saul_example" for "samr21-xpro" with MCU "samd21".

   text	  data	   bss	   dec	   hex	filename
  18172	   132	  2396	 20700	  50dc	/home/maribu/Repos/software/RIOT/examples/saul/bin/samr21-xpro/saul_example.elf
make: Leaving directory '/home/maribu/Repos/software/RIOT/examples/saul'

In master

$ BOARD=samr21-xpro RIOT_CI_BUILD=1 make -C examples/saul
make: Entering directory '/home/maribu/Repos/software/RIOT/examples/saul'
Building application "saul_example" for "samr21-xpro" with MCU "samd21".

   text	  data	   bss	   dec	   hex	filename
  18172	   132	  2396	 20700	  50dc	/home/maribu/Repos/software/RIOT/examples/saul/bin/samr21-xpro/saul_example.elf
make: Leaving directory '/home/maribu/Repos/software/RIOT/examples/saul'

Issues/PRs references

None

@maribu maribu added Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: SAUL Area: Sensor/Actuator Uber Layer labels May 2, 2022
@github-actions github-actions bot added Area: drivers Area: Device drivers Area: sys Area: System labels May 2, 2022
@maribu
Copy link
Member Author

maribu commented May 2, 2022

I seem to always forget to push the last minute fix I noticed just before opening the PR :/

@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms labels May 2, 2022
@maribu maribu removed Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: cpu Area: CPU/MCU ports labels May 2, 2022
@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms labels May 3, 2022
@benpicco
Copy link
Contributor

Looks like ph_oem_saul.c still needs an update.

@maribu
Copy link
Member Author

maribu commented May 21, 2022

All green static tests are failing :(

This makes life easier when calling e.g. `saul_reg_write()` with data
stored in flash.

As now the signatures for reading and writing differ (in that `const`
qualifier only), `saul_notsup()` is split into `saul_write_notsup()`
and `saul_read_notsup()`. However, one is implemented as a symbol alias
of the other, so that ROM consumption remains unchanged.
@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 23, 2022
@benpicco benpicco enabled auto-merge May 23, 2022 10:06
@benpicco benpicco merged commit ca17201 into RIOT-OS:master May 23, 2022
@maribu maribu deleted the drivers/saul branch May 23, 2022 12:19
@maribu
Copy link
Member Author

maribu commented May 23, 2022

thanks!

chrysn added a commit to RIOT-OS/rust-riot-wrappers that referenced this pull request Jun 10, 2022
This was not spotted in [18043] that caused the API break, because none
of the CI built examples have SAUL enabled.

[18043]: RIOT-OS/RIOT#18043
@chrysn chrysn added this to the Release 2022.07 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Area: drivers Area: Device drivers Area: SAUL Area: Sensor/Actuator Uber Layer Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants