Description dans le rapport.

Dependencies:   mbed

Committer:
Damien75
Date:
Sun Apr 02 09:48:30 2017 +0000
Revision:
0:34945468db9f
Projet C++ embarqu? MBED; Damien et Nicolas

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Damien75 0:34945468db9f 1 /*
Damien75 0:34945468db9f 2 * SeeedGrayOLED.h
Damien75 0:34945468db9f 3 * SSD1327 Gray OLED Driver Library for SSD1327
Damien75 0:34945468db9f 4 *
Damien75 0:34945468db9f 5 * Copyright (c) 2011 seeed technology inc.
Damien75 0:34945468db9f 6 * Author : Visweswara R
Damien75 0:34945468db9f 7 * Create Time : Dec 2011
Damien75 0:34945468db9f 8 * Change Log :
Damien75 0:34945468db9f 9 *
Damien75 0:34945468db9f 10 * This library is free software; you can redistribute it and/or
Damien75 0:34945468db9f 11 * modify it under the terms of the GNU Lesser General Public
Damien75 0:34945468db9f 12 * License as published by the Free Software Foundation; either
Damien75 0:34945468db9f 13 * version 2.1 of the License, or (at your option) any later version.
Damien75 0:34945468db9f 14 *
Damien75 0:34945468db9f 15 * This library is distributed in the hope that it will be useful,
Damien75 0:34945468db9f 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Damien75 0:34945468db9f 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Damien75 0:34945468db9f 18 * Lesser General Public License for more details.
Damien75 0:34945468db9f 19 *
Damien75 0:34945468db9f 20 * You should have received a copy of the GNU Lesser General Public
Damien75 0:34945468db9f 21 * License along with this library; if not, write to the Free Software
Damien75 0:34945468db9f 22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Damien75 0:34945468db9f 23 */
Damien75 0:34945468db9f 24
Damien75 0:34945468db9f 25 #ifndef SeeedGrayOLED_data_H
Damien75 0:34945468db9f 26 #define SeeedGrayOLED_data_H
Damien75 0:34945468db9f 27
Damien75 0:34945468db9f 28 // SeeedGrayOLED Instruction set addresses
Damien75 0:34945468db9f 29
Damien75 0:34945468db9f 30 // #include "Arduino.h"
Damien75 0:34945468db9f 31 #include "mbed.h"
Damien75 0:34945468db9f 32 #include <inttypes.h>
Damien75 0:34945468db9f 33
Damien75 0:34945468db9f 34
Damien75 0:34945468db9f 35 #define VERTICAL_MODE 01
Damien75 0:34945468db9f 36 #define HORIZONTAL_MODE 02
Damien75 0:34945468db9f 37
Damien75 0:34945468db9f 38 #define SeeedGrayOLED_Address 0x3c
Damien75 0:34945468db9f 39 #define SeeedGrayOLED_Command_Mode 0x80
Damien75 0:34945468db9f 40 #define SeeedGrayOLED_Data_Mode 0x40
Damien75 0:34945468db9f 41
Damien75 0:34945468db9f 42 #define SeeedGrayOLED_Display_Off_Cmd 0xAE
Damien75 0:34945468db9f 43 #define SeeedGrayOLED_Display_On_Cmd 0xAF
Damien75 0:34945468db9f 44
Damien75 0:34945468db9f 45 #define SeeedGrayOLED_Normal_Display_Cmd 0xA4
Damien75 0:34945468db9f 46 #define SeeedGrayOLED_Inverse_Display_Cmd 0xA7
Damien75 0:34945468db9f 47 #define SeeedGrayOLED_Activate_Scroll_Cmd 0x2F
Damien75 0:34945468db9f 48 #define SeeedGrayOLED_Dectivate_Scroll_Cmd 0x2E
Damien75 0:34945468db9f 49 #define SeeedGrayOLED_Set_ContrastLevel_Cmd 0x81
Damien75 0:34945468db9f 50
Damien75 0:34945468db9f 51 #define Scroll_Left 0x00
Damien75 0:34945468db9f 52 #define Scroll_Right 0x01
Damien75 0:34945468db9f 53
Damien75 0:34945468db9f 54 #define Scroll_2Frames 0x7
Damien75 0:34945468db9f 55 #define Scroll_3Frames 0x4
Damien75 0:34945468db9f 56 #define Scroll_4Frames 0x5
Damien75 0:34945468db9f 57 #define Scroll_5Frames 0x0
Damien75 0:34945468db9f 58 #define Scroll_25Frames 0x6
Damien75 0:34945468db9f 59 #define Scroll_64Frames 0x1
Damien75 0:34945468db9f 60 #define Scroll_128Frames 0x2
Damien75 0:34945468db9f 61 #define Scroll_256Frames 0x3
Damien75 0:34945468db9f 62
Damien75 0:34945468db9f 63
Damien75 0:34945468db9f 64 class SeeedGrayOLED {
Damien75 0:34945468db9f 65 public:
Damien75 0:34945468db9f 66
Damien75 0:34945468db9f 67 /** Create a new TDA7419 communication interface
Damien75 0:34945468db9f 68 *
Damien75 0:34945468db9f 69 * @param sda is the pin for I2C SDA
Damien75 0:34945468db9f 70 * @param scl is the pin for I2C SCL
Damien75 0:34945468db9f 71 */
Damien75 0:34945468db9f 72 SeeedGrayOLED(PinName sda, PinName scl);
Damien75 0:34945468db9f 73
Damien75 0:34945468db9f 74
Damien75 0:34945468db9f 75 char addressingMode;
Damien75 0:34945468db9f 76
Damien75 0:34945468db9f 77 void init(void);
Damien75 0:34945468db9f 78
Damien75 0:34945468db9f 79 void setNormalDisplay();
Damien75 0:34945468db9f 80 void setInverseDisplay();
Damien75 0:34945468db9f 81
Damien75 0:34945468db9f 82 void sendCommand(unsigned char command);
Damien75 0:34945468db9f 83 void sendData(unsigned char Data);
Damien75 0:34945468db9f 84 void setGrayLevel(unsigned char grayLevel);
Damien75 0:34945468db9f 85
Damien75 0:34945468db9f 86 void setVerticalMode();
Damien75 0:34945468db9f 87 void setHorizontalMode();
Damien75 0:34945468db9f 88
Damien75 0:34945468db9f 89 void setTextXY(unsigned char Row, unsigned char Column);
Damien75 0:34945468db9f 90 void clearDisplay();
Damien75 0:34945468db9f 91 void setContrastLevel(unsigned char ContrastLevel);
Damien75 0:34945468db9f 92 void putChar(unsigned char c);
Damien75 0:34945468db9f 93 void putString(const char *String);
Damien75 0:34945468db9f 94 unsigned char putNumber(long n);
Damien75 0:34945468db9f 95 unsigned char putFloat(float floatNumber,unsigned char decimal);
Damien75 0:34945468db9f 96 unsigned char putFloat(float floatNumber);
Damien75 0:34945468db9f 97
Damien75 0:34945468db9f 98 void drawBitmap(unsigned char *bitmaparray,int bytes);
Damien75 0:34945468db9f 99
Damien75 0:34945468db9f 100 void setHorizontalScrollProperties(bool direction,unsigned char startRow, unsigned char endRow,unsigned char startColumn, unsigned char endColumn, unsigned char scrollSpeed);
Damien75 0:34945468db9f 101 void activateScroll();
Damien75 0:34945468db9f 102 void deactivateScroll();
Damien75 0:34945468db9f 103
Damien75 0:34945468db9f 104 private:
Damien75 0:34945468db9f 105
Damien75 0:34945468db9f 106 // Signals related to I2C communication
Damien75 0:34945468db9f 107 I2C _device;
Damien75 0:34945468db9f 108
Damien75 0:34945468db9f 109 unsigned char grayH;
Damien75 0:34945468db9f 110 unsigned char grayL;
Damien75 0:34945468db9f 111
Damien75 0:34945468db9f 112
Damien75 0:34945468db9f 113 };
Damien75 0:34945468db9f 114
Damien75 0:34945468db9f 115
Damien75 0:34945468db9f 116 #endif