KS0108 LCD LIB with I2C I/O expander PCF8574 for Databus

Dependencies:   BusEnums

Dependents:   Menu

Committer:
GuiTwo
Date:
Mon Sep 10 16:33:35 2012 +0000
Revision:
4:eeaa5069be9c
Parent:
0:f2f71eab6aef
Classe fille de MendedDisplay ( Classe abstraite)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GuiTwo 0:f2f71eab6aef 1 /* PCF8574_DataBus - Use the PCF8574 I2C Port Extender for controlling the Data Bus
GuiTwo 0:f2f71eab6aef 2 * Copyright (c) 2011 Wim Huiskamp
GuiTwo 0:f2f71eab6aef 3 *
GuiTwo 0:f2f71eab6aef 4 * Released under the MIT License: http://mbed.org/license/mit
GuiTwo 0:f2f71eab6aef 5 *
GuiTwo 0:f2f71eab6aef 6 * version 0.2 Initial Release
GuiTwo 0:f2f71eab6aef 7 */
GuiTwo 0:f2f71eab6aef 8 #ifndef _PCF8574_DATABUS_H
GuiTwo 0:f2f71eab6aef 9 #define _PCF8574_DATABUS_H
GuiTwo 0:f2f71eab6aef 10
GuiTwo 0:f2f71eab6aef 11 //Pin Defines for PCF8574 Data Bus
GuiTwo 0:f2f71eab6aef 12 #define D_D0 0x01
GuiTwo 0:f2f71eab6aef 13 #define D_D1 0x02
GuiTwo 0:f2f71eab6aef 14 #define D_D2 0x04
GuiTwo 0:f2f71eab6aef 15 #define D_D3 0x08
GuiTwo 0:f2f71eab6aef 16 #define D_D4 0x10
GuiTwo 0:f2f71eab6aef 17 #define D_D5 0x20
GuiTwo 0:f2f71eab6aef 18 #define D_D6 0x40
GuiTwo 0:f2f71eab6aef 19 #define D_D7 0x80
GuiTwo 0:f2f71eab6aef 20
GuiTwo 0:f2f71eab6aef 21 #define D_DATA_MSK 0xFF
GuiTwo 0:f2f71eab6aef 22
GuiTwo 0:f2f71eab6aef 23 //Enums for Data Bus
GuiTwo 0:f2f71eab6aef 24 #include "BusEnums.h"
GuiTwo 0:f2f71eab6aef 25
GuiTwo 0:f2f71eab6aef 26
GuiTwo 0:f2f71eab6aef 27 /** Create an PCF8574_DataBus object connected to the specified I2C object and using the specified deviceAddress
GuiTwo 0:f2f71eab6aef 28 *
GuiTwo 0:f2f71eab6aef 29 * @param I2C &i2c the I2C port to connect to
GuiTwo 0:f2f71eab6aef 30 * @param char deviceAddress the address of the PCF8574
GuiTwo 0:f2f71eab6aef 31 */
GuiTwo 0:f2f71eab6aef 32 class PCF8574_DataBus {
GuiTwo 0:f2f71eab6aef 33 public:
GuiTwo 0:f2f71eab6aef 34 PCF8574_DataBus(I2C &i2c, char deviceAddress);
GuiTwo 0:f2f71eab6aef 35 char read();
GuiTwo 0:f2f71eab6aef 36 void write(char byte);
GuiTwo 0:f2f71eab6aef 37 void busdir (Bus_Dir bus_dir);
GuiTwo 0:f2f71eab6aef 38 void output(void);
GuiTwo 0:f2f71eab6aef 39 void input(void);
GuiTwo 0:f2f71eab6aef 40 protected:
GuiTwo 0:f2f71eab6aef 41 I2C &_i2c;
GuiTwo 0:f2f71eab6aef 42 char _readOpcode;
GuiTwo 0:f2f71eab6aef 43 char _writeOpcode;
GuiTwo 0:f2f71eab6aef 44 void _init();
GuiTwo 0:f2f71eab6aef 45 };
GuiTwo 0:f2f71eab6aef 46
GuiTwo 0:f2f71eab6aef 47 #endif