Skip to content

Commit efc8668

Browse files
committed
0.2.3 DS28CM00
1 parent dfbc898 commit efc8668

File tree

9 files changed

+87
-34
lines changed

9 files changed

+87
-34
lines changed

libraries/DS28CM00/.arduino-ci.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ compile:
22
# Choosing to run compilation tests on 2 different Arduino platforms
33
platforms:
44
- uno
5-
- leonardo
6-
- due
7-
- zero
5+
# - due
6+
# - zero
7+
# - leonardo
8+
- m4
9+
- esp32
10+
# - esp8266
11+
# - mega2560

libraries/DS28CM00/.github/workflows/arduino_test_runner.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ name: Arduino CI
44
on: [push, pull_request]
55

66
jobs:
7-
arduino_ci:
7+
runTest:
88
runs-on: ubuntu-latest
99

1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: Arduino-CI/action@master
13-
# Arduino-CI/[email protected]
12+
- uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: 2.6
15+
- run: |
16+
gem install arduino_ci
17+
arduino_ci.rb

libraries/DS28CM00/DS28CM00.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
// FILE: DS28CM00.cpp
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: Library for the DS28CM00 unique identification chip.
5-
// VERSION: 0.2.2
5+
// VERSION: 0.2.3
66
// URL: https://github.com/RobTillaart/DS28CM00
77
//
8-
// HISTORY:
9-
// 0.1.0 2017-07-15 initial version
10-
// 0.2.0 2020-04-11 refactor, #pragma once, ESP support, multiple Wire, ESP support (start)
11-
// 0.2.1 2020-06-07 fix library.json
12-
// 0.2.2 2020-12-20 add arduino-CI + unit test
8+
// HISTORY:
9+
// 0.1.0 2017-07-15 initial version
10+
// 0.2.0 2020-04-11 refactor, #pragma once, ESP support, multiple Wire, ESP support (start)
11+
// 0.2.1 2020-06-07 fix library.json
12+
// 0.2.2 2020-12-20 add arduino-CI + unit test
13+
// 0.2.3 2021-10-26 update build-CI + default Wire in constructor.
14+
1315

1416
#include "DS28CM00.h"
1517

@@ -23,6 +25,7 @@ DS28CM00::DS28CM00(TwoWire *wire)
2325
_wire = wire;
2426
}
2527

28+
2629
#if defined(ESP8266) || defined(ESP32)
2730
DS28CM00::DS28CM00(const uint8_t dataPin, const uint8_t clockPin)
2831
{
@@ -85,4 +88,5 @@ bool DS28CM00::getUID(uint8_t *buffer)
8588
return true;
8689
}
8790

91+
8892
// -- END OF FILE --

libraries/DS28CM00/DS28CM00.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@
33
// FILE: DS28CM00.h
44
// AUTHOR: Rob Tillaart
55
// PURPOSE: Library for the DS28CM00 unique identification chip.
6-
// VERSION: 0.2.2
6+
// VERSION: 0.2.3
77
// HISTORY: See DS28CM00.cpp
88
// URL: https://github.com/RobTillaart/DS28CM00
99
//
1010

1111
#include "Arduino.h"
1212
#include "Wire.h"
1313

14-
#define DS28CM00_LIB_VERSION "0.2.2"
15-
#define DS28CM00_I2C_MODE 0x00
16-
#define DS28CM00_SMBUS_MODE 0x01
17-
#define DS28CM00_MODE_UNKNOWN 0xFF
14+
15+
#define DS28CM00_LIB_VERSION (F("0.2.3"))
16+
#define DS28CM00_I2C_MODE 0x00
17+
#define DS28CM00_SMBUS_MODE 0x01
18+
#define DS28CM00_MODE_UNKNOWN 0xFF
19+
1820

1921
class DS28CM00
2022
{
2123
public:
22-
explicit DS28CM00(TwoWire *wire);
24+
explicit DS28CM00(TwoWire *wire = &Wire);
2325
#if defined(ESP8266) || defined(ESP32)
2426
explicit DS28CM00(const uint8_t dataPin, const uint8_t clockPin);
2527
#endif

libraries/DS28CM00/README.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
[![Arduino CI](https://github.com/RobTillaart/DS28CM00/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
3+
[![Arduino-lint](https://github.com/RobTillaart/DS28CM00/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/DS28CM00/actions/workflows/arduino-lint.yml)
4+
[![JSON check](https://github.com/RobTillaart/DS28CM00/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/DS28CM00/actions/workflows/jsoncheck.yml)
35
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/DS28CM00/blob/master/LICENSE)
46
[![GitHub release](https://img.shields.io/github/release/RobTillaart/DS28CM00.svg?maxAge=3600)](https://github.com/RobTillaart/DS28CM00/releases)
57

@@ -8,36 +10,55 @@
810

911
Arduino library for I2C DS28CM00 unique identification chip. \[48 bit\]
1012

13+
1114
## Description
1215

1316
THe DS28CM00 IC has a 64 bit address consisting of one type byte, 0x50, 6 bytes unique serial and a CRC
1417
over the previous 7 bytes. This results in an 48 bits unique ID giving 281.474.976.710.656 combinations.
1518
If that number is not unique enough, you could use 2 or more of them with an I2C multiplexer.
1619

1720
The DS28CM00 IC has the same addressing scheme as the better known DS18B20, except for the type byte.
18-
Therefor one could use an DS18B20 as an unique ID chip in a similar way and getting a temperature sensor
21+
Therefore one could use an DS18B20 as an unique ID chip in a similar way and getting a temperature sensor
1922
as bonus.
2023

21-
The DS28CM00 can work in 2 modes, I2C and SMBus mode. check datasheet for details.
24+
The DS28CM00 can work in 2 modes, I2C and SMBus mode. Check datasheet for details.
25+
2226

2327
## Interface
2428

29+
2530
### Constructor
2631

27-
- **DS28CM00(TwoWire \*wire)**
28-
- **DS28CM00(dataPin, clockPin)** ESP32, ESP8266
32+
- **DS28CM00(TwoWire \*wire = &Wire)** Constructor, with default Wire as I2C bus.
33+
- **DS28CM00(uint8_t dataPin, uint8_t clockPin)** Constructor for ESP32, ESP8266 et al.
34+
2935

3036
### public
31-
- **void begin()** initializes I2C bus, default DS28CM00_I2C_MODE
37+
38+
- **void begin()** initializes I2C bus, sets default DS28CM00_I2C_MODE.
3239
- **bool getUID(uint8_t \*serial)** get unique 8 bytes serial number or error.
33-
- **bool setI2CMode()** set DS28CM00_I2C_MODE (0x00)
34-
- **bool setSMBusMode()** set DS28CM00_SMBUS_MODE (0x01)
35-
- **bool getMode(uint8_t &mode)** returns mode set above
40+
Returns false if action failed.
41+
- **bool setI2CMode()** set DS28CM00_I2C_MODE (0x00). Returns false if action failed.
42+
- **bool setSMBusMode()** set DS28CM00_SMBUS_MODE (0x01). Returns false if action failed.
43+
- **bool getMode(uint8_t &mode)** returns mode set above. Returns false if action failed.
44+
3645

3746
## Operation
3847

3948
See examples.
4049

4150
The class is not tested extensively e.g. with ESP32 / ESP8266.
42-
An example sketch for ESP32 exist and compiles. (feedback welcome)
51+
An example sketch for ESP32 exist and compiles. Feedback welcome.
52+
53+
54+
## Future
55+
56+
- **bool getUID4()** to read only 4 bytes to improve performance. Possible?
57+
- **bool getUID(4)** number of bytes as parameter?
58+
- **uint8_t getError()** add error handling? - I2C; #bytes; mode; ...
59+
- measure performance I2C 400 500 600 kHz ...
60+
- cache the serial? (costs 8 bytes)
61+
- **bool isConnected()** check in begin.
62+
- **bool begin()** return type upgrade.
63+
- **uint8_t getMode()** if not connected error ..
4364

libraries/DS28CM00/examples/DS28CM00_test_ESP/.arduino-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ compile:
55
# - leonardo
66
# - due
77
# - zero
8+
# - m4
9+
- esp32
10+
# - esp8266
11+
# - mega2560

libraries/DS28CM00/library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"url": "https://github.com/RobTillaart/DS28CM00.git"
1717
},
18-
"version": "0.2.2",
18+
"version": "0.2.3",
1919
"license": "MIT",
2020
"frameworks": "arduino",
2121
"platforms": "*"

libraries/DS28CM00/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=DS28CM00
2-
version=0.2.2
2+
version=0.2.3
33
author=Rob Tillaart <[email protected]>
44
maintainer=Rob Tillaart <[email protected]>
55
sentence=Arduino library for I2C DS28CM00 unique identification chip.

libraries/DS28CM00/test/unit_test_001.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,40 @@ unittest_teardown()
3636
}
3737

3838

39-
unittest(test_constructor)
39+
unittest(test_constructor_I)
4040
{
4141
uint8_t uid[8];
4242
DS28CM00 DS28(&Wire);
43-
43+
4444
DS28.begin();
4545
uint8_t mode;
46-
46+
4747
assertFalse(DS28.getMode(mode)); // not connected...
4848
assertEqual(DS28CM00_MODE_UNKNOWN, mode);
49-
49+
5050
assertTrue(DS28.setSMBusMode()); // apparently
5151
assertFalse(DS28.getMode(mode));
5252
assertEqual(DS28CM00_MODE_UNKNOWN, mode);
53-
53+
5454
assertTrue(DS28.setI2CMode());
5555
assertFalse(DS28.getMode(mode));
5656
assertEqual(DS28CM00_MODE_UNKNOWN, mode);
5757
}
5858

59+
60+
unittest(test_constructor_II)
61+
{
62+
fprintf(stderr, "DS28CM00_LIB_VERSION: %s\n", (char *) DS28CM00_LIB_VERSION);
63+
uint8_t uid[8];
64+
DS28CM00 DS28; // use default Wire
65+
66+
DS28.begin();
67+
uint8_t mode;
68+
69+
assertFalse(DS28.getMode(mode)); // not connected...
70+
assertEqual(DS28CM00_MODE_UNKNOWN, mode);
71+
}
72+
5973
unittest_main()
6074

6175
// --------

0 commit comments

Comments
 (0)