Skip to content

Commit f8dc37d

Browse files
committed
drivers/sht2x: fix printf format for native
Signed-off-by: Gilles DOFFE <[email protected]>
1 parent 7e45997 commit f8dc37d

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

drivers/l3gxxxx/l3gxxxx.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* @{
1515
*/
1616

17+
#include <inttypes.h>
18+
#include <stdint.h>
1719
#include <string.h>
1820
#include <stdlib.h>
1921

@@ -37,7 +39,7 @@
3739

3840
#define DEBUG_DEV(m, d, ...) \
3941
DEBUG("[l3gxxxx] %s dev=%" PRIxPTR ": " m "\n", \
40-
__func__, (unsigned int)d, ## __VA_ARGS__)
42+
__func__, (uintptr_t)d, ## __VA_ARGS__)
4143

4244
#else /* ENABLE_DEBUG */
4345

@@ -1032,7 +1034,7 @@ static int _read(const l3gxxxx_t *dev, uint8_t reg, uint8_t *data, uint8_t len)
10321034

10331035
if (ENABLE_DEBUG) {
10341036
printf("[l3gxxxx] %s dev=%" PRIxPTR ": read following bytes: ",
1035-
__func__, (unsigned int)dev);
1037+
__func__, (uintptr_t)dev);
10361038
for (uint8_t i = 0; i < len; i++) {
10371039
printf("%02x ", data[i]);
10381040
}
@@ -1059,7 +1061,7 @@ static int _read(const l3gxxxx_t *dev, uint8_t reg, uint8_t *data, uint8_t len)
10591061

10601062
if (ENABLE_DEBUG) {
10611063
printf("[l3gxxxx] %s dev=%" PRIxPTR ": read following bytes: ",
1062-
__func__, (unsigned int)dev);
1064+
__func__, (uintptr_t)dev);
10631065
for (uint8_t i = 0; i < len; i++) {
10641066
printf("%02x ", data[i]);
10651067
}
@@ -1090,7 +1092,7 @@ static int _write(const l3gxxxx_t *dev,
10901092

10911093
if (ENABLE_DEBUG) {
10921094
printf("[l3gxxxx] %s dev=%" PRIxPTR ": write following bytes: ",
1093-
__func__, (unsigned int)dev);
1095+
__func__, (uintptr_t)dev);
10941096
for (uint8_t i = 0; i < len; i++) {
10951097
printf("%02x ", data[i]);
10961098
}
@@ -1112,7 +1114,7 @@ static int _write(const l3gxxxx_t *dev,
11121114

11131115
if (ENABLE_DEBUG) {
11141116
printf("[l3gxxxx] %s dev=%" PRIxPTR ": write following bytes: ",
1115-
__func__, (unsigned int)dev);
1117+
__func__, (uintptr_t)dev);
11161118
for (uint8_t i = 0; i < len; i++) {
11171119
printf("%02x ", data[i]);
11181120
}

drivers/sht2x/sht2x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ int sht2x_read_ident(const sht2x_t *dev, uint8_t * buffer, size_t buflen)
209209
DEBUG("[SHT2x] ident (1): %02x %02x %02x %02x\n", data1[4], data1[5], data1[6], data1[7]);
210210
for (size_t ix = 0; ix < sizeof(data1); ix += 2) {
211211
if (sht2x_checkcrc(&data1[ix], 1, data1[ix + 1]) != 0) {
212-
DEBUG("[SHT2x] checksum error first (ix=%d)\n", ix);
212+
DEBUG("[SHT2x] checksum error first (ix=%zu)\n", ix);
213213
return SHT2X_ERR_CRC;
214214
}
215215
}
@@ -225,7 +225,7 @@ int sht2x_read_ident(const sht2x_t *dev, uint8_t * buffer, size_t buflen)
225225
DEBUG("[SHT2x] ident (2): %02x %02x %02x\n", data2[3], data2[4], data2[5]);
226226
for (size_t ix = 0; ix < sizeof(data2); ix += 3) {
227227
if (sht2x_checkcrc(&data2[ix], 2, data2[ix + 2]) != 0) {
228-
DEBUG("[SHT2x] checksum error, second (ix=%d)\n", ix);
228+
DEBUG("[SHT2x] checksum error, second (ix=%zu)\n", ix);
229229
return SHT2X_ERR_CRC;
230230
}
231231
}

0 commit comments

Comments
 (0)