From 74b4098608d2ed05586d70af7542d40963bad72b Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Tue, 27 Jan 2026 20:32:38 +0100 Subject: [PATCH] ili9341: tested backlight dimming (doesn't work with my displays, either) probably the LED pins are hardcoded with my displays. They respond neither to PWM on the LED pin nor to ili9341 commands. --- avr/modules/lcd2/ili9341/main.asm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/avr/modules/lcd2/ili9341/main.asm b/avr/modules/lcd2/ili9341/main.asm index 728f202..1290e24 100644 --- a/avr/modules/lcd2/ili9341/main.asm +++ b/avr/modules/lcd2/ili9341/main.asm @@ -46,7 +46,7 @@ ILI9341_Init: rcall ILI9341_Reset rcall ILI9341_LeaveSleepMode - ldi r16, 0xff + ldi r16, 0x20 rcall ILI9341_SetBacklight sec @@ -146,13 +146,14 @@ ILI9341_SetBacklight: ILI9341_SetBacklight_on: sbi ILI9341_LED_OUTPUT, ILI9341_LED_PIN ret ; DEBUG + push r16 rcall ili9341BeginSpi ldi r16, ILI9341_CMD_WRITECTLDISPLAY rcall ili9341SendCommand - ; ldi r16, 0b00100100 - ldi r16, 0x24 + ; BCTRL=1, DD=1, BL=1 (or: 0x24 reported to work) + ldi r16, (1<<5) | (1<<3) | (1<<2) rcall ili9341SendData ldi r16, ILI9341_CMD_SETDSPBRIGHTNESS @@ -160,10 +161,10 @@ ret ; DEBUG pop r16 rcall ili9341SendData - ldi r16, 0xbe - rcall ili9341SendCommand - ldi r16, 0x0f - rcall ili9341SendData +; ldi r16, 0xbe +; rcall ili9341SendCommand +; ldi r16, 0x0f +; rcall ili9341SendData rcall ili9341EndSpi