Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 1 | From 5a1e731d71d577f56a2c013e4a75a8e90188e63b Mon Sep 17 00:00:00 2001 |
| 2 | From: Paul Eggleton <paul.eggleton@linux.intel.com> |
| 3 | Date: Tue, 9 Jul 2019 05:21:59 -0700 |
| 4 | Subject: [PATCH] Use stdint types |
| 5 | |
| 6 | Fixes compilation with musl. |
| 7 | |
| 8 | Upstream-Status: Pending |
| 9 | |
| 10 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> |
| 11 | --- |
| 12 | src/bma250e/bma250e.cxx | 16 ++++++++-------- |
| 13 | src/bmg160/bmg160.cxx | 10 +++++----- |
| 14 | src/bmi160/bosch_bmi160.h | 2 +- |
| 15 | src/bmm150/bmm150.cxx | 8 ++++---- |
| 16 | 4 files changed, 18 insertions(+), 18 deletions(-) |
| 17 | |
| 18 | diff --git a/src/bma250e/bma250e.cxx b/src/bma250e/bma250e.cxx |
| 19 | index a8792782..1b3ecdd8 100644 |
| 20 | --- a/src/bma250e/bma250e.cxx |
| 21 | +++ b/src/bma250e/bma250e.cxx |
| 22 | @@ -195,35 +195,35 @@ BMA250E::BMA250E(std::string initStr) : mraaIo(initStr) |
| 23 | fifoConfig(mode, axes); |
| 24 | } |
| 25 | if(tok.substr(0, 20) == "setInterruptEnable0:") { |
| 26 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0); |
| 27 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(20), nullptr, 0); |
| 28 | setInterruptEnable0(bits); |
| 29 | } |
| 30 | if(tok.substr(0, 20) == "setInterruptEnable1:") { |
| 31 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0); |
| 32 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(20), nullptr, 0); |
| 33 | setInterruptEnable1(bits); |
| 34 | } |
| 35 | if(tok.substr(0, 20) == "setInterruptEnable2:") { |
| 36 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0); |
| 37 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(20), nullptr, 0); |
| 38 | setInterruptEnable2(bits); |
| 39 | } |
| 40 | if(tok.substr(0, 17) == "setInterruptMap0:") { |
| 41 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 42 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 43 | setInterruptMap0(bits); |
| 44 | } |
| 45 | if(tok.substr(0, 17) == "setInterruptMap1:") { |
| 46 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 47 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 48 | setInterruptMap1(bits); |
| 49 | } |
| 50 | if(tok.substr(0, 17) == "setInterruptMap2:") { |
| 51 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 52 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 53 | setInterruptMap2(bits); |
| 54 | } |
| 55 | if(tok.substr(0, 16) == "setInterruptSrc:") { |
| 56 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(16), nullptr, 0); |
| 57 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(16), nullptr, 0); |
| 58 | setInterruptSrc(bits); |
| 59 | } |
| 60 | if(tok.substr(0, 26) == "setInterruptOutputControl:") { |
| 61 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(26), nullptr, 0); |
| 62 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(26), nullptr, 0); |
| 63 | setInterruptOutputControl(bits); |
| 64 | } |
| 65 | if(tok.substr(0, 26) == "setInterruptLatchBehavior:") { |
| 66 | diff --git a/src/bmg160/bmg160.cxx b/src/bmg160/bmg160.cxx |
| 67 | index 1a0939f8..2438c399 100644 |
| 68 | --- a/src/bmg160/bmg160.cxx |
| 69 | +++ b/src/bmg160/bmg160.cxx |
| 70 | @@ -173,23 +173,23 @@ BMG160::BMG160(std::string initStr) : mraaIo(initStr) |
| 71 | fifoConfig(mode, axes); |
| 72 | } |
| 73 | if(tok.substr(0, 20) == "setInterruptEnable0:") { |
| 74 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0); |
| 75 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(20), nullptr, 0); |
| 76 | setInterruptEnable0(bits); |
| 77 | } |
| 78 | if(tok.substr(0, 17) == "setInterruptMap0:") { |
| 79 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 80 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 81 | setInterruptMap0(bits); |
| 82 | } |
| 83 | if(tok.substr(0, 17) == "setInterruptMap1:") { |
| 84 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 85 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 86 | setInterruptMap1(bits); |
| 87 | } |
| 88 | if(tok.substr(0, 16) == "setInterruptSrc:") { |
| 89 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(16), nullptr, 0); |
| 90 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(16), nullptr, 0); |
| 91 | setInterruptSrc(bits); |
| 92 | } |
| 93 | if(tok.substr(0, 26) == "setInterruptOutputControl:") { |
| 94 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(26), nullptr, 0); |
| 95 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(26), nullptr, 0); |
| 96 | setInterruptOutputControl(bits); |
| 97 | } |
| 98 | if(tok.substr(0, 26) == "setInterruptLatchBehavior:") { |
| 99 | diff --git a/src/bmi160/bosch_bmi160.h b/src/bmi160/bosch_bmi160.h |
| 100 | index 87ca2249..cd9efe6f 100644 |
| 101 | --- a/src/bmi160/bosch_bmi160.h |
| 102 | +++ b/src/bmi160/bosch_bmi160.h |
| 103 | @@ -81,7 +81,7 @@ typedef int16_t s16;/**< used for signed 16bit */ |
| 104 | typedef int32_t s32;/**< used for signed 32bit */ |
| 105 | typedef int64_t s64;/**< used for signed 64bit */ |
| 106 | |
| 107 | -typedef u_int8_t u8;/**< used for unsigned 8bit */ |
| 108 | +typedef uint8_t u8;/**< used for unsigned 8bit */ |
| 109 | typedef u_int16_t u16;/**< used for unsigned 16bit */ |
| 110 | typedef u_int32_t u32;/**< used for unsigned 32bit */ |
| 111 | typedef u_int64_t u64;/**< used for unsigned 64bit */ |
| 112 | diff --git a/src/bmm150/bmm150.cxx b/src/bmm150/bmm150.cxx |
| 113 | index 234ebf92..02436788 100644 |
| 114 | --- a/src/bmm150/bmm150.cxx |
| 115 | +++ b/src/bmm150/bmm150.cxx |
| 116 | @@ -170,19 +170,19 @@ BMM150::BMM150(std::string initStr) : mraaIo(initStr) |
| 117 | setOpmode(opmode); |
| 118 | } |
| 119 | if(tok.substr(0, 19) == "setInterruptEnable:") { |
| 120 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(19), nullptr, 0); |
| 121 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(19), nullptr, 0); |
| 122 | setInterruptEnable(bits); |
| 123 | } |
| 124 | if(tok.substr(0, 19) == "setInterruptConfig:") { |
| 125 | - u_int8_t bits = (u_int8_t)std::stoul(tok.substr(19), nullptr, 0); |
| 126 | + uint8_t bits = (uint8_t)std::stoul(tok.substr(19), nullptr, 0); |
| 127 | setInterruptConfig(bits); |
| 128 | } |
| 129 | if(tok.substr(0, 17) == "setRepetitionsXY:") { |
| 130 | - u_int8_t reps = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 131 | + uint8_t reps = (uint8_t)std::stoul(tok.substr(17), nullptr, 0); |
| 132 | setRepetitionsXY(reps); |
| 133 | } |
| 134 | if(tok.substr(0, 16) == "setRepetitionsZ:") { |
| 135 | - u_int8_t reps = (u_int8_t)std::stoul(tok.substr(16), nullptr, 0); |
| 136 | + uint8_t reps = (uint8_t)std::stoul(tok.substr(16), nullptr, 0); |
| 137 | setRepetitionsZ(reps); |
| 138 | } |
| 139 | if(tok.substr(0, 14) == "setPresetMode:") { |