|
|
@ -11,9 +11,11 @@ |
|
|
|
enum PinCmd_ { |
|
|
|
enum PinCmd_ { |
|
|
|
CMD_CLEAR = 0, |
|
|
|
CMD_CLEAR = 0, |
|
|
|
CMD_LOAD = 1, |
|
|
|
CMD_LOAD = 1, |
|
|
|
CMD_LOAD_U32_LE = 2, |
|
|
|
CMD_LOAD_ZRGB = 0x08, // 0,0 - trail zero, bgr
|
|
|
|
CMD_LOAD_U32_BE = 3, |
|
|
|
CMD_LOAD_ZBGR = 0x09, // 0,1
|
|
|
|
CMD_GET_LEN = 4, |
|
|
|
CMD_LOAD_RGBZ = 0x0A, // 1,0
|
|
|
|
|
|
|
|
CMD_LOAD_BGRZ = 0x0B, // 1,1
|
|
|
|
|
|
|
|
CMD_GET_LEN = 0x10, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** Handle a request message */ |
|
|
|
/** Handle a request message */ |
|
|
@ -32,15 +34,15 @@ static error_t Npx_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, Pa |
|
|
|
bytes = pp_tail(pp, &len); |
|
|
|
bytes = pp_tail(pp, &len); |
|
|
|
return UU_Npx_Load(unit, bytes, len); |
|
|
|
return UU_Npx_Load(unit, bytes, len); |
|
|
|
|
|
|
|
|
|
|
|
/** Load sparse (uint32_t) colors, 0x00RRGGBB, little endian. */ |
|
|
|
/** Load sparse (uint32_t) colors */ |
|
|
|
case CMD_LOAD_U32_LE: |
|
|
|
case CMD_LOAD_ZRGB: |
|
|
|
|
|
|
|
case CMD_LOAD_ZBGR: |
|
|
|
|
|
|
|
case CMD_LOAD_RGBZ: |
|
|
|
|
|
|
|
case CMD_LOAD_BGRZ: |
|
|
|
bytes = pp_tail(pp, &len); |
|
|
|
bytes = pp_tail(pp, &len); |
|
|
|
return UU_Npx_LoadU32LE(unit, bytes, len); |
|
|
|
bool trail_zero = (bool) (command & 0b10); |
|
|
|
|
|
|
|
bool order_bgr = (bool) (command & 0b01); |
|
|
|
/** Load sparse (uint32_t) colors, 0x00RRGGBB, big endian. */ |
|
|
|
return UU_Npx_Load32(unit, bytes, len, order_bgr, !trail_zero); |
|
|
|
case CMD_LOAD_U32_BE: |
|
|
|
|
|
|
|
bytes = pp_tail(pp, &len); |
|
|
|
|
|
|
|
return UU_Npx_LoadU32BE(unit, bytes, len); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Get the Neopixel strip length */ |
|
|
|
/** Get the Neopixel strip length */ |
|
|
|
case CMD_GET_LEN:; |
|
|
|
case CMD_GET_LEN:; |
|
|
|