0.3.5 MCP4725

This commit is contained in:
rob tillaart 2023-01-16 17:33:16 +01:00
parent 0e79c7ba67
commit c2af029108
12 changed files with 77 additions and 48 deletions

View File

@ -6,7 +6,7 @@ jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: arduino/arduino-lint-action@v1 - uses: arduino/arduino-lint-action@v1
with: with:
library-manager: update library-manager: update

View File

@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
ruby-version: 2.6 ruby-version: 2.6

View File

@ -10,7 +10,7 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: json-syntax-check - name: json-syntax-check
uses: limitusus/json-syntax-check@v1 uses: limitusus/json-syntax-check@v1
with: with:

View File

@ -4,76 +4,85 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.3.5] - 2023-01-17
- update GitHub actions
- update license
- fix #23 add note about RP2040
- add **MCP4725_MIDPOINT** constant
- minor edits
## [0.3.4] - 2022-10-17 ## [0.3.4] - 2022-10-17
- Add RP2040 support (kudos to intubun) - Add RP2040 support (kudos to intubun)
- Add RP2040 in build-CI - Add RP2040 in build-CI
- Add changelog.md - Add changelog.md
## [0.3.3] - 2021-12-21 ## [0.3.3] - 2021-12-21
- update library.json, - update library.json,
- update license - update license
- minor edits - minor edits
## [0.3.2] - 2021-06-06 ## [0.3.2] - 2021-06-06
- Verify input of setPercentage() - Verify input of setPercentage()
## [0.3.1] - 2021-05-27 ## [0.3.1] - 2021-05-27
- Fix Arduino-CI / Arduino-lint - Fix Arduino-CI / Arduino-lint
## [0.3.0] - 2021-01-15 ## [0.3.0] - 2021-01-15
- Add WireN support (e.g. teensy) - Add WireN support (e.g. teensy)
---- ----
## [0.2.3] - 2020-12-26 ## [0.2.3] - 2020-12-26
- Arduino-CI, - Arduino-CI,
- add bool isConnected(), - add bool isConnected(),
- update bool begin() - update bool begin()
## [0.2.2] - 2020-07-05 ## [0.2.2] - 2020-07-05
- add get/setPercentage(); - add get/setPercentage();
## [0.2.1] - 2020-07-04 ## [0.2.1] - 2020-07-04
- Add yield(); - Add yield();
- add getLastWriteEEPROM(); - add getLastWriteEEPROM();
- update readme.md - update readme.md
- update keywords.txt - update keywords.txt
## [0.2.0] - 2020-06-20 ## [0.2.0] - 2020-06-20
- use #pragma once; - use #pragma once;
- remove pre 1.0 support; - remove pre 1.0 support;
- refactor a lot - refactor a lot
- rename RDY() -> ready() - rename RDY() -> ready()
---- ----
## [0.1.9] - 2019-10-14 ## [0.1.9] - 2019-10-14
- replace AVR specific TWBR with \_wire->setClock() #131 - replace AVR specific TWBR with \_wire->setClock() #131
## [0.1.8] - 2018-10-24 ## [0.1.8] - 2018-10-24
- fix read only variables #115 (kudos to perl1234) - fix read only variables #115 (kudos to perl1234)
## [0.1.7] - 2017-04-20 ## [0.1.7] - 2017-04-20
- refactor the removed timeout (Thanks to Koepel) - refactor the removed timeout (Thanks to Koepel)
## [0.1.6] - 2017-04-19 ## [0.1.6] - 2017-04-19
- refactor - refactor
- remove timeout - https://github.com/RobTillaart/Arduino/issues/63 - remove timeout - https://github.com/RobTillaart/Arduino/issues/63
## [0.1.05] - 2015-03-06 ## [0.1.05] - 2015-03-06
- refactoring, stricter interfaces - refactoring, stricter interfaces
## [0.1.04] - 2013-12-04 ## [0.1.04] - 2013-12-04
- improved the generalCall code (still experimental) - improved the generalCall code (still experimental)
## [0.1.03] - 2013-12-01 ## [0.1.03] - 2013-12-01
- added powerDownMode code - added powerDownMode code
## [0.1.02] - 2013-12-01 ## [0.1.02] - 2013-12-01
- added readEEPROM() - added readEEPROM()
- added RDY() - added RDY()
## [0.1.01] - 2013-11-30 ## [0.1.01] - 2013-11-30
- added readDAC() - added readDAC()
- added writeDAC(registerwrite) - added writeDAC(registerwrite)

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2013-2022 Rob Tillaart Copyright (c) 2013-2023 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,8 +1,8 @@
// //
// FILE: MCP4725.cpp // FILE: MCP4725.cpp
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for 12 bit I2C DAC - MCP4725 // PURPOSE: Arduino library for 12 bit I2C DAC - MCP4725
// VERSION: 0.3.4 // VERSION: 0.3.5
// URL: https://github.com/RobTillaart/MCP4725 // URL: https://github.com/RobTillaart/MCP4725
// //
// HISTORY see changelog.md // HISTORY see changelog.md
@ -270,5 +270,5 @@ int MCP4725::_generalCall(const uint8_t gc)
} }
// -- END OF FILE -- // -- END OF FILE --

View File

@ -2,8 +2,8 @@
// //
// FILE: MCP4725.h // FILE: MCP4725.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for 12 bit I2C DAC - MCP4725 // PURPOSE: Arduino library for 12 bit I2C DAC - MCP4725
// VERSION: 0.3.4 // VERSION: 0.3.5
// URL: https://github.com/RobTillaart/MCP4725 // URL: https://github.com/RobTillaart/MCP4725
// //
@ -12,7 +12,7 @@
#include "Arduino.h" #include "Arduino.h"
#define MCP4725_VERSION (F("0.3.4")) #define MCP4725_VERSION (F("0.3.5"))
// CONSTANTS // CONSTANTS
@ -32,6 +32,8 @@
#define MCP4725_PDMODE_100K 0x02 #define MCP4725_PDMODE_100K 0x02
#define MCP4725_PDMODE_500K 0x03 #define MCP4725_PDMODE_500K 0x03
#define MCP4725_MIDPOINT 2048
class MCP4725 class MCP4725
{ {
@ -44,7 +46,7 @@ public:
#if defined (ARDUINO_ARCH_RP2040) #if defined (ARDUINO_ARCH_RP2040)
bool begin(int sda, int scl); bool begin(int sda, int scl);
#endif #endif
@ -94,5 +96,5 @@ private:
}; };
// -- END OF FILE -- // -- END OF FILE --

View File

@ -13,7 +13,7 @@ Arduino library for 12 bit I2C DAC - MCP4725.
## Description ## Description
The MCP4725 is an I2C 12 bit Digital to Analog Converter (DAC). The MCP4725 is an I2C single channel 12 bit Digital to Analog Converter (DAC).
It is possible to have up to 8 MCP4725 on one I2C bus. It is possible to have up to 8 MCP4725 on one I2C bus.
The MCP4725 supports 100 KHz 400 KHz and 3.4 MHz bus speeds. The MCP4725 supports 100 KHz 400 KHz and 3.4 MHz bus speeds.
@ -100,7 +100,13 @@ If one need more DAC's one might have a look at the MCP4728
It has 4 channels per chip (no experience /library yet) It has 4 channels per chip (no experience /library yet)
### RP2040 specific #### RP2040 specific
There are different RP2040 board files.
This library works with RP2040 pico - https://github.com/earlephilhower/arduino-pico
Will give an error on setSDA() and setSCL() with the "Arduino MBED OS" version.
See remark PR #21.
- **bool begin(int sda, int scl)** begin communication with the DAC. - **bool begin(int sda, int scl)** begin communication with the DAC.
It has the parameter for selecting on which pins the communication should happen. It has the parameter for selecting on which pins the communication should happen.
@ -115,10 +121,16 @@ See examples
## Future ## Future
#### Must
- update documentation - update documentation
#### Should
- test the powerDown modes / functions. - test the powerDown modes / functions.
- write a sketch to measure the **writeDac()** timing if possible.
#### Could
- extend unit tests - extend unit tests
-

View File

@ -12,9 +12,13 @@ read KEYWORD2
setValue KEYWORD2 setValue KEYWORD2
getValue KEYWORD2 getValue KEYWORD2
writeDAC KEYWORD2
setPercentage KEYWORD2
getPercentage KEYWORD2
writeDAC KEYWORD2
ready KEYWORD2 ready KEYWORD2
getLastWriteEEPROM KEYWORD2
readDAC KEYWORD2 readDAC KEYWORD2
readEEPROM KEYWORD2 readEEPROM KEYWORD2
@ -24,10 +28,6 @@ readPowerDownModeDAC KEYWORD2
powerOnReset KEYWORD2 powerOnReset KEYWORD2
powerOnWakeUp KEYWORD2 powerOnWakeUp KEYWORD2
getLastWriteEEPROM KEYWORD2
setPercentage KEYWORD2
getPercentage KEYWORD2
# Instances (KEYWORD2) # Instances (KEYWORD2)
@ -43,3 +43,6 @@ MCP4725_PDMODE_1K LITERAL1
MCP4725_PDMODE_100K LITERAL1 MCP4725_PDMODE_100K LITERAL1
MCP4725_PDMODE_500K LITERAL1 MCP4725_PDMODE_500K LITERAL1
MCP4725_MIDPOINT LITERAL1

View File

@ -15,7 +15,7 @@
"type": "git", "type": "git",
"url": "https://github.com/RobTillaart/MCP4725.git" "url": "https://github.com/RobTillaart/MCP4725.git"
}, },
"version": "0.3.4", "version": "0.3.5",
"license": "MIT", "license": "MIT",
"frameworks": "arduino", "frameworks": "arduino",
"platforms": "*", "platforms": "*",

View File

@ -1,9 +1,9 @@
name=MCP4725 name=MCP4725
version=0.3.4 version=0.3.5
author=Rob Tillaart <rob.tillaart@gmail.com> author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com> maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for 12 bit I2C DAC - MCP4725 sentence=Arduino library for 12 bit I2C DAC - MCP4725
paragraph= paragraph=
category=Sensors category=Sensors
url=https://github.com/RobTillaart/MCP4725 url=https://github.com/RobTillaart/MCP4725
architectures=* architectures=*

View File

@ -67,6 +67,9 @@ unittest(test_constant)
assertEqual(MCP4725_PDMODE_1K, 1); assertEqual(MCP4725_PDMODE_1K, 1);
assertEqual(MCP4725_PDMODE_100K, 2); assertEqual(MCP4725_PDMODE_100K, 2);
assertEqual(MCP4725_PDMODE_500K, 3); assertEqual(MCP4725_PDMODE_500K, 3);
fprintf(stderr, "other\n");
assertEqual(MCP4725_MIDPOINT, 2048);
} }