Libraries and Example of mbed parallel bus using I2C port expanders

Dependencies:   HDSP253X mbed PCF8574_Bus

Committer:
wim
Date:
Sun Jan 25 17:52:55 2015 +0000
Revision:
7:8680b8b718c8
Parent:
6:aaefa04f06be
Test of PCF8574 Bus interface to control HDSP253X Smart Alphanumeric LED matrix display.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wim 2:1dab1089c332 1 /* MBED_ControlBus - Use the MBED Port pins for controlling the Bus
wim 2:1dab1089c332 2 * Copyright (c) 2011 Wim Huiskamp
wim 2:1dab1089c332 3 *
wim 2:1dab1089c332 4 * Released under the MIT License: http://mbed.org/license/mit
wim 2:1dab1089c332 5 *
wim 2:1dab1089c332 6 * version 0.2 Initial Release
wim 2:1dab1089c332 7 */
wim 2:1dab1089c332 8 #ifndef _MBED_CONTROLBUS_H
wim 2:1dab1089c332 9 #define _MBED_CONTROLBUS_H
wim 2:1dab1089c332 10
wim 2:1dab1089c332 11 //Enums for Control Bus
wim 2:1dab1089c332 12 #include "BusEnums.h"
wim 2:1dab1089c332 13
wim 2:1dab1089c332 14 /** Create an MBED_ControlBus object connected to the specified Pins
wim 2:1dab1089c332 15 *
wim 2:1dab1089c332 16 * @param PinName WR the Write pin
wim 2:1dab1089c332 17 * @param PinName RD the Read pin
wim 2:1dab1089c332 18 * @param PinName DTR the databuffer Transmit/Receive direction pin
wim 2:1dab1089c332 19 * @param PinName CDBUF the databuffer enable pin
wim 2:1dab1089c332 20 * @param PinName CDINT the Keyboard interrupt pin
wim 2:1dab1089c332 21 */
wim 2:1dab1089c332 22 class MBED_ControlBus {
wim 2:1dab1089c332 23 public:
wim 6:aaefa04f06be 24 MBED_ControlBus(PinName WR, PinName RD, PinName DTR, PinName CDBUF, PinName CDINT);
wim 2:1dab1089c332 25 void WR (Bit_Level wr_level);
wim 2:1dab1089c332 26 void RD (Bit_Level rd_level);
wim 2:1dab1089c332 27 void busdir (Bus_Dir buf_dir);
wim 2:1dab1089c332 28 void busctrl (Bus_Ena buf_ena, Bus_Dir buf_dir);
wim 2:1dab1089c332 29 Bit_Level CDINT ();
wim 6:aaefa04f06be 30
wim 2:1dab1089c332 31 protected:
wim 2:1dab1089c332 32 DigitalOut _WR; // Write pin
wim 2:1dab1089c332 33 DigitalOut _RD; // Read pin
wim 2:1dab1089c332 34 DigitalOut _DTR; // Databuffer Transmit/Receive direction pin
wim 2:1dab1089c332 35 DigitalOut _CDBUF; // Databuffer enable pin
wim 2:1dab1089c332 36
wim 2:1dab1089c332 37 //Plain digital input pin
wim 6:aaefa04f06be 38 DigitalIn _CDINT; // Keyboard interrupt pin
wim 6:aaefa04f06be 39
wim 2:1dab1089c332 40 //Plain digital interrupt pin
wim 2:1dab1089c332 41 // InterruptIn _CDINT; // Keyboard interrupt pin
wim 2:1dab1089c332 42
wim 4:745fbbd5e4e5 43 //Debounced and Edge detected input pin (Andy Kirkmans's Lib)
wim 6:aaefa04f06be 44 // PinDetect _CDINT; // Keyboard interrupt pin
wim 6:aaefa04f06be 45
wim 2:1dab1089c332 46 bool _CDINT_detected;
wim 2:1dab1089c332 47
wim 2:1dab1089c332 48 void _init();
wim 2:1dab1089c332 49 };
wim 2:1dab1089c332 50
wim 2:1dab1089c332 51 #endif