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