Libraries and Example of mbed parallel bus using I2C port expanders

Dependencies:   HDSP253X mbed PCF8574_Bus

Revision:
6:aaefa04f06be
Parent:
2:1dab1089c332
--- a/MBED_ControlBus.cpp	Fri Aug 26 20:35:11 2011 +0000
+++ b/MBED_ControlBus.cpp	Sun Jan 25 17:30:47 2015 +0000
@@ -8,14 +8,6 @@
 #include "mbed.h"
 #include "MBED_ControlBus.h"
 
-//Debounce and Edge detecting stuff
-#include "PinDetect.h"
-//#define __DIGITAL_IN
-//#define __INTERRUPT_IN
-#define __PINDETECT_IN
-
-
-
 
 /** Create an MBED_ControlBus object connected to the specified Pins
  *
@@ -24,15 +16,13 @@
  * @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   
 */
-MBED_ControlBus::MBED_ControlBus(PinName WR, PinName RD, PinName DTR, PinName CDBUF, PinName CDINT, PinName FIRE) :
+MBED_ControlBus::MBED_ControlBus(PinName WR, PinName RD, PinName DTR, PinName CDBUF, PinName CDINT) :
    _WR(WR),        // WR pin
    _RD(RD),        // RD pin
    _DTR(DTR),      // DTR pin
    _CDBUF(CDBUF),  // CDBUF pin   
-   _CDINT(CDINT),  // CDINT pin      
-   _FIRE(FIRE) {   // FIRE pin         
+   _CDINT(CDINT){  // CDINT pin      
    _init();
 }
 
@@ -117,7 +107,6 @@
 }
 
 
-#ifdef __DIGITAL_IN
 /** Get the CDINT pin value from Control Bus
  *
  * @returns Bit_Level CDINT_level
@@ -131,249 +120,6 @@
       return HIGH;      
 }
 
-/** Get the FIRE pin value from Control Bus
- *
- * @returns Bit_Level FIRE_level
-*/
-Bit_Level MBED_ControlBus::FIRE() {
-    
-    // FIRE Pin value, used as regular Pin rather than as interrupt
-    if (_FIRE == 0)
-      return LOW;
-    else 
-      return HIGH;      
-}
-
-/** Setup debouncing and edge detection on the CDINT pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_CDINT_init() {
-}
-
-/** Setup debouncing and edge detection on the FIRE pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_FIRE_init() {
-}
-#endif   //__DIGITAL_IN
-
-
-
-#ifdef __INTERRUPT_IN
-/** Get the CDINT pin value from Control Bus
- *
- * @returns Bit_Level CDINT_detected
-*/
-Bit_Level MBED_ControlBus::CDINT () {
-       
-    // CDINT pin has been Debounced and Edge detected
-    // Respond only once for every keypress
-    if (_CDINT_detected) {
-      _CDINT_detected = false;
-      return HIGH;
-    }
-    else {
-      return LOW;      
-    }
-}
- 
-/** Get the FIRE pin value from Control Bus
- *
- * @returns Bit_Level FIRE_detected
-*/
-Bit_Level MBED_ControlBus::FIRE() {
-    
-    // FIRE pin has been Debounced and Edge detected
-    // Respond only once for every keypress
-    if (_FIRE_detected) {
-      _FIRE_detected = false;
-      return HIGH;
-    }
-    else {
-      return LOW;      
-    }
-}
-
-
-/** Called on detection of a rising edge at the CDINT pin 
- *
- * @returns
-*/
- void MBED_ControlBus::_CDINT_activated(void) {
-    _CDINT_detected = true;
-}
-
-
-/** Called on detection of a rising edge at the FIRE pin 
- *
- * @returns
-*/
- void MBED_ControlBus::_FIRE_activated(void) {
-    _FIRE_detected = true;
-}
-
-
-/** Setup simple edge detection on the CDINT pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_CDINT_init() {
-    // Setup the callback function
-   _CDINT.mode(PullDown);
-   _CDINT.rise(this, &MBED_ControlBus::_CDINT_activated);
-
-   // Init the edge detection boolean
-   _CDINT_detected = false;
-}
-
-/** Setup simple edge detection on the FIRE pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_FIRE_init() {
-    // Setup the callback function
-   _FIRE.mode(PullDown);
-   _FIRE.rise(this, &MBED_ControlBus::_FIRE_activated);
-
-   // Init the edge detection boolean
-   _FIRE_detected = false;
-}
-
-/** Setup debouncing and edge detection on the CDINT pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_CDINT_init() {
-}
-
-/** Setup debouncing and edge detection on the FIRE pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_FIRE_init() {
-}
-#endif //__INTERRUPT_IN
-
-
-
-#ifdef __PINDETECT_IN
-/** Get the CDINT pin value from Control Bus
- *
- * @returns Bit_Level CDINT_detected
-*/
-Bit_Level MBED_ControlBus::CDINT () {
-       
-    // CDINT pin has been Debounced and Edge detected
-    // Respond only once for every keypress
-    if (_CDINT_detected) {
-      _CDINT_detected = false;
-      return HIGH;
-    }
-    else {
-      return LOW;      
-    }
-}
- 
- /** Get the FIRE pin value from Control Bus
- *
- * @returns Bit_Level FIRE_detected
-*/
-Bit_Level MBED_ControlBus::FIRE() {
-    
-    // FIRE pin has been Debounced and Edge detected
-    // Respond only once for every keypress
-    if (_FIRE_detected) {
-      _FIRE_detected = false;
-      return HIGH;
-    }
-    else {
-      return LOW;      
-    }
-}
-
-/** Called on detection of a rising edge at the CDINT pin 
- *
- * @returns
-*/
- void MBED_ControlBus::_CDINT_activated(void) {
-    _CDINT_detected = true;
-}
-
-/** Called on detection of a falling edge at the CDINT pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_CDINT_deactivated(void) {
-    _CDINT_detected = false;
-}
-
-/** Called on detection of a rising edge at the FIRE pin 
- *
- * @returns
-*/
- void MBED_ControlBus::_FIRE_activated(void) {
-    _FIRE_detected = true;
-}
-
-/** Called on detection of a falling edge at the FIRE pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_FIRE_deactivated(void) {
-    _FIRE_detected = false;
-}
-
-/** Setup debouncing and edge detection on the CDINT pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_CDINT_init() {
-
-    // Setup the callback functions
-   _CDINT.mode(PullDown);
-   _CDINT.attach_asserted(this, &MBED_ControlBus::_CDINT_activated);
-   _CDINT.attach_deasserted(this, &MBED_ControlBus::_CDINT_deactivated);
-//   _CDINT.attach_asserted_held( &keyPressedHeld );
-//   _CDINT.attach_deasserted_held( &keyReleasedHeld );
- 
-   // Init the edge detection boolean
-   _CDINT_detected = false;
-
-   // Sampling does not begin until you set a frequency.
-   // The default is 20ms. If you want a different frequency
-   // then pass the period in microseconds for example, for 10ms :-
-   //     _CDINT.setSampleFrequency(10000);
-   //
-   _CDINT.setSampleFrequency(); // Defaults to 20ms.
-}
-
-/** Setup debouncing and edge detection on the FIRE pin 
- *
- * @returns
-*/
-void MBED_ControlBus::_FIRE_init() {
-
-    // Setup the callback functions
-   _FIRE.mode(PullDown);
-   _FIRE.attach_asserted(this, &MBED_ControlBus::_FIRE_activated);
-   _FIRE.attach_deasserted(this, &MBED_ControlBus::_FIRE_deactivated);
-//   _FIRE.attach_asserted_held( &keyPressedHeld );
-//   _FIRE.attach_deasserted_held( &keyReleasedHeld );
- 
-   // Init the edge detection boolean
-   _FIRE_detected = false;
-
-   // Sampling does not begin until you set a frequency.
-   // The default is 20ms. If you want a different frequency
-   // then pass the period in microseconds for example, for 10ms :-
-   //     _FIRE.setSampleFrequency(10000);
-   //
-   _FIRE.setSampleFrequency(); // Defaults to 20ms.
-}
-#endif // __PINDETECT_IN
-
 
 /** Init MBED_ControlBus
  * @param
@@ -387,9 +133,4 @@
     // Make sure that databus buffer is enabled for Write
     busctrl(ENABLE, WRITE);
     
-    // Setup debouncing and edge detection for CDINT    
-    _CDINT_init();    
-    
-    // Setup debouncing and edge detection for FIRE    
-    _FIRE_init();        
 }
\ No newline at end of file