2014-06-06 12:27:43 +00:00
|
|
|
/*
|
|
|
|
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
|
|
|
* Copyright (c) 2014 Intel Corporation.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "ssd1327.h"
|
|
|
|
|
|
|
|
using namespace upm;
|
|
|
|
|
|
|
|
#define INIT_SLEEP 50000
|
2015-04-08 14:06:49 +01:00
|
|
|
#define CMD_SLEEP 10000
|
|
|
|
|
|
|
|
SSD1327::SSD1327(int bus_in, int addr_in) : I2CLcd(bus_in, addr_in)
|
|
|
|
{
|
|
|
|
mraa_result_t error = MRAA_SUCCESS;
|
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xFD, LCD_CMD); // Unlock OLED driver IC MCU
|
|
|
|
// interface from entering command.
|
|
|
|
// i.e: Accept commands
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x12, LCD_CMD);
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xAE, LCD_CMD); // Set display off
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xA8, LCD_CMD); // set multiplex ratio
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x5F, LCD_CMD); // 96
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xA1, LCD_CMD); // set display start line
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x00, LCD_CMD); //
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xA2, LCD_CMD); // set display offset
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x60, LCD_CMD);
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xA0, LCD_CMD); // set remap
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x46, LCD_CMD);
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xAB, LCD_CMD); // set vdd internal
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x01, LCD_CMD); //
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x81, LCD_CMD); // set contrasr
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x53, LCD_CMD); // 100 nit
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xB1, LCD_CMD); // Set Phase Length
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0X51, LCD_CMD); //
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control,
|
|
|
|
0xB3,
|
|
|
|
LCD_CMD); // Set Display Clock Divide Ratio/Oscillator
|
|
|
|
// Frequency
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x01, LCD_CMD); //
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xB9, LCD_CMD); //
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xBC, LCD_CMD); // set pre_charge
|
|
|
|
// voltage/VCOMH
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x08, LCD_CMD); // (0x08);
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xBE, LCD_CMD); // set VCOMH
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0X07, LCD_CMD); // (0x07);
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xB6, LCD_CMD); // Set second pre-charge
|
|
|
|
// period
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x01, LCD_CMD); //
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control,
|
|
|
|
0xD5,
|
|
|
|
LCD_CMD); // enable second precharge and enternal vsl
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0X62, LCD_CMD); // (0x62);
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xA4, LCD_CMD); // Set Normal Display Mode
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x2E, LCD_CMD); // Deactivate Scroll
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xAF, LCD_CMD); // Switch on display
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2014-06-06 12:27:43 +00:00
|
|
|
|
|
|
|
// Row Address
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x75, LCD_CMD); // Set Row Address
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x00, LCD_CMD); // Start 0
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x5f, LCD_CMD); // End 95
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2014-06-06 12:27:43 +00:00
|
|
|
|
|
|
|
// Column Address
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x15, LCD_CMD); // Set Column Address
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x08, LCD_CMD); // Start from 8th Column of
|
|
|
|
// driver IC. This is 0th
|
|
|
|
// Column for OLED
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
error = mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x37, LCD_CMD); // End at (8 + 47)th
|
|
|
|
// column. Each Column has 2
|
|
|
|
// pixels(segments)
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(INIT_SLEEP);
|
|
|
|
|
|
|
|
clear();
|
|
|
|
setNormalDisplay();
|
|
|
|
setVerticalMode();
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::~SSD1327()
|
|
|
|
{
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::draw(uint8_t* data, int bytes)
|
|
|
|
{
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t error = MRAA_SUCCESS;
|
2014-06-06 12:27:43 +00:00
|
|
|
|
2015-04-08 14:06:49 +01:00
|
|
|
setHorizontalMode();
|
2014-06-06 12:27:43 +00:00
|
|
|
for (int row = 0; row < bytes; row++) {
|
2015-04-08 14:06:49 +01:00
|
|
|
for (uint8_t col = 0; col < 8; col += 2) {
|
2014-06-06 12:27:43 +00:00
|
|
|
uint8_t value = 0x0;
|
|
|
|
|
|
|
|
uint8_t bitOne = (data[row] << col) & 0x80;
|
|
|
|
uint8_t bitTwo = (data[row] << (col + 1)) & 0x80;
|
|
|
|
|
|
|
|
value |= (bitOne) ? grayHigh : 0x00;
|
|
|
|
value |= (bitTwo) ? grayLow : 0x00;
|
|
|
|
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, value, LCD_DATA);
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP - 2000);
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* **************
|
|
|
|
* virtual area
|
|
|
|
* **************
|
|
|
|
*/
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::write(std::string msg)
|
|
|
|
{
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t error = MRAA_SUCCESS;
|
2014-06-06 12:27:43 +00:00
|
|
|
|
2015-04-08 14:06:49 +01:00
|
|
|
setVerticalMode();
|
2014-06-06 12:27:43 +00:00
|
|
|
for (std::string::size_type i = 0; i < msg.size(); ++i) {
|
2015-04-20 14:11:54 +01:00
|
|
|
writeChar(msg[i]);
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::setCursor(int row, int column)
|
|
|
|
{
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t error = MRAA_SUCCESS;
|
2014-06-06 12:27:43 +00:00
|
|
|
|
2015-04-08 14:06:49 +01:00
|
|
|
// Column Address
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x15, LCD_CMD); /* Set Column Address */
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x08 + (column * 4), LCD_CMD); /* Start Column:
|
|
|
|
Start from 8 */
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x37, LCD_CMD); /* End Column */
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2014-06-06 12:27:43 +00:00
|
|
|
// Row Address
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x75, LCD_CMD); /* Set Row Address */
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x00 + (row * 8), LCD_CMD); /* Start Row*/
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x07 + (row * 8), LCD_CMD); /* End Row*/
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2014-06-06 12:27:43 +00:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::clear()
|
|
|
|
{
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t error = MRAA_SUCCESS;
|
2014-06-06 12:27:43 +00:00
|
|
|
uint8_t columnIdx, rowIdx;
|
|
|
|
|
2015-04-08 14:06:49 +01:00
|
|
|
for (rowIdx = 0; rowIdx < 12; rowIdx++) {
|
2014-06-06 12:27:43 +00:00
|
|
|
// clear all columns
|
2015-04-08 14:06:49 +01:00
|
|
|
for (columnIdx = 0; columnIdx < 12; columnIdx++) {
|
2015-04-20 14:11:54 +01:00
|
|
|
writeChar(' ');
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-25 10:05:27 +01:00
|
|
|
return MRAA_SUCCESS;
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::home()
|
|
|
|
{
|
|
|
|
return setCursor(0, 0);
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::setGrayLevel(uint8_t level)
|
|
|
|
{
|
2014-06-06 12:27:43 +00:00
|
|
|
grayHigh = (level << 4) & 0xF0;
|
2015-04-08 14:06:49 +01:00
|
|
|
grayLow = level & 0x0F;
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* **************
|
|
|
|
* private area
|
|
|
|
* **************
|
|
|
|
*/
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-20 14:11:54 +01:00
|
|
|
SSD1327::writeChar(uint8_t value)
|
2015-04-08 14:06:49 +01:00
|
|
|
{
|
2014-06-06 12:27:43 +00:00
|
|
|
if (value < 0x20 || value > 0x7F) {
|
|
|
|
value = 0x20; // space
|
|
|
|
}
|
|
|
|
|
2015-04-08 14:06:49 +01:00
|
|
|
for (uint8_t row = 0; row < 8; row = row + 2) {
|
2014-06-06 12:27:43 +00:00
|
|
|
for (uint8_t col = 0; col < 8; col++) {
|
|
|
|
uint8_t data = 0x0;
|
|
|
|
|
|
|
|
uint8_t bitOne = ((BasicFont[value - 32][row]) >> col) & 0x1;
|
|
|
|
uint8_t bitTwo = ((BasicFont[value - 32][row + 1]) >> col) & 0x1;
|
|
|
|
|
|
|
|
data |= (bitOne) ? grayHigh : 0x00;
|
|
|
|
data |= (bitTwo) ? grayLow : 0x00;
|
|
|
|
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, data, LCD_DATA);
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP - 2000);
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::setNormalDisplay()
|
|
|
|
{
|
2015-04-13 11:58:03 +01:00
|
|
|
return mraa_i2c_write_byte_data(m_i2c_lcd_control,
|
|
|
|
DISPLAY_CMD_SET_NORMAL,
|
|
|
|
LCD_CMD); // set to normal display '1' is ON
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::setHorizontalMode()
|
|
|
|
{
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xA0, LCD_CMD); // remap to
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x42, LCD_CMD); // horizontal mode
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2014-06-06 12:27:43 +00:00
|
|
|
|
|
|
|
// Row Address
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x75, LCD_CMD); // Set Row Address
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x00, LCD_CMD); // Start 0
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x5f, LCD_CMD); // End 95
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2014-06-06 12:27:43 +00:00
|
|
|
|
|
|
|
// Column Address
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x15, LCD_CMD); // Set Column Address
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x08, LCD_CMD); // Start from 8th Column of driver
|
|
|
|
// IC. This is 0th Column for OLED
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x37, LCD_CMD); // End at (8 + 47)th column. Each
|
|
|
|
// Column has 2 pixels(or segments)
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-25 10:05:27 +01:00
|
|
|
mraa_result_t
|
2015-04-08 14:06:49 +01:00
|
|
|
SSD1327::setVerticalMode()
|
|
|
|
{
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0xA0, LCD_CMD); // remap to
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2015-04-13 11:58:03 +01:00
|
|
|
mraa_i2c_write_byte_data(m_i2c_lcd_control, 0x46, LCD_CMD); // Vertical mode
|
2015-04-08 14:06:49 +01:00
|
|
|
usleep(CMD_SLEEP);
|
2014-06-06 12:27:43 +00:00
|
|
|
}
|