din renames, dout split
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include "ws2812.h"
|
||||
|
||||
/* Clear the strip */
|
||||
error_t UU_NEOPIXEL_Clear(Unit *unit)
|
||||
error_t UU_Npx_Clear(Unit *unit)
|
||||
{
|
||||
CHECK_TYPE(unit, &UNIT_NEOPIXEL);
|
||||
|
||||
@@ -21,7 +21,7 @@ error_t UU_NEOPIXEL_Clear(Unit *unit)
|
||||
}
|
||||
|
||||
/* Load packed */
|
||||
error_t UU_NEOPIXEL_Load(Unit *unit, const uint8_t *packed_rgb, uint32_t nbytes)
|
||||
error_t UU_Npx_Load(Unit *unit, const uint8_t *packed_rgb, uint32_t nbytes)
|
||||
{
|
||||
CHECK_TYPE(unit, &UNIT_NEOPIXEL);
|
||||
|
||||
@@ -43,19 +43,19 @@ static error_t load_u32(Unit *unit, const uint8_t *bytes, uint32_t nbytes, bool
|
||||
}
|
||||
|
||||
/* Load U32, LE */
|
||||
inline error_t UU_NEOPIXEL_LoadU32LE(Unit *unit, const uint8_t *bytes, uint32_t nbytes)
|
||||
inline error_t UU_Npx_LoadU32LE(Unit *unit, const uint8_t *bytes, uint32_t nbytes)
|
||||
{
|
||||
return load_u32(unit, bytes, nbytes, false);
|
||||
}
|
||||
|
||||
/* Load U32, BE */
|
||||
inline error_t UU_NEOPIXEL_LoadU32BE(Unit *unit, const uint8_t *bytes, uint32_t nbytes)
|
||||
inline error_t UU_Npx_LoadU32BE(Unit *unit, const uint8_t *bytes, uint32_t nbytes)
|
||||
{
|
||||
return load_u32(unit, bytes, nbytes, true);
|
||||
}
|
||||
|
||||
/* Get the pixel count */
|
||||
error_t UU_NEOPIXEL_GetCount(Unit *unit, uint16_t *count)
|
||||
error_t UU_Npx_GetCount(Unit *unit, uint16_t *count)
|
||||
{
|
||||
CHECK_TYPE(unit, &UNIT_NEOPIXEL);
|
||||
|
||||
|
||||
@@ -26,27 +26,27 @@ static error_t Npx_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, Pa
|
||||
switch (command) {
|
||||
/** Clear the entire strip */
|
||||
case CMD_CLEAR:
|
||||
return UU_NEOPIXEL_Clear(unit);
|
||||
return UU_Npx_Clear(unit);
|
||||
|
||||
/** Load packed RGB colors (length must match the strip size) */
|
||||
case CMD_LOAD:;
|
||||
bytes = pp_tail(pp, &len);
|
||||
return UU_NEOPIXEL_Load(unit, bytes, len);
|
||||
return UU_Npx_Load(unit, bytes, len);
|
||||
|
||||
/** Load sparse (uint32_t) colors, 0x00RRGGBB, little endian. */
|
||||
case CMD_LOAD_U32_LE:
|
||||
bytes = pp_tail(pp, &len);
|
||||
return UU_NEOPIXEL_LoadU32LE(unit, bytes, len);
|
||||
return UU_Npx_LoadU32LE(unit, bytes, len);
|
||||
|
||||
/** Load sparse (uint32_t) colors, 0x00RRGGBB, big endian. */
|
||||
case CMD_LOAD_U32_BE:
|
||||
bytes = pp_tail(pp, &len);
|
||||
return UU_NEOPIXEL_LoadU32BE(unit, bytes, len);
|
||||
return UU_Npx_LoadU32BE(unit, bytes, len);
|
||||
|
||||
/** Get the Neopixel strip length */
|
||||
case CMD_GET_LEN:;
|
||||
uint16_t count;
|
||||
TRY(UU_NEOPIXEL_GetCount(unit, &count));
|
||||
TRY(UU_Npx_GetCount(unit, &count));
|
||||
com_respond_u16(frame_id, count);
|
||||
return E_SUCCESS;
|
||||
|
||||
@@ -59,7 +59,7 @@ static error_t Npx_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, Pa
|
||||
|
||||
/** Unit template */
|
||||
const UnitDriver UNIT_NEOPIXEL = {
|
||||
.name = "NEOPIXEL",
|
||||
.name = "NPX",
|
||||
.description = "Neopixel RGB LED strip",
|
||||
// Settings
|
||||
.preInit = Npx_preInit,
|
||||
|
||||
@@ -18,7 +18,7 @@ extern const UnitDriver UNIT_NEOPIXEL;
|
||||
* @param unit
|
||||
* @return success
|
||||
*/
|
||||
error_t UU_NEOPIXEL_Clear(Unit *unit);
|
||||
error_t UU_Npx_Clear(Unit *unit);
|
||||
|
||||
/**
|
||||
* Load the strip with packed bytes R,G,B.
|
||||
@@ -28,7 +28,7 @@ error_t UU_NEOPIXEL_Clear(Unit *unit);
|
||||
* @param nbytes - number of bytes, must be count*3
|
||||
* @return success
|
||||
*/
|
||||
error_t UU_NEOPIXEL_Load(Unit *unit, const uint8_t *packed_rgb, uint32_t nbytes);
|
||||
error_t UU_Npx_Load(Unit *unit, const uint8_t *packed_rgb, uint32_t nbytes);
|
||||
|
||||
/**
|
||||
* Load the strip with sparse (uint32_t) colors 0x00RRGGBB as little endian bytes
|
||||
@@ -39,7 +39,7 @@ error_t UU_NEOPIXEL_Load(Unit *unit, const uint8_t *packed_rgb, uint32_t nbytes)
|
||||
* @param nbytes - number of bytes, must be count*4
|
||||
* @return success
|
||||
*/
|
||||
error_t UU_NEOPIXEL_LoadU32LE(Unit *unit, const uint8_t *bytes, uint32_t nbytes);
|
||||
error_t UU_Npx_LoadU32LE(Unit *unit, const uint8_t *bytes, uint32_t nbytes);
|
||||
|
||||
/**
|
||||
* Load the strip with sparse (uint32_t) colors 0x00RRGGBB as big endian bytes
|
||||
@@ -50,7 +50,7 @@ error_t UU_NEOPIXEL_LoadU32LE(Unit *unit, const uint8_t *bytes, uint32_t nbytes)
|
||||
* @param nbytes - number of bytes, must be count*4
|
||||
* @return success
|
||||
*/
|
||||
error_t UU_NEOPIXEL_LoadU32BE(Unit *unit, const uint8_t *bytes, uint32_t nbytes);
|
||||
error_t UU_Npx_LoadU32BE(Unit *unit, const uint8_t *bytes, uint32_t nbytes);
|
||||
|
||||
/**
|
||||
* Get number of pixels on the strip
|
||||
@@ -59,6 +59,6 @@ error_t UU_NEOPIXEL_LoadU32BE(Unit *unit, const uint8_t *bytes, uint32_t nbytes)
|
||||
* @param count - destination for the count value
|
||||
* @return success
|
||||
*/
|
||||
error_t UU_NEOPIXEL_GetCount(Unit *unit, uint16_t *count);
|
||||
error_t UU_Npx_GetCount(Unit *unit, uint16_t *count);
|
||||
|
||||
#endif //U_NEOPIXEL_H
|
||||
|
||||
Reference in New Issue
Block a user