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

90 lines
2.9 KiB
Markdown
Raw Normal View History

2022-11-05 05:55:35 -04:00
[![Arduino CI](https://github.com/RobTillaart/FastShiftInOut/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/FastShiftInOut/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/FastShiftInOut/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/FastShiftInOut/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/FastShiftInOut/actions/workflows/jsoncheck.yml)
2023-11-01 07:26:45 -04:00
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/FastShiftInOut.svg)](https://github.com/RobTillaart/FastShiftInOut/issues)
2022-11-05 05:55:35 -04:00
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/FastShiftInOut/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/FastShiftInOut.svg?maxAge=3600)](https://github.com/RobTillaart/FastShiftInOut/releases)
2023-11-01 07:26:45 -04:00
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/FastShiftInOut.svg)](https://registry.platformio.org/libraries/robtillaart/FastShiftInOut)
2022-11-05 05:55:35 -04:00
# FastShiftInOut
2022-11-06 14:27:03 -05:00
Arduino library for **AVR** optimized shiftInOut (simultaneously).
2022-11-05 05:55:35 -04:00
2022-11-06 14:27:03 -05:00
Related libraries
- https://github.com/RobTillaart/FastShiftIn
- https://github.com/RobTillaart/FastShiftOut
- https://github.com/RobTillaart/ShiftInSlow
- https://github.com/RobTillaart/ShiftOutSlow
2022-11-05 05:55:35 -04:00
## Description
FastShiftInOut is a class that can send and receive bytes simultaneously.
In that sense it mimics a SPI bus.
2022-11-05 13:42:15 -04:00
Experimental.
2022-11-05 05:55:35 -04:00
## Performance
performance of **write()**
| version | UNO (us) | ESP32 (us) |
2023-02-20 13:36:46 -05:00
|:---------:|-----------:|-------------:|
2022-11-05 05:55:35 -04:00
| 0.1.0 | 181.08 | 4.32 |
2022-11-05 13:42:15 -04:00
| 0.1.1 | 26.84 | 4.32 |
2023-02-20 13:36:46 -05:00
| 0.1.2 | 26.84 | no data |
| 0.1.3 | 25.52 | 4.32 |
2022-11-05 05:55:35 -04:00
## Interface
2023-02-20 13:36:46 -05:00
```cpp
#include "FastShiftInOut.h"
```
#### Functions
2022-11-05 05:55:35 -04:00
bitOrder = { LSBFIRST, MSBFIRST };
2023-02-20 13:36:46 -05:00
- **FastShiftInOut(uint8_t dataIn, uint8_t dataOut, uint8_t clockPin, uint8_t bitOrder = LSBFIRST)** Constructor.
2022-11-05 05:55:35 -04:00
- **uint8_t write(uint8_t data)** reads and writes simultaneously.
2023-02-20 13:36:46 -05:00
- **uint8_t lastWritten(void)** returns last byte written.
- **uint8_t lastRead(void)** returns last byte read.
- **bool setBitOrder(uint8_t bitOrder)** bitOrder must be LSBFIRST or MSBFIRST.
2022-11-05 05:55:35 -04:00
- **uint8_t getBitOrder(void)** idem.
2023-02-20 13:36:46 -05:00
- **uint8_t writeLSBFIRST(uint8_t data)** optimized version, in practice almost no difference.
- **uint8_t writeMSBFIRST(uint8_t data)** optimized version, in practice almost no difference.
2022-11-05 05:55:35 -04:00
## Future
2023-02-20 13:36:46 -05:00
#### Must
2022-11-05 05:55:35 -04:00
- documentation
2023-02-20 13:36:46 -05:00
- follow FastShiftIn and FastShiftOut
2022-11-05 05:55:35 -04:00
2023-11-01 07:26:45 -04:00
#### Should
2023-02-20 13:36:46 -05:00
2022-11-05 05:55:35 -04:00
2023-11-01 07:26:45 -04:00
#### Could
2023-02-20 13:36:46 -05:00
2022-11-05 05:55:35 -04:00
- **void ignoreRead()**
- add Print interface?
2023-11-01 07:26:45 -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,
2022-11-05 05:55:35 -04:00