Freeplaytech Forum

Full Version: Program to control TFT Backlight 'sleep mode' with juj/fbcp-ili9341 driver
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This programs is design to work aside of Freeplay setPCA9633 on Raspberry Pi 3 on Freeplay Zero/CM3 platform (with installed backlight control).
It also require to have juj fbcp-ili9341 driver running with backlight control and backlight pin set.

# Provided scripts :
- : Compile cpp file (run this first).
- : Install service (need restart)
- : Remove service

GitHub :


Please note: This line use gpio pin 31, I don't think it's in use but not sure...
Don't miss to edit nns-freeplay-backlight-daemon.service set path and pin correctly.

- [DONE] Monitor evdev, need more work to ignore analog input (workaround for noisy line)
- [ABORT] go in sleep mode if no input detected, wrong idea if some want to watch a movie...
- [DONE] Look around pthread to avoid use of system()

pthread version look stable, reduce cpu load by around 2-3 time but 'huge' increase in memory usage. There is 2 child threads (gpio, evdev), 8mb heap for each.
Once again, this is quite awesome. At some point, I would like to add this (at least as an option) in the Freeplay CM3/Zero SD image. Would you have any problem with that?
Thanks Smile
No problem at all Wink

Please note that sleep and wake are together based on gpio, no inputs events whatsoever.
I don't have any way to check how the program behave on Zero, so if you can check on your side Smile

GPIO_TFT_BACKLIGHT can only be 0-31 for reason I don't understand, if you have another pin pin in this range that will never be in use, i will be glad to update the git as well Wink

If you want, I will take a look on evdev monitoring, a simple 'cat' may do the tick, but I am going to be really busy in next days.
Updated service file for autorestart on crash.
If you can want a bit, I missed a 'security', in current code, there is no check if file use to return to wake brightness does not exist. Will add this maybe the afternoon Smile
To be honest, Porcinus, I have been really busy with several other things lately. I have not had a chance to work on software much lately. If you wanted to look at the evdev stuff, that'd be awesome. If you had an easy way to install this into a working/running Freeplay CM3 image, that'd be even better. Then, I could make a new image with your mods and test it. If things seem fine, then maybe that should be in our next SD image. Any help I could get in making that go smooth would be really appreciated. I'd try to support that however we can.
Right now, Backlight and Overlay programs fully work in my current setup.

You just have to clone git and run '' to build binary, Overlay require libgd-dev, libpng-dev, zlib1g-dev, libfreetype6-dev, ffmpeg and omxplayer.

-To install Overlay, please refer to 'service/install.txt', to use hotkey in addon board set pin to 41, for power switch set pin to 20 and add argument ' -reverselogic'.

-To install Backlight:
Compile juj fbcp-ili9341 driver with backlight control enable:
git clone
cd fbcp-ili9341
mkdir build
cd build
make -j
sudo ./fbcp-ili9341

Then edit path in 'nns-freeplay-backlight-daemon.service' and run ''

Should work as is Smile