2020-11-27 05:10:47 -05:00
|
|
|
#pragma once
|
2017-07-24 08:02:11 -04:00
|
|
|
//
|
|
|
|
// FILE: DS28CM00.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: Library for the DS28CM00 unique identification chip.
|
2022-11-02 06:55:17 -04:00
|
|
|
// VERSION: 0.2.5
|
2017-07-24 08:02:11 -04:00
|
|
|
// HISTORY: See DS28CM00.cpp
|
2020-11-27 05:10:47 -05:00
|
|
|
// URL: https://github.com/RobTillaart/DS28CM00
|
2021-12-17 07:06:20 -05:00
|
|
|
|
2017-07-24 08:02:11 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
#include "Arduino.h"
|
|
|
|
#include "Wire.h"
|
2017-07-24 08:02:11 -04:00
|
|
|
|
2021-10-26 08:02:32 -04:00
|
|
|
|
2022-11-02 06:55:17 -04:00
|
|
|
#define DS28CM00_LIB_VERSION (F("0.2.5"))
|
2021-10-26 08:02:32 -04:00
|
|
|
#define DS28CM00_I2C_MODE 0x00
|
|
|
|
#define DS28CM00_SMBUS_MODE 0x01
|
|
|
|
#define DS28CM00_MODE_UNKNOWN 0xFF
|
|
|
|
|
2017-07-24 08:02:11 -04:00
|
|
|
|
|
|
|
class DS28CM00
|
|
|
|
{
|
|
|
|
public:
|
2021-10-26 08:02:32 -04:00
|
|
|
explicit DS28CM00(TwoWire *wire = &Wire);
|
2020-11-27 05:10:47 -05:00
|
|
|
#if defined(ESP8266) || defined(ESP32)
|
|
|
|
explicit DS28CM00(const uint8_t dataPin, const uint8_t clockPin);
|
|
|
|
#endif
|
|
|
|
|
2022-11-02 06:55:17 -04:00
|
|
|
bool begin(); // default DS28CM00_I2C_MODE
|
2021-12-17 07:06:20 -05:00
|
|
|
bool isConnected();
|
2021-01-29 06:31:58 -05:00
|
|
|
bool getUID(uint8_t *);
|
2017-07-24 08:02:11 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
bool setI2CMode() { return setMode(DS28CM00_I2C_MODE); };
|
|
|
|
bool setSMBusMode() { return setMode(DS28CM00_SMBUS_MODE); };
|
|
|
|
bool getMode(uint8_t &mode);
|
2017-07-24 08:02:11 -04:00
|
|
|
|
|
|
|
private:
|
2021-01-29 06:31:58 -05:00
|
|
|
bool setMode(uint8_t m);
|
2020-11-27 05:10:47 -05:00
|
|
|
TwoWire* _wire;
|
2017-07-24 08:02:11 -04:00
|
|
|
};
|
|
|
|
|
2021-12-17 07:06:20 -05:00
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
// -- END OF FILE --
|
2021-12-17 07:06:20 -05:00
|
|
|
|