GY-63_MS5611/libraries/FastShiftIn/FastShiftIn.h

38 lines
745 B
C
Raw Normal View History

2020-11-27 05:16:22 -05:00
#pragma once
//
// FILE: FastShiftIn.h
// AUTHOR: Rob Tillaart
2020-11-27 05:16:22 -05:00
// VERSION: 0.2.1
// PURPOSE: Fast ShiftIn for 74HC165 register, AVR optimized
// DATE: 2013-09-29
2020-11-27 05:16:22 -05:00
// URL: https://github.com/RobTillaart/FastShiftIn
//
#include "Arduino.h"
2020-11-27 05:16:22 -05:00
#define FASTSHIFTIN_LIB_VERSION (F("0.2.1"))
class FastShiftIn
{
public:
2020-11-27 05:16:22 -05:00
// bitorder = { LSBFIRST, MSBFIRST };
FastShiftIn(const uint8_t datapin, const uint8_t clockpin, const uint8_t bitOrder = LSBFIRST);
int read(void);
// overrule bitorder (most optimized).
int readLSBFIRST(void);
int readMSBFIRST(void);
private:
2020-11-27 05:16:22 -05:00
uint8_t _bitorder;
int _value;
2020-11-27 05:16:22 -05:00
uint8_t _databit;
volatile uint8_t *_datain;
2020-11-27 05:16:22 -05:00
uint8_t _clockbit;
volatile uint8_t *_clockin;
};
2020-11-27 05:16:22 -05:00
// -- END OF FILE --