2013-08-28 16:30:00 -04:00
|
|
|
//
|
|
|
|
// FILE: FastShiftOut.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
2017-04-26 18:10:51 -04:00
|
|
|
// VERSION: 0.1.5
|
2013-08-29 05:39:24 -04:00
|
|
|
// PURPOSE: shiftout that implements the Print interface
|
2013-09-29 06:38:05 -04:00
|
|
|
// DATE: 2013-08-22
|
2013-08-28 16:30:00 -04:00
|
|
|
// URL:
|
|
|
|
//
|
|
|
|
// Released to the public domain
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef FastShiftOut_h
|
|
|
|
#define FastShiftOut_h
|
|
|
|
|
|
|
|
#if defined(ARDUINO) && ARDUINO >= 100
|
2015-03-06 09:37:48 -05:00
|
|
|
#include "Arduino.h"
|
2013-08-28 16:30:00 -04:00
|
|
|
#else
|
2015-03-06 09:37:48 -05:00
|
|
|
#include "WProgram.h"
|
2013-08-28 16:30:00 -04:00
|
|
|
#endif
|
|
|
|
|
2017-04-26 18:10:51 -04:00
|
|
|
#define FASTSHIFTOUT_LIB_VERSION (F("0.1.5"))
|
2013-08-28 16:30:00 -04:00
|
|
|
|
2013-08-29 05:39:24 -04:00
|
|
|
#include "Print.h"
|
|
|
|
|
|
|
|
class FastShiftOut : public Print
|
2013-08-28 16:30:00 -04:00
|
|
|
{
|
2015-03-06 09:37:48 -05:00
|
|
|
public:
|
|
|
|
FastShiftOut(const uint8_t, const uint8_t, const uint8_t);
|
|
|
|
size_t write(const uint8_t);
|
2013-08-28 16:30:00 -04:00
|
|
|
int read(void);
|
|
|
|
|
2015-03-06 09:37:48 -05:00
|
|
|
private:
|
2013-08-28 16:30:00 -04:00
|
|
|
uint8_t _bitorder;
|
|
|
|
int _value;
|
2015-03-06 09:37:48 -05:00
|
|
|
|
|
|
|
uint8_t _databit;
|
2013-08-28 16:30:00 -04:00
|
|
|
volatile uint8_t *_dataout;
|
2015-03-06 09:37:48 -05:00
|
|
|
|
|
|
|
uint8_t _clockbit;
|
2013-08-28 16:30:00 -04:00
|
|
|
volatile uint8_t *_clockout;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// -- END OF FILE --
|