Skip to content

Commit 493ae2b

Browse files
author
Hasnain Virk
committed
dr_range bitfield should be unsigned integer
If the value is an integer, the 4th bit is used for sign, so you can store values upto 7 only whereas the datarate values could go upto 15. That's why we need to turn this to an unsigned integer so that the last bit can also be used.
1 parent 9ac7f21 commit 493ae2b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

features/lorawan/lorawan_types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ typedef union {
275275
/**
276276
* Byte-access to the bits.
277277
*/
278-
int8_t value;
278+
uint8_t value;
279279
/**
280280
* The structure to store the minimum and the maximum datarate.
281281
*/
@@ -288,7 +288,7 @@ typedef union {
288288
* The allowed ranges are region-specific.
289289
* Please refer to \ref DR_0 to \ref DR_15 for details.
290290
*/
291-
int8_t min : 4;
291+
uint8_t min : 4;
292292
/**
293293
* The maximum data rate.
294294
*
@@ -297,7 +297,7 @@ typedef union {
297297
* The allowed ranges are region-specific.
298298
* Please refer to \ref DR_0 to \ref DR_15 for details.
299299
*/
300-
int8_t max : 4;
300+
uint8_t max : 4;
301301
} fields;
302302
} dr_range_t;
303303

0 commit comments

Comments
 (0)