Added setPixel method

This commit is contained in:
Clément SAILLANT
2025-02-10 17:53:13 +01:00
parent 3ba7da20ec
commit 18d3496421
2 changed files with 19 additions and 3 deletions
+6 -2
View File
@@ -2,7 +2,9 @@
multiple LED display objects
Copyright (c) 2024 Kurt Funderburg
2025 Clément SAILLANT
=> added setPixel method
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@@ -127,6 +129,8 @@ public:
uint32_t getBalance() { return colorBalance; }
void setPixel(uint32_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w);
private:
static void isr(void);
@@ -180,4 +184,4 @@ void fadeToColorBy(void*, uint16_t, uint32_t, uint8_t);
//Safe to specify -Y, -X corner, safe to draw a box which partially fits on LED plane.
void drawSquare(void*, uint16_t, uint16_t, int, int, uint32_t, uint32_t);
#endif
#endif
+13 -1
View File
@@ -55,6 +55,9 @@ GOIO9List = { 2, 3, 4, 5, 29, 33, 48, 49, 50, 51, 52, 53, 54 } //6 top, 7 botto
* Set DSE=3, SPEED=0, SRE=0 on output pins per experiment & PJRC forum guidance
* New default values for TH_TL, T0H, T1H, LATCH_DELAY to work with Audio lib and more LED types
* Added wait for prior xmission to complete in destructor
* CHANGES by Clément SAILLANT:
* Added setPixel method
* Added support for GRBW LED strips
*/
#ifndef __IMXRT1062__
@@ -648,4 +651,13 @@ void drawSquare(void* leds, uint16_t planeY, uint16_t planeX, int yCorner, int x
} //for y
} // drawSquare()
#endif // __IMXRT1062__
void ObjectFLED::setPixel(uint32_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
if (index < numbytes / 4) {
frameBuffer[index * 4] = r;
frameBuffer[index * 4 + 1] = g;
frameBuffer[index * 4 + 2] = b;
frameBuffer[index * 4 + 3] = w;
}
}
#endif // __IMXRT1062__