AddNew屏幕BacklightDriver¶
Adding a new screen backlight driver is mainly divided into:
Add macro definitions for the driver IC in the Kconfig file¶
Open the SDK\customer\peripherals\Kconfig file and find the definition of other backlights,Such asBL_USING_AW9364
的config,Add a new config afterward(For exampleJoin的ICNameForNW9527):
config BL_USING_NW9527
def_bool n
Copy similar driver code and add it to the compilation¶
Find the aw9364 directory under SDK\customer\peripherals,
Copy the entire directory and rename it to “nw9527”
Inside的Driver.cFile也Change成nw9527.c, 并ModifyInside的Content。
Inside的SConscriptFile中的dependMacroChange to前面Add的
BL_USING_NW9527
,Let新加的FileJoinCompile
Modify the copied driver file¶
Here is an example of the aw9364 backlight driver:
Initialize¶
In the aw9364_init
function, initialize the control pin LCD_BACKLIGHT_CONTROL_PIN
as a GPIO output and set it to low (turn off the backlight)。
Set backlight brightness¶
In the callback function backligt_set
, convert the brightness percentage passed down from the upper layer(Based on the brightness level supported by the backlight IC),Then pass it to the sif_aw9364_set_backlight
function to set the brightness。
Read backlight brightness¶
In the callback function backligt_get
, use the variable aw9364_bl to return the brightness because this backlight chip does not support reading the brightness level。