Libraries and Example of mbed parallel bus using I2C port expanders

Dependencies:   HDSP253X mbed PCF8574_Bus

Committer:
wim
Date:
Wed Aug 31 19:45:31 2011 +0000
Revision:
0:2467aed99127
First Version

Who changed what in which revision?

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