# C-Berry_Display

Some code to bring the C-Berry Display alive. 
Updated code from admatec GmbH so it will compile with newer gcc-versions


## Dependencies:

### Raspberry Pi Userland: https://github.com/raspberrypi/userland
	$ sudo apt install build-essential pkg-config cmake
	$ mkdir /tmp/ramdisk
	$ sudo mount -t tmpfs -o size=128M tmpfs /tmp/ramdisk
	$ cd /tmp/ramdisk
	$ git clone https://github.com/raspberrypi/userland
	$ cd userland
	$ ./buildme

Add login username to /etc/group for audio, video:

	...
	audio:x:29:username
	video:x:44:username
	...

Create '/etc/udev/rules.d/10-local-rpi.rules', to set VC device group and permissions:

	SUBSYSTEM=="vchiq", GROUP="video", MODE="0660"
	SUBSYSTEM=="vc-sm", GROUP="video", MODE="0660"
	SUBSYSTEM=="bcm2708_vcio", GROUP="video", MODE="0660"

Then reboot:

	$ sudo reboot

Testing (shows a rotating tiger):
	$ sudo apt install libfreetype6-dev

	$ cd /opt/vc/src/hello_pi
	$ sudo sh rebuild.sh
	$ export LD_LIBRARY_PATH=/opt/vc/lib
	$ ./hello_tiger/hello_tiger.bin


### BCM2835 c library for Raspberry Pi:
Look for the latest version (http://www.airspayce.com/mikem/bcm2835/)

	$ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-$VERSION.tar.gz

	$ tar zxvf bcm2835-$VERSION.tar.gz
	$ cd bcm2835-1.36
	$ ./configure
	$ make
	$ sudo make check
	$ sudo make install

## Compile
* Complie tft_test and fb2cberry with "make"
* Go to the root folder

	$ cd SW/tft_test
	$ make
	$ sudo ./tft_test	# shows some test pictures and waits for touch input (if availabe)


	$ cd SW/fb2cberry
	$ make
	$ sudo ./fb2cberry &	# copys the HDMI output to the framebuffer (around 2% cpu usage), very slow and runs in the background (because of "&")



