driver: adxl38x - bare-metal driver for parts ADXL380 and ADXL382
Pull Request Description
Bare metal device drivers for ADXL380/382 parts.
Please replace this with a detailed description and motivation of the changes. You can tick the checkboxes below with an 'x' between square brackets or just check them after publishing the PR. If this PR contains a breaking change, list dependent PRs and try to push all related PRs at the same time.
PR Type
- [ ] Bug fix (change that fixes an issue)
- [x] New feature (change that adds new functionality)
- [ ] Breaking change (has dependencies in other repos or will cause CI to fail)
PR Checklist
- [x] I have followed the Coding style guidelines
- [x] I have performed a self-review of the changes
- [x] I have commented my code, at least hard-to-understand parts
- [x] I have build all projects affected by the changes in this PR
- [x] I have tested in hardware affected projects, at the relevant boards
- [x] I have signed off all commits from this PR
- [ ] I have updated the documentation (wiki pages, ReadMe etc), if applies
There are some compilation warnings which need to be fix:
2024-06-13T15:35:15.9048705Z CC adxl38x.c
2024-06-13T15:35:15.9273766Z accel/adxl38x/adxl38x.c: In function 'adxl38x_soft_reset':
2024-06-13T15:35:15.9274999Z accel/adxl38x/adxl38x.c:252:30: warning: unused variable 'flags' [-Wunused-variable]
2024-06-13T15:35:15.9275353Z 252 | union adxl38x_sts_reg_flags flags;
2024-06-13T15:35:15.9275663Z | ^~~~~
2024-06-13T15:35:15.9281204Z accel/adxl38x/adxl38x.c: In function 'adxl38x_get_op_mode':
2024-06-13T15:35:15.9283047Z accel/adxl38x/adxl38x.c:312:58: warning: passing argument 4 of 'adxl38x_read_device_data' from incompatible pointer type [-Wincompatible-pointer-types]
2024-06-13T15:35:15.9284126Z 312 | ret = adxl38x_read_device_data(dev, ADXL38x_OP_MODE, 1, &op_mode_reg_val);
2024-06-13T15:35:15.9284450Z | ^~~~~~~~~~~~~~~~
2024-06-13T15:35:15.9284766Z | |
2024-06-13T15:35:15.9285103Z | uint8_t (*)[1] {aka unsigned char (*)[1]}
2024-06-13T15:35:15.9285838Z accel/adxl38x/adxl38x.c:78:33: note: expected 'uint8_t *' {aka 'unsigned char *'} but argument is of type 'uint8_t (*)[1]' {aka 'unsigned char (*)[1]'}
2024-06-13T15:35:15.9286625Z 78 | uint16_t size, uint8_t *read_data)
2024-06-13T15:35:15.9287176Z | ~~~~~~~~~^~~~~~~~~
2024-06-13T15:35:15.9292415Z accel/adxl38x/adxl38x.c: In function 'adxl38x_set_range':
2024-06-13T15:35:15.9293544Z accel/adxl38x/adxl38x.c:334:58: warning: passing argument 4 of 'adxl38x_read_device_data' from incompatible pointer type [-Wincompatible-pointer-types]
2024-06-13T15:35:15.9294004Z 334 | ret = adxl38x_read_device_data(dev, ADXL38x_OP_MODE, 1, &range_reg_val);
2024-06-13T15:35:15.9294382Z | ^~~~~~~~~~~~~~
2024-06-13T15:35:15.9294760Z | |
2024-06-13T15:35:15.9295021Z | uint8_t (*)[1] {aka unsigned char (*)[1]}
2024-06-13T15:35:15.9295614Z accel/adxl38x/adxl38x.c:78:33: note: expected 'uint8_t *' {aka 'unsigned char *'} but argument is of type 'uint8_t (*)[1]' {aka 'unsigned char (*)[1]'}
2024-06-13T15:35:15.9296227Z 78 | uint16_t size, uint8_t *read_data)
2024-06-13T15:35:15.9296581Z | ~~~~~~~~~^~~~~~~~~
2024-06-13T15:35:15.9303021Z accel/adxl38x/adxl38x.c:345:59: warning: passing argument 4 of 'adxl38x_write_device_data' from incompatible pointer type [-Wincompatible-pointer-types]
2024-06-13T15:35:15.9303555Z 345 | ret = adxl38x_write_device_data(dev, ADXL38x_OP_MODE, 1, &range_reg_val);
2024-06-13T15:35:15.9303951Z | ^~~~~~~~~~~~~~
2024-06-13T15:35:15.9304265Z | |
2024-06-13T15:35:15.9304514Z | uint8_t (*)[1] {aka unsigned char (*)[1]}
2024-06-13T15:35:15.9305250Z accel/adxl38x/adxl38x.c:111:34: note: expected 'uint8_t *' {aka 'unsigned char *'} but argument is of type 'uint8_t (*)[1]' {aka 'unsigned char (*)[1]'}
2024-06-13T15:35:15.9305627Z 111 | uint16_t size, uint8_t *write_data)
2024-06-13T15:35:15.9305947Z | ~~~~~~~~~^~~~~~~~~~
2024-06-13T15:35:15.9311329Z accel/adxl38x/adxl38x.c: In function 'adxl38x_get_range':
2024-06-13T15:35:15.9312372Z accel/adxl38x/adxl38x.c:366:58: warning: passing argument 4 of 'adxl38x_read_device_data' from incompatible pointer type [-Wincompatible-pointer-types]
2024-06-13T15:35:15.9312822Z 366 | ret = adxl38x_read_device_data(dev, ADXL38x_OP_MODE, 1, &range_reg_val);
2024-06-13T15:35:15.9313210Z | ^~~~~~~~~~~~~~
2024-06-13T15:35:15.9313873Z | |
2024-06-13T15:35:15.9314127Z | uint8_t (*)[1] {aka unsigned char (*)[1]}
2024-06-13T15:35:15.9314783Z accel/adxl38x/adxl38x.c:78:33: note: expected 'uint8_t *' {aka 'unsigned char *'} but argument is of type 'uint8_t (*)[1]' {aka 'unsigned char (*)[1]'}
2024-06-13T15:35:15.9315163Z 78 | uint16_t size, uint8_t *read_data)
2024-06-13T15:35:15.9315480Z | ~~~~~~~~~^~~~~~~~~
2024-06-13T15:35:15.9325204Z accel/adxl38x/adxl38x.c: In function 'adxl38x_get_sts_reg':
2024-06-13T15:35:15.9326139Z accel/adxl38x/adxl38x.c:475:58: warning: passing argument 4 of 'adxl38x_read_device_data' from incompatible pointer type [-Wincompatible-pointer-types]
2024-06-13T15:35:15.9327101Z 475 | ret = adxl38x_read_device_data(dev, ADXL38x_STATUS0, 4, &status_value);
2024-06-13T15:35:15.9327502Z | ^~~~~~~~~~~~~
2024-06-13T15:35:15.9327825Z | |
2024-06-13T15:35:15.9328098Z | uint8_t (*)[4] {aka unsigned char (*)[4]}
2024-06-13T15:35:15.9332361Z accel/adxl38x/adxl38x.c:78:33: note: expected 'uint8_t *' {aka 'unsigned char *'} but argument is of type 'uint8_t (*)[4]' {aka 'unsigned char (*)[4]'}
2024-06-13T15:35:15.9332857Z 78 | uint16_t size, uint8_t *read_data)
2024-06-13T15:35:15.9333285Z | ~~~~~~~~~^~~~~~~~~
2024-06-13T15:35:15.9341760Z accel/adxl38x/adxl38x.c: In function 'adxl38x_get_temp':
2024-06-13T15:35:15.9342639Z accel/adxl38x/adxl38x.c:540:6: warning: unused variable 'j' [-Wunused-variable]
2024-06-13T15:35:15.9343022Z 540 | int j = 0;
2024-06-13T15:35:15.9343502Z | ^
2024-06-13T15:35:15.9351386Z accel/adxl38x/adxl38x.c: In function 'adxl38x_get_raw_data':
2024-06-13T15:35:15.9355587Z accel/adxl38x/adxl38x.c:649:29: warning: assignment to 'uint8_t' {aka 'unsigned char'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
2024-06-13T15:35:15.9357392Z 649 | array_rearranged_data[i] = NULL;
2024-06-13T15:35:15.9357796Z | ^
2024-06-13T15:35:15.9362833Z accel/adxl38x/adxl38x.c:650:31: warning: assignment to 'uint8_t' {aka 'unsigned char'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
2024-06-13T15:35:15.9363514Z 650 | array_rearranged_data[i+1] = NULL;
2024-06-13T15:35:15.9364256Z | ^
2024-06-13T15:35:15.9371922Z accel/adxl38x/adxl38x.c: In function 'adxl38x_get_xyz_gees':
2024-06-13T15:35:15.9379493Z accel/adxl38x/adxl38x.c:686:10: warning: unused variable 'dummy' [-Wunused-variable]
2024-06-13T15:35:15.9381166Z 686 | int64_t dummy;
2024-06-13T15:35:15.9381552Z | ^~~~~
2024-06-13T15:35:15.9386357Z accel/adxl38x/adxl38x.c:683:11: warning: unused variable 'dum' [-Wunused-variable]
2024-06-13T15:35:15.9386872Z 683 | uint16_t dum;
2024-06-13T15:35:15.9387367Z | ^~~
2024-06-13T15:35:15.9442160Z accel/adxl38x/adxl38x.c: In function 'adxl38x_init':
2024-06-13T15:35:15.9443062Z accel/adxl38x/adxl38x.c:150:17: warning: 'dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
2024-06-13T15:35:15.9443776Z 150 | dev->dev_type = init_param.dev_type;
2024-06-13T15:35:15.9444128Z | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
Please make sure to add a message to the https://github.com/analogdevicesinc/no-OS/pull/2210/commits/f84e5949e968e57002181e864162eaeebeec5805 commit. Briefly describe what the examples do and what platform/board they run on.
CI issue was solved (it was a discrepancy between .ioc and CI CubeMX version), a description was added to the commit adding the project, so I will merge