Brian Pearson
/
LPC1768OpacityMeterUSB
Opacity meter with USB interface
ByteOperations.h@0:8ce24e6c4de1, 2016-01-05 (annotated)
- Committer:
- BPPearson
- Date:
- Tue Jan 05 16:44:57 2016 +0000
- Revision:
- 0:8ce24e6c4de1
Opacity meter with USB interface
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
BPPearson | 0:8ce24e6c4de1 | 1 | #ifndef BYTEOPERATION_H_ |
BPPearson | 0:8ce24e6c4de1 | 2 | #define BYTEOPERATION_H_ |
BPPearson | 0:8ce24e6c4de1 | 3 | |
BPPearson | 0:8ce24e6c4de1 | 4 | #include <stdint.h> |
BPPearson | 0:8ce24e6c4de1 | 5 | |
BPPearson | 0:8ce24e6c4de1 | 6 | /* low index equals low nibble */ |
BPPearson | 0:8ce24e6c4de1 | 7 | /* Write 32 bit var to 4 bytes */ |
BPPearson | 0:8ce24e6c4de1 | 8 | void write_32_to_8(int *i, uint8_t dst[], uint32_t src); |
BPPearson | 0:8ce24e6c4de1 | 9 | |
BPPearson | 0:8ce24e6c4de1 | 10 | /* Write 16 bit var to 2 bytes */ |
BPPearson | 0:8ce24e6c4de1 | 11 | void write_16_to_8(int *i, uint8_t dst[], uint16_t src); |
BPPearson | 0:8ce24e6c4de1 | 12 | |
BPPearson | 0:8ce24e6c4de1 | 13 | /* Write 4 bytes to 32 bit var*/ |
BPPearson | 0:8ce24e6c4de1 | 14 | uint32_t read_8_to_32(int *i, uint8_t *src); |
BPPearson | 0:8ce24e6c4de1 | 15 | |
BPPearson | 0:8ce24e6c4de1 | 16 | /* Write 2 bytes to 16 bit var*/ |
BPPearson | 0:8ce24e6c4de1 | 17 | uint16_t read_8_to_16(int *i, uint8_t *src); |
BPPearson | 0:8ce24e6c4de1 | 18 | |
BPPearson | 0:8ce24e6c4de1 | 19 | |
BPPearson | 0:8ce24e6c4de1 | 20 | const uint8_t logaritmify[0xFF] = { |
BPPearson | 0:8ce24e6c4de1 | 21 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 22 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 23 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 24 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 25 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 26 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 27 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 28 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 29 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 30 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 31 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 32 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 33 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 34 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 35 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 36 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 37 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 38 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 39 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 40 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 41 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 42 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 43 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 44 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 45 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 46 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 47 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 48 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 49 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 50 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 51 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 52 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 53 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 54 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 55 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 56 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 57 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 58 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 59 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 60 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 61 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 62 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 63 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 64 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 65 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 66 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 67 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 68 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 69 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 70 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 71 | 1 , |
BPPearson | 0:8ce24e6c4de1 | 72 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 73 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 74 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 75 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 76 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 77 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 78 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 79 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 80 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 81 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 82 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 83 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 84 | 2 , |
BPPearson | 0:8ce24e6c4de1 | 85 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 86 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 87 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 88 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 89 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 90 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 91 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 92 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 93 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 94 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 95 | 3 , |
BPPearson | 0:8ce24e6c4de1 | 96 | 4 , |
BPPearson | 0:8ce24e6c4de1 | 97 | 4 , |
BPPearson | 0:8ce24e6c4de1 | 98 | 4 , |
BPPearson | 0:8ce24e6c4de1 | 99 | 4 , |
BPPearson | 0:8ce24e6c4de1 | 100 | 4 , |
BPPearson | 0:8ce24e6c4de1 | 101 | 4 , |
BPPearson | 0:8ce24e6c4de1 | 102 | 4 , |
BPPearson | 0:8ce24e6c4de1 | 103 | 4 , |
BPPearson | 0:8ce24e6c4de1 | 104 | 5 , |
BPPearson | 0:8ce24e6c4de1 | 105 | 5 , |
BPPearson | 0:8ce24e6c4de1 | 106 | 5 , |
BPPearson | 0:8ce24e6c4de1 | 107 | 5 , |
BPPearson | 0:8ce24e6c4de1 | 108 | 5 , |
BPPearson | 0:8ce24e6c4de1 | 109 | 5 , |
BPPearson | 0:8ce24e6c4de1 | 110 | 5 , |
BPPearson | 0:8ce24e6c4de1 | 111 | 6 , |
BPPearson | 0:8ce24e6c4de1 | 112 | 6 , |
BPPearson | 0:8ce24e6c4de1 | 113 | 6 , |
BPPearson | 0:8ce24e6c4de1 | 114 | 6 , |
BPPearson | 0:8ce24e6c4de1 | 115 | 6 , |
BPPearson | 0:8ce24e6c4de1 | 116 | 6 , |
BPPearson | 0:8ce24e6c4de1 | 117 | 7 , |
BPPearson | 0:8ce24e6c4de1 | 118 | 7 , |
BPPearson | 0:8ce24e6c4de1 | 119 | 7 , |
BPPearson | 0:8ce24e6c4de1 | 120 | 7 , |
BPPearson | 0:8ce24e6c4de1 | 121 | 7 , |
BPPearson | 0:8ce24e6c4de1 | 122 | 7 , |
BPPearson | 0:8ce24e6c4de1 | 123 | 8 , |
BPPearson | 0:8ce24e6c4de1 | 124 | 8 , |
BPPearson | 0:8ce24e6c4de1 | 125 | 8 , |
BPPearson | 0:8ce24e6c4de1 | 126 | 8 , |
BPPearson | 0:8ce24e6c4de1 | 127 | 9 , |
BPPearson | 0:8ce24e6c4de1 | 128 | 9 , |
BPPearson | 0:8ce24e6c4de1 | 129 | 9 , |
BPPearson | 0:8ce24e6c4de1 | 130 | 9 , |
BPPearson | 0:8ce24e6c4de1 | 131 | 9 , |
BPPearson | 0:8ce24e6c4de1 | 132 | 10 , |
BPPearson | 0:8ce24e6c4de1 | 133 | 10 , |
BPPearson | 0:8ce24e6c4de1 | 134 | 10 , |
BPPearson | 0:8ce24e6c4de1 | 135 | 10 , |
BPPearson | 0:8ce24e6c4de1 | 136 | 11 , |
BPPearson | 0:8ce24e6c4de1 | 137 | 11 , |
BPPearson | 0:8ce24e6c4de1 | 138 | 11 , |
BPPearson | 0:8ce24e6c4de1 | 139 | 11 , |
BPPearson | 0:8ce24e6c4de1 | 140 | 12 , |
BPPearson | 0:8ce24e6c4de1 | 141 | 12 , |
BPPearson | 0:8ce24e6c4de1 | 142 | 12 , |
BPPearson | 0:8ce24e6c4de1 | 143 | 13 , |
BPPearson | 0:8ce24e6c4de1 | 144 | 13 , |
BPPearson | 0:8ce24e6c4de1 | 145 | 13 , |
BPPearson | 0:8ce24e6c4de1 | 146 | 14 , |
BPPearson | 0:8ce24e6c4de1 | 147 | 14 , |
BPPearson | 0:8ce24e6c4de1 | 148 | 14 , |
BPPearson | 0:8ce24e6c4de1 | 149 | 15 , |
BPPearson | 0:8ce24e6c4de1 | 150 | 15 , |
BPPearson | 0:8ce24e6c4de1 | 151 | 15 , |
BPPearson | 0:8ce24e6c4de1 | 152 | 16 , |
BPPearson | 0:8ce24e6c4de1 | 153 | 16 , |
BPPearson | 0:8ce24e6c4de1 | 154 | 16 , |
BPPearson | 0:8ce24e6c4de1 | 155 | 17 , |
BPPearson | 0:8ce24e6c4de1 | 156 | 17 , |
BPPearson | 0:8ce24e6c4de1 | 157 | 18 , |
BPPearson | 0:8ce24e6c4de1 | 158 | 18 , |
BPPearson | 0:8ce24e6c4de1 | 159 | 19 , |
BPPearson | 0:8ce24e6c4de1 | 160 | 19 , |
BPPearson | 0:8ce24e6c4de1 | 161 | 19 , |
BPPearson | 0:8ce24e6c4de1 | 162 | 20 , |
BPPearson | 0:8ce24e6c4de1 | 163 | 20 , |
BPPearson | 0:8ce24e6c4de1 | 164 | 21 , |
BPPearson | 0:8ce24e6c4de1 | 165 | 21 , |
BPPearson | 0:8ce24e6c4de1 | 166 | 22 , |
BPPearson | 0:8ce24e6c4de1 | 167 | 22 , |
BPPearson | 0:8ce24e6c4de1 | 168 | 23 , |
BPPearson | 0:8ce24e6c4de1 | 169 | 23 , |
BPPearson | 0:8ce24e6c4de1 | 170 | 24 , |
BPPearson | 0:8ce24e6c4de1 | 171 | 25 , |
BPPearson | 0:8ce24e6c4de1 | 172 | 25 , |
BPPearson | 0:8ce24e6c4de1 | 173 | 26 , |
BPPearson | 0:8ce24e6c4de1 | 174 | 26 , |
BPPearson | 0:8ce24e6c4de1 | 175 | 27 , |
BPPearson | 0:8ce24e6c4de1 | 176 | 28 , |
BPPearson | 0:8ce24e6c4de1 | 177 | 28 , |
BPPearson | 0:8ce24e6c4de1 | 178 | 29 , |
BPPearson | 0:8ce24e6c4de1 | 179 | 29 , |
BPPearson | 0:8ce24e6c4de1 | 180 | 30 , |
BPPearson | 0:8ce24e6c4de1 | 181 | 31 , |
BPPearson | 0:8ce24e6c4de1 | 182 | 32 , |
BPPearson | 0:8ce24e6c4de1 | 183 | 32 , |
BPPearson | 0:8ce24e6c4de1 | 184 | 33 , |
BPPearson | 0:8ce24e6c4de1 | 185 | 34 , |
BPPearson | 0:8ce24e6c4de1 | 186 | 35 , |
BPPearson | 0:8ce24e6c4de1 | 187 | 35 , |
BPPearson | 0:8ce24e6c4de1 | 188 | 36 , |
BPPearson | 0:8ce24e6c4de1 | 189 | 37 , |
BPPearson | 0:8ce24e6c4de1 | 190 | 38 , |
BPPearson | 0:8ce24e6c4de1 | 191 | 39 , |
BPPearson | 0:8ce24e6c4de1 | 192 | 40 , |
BPPearson | 0:8ce24e6c4de1 | 193 | 40 , |
BPPearson | 0:8ce24e6c4de1 | 194 | 41 , |
BPPearson | 0:8ce24e6c4de1 | 195 | 42 , |
BPPearson | 0:8ce24e6c4de1 | 196 | 43 , |
BPPearson | 0:8ce24e6c4de1 | 197 | 44 , |
BPPearson | 0:8ce24e6c4de1 | 198 | 45 , |
BPPearson | 0:8ce24e6c4de1 | 199 | 46 , |
BPPearson | 0:8ce24e6c4de1 | 200 | 47 , |
BPPearson | 0:8ce24e6c4de1 | 201 | 48 , |
BPPearson | 0:8ce24e6c4de1 | 202 | 50 , |
BPPearson | 0:8ce24e6c4de1 | 203 | 51 , |
BPPearson | 0:8ce24e6c4de1 | 204 | 52 , |
BPPearson | 0:8ce24e6c4de1 | 205 | 53 , |
BPPearson | 0:8ce24e6c4de1 | 206 | 54 , |
BPPearson | 0:8ce24e6c4de1 | 207 | 55 , |
BPPearson | 0:8ce24e6c4de1 | 208 | 57 , |
BPPearson | 0:8ce24e6c4de1 | 209 | 58 , |
BPPearson | 0:8ce24e6c4de1 | 210 | 59 , |
BPPearson | 0:8ce24e6c4de1 | 211 | 61 , |
BPPearson | 0:8ce24e6c4de1 | 212 | 62 , |
BPPearson | 0:8ce24e6c4de1 | 213 | 63 , |
BPPearson | 0:8ce24e6c4de1 | 214 | 65 , |
BPPearson | 0:8ce24e6c4de1 | 215 | 66 , |
BPPearson | 0:8ce24e6c4de1 | 216 | 68 , |
BPPearson | 0:8ce24e6c4de1 | 217 | 69 , |
BPPearson | 0:8ce24e6c4de1 | 218 | 71 , |
BPPearson | 0:8ce24e6c4de1 | 219 | 72 , |
BPPearson | 0:8ce24e6c4de1 | 220 | 74 , |
BPPearson | 0:8ce24e6c4de1 | 221 | 76 , |
BPPearson | 0:8ce24e6c4de1 | 222 | 77 , |
BPPearson | 0:8ce24e6c4de1 | 223 | 79 , |
BPPearson | 0:8ce24e6c4de1 | 224 | 81 , |
BPPearson | 0:8ce24e6c4de1 | 225 | 83 , |
BPPearson | 0:8ce24e6c4de1 | 226 | 85 , |
BPPearson | 0:8ce24e6c4de1 | 227 | 86 , |
BPPearson | 0:8ce24e6c4de1 | 228 | 88 , |
BPPearson | 0:8ce24e6c4de1 | 229 | 90 , |
BPPearson | 0:8ce24e6c4de1 | 230 | 92 , |
BPPearson | 0:8ce24e6c4de1 | 231 | 94 , |
BPPearson | 0:8ce24e6c4de1 | 232 | 97 , |
BPPearson | 0:8ce24e6c4de1 | 233 | 99 , |
BPPearson | 0:8ce24e6c4de1 | 234 | 101, |
BPPearson | 0:8ce24e6c4de1 | 235 | 103, |
BPPearson | 0:8ce24e6c4de1 | 236 | 105, |
BPPearson | 0:8ce24e6c4de1 | 237 | 108, |
BPPearson | 0:8ce24e6c4de1 | 238 | 110, |
BPPearson | 0:8ce24e6c4de1 | 239 | 113, |
BPPearson | 0:8ce24e6c4de1 | 240 | 115, |
BPPearson | 0:8ce24e6c4de1 | 241 | 118, |
BPPearson | 0:8ce24e6c4de1 | 242 | 120, |
BPPearson | 0:8ce24e6c4de1 | 243 | 123, |
BPPearson | 0:8ce24e6c4de1 | 244 | 126, |
BPPearson | 0:8ce24e6c4de1 | 245 | 129, |
BPPearson | 0:8ce24e6c4de1 | 246 | 131, |
BPPearson | 0:8ce24e6c4de1 | 247 | 134, |
BPPearson | 0:8ce24e6c4de1 | 248 | 137, |
BPPearson | 0:8ce24e6c4de1 | 249 | 140, |
BPPearson | 0:8ce24e6c4de1 | 250 | 143, |
BPPearson | 0:8ce24e6c4de1 | 251 | 147, |
BPPearson | 0:8ce24e6c4de1 | 252 | 150, |
BPPearson | 0:8ce24e6c4de1 | 253 | 153, |
BPPearson | 0:8ce24e6c4de1 | 254 | 157, |
BPPearson | 0:8ce24e6c4de1 | 255 | 160, |
BPPearson | 0:8ce24e6c4de1 | 256 | 164, |
BPPearson | 0:8ce24e6c4de1 | 257 | 167, |
BPPearson | 0:8ce24e6c4de1 | 258 | 171, |
BPPearson | 0:8ce24e6c4de1 | 259 | 175, |
BPPearson | 0:8ce24e6c4de1 | 260 | 179, |
BPPearson | 0:8ce24e6c4de1 | 261 | 183, |
BPPearson | 0:8ce24e6c4de1 | 262 | 187, |
BPPearson | 0:8ce24e6c4de1 | 263 | 191, |
BPPearson | 0:8ce24e6c4de1 | 264 | 195, |
BPPearson | 0:8ce24e6c4de1 | 265 | 199, |
BPPearson | 0:8ce24e6c4de1 | 266 | 204, |
BPPearson | 0:8ce24e6c4de1 | 267 | 208, |
BPPearson | 0:8ce24e6c4de1 | 268 | 213, |
BPPearson | 0:8ce24e6c4de1 | 269 | 218, |
BPPearson | 0:8ce24e6c4de1 | 270 | 222, |
BPPearson | 0:8ce24e6c4de1 | 271 | 227, |
BPPearson | 0:8ce24e6c4de1 | 272 | 232, |
BPPearson | 0:8ce24e6c4de1 | 273 | 237, |
BPPearson | 0:8ce24e6c4de1 | 274 | 243, |
BPPearson | 0:8ce24e6c4de1 | 275 | 248}; |
BPPearson | 0:8ce24e6c4de1 | 276 | |
BPPearson | 0:8ce24e6c4de1 | 277 | #endif |
BPPearson | 0:8ce24e6c4de1 | 278 |