mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.2.6 DAC8551
This commit is contained in:
parent
9fc027bdf3
commit
0edc75ad8b
@ -1,3 +1,18 @@
|
||||
platforms:
|
||||
rpipico:
|
||||
board: rp2040:rp2040:rpipico
|
||||
package: rp2040:rp2040
|
||||
gcc:
|
||||
features:
|
||||
defines:
|
||||
- ARDUINO_ARCH_RP2040
|
||||
warnings:
|
||||
flags:
|
||||
|
||||
packages:
|
||||
rp2040:rp2040:
|
||||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
|
||||
|
||||
compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
@ -8,4 +23,6 @@ compile:
|
||||
- m4
|
||||
- esp32
|
||||
# - esp8266
|
||||
# - mega2560
|
||||
# - mega2560
|
||||
- rpipico
|
||||
|
||||
|
48
libraries/DAC8551/CHANGELOG.md
Normal file
48
libraries/DAC8551/CHANGELOG.md
Normal file
@ -0,0 +1,48 @@
|
||||
# Change Log DAC8551
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.2.6] - 2022-10-31
|
||||
- add changelog.md
|
||||
- add rp2040 to build-CI
|
||||
|
||||
## [0.2.5] - 2021-12-15
|
||||
- update library.json
|
||||
- update license
|
||||
- minor edits
|
||||
|
||||
## [0.2.4] - 2021-08-29
|
||||
- add support for HSPI / VSPI ESP32 ++
|
||||
|
||||
## [0.2.3] - 2021-06-02
|
||||
- compile ESP32
|
||||
|
||||
## [0.2.2] - 2021-02-04
|
||||
- add DAC8550 DAC8501 DAC8501 derived class
|
||||
- minor refactor
|
||||
|
||||
## [0.2.1] - 2020-12-18
|
||||
- add arduino-ci + unit tests
|
||||
|
||||
## [0.2.0] - 2020-12-18
|
||||
- add slaveSelect to hardware SPI
|
||||
|
||||
----
|
||||
|
||||
## [0.1.3] - 2020-06-07
|
||||
- fix library.json
|
||||
## [0.1.2] - 2020-04-06
|
||||
- minor refactor
|
||||
- update readme.md
|
||||
|
||||
## [0.1.1] - 2017-12-19
|
||||
- fix begin() bug
|
||||
|
||||
## [0.1.0] - 2017-12-18
|
||||
- initial version
|
||||
|
||||
|
@ -2,20 +2,11 @@
|
||||
// FILE: DAC8551.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: Arduino library for DAC8551 SPI Digital Analog Convertor
|
||||
// VERSION: 0.2.4
|
||||
// VERSION: 0.2.6
|
||||
// URL: https://github.com/RobTillaart/DAC8551
|
||||
//
|
||||
// HISTORY
|
||||
// 0.1.0: 2017-12-18 initial version
|
||||
// 0.1.1: 2017-12-19 fix begin() bug
|
||||
// 0.1.2 2020-04-06 minor refactor, readme.md
|
||||
// 0.1.3 2020-06-07 fix library.json
|
||||
// 0.2.0 2020-12-18 add slaveSelect to hardware SPI
|
||||
// 0.2.1 2020-12-18 add arduino-ci + unit tests
|
||||
// 0.2.2 2021-02-04 add DAC8550 DAC8501 DAC8501 derived class + minor refactor
|
||||
// 0.2.3 2021-06-02 compile ESP32
|
||||
// 0.2.4 2021-08-29 add support for HSPI / VSPI ESP32 ++
|
||||
// 0.2.5 2021-12-15 update library.json, license, minor edits
|
||||
// HISTORY: see changelog.md
|
||||
|
||||
|
||||
|
||||
#include "DAC8551.h"
|
||||
@ -37,8 +28,8 @@ DAC8551::DAC8551(uint8_t spiData, uint8_t spiClock, uint8_t slaveSelect)
|
||||
}
|
||||
|
||||
|
||||
// initializes the SPI
|
||||
// and sets internal state
|
||||
// initializes the SPI
|
||||
// and sets internal state
|
||||
void DAC8551::begin()
|
||||
{
|
||||
pinMode(_select, OUTPUT);
|
||||
@ -49,26 +40,26 @@ void DAC8551::begin()
|
||||
if(_hwSPI)
|
||||
{
|
||||
#if defined(ESP32)
|
||||
if (_useHSPI) // HSPI
|
||||
if (_useHSPI) // HSPI
|
||||
{
|
||||
mySPI = new SPIClass(HSPI);
|
||||
mySPI->end();
|
||||
mySPI->begin(14, 12, 13, _select); // CLK=14 MISO=12 MOSI=13
|
||||
mySPI->begin(14, 12, 13, _select); // CLK=14 MISO=12 MOSI=13
|
||||
}
|
||||
else // VSPI
|
||||
else // VSPI
|
||||
{
|
||||
mySPI = new SPIClass(VSPI);
|
||||
mySPI->end();
|
||||
mySPI->begin(18, 19, 23, _select); // CLK=18 MISO=19 MOSI=23
|
||||
mySPI->begin(18, 19, 23, _select); // CLK=18 MISO=19 MOSI=23
|
||||
}
|
||||
#else // generic hardware SPI
|
||||
#else // generic hardware SPI
|
||||
mySPI = &SPI;
|
||||
mySPI->end();
|
||||
mySPI->begin();
|
||||
#endif
|
||||
delay(1);
|
||||
}
|
||||
else // software SPI
|
||||
else // software SPI
|
||||
{
|
||||
pinMode(_dataOut, OUTPUT);
|
||||
pinMode(_clock, OUTPUT);
|
||||
@ -96,7 +87,7 @@ void DAC8551::setGPIOpins(uint8_t clk, uint8_t miso, uint8_t mosi, uint8_t selec
|
||||
#endif
|
||||
|
||||
|
||||
// value = 0..65535
|
||||
// value = 0..65535
|
||||
void DAC8551::setValue(uint16_t value)
|
||||
{
|
||||
_value = value;
|
||||
@ -104,7 +95,7 @@ void DAC8551::setValue(uint16_t value)
|
||||
}
|
||||
|
||||
|
||||
// returns 0..65535
|
||||
// returns 0..65535
|
||||
uint16_t DAC8551::getValue()
|
||||
{
|
||||
return _value;
|
||||
@ -133,7 +124,7 @@ void DAC8551::setSPIspeed(uint32_t speed)
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PRIVATE
|
||||
// PRIVATE
|
||||
//
|
||||
void DAC8551::updateDevice()
|
||||
{
|
||||
@ -148,7 +139,7 @@ void DAC8551::updateDevice()
|
||||
mySPI->transfer(_value & 0xFF);
|
||||
mySPI->endTransaction();
|
||||
}
|
||||
else // Software SPI
|
||||
else // Software SPI
|
||||
{
|
||||
swSPI_transfer(configRegister);
|
||||
swSPI_transfer(_value >> 8);
|
||||
@ -158,7 +149,7 @@ void DAC8551::updateDevice()
|
||||
}
|
||||
|
||||
|
||||
// simple one mode version
|
||||
// simple one mode version
|
||||
void DAC8551::swSPI_transfer(uint8_t value)
|
||||
{
|
||||
uint8_t clk = _clock;
|
||||
@ -174,7 +165,7 @@ void DAC8551::swSPI_transfer(uint8_t value)
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
//
|
||||
// derive 8501, 8531 and 8550 from 8551
|
||||
// derive 8501, 8531 and 8550 from 8551
|
||||
//
|
||||
|
||||
DAC8501::DAC8501(uint8_t slaveSelect) : DAC8551(slaveSelect)
|
||||
|
@ -4,7 +4,7 @@
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: Arduino library for DAC8551 SPI Digital Analog Convertor
|
||||
// could work with DAC8550, not tested
|
||||
// VERSION: 0.2.5
|
||||
// VERSION: 0.2.6
|
||||
// HISTORY: See DAC8551.cpp
|
||||
// URL: https://github.com/RobTillaart/DAC8551
|
||||
//
|
||||
@ -14,7 +14,7 @@
|
||||
#include "SPI.h"
|
||||
|
||||
|
||||
#define DAC8551_LIB_VERSION (F("0.2.5"))
|
||||
#define DAC8551_LIB_VERSION (F("0.2.6"))
|
||||
|
||||
|
||||
#define DAC8551_POWERDOWN_NORMAL 0
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/DAC8551"
|
||||
},
|
||||
"version": "0.2.5",
|
||||
"version": "0.2.6",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=DAC8551
|
||||
version=0.2.5
|
||||
version=0.2.6
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for DAC8501, DAC8531, DAC8550 and DAC8551 SPI 16-bit Digital Analog Convertor
|
||||
|
Loading…
Reference in New Issue
Block a user