emersonwsm

PBO595.h

Dec 28th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. #ifndef PBO595_h
  2. #define PBO595_h 001  // software version of this library.
  3. #define BUS_OUTPUT
  4.  
  5. #ifdef ARDUINO && ARDUINO >= 100
  6. #include "Arduino.h"
  7. #else
  8. #include "WProgram.h"
  9. #endif
  10.  
  11. #ifndef DATA_SIZE
  12. #define DATA_SIZE uint8_t
  13. #endif
  14.  
  15. #include <ParallelBus.h>
  16.  
  17. // Default control pins.
  18. #define PIN_CS          10
  19. #define PIN_CLOCK       13
  20. #define PIN_DATA_OUT    11
  21. #define PIN_LATCH       8
  22.  
  23.  
  24. class PBO595 : public ParallelBus {
  25.   public:
  26.     // Contructors.
  27.     PBO595();
  28.     PBO595(uint8_t pinCS, uint8_t pinClock, uint8_t pinLatch, uint8_t pinData);
  29.      
  30.     // Public methods.
  31.     void begin();
  32.     DATA_SIZE read();
  33.     void write(DATA_SIZE value);
  34.    
  35.   private:
  36.     // Private methods.
  37.     void init(uint8_t pinCS, uint8_t pinClock, uint8_t pinLatch, uint8_t pinData);
  38.  
  39.     // Private attributes.
  40.    
  41.     // Demux 74595 connections.
  42.     uint8_t _pinCS;
  43.     uint8_t _pinClock;
  44.     uint8_t _pinLatch;
  45.     uint8_t _pinData;
  46. };
  47. #endif
Advertisement
Add Comment
Please, Sign In to add comment