mirror of
https://github.com/RobTillaart/I2C_EEPROM.git
synced 2026-07-27 20:06:07 +00:00
@@ -0,0 +1,7 @@
|
||||
compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
- uno
|
||||
- leonardo
|
||||
- due
|
||||
- zero
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
name: Arduino CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
arduino_ci:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: Arduino-CI/action@master
|
||||
# Arduino-CI/action@v0.1.1
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
|
||||
int determineSize();
|
||||
|
||||
|
||||
private:
|
||||
uint8_t _deviceAddress;
|
||||
uint32_t _lastWrite; // for waitEEReady
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
|
||||
[](https://github.com/marketplace/actions/arduino_ci)
|
||||
[](https://github.com/RobTillaart/I2C_EEPROM/blob/master/LICENSE)
|
||||
[](https://github.com/RobTillaart/I2C_EEPROM/releases)
|
||||
|
||||
# I2C_EEPROM
|
||||
|
||||
Arduino Library for external I2C EEPROM - 24LC256, 24LC64
|
||||
@@ -8,13 +13,14 @@ Library to access external I2C EEPROM.
|
||||
|
||||
The interface is pretty straightforward
|
||||
|
||||
* readByte - read a single byte from a given address
|
||||
* writeByte
|
||||
* setBlock
|
||||
* readBlock
|
||||
* writeBlock
|
||||
* determineSize
|
||||
|
||||
- **begin()** constructor
|
||||
- **begin(sda, scl)** constructor for ESP32
|
||||
- **writeByte(address, value)** write a single byte
|
||||
- **writeBlock(address, buffer, length)**
|
||||
- **setBlock(address, value, length)** e.g. use to clear I2C EEPROM
|
||||
- **readByte(address)** - read a single byte from a given address
|
||||
- **readBlock(address, buffer, length)**
|
||||
- **determineSize()**
|
||||
|
||||
|
||||
## Limitation
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// FILE: unit_test_001.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2020-12-22
|
||||
// PURPOSE: unit tests for the I2C_EEPROM library
|
||||
// https://github.com/RobTillaart/
|
||||
// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md
|
||||
//
|
||||
|
||||
// supported assertions
|
||||
// https://github.com/Arduino-CI/arduino_ci/blob/master/cpp/unittest/Assertion.h#L33-L42
|
||||
// ----------------------------
|
||||
// assertEqual(expected, actual)
|
||||
// assertNotEqual(expected, actual)
|
||||
// assertLess(expected, actual)
|
||||
// assertMore(expected, actual)
|
||||
// assertLessOrEqual(expected, actual)
|
||||
// assertMoreOrEqual(expected, actual)
|
||||
// assertTrue(actual)
|
||||
// assertFalse(actual)
|
||||
// assertNull(actual)
|
||||
// assertNotNull(actual)
|
||||
|
||||
#include <ArduinoUnitTests.h>
|
||||
|
||||
#define assertEqualFloat(arg1, arg2, arg3) assertOp("assertEqualFloat", "expected", fabs(arg1 - arg2), compareLessOrEqual, "<=", "actual", arg3)
|
||||
#define assertEqualINF(arg) assertOp("assertEqualINF", "expected", INFINITY, compareEqual, "==", "actual", arg)
|
||||
#define assertEqualNAN(arg) assertOp("assertEqualNAN", "expected", true, compareEqual, "==", "actual", isnan(arg))
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "I2C_eeprom.h"
|
||||
|
||||
|
||||
|
||||
unittest_setup()
|
||||
{
|
||||
}
|
||||
|
||||
unittest_teardown()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
unittest(test_new_operator)
|
||||
{
|
||||
assertEqualINF(exp(800));
|
||||
assertEqualINF(0.0/0.0);
|
||||
assertEqualINF(42);
|
||||
|
||||
assertEqualNAN(INFINITY - INFINITY);
|
||||
assertEqualNAN(0.0/0.0);
|
||||
assertEqualNAN(42);
|
||||
}
|
||||
*/
|
||||
|
||||
unittest(test_constructor)
|
||||
{
|
||||
I2C_eeprom EE(48);
|
||||
EE.begin();
|
||||
|
||||
|
||||
assertEqual(1, 1);
|
||||
}
|
||||
|
||||
unittest_main()
|
||||
|
||||
// --------
|
||||
Reference in New Issue
Block a user