Is it possible to turn off the backlight in software?
Yes it is;
# Turn off backlight echo 1 | sudo tee /sys/class/backlight/*/bl_power # Turn on backlight echo 0 | sudo tee /sys/class/backlight/*/bl_power
What was the old method to enabled PiScreen drivers?
1. Edit /boot/config.txt
2. Edit /etc/modules
Copy and paste the code below into this file;
flexfb width=320 height=480 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0x36,0x28,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x0,0x0,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x11,-1,0X29,-3 fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24,led:22 ads7846_device gpio_pendown=17 verbose=3 x_plate_ohms=100 pressure_max=255 swap_xy=1
How do I rotate the display on PiScreen?
Rotating the display on PiScreen to portrait mode can be done by editing /boot/config.txt and adding the optional rotation parameter after the overlay statement
The values, 0, 90, 180, 270 are supported.
How do I Change DPI for X Windows?
The DPI can be set when starting X windows. Changing the DPI can give you a bit more screen real-estate.
To make a permanent change;
edit /usr/bin/startx as root and enter in some default server arguments.
defaultserverargs=”-dpi 60” serverargs=”-dpi 60”
How do I use python to display information on PiScreen?
You will need to use the pygame module to display information on PiScreen with Python.
And before you call pygame.init(), you need to set the environment variable to point the output to PiScreen. (/dev/fb1).
import pygame, sys, os from pygame.locals import * os.putenv('SDL_FBDEV', '/dev/fb1') pygame.init() # set up the window DISPLAYSURF = pygame.display.set_mode((480, 320)) # set up the colors BLACK = ( 0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = ( 0, 255, 0) BLUE = ( 0, 0, 255) # draw on the surface object DISPLAYSURF.fill(WHITE) pygame.draw.polygon(DISPLAYSURF, GREEN, ((146, 0), (291, 106), (236, 277), (56, 277), (0, 106))) pygame.draw.line(DISPLAYSURF, BLUE, (60, 60), (120, 60), 4) pygame.draw.line(DISPLAYSURF, BLUE, (120, 60), (60, 120)) pygame.draw.line(DISPLAYSURF, BLUE, (60, 120), (120, 120), 4) pygame.draw.circle(DISPLAYSURF, BLUE, (300, 50), 20, 0) pygame.draw.ellipse(DISPLAYSURF, RED, (300, 200, 40, 80), 1) pygame.draw.rect(DISPLAYSURF, RED, (200, 150, 100, 50)) pixObj = pygame.PixelArray(DISPLAYSURF) pixObj = BLACK pixObj = BLACK pixObj = BLACK pixObj = BLACK pixObj = BLACK del pixObj # run the game loop while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() pygame.display.update()
How do I use PiScreen with XBMC?
PiScreen isnt supported on XBMC. However there is a work around to copy what is display on the HDMI port(fb0) to the PiScreen.
To do this, we will need Framebuffer Copy.
pi@raspberrypi ~ $ git clone https://github.com/tasanakorn/rpi-fbcp
pi@raspberrypi ~ $ cd rpi-fbcp/
pi@raspberrypi ~ $ mkdir build
pi@raspberrypi ~ $ cmake ..
pi@raspberrypi ~ $ make
pi@raspberrypi ~ $ sudo install fbcp /usr/local/bin/fbcp
To use Framebuffer Copy the console needs to be on fb0. If it isnt already there, you can change it to fb0 using this command;
The run framebuffer copy in the background
You should now have fb0 mirrored onto fb1(PiScreen).
How to rotate the touchscreen on a PiScreen
If you rotate the display on the TFT, you will also need to rotate the touchscreen.
If you haven’t already done so, install xinput.
Open up the X init script
And add these lines;
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 1 DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 1
You may need to change the values at the end of the each line;
Evdev Axes Swap
Swap X & Y
1 for yes and 0 for no
Evdev Axis Inversion
Swap the direction on the X or Y plane.
1 for yes and 0 for no. A number is needed for each plane
You may also need to re-calibrate the touch screen for X windows. This can be done by deleting the file below and then rebooting;
How to Re-calibrate the Touchscreen input for X Windows
The calibration script runs every time X Windows starts
It first checks for the calibration file and if it is present it then loads this data into X windows.
If the calibration data is not present, it will then start the calibration program.
To rerun the calibration program, delete
No console out of the HDMI port.
When the console is moved to the PiScreen, no console will appear out the HDMI port.
The console can be moved back to the HDMI port by deleting the text below from /boot/cmdline.txt
fbcon=map:10 fbcon=rotate:2 fbcon=font:ProFont6x11
This can be down from a Windows or Mac PC.
You can always leave the console on the HDMI and manually swing it over to piscreen with
con2fbmap 1 1
and back to the HDMI with
con2fbmap 1 0
This will have to be done every time the Pi is booted.
Will a 5v 1.5A battery be able to power a Raspberry Pi with a PiScreen?
How do I disable console blanking?
How to disable console blanking
Will PiScreen work with the Raspberry Pi B+?
Yes it will.
Change DPI on X Windows
Does PiScreen need an external power supply?
No battery or external power source needed. PiScreen gets it’s power off the Raspberry Pi through the GPIO pins.
Does PiScreen work with the Raspberry Pi Model A?
Yes, it sure does.
What version of O/S does PiScreen work with?
Currently, the only O/S PiScreen works at 100% is Raspbian.
There is a hack to get it working with RaspBMC, which is to copy the image from the normal display output (HDMI/RCA) to PiScreen. This makes the touch input unusable and shows video with poor quality .
We will share any updates we have of PiScreen working with other O/Ss.
What about the unused GPIO?
The remaining I/O pins are presented somewhere else on the PCB for PiScreens V1 only.
The free GPIO are;