Skip to content

Commit

Permalink
update library.json, license, minor edits (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart authored Dec 21, 2021
1 parent 56ed80d commit f960eb0
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 34 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2013-2021 Rob Tillaart
Copyright (c) 2013-2022 Rob Tillaart

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 6 additions & 5 deletions MCP4725.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// FILE: MCP4725.cpp
// AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for 12 bit I2C DAC - MCP4725
// VERSION: 0.3.2
// VERSION: 0.3.3
// URL: https://github.com/RobTillaart/MCP4725
//
// HISTORY:
Expand All @@ -21,10 +21,11 @@
// 0.2.1 2020-07-04 Add yield(); add getLastWriteEEPROM();
// update readme.md + keywords.txt
// 0.2.2 2020-07-05 add get/setPercentage();
// 0.2.3 2020-12-26 arduino-CI, bool isConnected(), bool begin()
// 0.2.3 2020-12-26 Arduino-CI, bool isConnected(), bool begin()
// 0.3.0 2021-01-15 Add WireN support (e.g. teensy)
// 0.3.1 2021-05-27 Fix arduino-CI / arduino-lint
// 0.3.1 2021-05-27 Fix Arduino-CI / Arduino-lint
// 0.3.2 2021-06-06 Verify input of setPercentage()
// 0.3.3 2021-12-21 update library.json, license, minor edits


#include "MCP4725.h"
Expand Down Expand Up @@ -152,7 +153,7 @@ uint16_t MCP4725::readEEPROM()
// (true) DAC & EEPROM,
int MCP4725::writePowerDownMode(const uint8_t PDM, const bool EEPROM)
{
_powerDownMode = (PDM & 0x03); // mask pdm bits only (written later low level)
_powerDownMode = (PDM & 0x03); // mask PDM bits only (written later low level)
return writeDAC(_lastValue, EEPROM);
}

Expand Down Expand Up @@ -189,7 +190,7 @@ int MCP4725::powerOnReset()


// PAGE 22 - experimental
// _powerDownMode DAC resets to 0 -- pdm EEPROM stays same !!!
// _powerDownMode DAC resets to 0 -- PDM EEPROM stays same !!!
// need to reflect this in cached value
int MCP4725::powerOnWakeUp()
{
Expand Down
4 changes: 2 additions & 2 deletions MCP4725.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// FILE: MCP4725.h
// AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for 12 bit I2C DAC - MCP4725
// VERSION: 0.3.2
// VERSION: 0.3.3
// URL: https://github.com/RobTillaart/MCP4725
//

Expand All @@ -12,7 +12,7 @@
#include "Arduino.h"


#define MCP4725_VERSION (F("0.3.2"))
#define MCP4725_VERSION (F("0.3.3"))


// constants
Expand Down
8 changes: 5 additions & 3 deletions examples/MCP4725_wave_generator/MCP4725_wave_generator.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
// FILE: MCP4725_wave_generator.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo function generators
// DATE: 2021-01-07
// URL: https://github.com/RobTillaart/FunctionGenerator
Expand All @@ -10,10 +9,11 @@
// other signals are less difficult so have a slightly larger range.
//
// PLATFORM SINUS SQUARE SAWTOOTH TRIANGLE
// UNO -100 Hz
// UNO -100 Hz
// ESP32 -200 Hz -1000 -250 -100
//


#include "MCP4725.h"
#include "Wire.h"

Expand Down Expand Up @@ -171,4 +171,6 @@ void loop()
{
}

// END OF FILE

// -- END OF FILE --

7 changes: 4 additions & 3 deletions examples/mcp4725_isConnected/mcp4725_isConnected.ino
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
//
// FILE: mcp4725_isConnected.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: test mcp4725 lib
// DATE: 2020-12-26
// URL: https://github.com/RobTillaart/MCP4725
//
// test to see behaviour when sensor is not connected and reconnected again. E.g. loose wires..

// test to see behavior when sensor is not connected and reconnected again. E.g. loose wires..

#include "Wire.h"
#include "MCP4725.h"
Expand All @@ -16,6 +15,7 @@ MCP4725 MCP(0x62); // 0x62 or 0x63

bool connected = false;


void setup()
{
Serial.begin(115200);
Expand All @@ -31,6 +31,7 @@ void setup()
Serial.println("end of setup()");
}


void loop()
{
if (!connected && MCP.isConnected())
Expand All @@ -47,5 +48,5 @@ void loop()
}



// -- END OF FILE --

6 changes: 4 additions & 2 deletions examples/mcp4725_keypad/mcp4725_keypad.ino
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
//
// FILE: MCP4725_keypad.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.2.0
// PURPOSE: test MCP4725 lib
// DATE: 2019-10-16
// URL: https://github.com/RobTillaart/MCP4725
//

// Note: possible to replace I2CKeypad with Serial code


Expand All @@ -23,6 +21,7 @@ I2CKeyPad keyPad(KEYPAD_ADDR);
uint32_t value = 0;
uint32_t oldValue = 0;


void setup()
{
Serial.begin(115200);
Expand All @@ -35,6 +34,7 @@ void setup()
keyPad.begin();
}


void loop()
{
char c = updateKeyPadValue(value, 4095);
Expand Down Expand Up @@ -81,4 +81,6 @@ char updateKeyPadValue(uint32_t &value, uint32_t maxValue)
return c;
}


// -- END OF FILE --

13 changes: 11 additions & 2 deletions examples/mcp4725_test/mcp4725_test.ino
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
//
// FILE: mcp4725_test.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.5
// PURPOSE: test mcp4725 lib
// DATE: 2013-11-24
// URL: https://github.com/RobTillaart/MCP4725
//


#include "Wire.h"
#include "MCP4725.h"
Expand All @@ -15,6 +14,7 @@ MCP4725 MCP(0x62); // 0x62 or 0x63
volatile int x;
uint32_t start, stop;


void setup()
{
Serial.begin(115200);
Expand All @@ -31,6 +31,7 @@ void setup()
test6();
}


void test1()
{
Serial.print("\nValue:\t");
Expand All @@ -49,6 +50,7 @@ void test1()
Serial.println();
}


void test2()
{
Serial.println("\n\nMCP4725_II\n\n");
Expand Down Expand Up @@ -88,6 +90,7 @@ void test2()
Serial.println();
}


void test3()
{
Serial.println("\n\nMCP4725_POWERDOWNMODE\n\n");
Expand Down Expand Up @@ -134,6 +137,7 @@ void test3()
Serial.println();
}


void test4()
{
Serial.println("\n\nEXPERIMENTAL");
Expand Down Expand Up @@ -168,6 +172,7 @@ void test4()
Serial.println();
}


void test5()
{
Serial.println("\n\nPERFORMANCE");
Expand Down Expand Up @@ -245,6 +250,7 @@ void test5()
Serial.println(stop - start);
}


void test6()
{
Serial.println("\n\nEXPERIMENTAL II");
Expand Down Expand Up @@ -279,6 +285,7 @@ void test6()
Serial.print("\nDone... (start triangle mode)");
}


void loop()
{
for (uint16_t i = 0; i < 4096; i++)
Expand All @@ -293,4 +300,6 @@ void loop()
}
}


// -- END OF FILE --

7 changes: 5 additions & 2 deletions examples/smooth2Value/smooth2Value.ino
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//
// FILE: smooth2Value.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// PURPOSE: test mcp4725 lib
// DATE: 2013-12-01
// URL: https://github.com/RobTillaart/MCP4725
//


#include "Wire.h"
#include "MCP4725.h"

MCP4725 MCP(0x62); // 0x62 or 0x63


void setup()
{
Serial.begin(115200);
Expand Down Expand Up @@ -54,6 +54,7 @@ void setup()
Serial.print("\nDone... (start triangle mode)");
}


void loop()
{
// different gradients
Expand Down Expand Up @@ -84,4 +85,6 @@ int smooth2Value(uint16_t value, uint16_t steps)
return MCP.setValue(value);
}


// -- END OF FILE --

2 changes: 2 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Syntax Colouring Map For MCP4725


# Data types (KEYWORD1)
MCP4725 KEYWORD1


# Methods and Functions (KEYWORD2)
begin KEYWORD2
isConnected KEYWORD2
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/MCP4725.git"
},
"version": "0.3.2",
"version": "0.3.3",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=MCP4725
version=0.3.2
version=0.3.3
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for 12 bit I2C DAC - MCP4725
Expand Down
26 changes: 14 additions & 12 deletions test/unit_test_001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,33 @@
#include "MCP4725.h"



unittest_setup()
{
fprintf(stderr, "MCP4725_VERSION: %s\n", (char *) MCP4725_VERSION);
}


unittest_teardown()
{
}


unittest(test_constructor)
{
fprintf(stderr, "VERSION: %s\n", MCP4725_VERSION);
MCP4725 MCP(0x62);
Wire.begin();

assertEqual(0, MCP.getValue());
assertEqual(0, MCP.getLastWriteEEPROM());

fprintf(stderr, "test start\n");
assureTrue(MCP.isConnected());
// assertTrue(MCP.begin());
}


unittest(test_constant)
{
fprintf(stderr, "test default values\n");
assertEqual(MCP4725_MAXVALUE, 4095);
assertEqual(MCP4725_OK, 0);
Expand All @@ -56,16 +67,6 @@ unittest(test_constructor)
assertEqual(MCP4725_PDMODE_1K, 1);
assertEqual(MCP4725_PDMODE_100K, 2);
assertEqual(MCP4725_PDMODE_500K, 3);

assertEqual(0, MCP.getValue());
assertEqual(0, MCP.getLastWriteEEPROM());

fprintf(stderr, "test start\n");

assureTrue(MCP.isConnected());
// assertTrue(MCP.begin());
// assertTrue(MCP.isConnected());

}


Expand Down Expand Up @@ -95,6 +96,7 @@ unittest(test_writeDAC)
assertEqual(MCP4725_VALUE_ERROR, MCP.writeDAC(4096, true));
}


unittest_main()

// --------

0 comments on commit f960eb0

Please sign in to comment.