| 498 | } |
| 499 | |
| 500 | static SDL_bool SetHomeLED(SDL_DriverSwitch_Context *ctx, Uint8 brightness) |
| 501 | { |
| 502 | Uint8 ucLedIntensity = 0; |
| 503 | Uint8 rgucBuffer[4]; |
| 504 | |
| 505 | if (brightness > 0) { |
| 506 | if (brightness < 65) { |
| 507 | ucLedIntensity = (brightness + 5) / 10; |
| 508 | } else { |
| 509 | ucLedIntensity = (Uint8)SDL_ceilf(0xF * SDL_powf((float)brightness / 100.f, 2.13f)); |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | rgucBuffer[0] = (0x0 << 4) | 0x1; /* 0 mini cycles (besides first), cycle duration 8ms */ |
| 514 | rgucBuffer[1] = ((ucLedIntensity & 0xF) << 4) | 0x0; /* LED start intensity (0x0-0xF), 0 cycles (LED stays on at start intensity after first cycle) */ |
| 515 | rgucBuffer[2] = ((ucLedIntensity & 0xF) << 4) | 0x0; /* First cycle LED intensity, 0x0 intensity for second cycle */ |
| 516 | rgucBuffer[3] = (0x0 << 4) | 0x0; /* 8ms fade transition to first cycle, 8ms first cycle LED duration */ |
| 517 | |
| 518 | return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetHomeLight, rgucBuffer, sizeof(rgucBuffer), NULL); |
| 519 | } |
| 520 | |
| 521 | static SDL_bool SetSlotLED(SDL_DriverSwitch_Context *ctx, Uint8 slot) |
| 522 | { |
no test coverage detected