Skip to content

Commit

Permalink
Update drv_sm16703P.c
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Jan 22, 2025
1 parent 36f6035 commit bd8ff20
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/driver/drv_sm16703P.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,6 @@ bool SM16703P_VerifyPixel(uint32_t pixel, byte r, byte g, byte b) {
}


void SM16703P_setMultiplePixel(uint32_t pixel, uint8_t *data, bool push) {

// Return if driver is not loaded
if (!spiLED.ready)
return;

// Check max pixel
if (pixel > pixel_count)
pixel = pixel_count;

// Iterate over pixel
uint8_t *dst = spiLED.buf + spiLED.ofs;
for (uint32_t i = 0; i < pixel; i++) {
uint8_t r, g, b;
r = *data++;
g = *data++;
b = *data++;
SM16703P_setPixel((int) i, (int) r, (int) g, (int)b);
}
if (push) {
SPIDMA_StartTX(spiLED.msg);
}
}
void SM16703P_setPixel(int pixel, int r, int g, int b) {
if (!spiLED.ready)
return;
Expand Down Expand Up @@ -114,6 +91,29 @@ void SM16703P_setPixel(int pixel, int r, int g, int b) {
translate_byte(b1, spiLED.buf + (spiLED.ofs + 4 + (pixel * 3 * 4)));
translate_byte(b2, spiLED.buf + (spiLED.ofs + 8 + (pixel * 3 * 4)));
}
void SM16703P_setMultiplePixel(uint32_t pixel, uint8_t *data, bool push) {

// Return if driver is not loaded
if (!spiLED.ready)
return;

// Check max pixel
if (pixel > pixel_count)
pixel = pixel_count;

// Iterate over pixel
uint8_t *dst = spiLED.buf + spiLED.ofs;
for (uint32_t i = 0; i < pixel; i++) {
uint8_t r, g, b;
r = *data++;
g = *data++;
b = *data++;
SM16703P_setPixel((int)i, (int)r, (int)g, (int)b);
}
if (push) {
SPIDMA_StartTX(spiLED.msg);
}
}
extern float g_brightness0to100;//TODO
void SM16703P_setPixelWithBrig(int pixel, int r, int g, int b) {
#if ENABLE_LED_BASIC
Expand Down

0 comments on commit bd8ff20

Please sign in to comment.