Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: PCF8576_GH08172_test
PCF8576.h
00001 /* Copyright (c) 2016 ARM Ltd., MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without 00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00007 * Software is furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 * 00018 * 00019 * PCF8576 Universal LCD driver library 00020 * 00021 * @author Toyomasa Watarai 00022 * @version 1.0 00023 * @date 28-March-2016 00024 * 00025 * Library for "PCF8576 Universal LCD driver for low multiplex rates" 00026 * 00027 */ 00028 00029 #ifndef PCF8576_H 00030 #define PCF8576_H 00031 00032 #include "mbed.h" 00033 #include "char_pattern.h" 00034 00035 #define PCF8576_CMD_MODE_SET 0x40 00036 #define PCF8576_CMD_LOAD_DATA 0x00 00037 #define PCF8576_CMD_DEVICE_SEL 0x60 00038 #define PCF8576_CMD_BANK_SEL 0x78 00039 #define PCF8576_CMD_BINK 0x70 00040 00041 #define PCF8576_DEFAULT_SLAVE_ADDRESS 0x70 00042 00043 /** 00044 * PCF8576 Universal LCD driver library example 00045 * 00046 * @code 00047 * #include "PCF8576.h" 00048 * PCF8576 lcd(D14, D15); 00049 * 00050 * int main() { 00051 * lcd.print("mbed"); 00052 * while(1) { 00053 * } 00054 * } 00055 * @endcode 00056 */ 00057 class PCF8576 { 00058 public: 00059 /** 00060 * PCF8576 constructor 00061 * 00062 * @param sda SDA pin 00063 * @param sdl SCL pin 00064 * @param addr Slave address of the I2C peripheral (default: 0x70) 00065 */ 00066 PCF8576(PinName sda, PinName scl, int addr = PCF8576_DEFAULT_SLAVE_ADDRESS); 00067 00068 /** 00069 * Create a PCF8576 instance which is connected to specified I2C pins 00070 * with specified address 00071 * 00072 * @param i2c_obj I2C object (instance) 00073 * @param addr Slave address of the I2C-bus peripheral (default: 0x70) 00074 */ 00075 PCF8576(I2C &i2c_obj, int addr = PCF8576_DEFAULT_SLAVE_ADDRESS); 00076 00077 /** 00078 * PCF8576 destructor 00079 */ 00080 ~PCF8576(); 00081 00082 /** Initializa PCF8576 device 00083 * 00084 * Configure LCD setting 00085 * 00086 */ 00087 void initialize(void); 00088 00089 /** 00090 * Print string 00091 * 00092 * @param str Poiner to print string 00093 */ 00094 void print(char *str); 00095 00096 /** 00097 * Print level-bar pictogram icon 00098 * 00099 * @param icon Level-bar pictogram icon from 0 (all off) to 0xF (all on) 00100 */ 00101 void icon(uint32_t icon); 00102 00103 private: 00104 I2C m_i2c; 00105 int m_addr; 00106 char m_lcd_buf[14]; 00107 char m_C5_mask; 00108 char m_C6_mask; 00109 00110 }; 00111 00112 #endif
Generated on Wed Jul 13 2022 02:09:56 by
1.7.2
NXP PCF8576 Universal LCD driver