Initial version for Modtronix LCD2S I2C and SPI serial LCD displays. For details, see http://modtronix.com/products-serial-lcd-board/

Committer:
modtronix
Date:
Fri Aug 07 18:27:11 2015 +1000
Revision:
2:fe0c1e27f362
Parent:
1:429b7d3f7b95
Improvements

Who changed what in which revision?

UserRevisionLine numberNew contents of line
modtronix 1:429b7d3f7b95 1 /**
modtronix 1:429b7d3f7b95 2 * File: lcd2s_i2c.h
modtronix 1:429b7d3f7b95 3 *
modtronix 1:429b7d3f7b95 4 * Author: Modtronix Engineering - www.modtronix.com
modtronix 1:429b7d3f7b95 5 *
modtronix 1:429b7d3f7b95 6 * Description:
modtronix 1:429b7d3f7b95 7 *
modtronix 1:429b7d3f7b95 8 * Software License Agreement:
modtronix 1:429b7d3f7b95 9 * This software has been written or modified by Modtronix Engineering. The code
modtronix 1:429b7d3f7b95 10 * may be modified and can be used free of charge for commercial and non commercial
modtronix 1:429b7d3f7b95 11 * applications. If this is modified software, any license conditions from original
modtronix 1:429b7d3f7b95 12 * software also apply. Any redistribution must include reference to 'Modtronix
modtronix 1:429b7d3f7b95 13 * Engineering' and web link(www.modtronix.com) in the file header.
modtronix 1:429b7d3f7b95 14 *
modtronix 1:429b7d3f7b95 15 * THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, WHETHER EXPRESS,
modtronix 1:429b7d3f7b95 16 * IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
modtronix 1:429b7d3f7b95 17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE
modtronix 1:429b7d3f7b95 18 * COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
modtronix 1:429b7d3f7b95 19 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
modtronix 1:429b7d3f7b95 20 */
modtronix 1:429b7d3f7b95 21
modtronix 1:429b7d3f7b95 22 #ifndef MODTRONIX_LCD2S_LCD2S_I2C_H_
modtronix 1:429b7d3f7b95 23 #define MODTRONIX_LCD2S_LCD2S_I2C_H_
modtronix 1:429b7d3f7b95 24
modtronix 1:429b7d3f7b95 25 #include "mbed.h"
modtronix 1:429b7d3f7b95 26 #include "lcd2s.h"
modtronix 1:429b7d3f7b95 27
modtronix 1:429b7d3f7b95 28 class LCD2S_I2C : public LCD2S {
modtronix 1:429b7d3f7b95 29 public:
modtronix 1:429b7d3f7b95 30 LCD2S_I2C(I2C* i2cBus, uint8_t rows = 4, uint8_t columns = 20);
modtronix 1:429b7d3f7b95 31
modtronix 1:429b7d3f7b95 32 /** Initializes the LCD2S device with default values
modtronix 1:429b7d3f7b95 33 * - Interrupt pin is Open Collector output type
modtronix 1:429b7d3f7b95 34 * - Backlight On
modtronix 1:429b7d3f7b95 35 * - Display On
modtronix 1:429b7d3f7b95 36 * - Backlight 200 (value from 0 to 255)
modtronix 1:429b7d3f7b95 37 * - Cursor off, block cursor off
modtronix 1:429b7d3f7b95 38 * - Cursor moves forward
modtronix 1:429b7d3f7b95 39 * - Keypad is 4x4 button type (if present)
modtronix 1:429b7d3f7b95 40 * - OUT1 disabled
modtronix 1:429b7d3f7b95 41 * - GPIO1 to 3 disabled
modtronix 1:429b7d3f7b95 42 * - Keypad Buzzer off
modtronix 1:429b7d3f7b95 43 * - Keypad repeat rate = 320ms
modtronix 1:429b7d3f7b95 44 * - Keypad Repeat Delay = 1 second
modtronix 1:429b7d3f7b95 45 * - Keypad Debounce Time = 64ms
modtronix 1:429b7d3f7b95 46 *
modtronix 1:429b7d3f7b95 47 * @param contrast The display contrast, a value from 0 to 255
modtronix 1:429b7d3f7b95 48 */
modtronix 1:429b7d3f7b95 49 void initDefault(uint8_t contrast);
modtronix 1:429b7d3f7b95 50
modtronix 1:429b7d3f7b95 51
modtronix 1:429b7d3f7b95 52
modtronix 1:429b7d3f7b95 53 /** Causes the display to be updated with buffer content
modtronix 2:fe0c1e27f362 54 *
modtronix 2:fe0c1e27f362 55 * @return: 0 is successful, else non-0
modtronix 1:429b7d3f7b95 56 */
modtronix 2:fe0c1e27f362 57 uint8_t display();
modtronix 1:429b7d3f7b95 58
modtronix 1:429b7d3f7b95 59 int writeChar(uint8_t c);
modtronix 1:429b7d3f7b95 60
modtronix 1:429b7d3f7b95 61 /** Get current I2C address. Default address is 0x60
modtronix 1:429b7d3f7b95 62 */
modtronix 1:429b7d3f7b95 63 uint8_t getAdress() const {
modtronix 1:429b7d3f7b95 64 return i2cAdr;
modtronix 1:429b7d3f7b95 65 }
modtronix 1:429b7d3f7b95 66
modtronix 1:429b7d3f7b95 67 /** Set current I2C address. Default address is 0x60
modtronix 1:429b7d3f7b95 68 */
modtronix 1:429b7d3f7b95 69 void setAdress(uint8_t adr) {
modtronix 1:429b7d3f7b95 70 this->i2cAdr = adr;
modtronix 1:429b7d3f7b95 71 }
modtronix 1:429b7d3f7b95 72
modtronix 1:429b7d3f7b95 73 // void write(const char* str);
modtronix 1:429b7d3f7b95 74
modtronix 1:429b7d3f7b95 75 private:
modtronix 1:429b7d3f7b95 76 I2C* pI2C;
modtronix 1:429b7d3f7b95 77 uint8_t i2cAdr;
modtronix 1:429b7d3f7b95 78 };
modtronix 1:429b7d3f7b95 79
modtronix 1:429b7d3f7b95 80 #endif /* MODTRONIX_LCD2S_LCD2S_I2C_H_ */