From 14a4d1fa2bd0534386549a5edeef995f522fb313 Mon Sep 17 00:00:00 2001 From: Rudy Hardeman Date: Tue, 10 May 2016 16:04:50 +0000 Subject: [PATCH] Added manual for oled driver installation --- OLED.cpp | 31 +++++++++++++++++++++++++++++++ OLED.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 +++ 3 files changed, 81 insertions(+) create mode 100644 OLED.md diff --git a/OLED.cpp b/OLED.cpp index d9c3cac..42cd03d 100644 --- a/OLED.cpp +++ b/OLED.cpp @@ -102,6 +102,17 @@ void COLED::setLockoutInt() void COLED::writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector) { m_mode = MODE_DSTAR; + display.fillRect(0, OLED_LINE1, display.width(), 10, BLACK); + display.setCursor(0,OLED_LINE1); + display.printf("%s %.8s/%4.4s", type, my1, my2); + display.fillRect(0, OLED_LINE2, display.width(), 10, BLACK); + display.setCursor(0,OLED_LINE2); + display.printf("via %.8s", reflector); + display.fillRect(0, OLED_LINE3, display.width(), 10, BLACK); + display.setCursor(0,OLED_LINE3); + display.printf("%.8s <- %-8s", your, reflector); + OLED_statusbar(); + display.display(); } void COLED::clearDStarInt() @@ -109,6 +120,8 @@ void COLED::clearDStarInt() display.fillRect(0, OLED_LINE1, display.width(), 10, BLACK); display.setCursor(0,OLED_LINE1); display.print("Listening"); + display.fillRect(0, OLED_LINE2, display.width(), 10, BLACK); + display.fillRect(0, OLED_LINE3, display.width(), 10, BLACK); OLED_statusbar(); display.display(); } @@ -177,10 +190,24 @@ void COLED::clearDMRInt(unsigned int slotNo) void COLED::writeFusionInt(const char* source, const char* dest) { m_mode = MODE_YSF; + display.fillRect(0, OLED_LINE1, display.width(), 10, BLACK); + display.setCursor(0,OLED_LINE1); + display.printf("%.10s", source); + display.fillRect(0, OLED_LINE2, display.width(), 10, BLACK); + display.setCursor(0,OLED_LINE2); + display.printf("%.10s", dest); + OLED_statusbar(); + display.display(); } void COLED::clearFusionInt() { + display.fillRect(0, OLED_LINE1, display.width(), 10, BLACK); + display.setCursor(0,OLED_LINE1); + display.print("Listening"); + display.fillRect(0, OLED_LINE2, display.width(), 10, BLACK); + OLED_statusbar(); + display.display(); } void COLED::close() @@ -196,6 +223,10 @@ void COLED::OLED_statusbar() display.setCursor(0,0); if (m_mode == MODE_DMR) display.drawBitmap(0, 0, logo_dmr_bmp, 48, 16, WHITE); + else if (m_mode == MODE_DSTAR) + display.print("D-Star"); + else if (m_mode == MODE_YSF) + display.print("Fusion"); else display.drawBitmap(0, 0, logo_glcd_bmp, 16, 15, WHITE); } diff --git a/OLED.md b/OLED.md new file mode 100644 index 0000000..a16934a --- /dev/null +++ b/OLED.md @@ -0,0 +1,47 @@ +# Prerequisite + +Enable I2C and SPI modules directly with raspi-config tool, issue a +``` +sudo raspi-config +``` + +Then go to menu Advanced Option, select SPI and under question ” Would you like the SPI kernel module to be loaded by default ?”, select Yes, Do the same thing for I2C Advanced Option. + +As I don’t use monitor or TV connected to Pi, I decreased dedicated video memory, always in raspi-config, go to Advanced Options then Memory Split, then type 16 Mo (the minimal) used for GPU, then select Finish, and select Yes when asked to reboot. + +To be able to compile you will need the compiler and some others tools, issue a : + +``` +sudo apt-get install build-essential git-core libi2c-dev i2c-tools lm-sensors +``` +*italic* Sometimes I2C and SPI modules are not started and thus he cannot start the sample code. The solution to start the modules at startup by adding the two following lines into the file /etc/modules + +``` +i2c-dev +spidev +``` +Reboot, then you MUST see SPI and I2C devices with the following command + +``` +root@raspberrypi:~# ls /dev/i2c* +/dev/i2c-0 +root@raspberrypi:~# ls /dev/spi* +/dev/spidev0.0 /dev/spidev0.1 +``` +# Installation of the generic Driver + +The Driver is based on Adafruit Arduino library, I ported the code to be able to compile and run on Raspberry Pi but added also some features. + +Get all the file from github dedicated repo : +``` +git clone https://github.com/hallard/ArduiPi_OLED +cd ArduiPi_OLED +sudo make +``` + +# Building MMDVMHost +``` +make -f Makefile.Pi.OLED +``` + +The initial guide is written by [Charles](http://hallard.me/adafruit-oled-display-driver-for-pi/) diff --git a/README.md b/README.md index dfba260..9bff0aa 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,12 @@ It builds on 32-bit and 64-bit Linux as well as on Windows using VS2015 on x86 a - Nextion TFTs (sizes 2.4", 3.2" and 3.5") - Adafruit 16x2 LCD+Keypad Kits - TFT displays sold by Hobbytronics in UK +- OLED 128x64 (SSD1306) The HD44780 displays are integrated with wiringPi for Raspberry Pi based platforms. The other displays can be directly connected to the UART on Raspberry Pis or with FT-232RL modules to any USB port. +The OLED display needs a extra lib see OLED.md + This software is licenced under the GPL v2 and is intended for amateur and educational use only. Use of this software for commercial purposes is strictly forbidden. It is only to be used on the main DMR+, the main BrandMeister, and Phoenix (UK) networks. If you wish to use it on any other network, you must get written permission from myself, G4KLX. Each such request will be dealt with on a case-by-case basis.