caller provides little-endian pixels @@ could double buffer "buffer" to get some aysnc sending in this loop
| 219 | // caller provides little-endian pixels |
| 220 | //@@ could double buffer "buffer" to get some aysnc sending in this loop |
| 221 | void dotstarSend_16LE(PocoPixel *pixels, int byteLength, void *refcon) |
| 222 | { |
| 223 | spiDisplay sd = refcon; |
| 224 | uint8_t *brightness = sd->brightness; |
| 225 | |
| 226 | if (byteLength < 0) byteLength = -byteLength; |
| 227 | while (byteLength > 0) { |
| 228 | uint8_t buffer[16 * 4]; |
| 229 | uint8_t *bgr = buffer; |
| 230 | uint16_t count = (byteLength >= 32) ? 32 : byteLength; |
| 231 | uint16_t counter = count >> 1; |
| 232 | |
| 233 | while (counter--) { |
| 234 | PocoPixel pixel = *pixels++; |
| 235 | uint8_t t; |
| 236 | |
| 237 | *bgr++ = 0xff; |
| 238 | |
| 239 | t = pixel & 0x1F; |
| 240 | *bgr++ = brightness[(t << 3) | (t >> 3)]; |
| 241 | |
| 242 | t = (pixel >> 5) & 0x3F; |
| 243 | *bgr++ = brightness[(t << 2) | (t >> 4)]; |
| 244 | |
| 245 | t = pixel >> 11; |
| 246 | *bgr++ = brightness[(t << 3) | (t >> 3)]; |
| 247 | } |
| 248 | |
| 249 | modSPITx(&sd->spiConfig, (void *)buffer, count << 1); |
| 250 | modSPIFlush(); |
| 251 | |
| 252 | byteLength -= count; |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | void dotstarChipSelect(uint8_t active, modSPIConfiguration config) |
| 257 | { |
nothing calls this directly
no test coverage detected