GY-63_MS5611/libraries/DAC8550/README.md

125 lines
3.7 KiB
Markdown
Raw Normal View History

2021-08-29 10:38:03 -04:00
2021-12-15 06:15:43 -05:00
[![Arduino CI](https://github.com/RobTillaart/DAC8550/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
2021-08-29 10:38:03 -04:00
[![Arduino-lint](https://github.com/RobTillaart/DAC8550/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/DAC8550/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/DAC8550/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/DAC8550/actions/workflows/jsoncheck.yml)
2023-10-19 09:27:18 -04:00
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/DAC8550.svg)](https://github.com/RobTillaart/DAC8550/issues)
2021-12-15 06:15:43 -05:00
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/DAC8550/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/DAC8550.svg?maxAge=3600)](https://github.com/RobTillaart/DAC8550/releases)
2023-10-19 09:27:18 -04:00
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/DAC8550.svg)](https://registry.platformio.org/libraries/robtillaart/DAC8550)
2021-08-29 10:38:03 -04:00
# DAC8550 - experimental
2021-12-15 06:15:43 -05:00
Arduino library for DAC8550 SPI Digital Analog Convertor.
2021-08-29 10:38:03 -04:00
## Description
The DAC8550 is a SPI based 16 bit DAC with one channel.
**WARNING** this library is not tested with real hardware yet.
It is derived from the DAC8551 library.
2024-01-20 07:09:32 -05:00
#### 0.3.0 Breaking change
Version 0.3.0 introduced a breaking change to improve handling the SPI dependency.
The user has to call **SPI.begin()** or equivalent before calling **DAC.begin()**.
Optionally the user can provide parameters to the **SPI.begin(...)**
2023-12-02 04:35:49 -05:00
#### 0.2.0 Breaking change
The version 0.2.0 has breaking changes in the interface.
The essence is removal of ESP32 specific code from the library.
This makes it possible to support the ESP32-S3 and other processors in the future.
Also it makes the library a bit simpler to maintain.
Note order of parameters changed.
#### Related
- https://github.com/RobTillaart/DAC8550
- https://github.com/RobTillaart/DAC8551
- https://github.com/RobTillaart/DAC8552
- https://github.com/RobTillaart/DAC8554
- https://github.com/RobTillaart/MCP_DAC
- https://github.com/RobTillaart/AD5680 (18 bit DAC)
2021-08-29 10:38:03 -04:00
## Interface
2023-10-19 09:27:18 -04:00
```cpp
#include "DAC8550"
```
2021-08-29 10:38:03 -04:00
### Core
2023-12-02 04:35:49 -05:00
- **DAC8550(uint8_t select, SPIClassRP2040 \* spi = &SPI)** Constructor for hardware SPI, RP2040.
- **DAC8550(uint8_t select, SPIClass \* spi = &SPI)** Constructor for hardware SPI, other.
- **DAC8550(uint8_t select, uint8_t spiData, uint8_t spiClock)** Constructor for the software SPI.
- **void begin()** initializes library internals.
2021-08-29 10:38:03 -04:00
- **void setValue(uint16_t value)** set the value of the channel to 0 - 65535
- **uint16_t getValue()** returns the last value written.
### Hardware SPI
To be used only if one needs a specific speed.
- **void setSPIspeed(uint32_t speed)** set SPI transfer rate.
- **uint32_t getSPIspeed()** returns SPI transfer rate.
- **bool usesHWSPI()** returns true if HW SPI is used.
### Power down
check datasheet for details.
- **void setPowerDown(uint8_t powerDownMode)** sets power down mode. 0 - 3.
- **uint8_t getPowerDownMode()** returns last written mode.
2021-12-15 06:15:43 -05:00
| Power down mode | Value |
|:---------------------------|:-----:|
| DAC8550_POWERDOWN_NORMAL | 0 |
| DAC8550_POWERDOWN_1K | 1 |
| DAC8550_POWERDOWN_100K | 2 |
| DAC8550_POWERDOWN_HIGH_IMP | 3 |
2021-08-29 10:38:03 -04:00
2022-10-31 11:21:38 -04:00
## Operation
2021-08-29 10:38:03 -04:00
2022-10-31 11:21:38 -04:00
See examples
2021-08-29 10:38:03 -04:00
2022-10-31 11:21:38 -04:00
## Future
2021-08-29 10:38:03 -04:00
2023-10-19 09:27:18 -04:00
#### Must
2022-10-31 11:21:38 -04:00
- improve documentation
2023-10-19 09:27:18 -04:00
#### Should
- testing with real hardware
#### Could
2022-10-31 11:21:38 -04:00
- improve code incl readability
- spiData => spiDataOut
2021-08-29 10:38:03 -04:00
2023-10-19 09:27:18 -04:00
#### Wont
## Support
If you appreciate my libraries, you can support the development and maintenance.
Improve the quality of the libraries by providing issues and Pull Requests, or
donate through PayPal or GitHub sponsors.
Thank you,
2021-08-29 10:38:03 -04:00