Libraries and Example of mbed parallel bus using I2C port expanders
Dependencies: HDSP253X mbed PCF8574_Bus
Diff: MBED_ControlBus.h
- Revision:
- 2:1dab1089c332
- Child:
- 4:745fbbd5e4e5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MBED_ControlBus.h Sat Aug 20 12:49:44 2011 +0000 @@ -0,0 +1,67 @@ +/* MBED_ControlBus - Use the MBED Port pins for controlling the Bus + * Copyright (c) 2011 Wim Huiskamp + * + * Released under the MIT License: http://mbed.org/license/mit + * + * version 0.2 Initial Release +*/ +#ifndef _MBED_CONTROLBUS_H +#define _MBED_CONTROLBUS_H + +//Enums for Control Bus +#include "BusEnums.h" + +//Debounce and Edge detecting stuff +#include "PinDetect.h" + +/** Create an MBED_ControlBus object connected to the specified Pins + * + * @param PinName WR the Write pin + * @param PinName RD the Read pin + * @param PinName DTR the databuffer Transmit/Receive direction pin + * @param PinName CDBUF the databuffer enable pin + * @param PinName CDINT the Keyboard interrupt pin + * @param PinName FIRE the Manual Fire Unit pin +*/ +class MBED_ControlBus { +public: + MBED_ControlBus(PinName WR, PinName RD, PinName DTR, PinName CDBUF, PinName CDINT, PinName FIRE); + void WR (Bit_Level wr_level); + void RD (Bit_Level rd_level); + void busdir (Bus_Dir buf_dir); + void busctrl (Bus_Ena buf_ena, Bus_Dir buf_dir); + Bit_Level CDINT (); + Bit_Level FIRE (); +protected: + DigitalOut _WR; // Write pin + DigitalOut _RD; // Read pin + DigitalOut _DTR; // Databuffer Transmit/Receive direction pin + DigitalOut _CDBUF; // Databuffer enable pin + +//Plain digital input pin +// DigitalIn _CDINT; // Keyboard interrupt pin +// DigitalIn _FIRE; // Fire interrupt pin + +//Plain digital interrupt pin +// InterruptIn _CDINT; // Keyboard interrupt pin +// InterruptIn _FIRE; // Fire interrupt pin + +//Debounced and Edge detected input pin (Andy Kirkmans's Lib + PinDetect _CDINT; // Keyboard interrupt pin + PinDetect _FIRE; // Fire interrupt pin + + bool _CDINT_detected; + bool _FIRE_detected; + + void _CDINT_activated(); + void _CDINT_deactivated(); + void _CDINT_init(); + + void _FIRE_activated(); + void _FIRE_deactivated(); + void _FIRE_init(); + + void _init(); +}; + +#endif \ No newline at end of file