Page 172 - MDP2022-2
P. 172
LED_Data2[LEDnum][3] = Blue;
}
void Set_Brightness(int brightness) // 0-45
{
#if USE_BRIGHTNESS
if (brightness > 45)
brightness = 45;
for (int i = 0; i < MAX_LED; i++) {
LED_Mod[i][0] = LED_Data[i][0];
for (int j = 1; j < 4; j++) {
float angle = 90 - brightness; // in degrees
angle = angle * 3.141592 / 180; // in rad
LED_Mod[i][j] = (LED_Data[i][j]) / (tan(angle));
}
}
#endif
}
void Set_Brightness2(int brightness) // 0-45
{
#if USE_BRIGHTNESS
if (brightness > 45)
brightness = 45;
for (int i = 0; i < MAX_LED2; i++) {
LED_Mod2[i][0] = LED_Data2[i][0];
for (int j = 1; j < 4; j++) {
float angle = 90 - brightness; // in degrees
angle = angle * 3.141592 / 180; // in rad
LED_Mod2[i][j] = (LED_Data2[i][j]) / (tan(angle));
}
}
#endif
}
void WS2812_Send(void) {
uint32_t indx = 0;
uint32_t color;
for (int i = 0; i < MAX_LED; i++) {
#if USE_BRIGHTNESS
color = ((LED_Mod[i][1] << 16) | (LED_Mod[i][2] << 8) | (LED_Mod[i][3]));
#else
color = ((LED_Data[i][1] << 16) | (LED_Data[i][2] << 8) | (LED_Data[i][3]));