Skip to content

Commit 90da998

Browse files
committed
0.1.0 SWSerialOut
1 parent 0b132b6 commit 90da998

File tree

20 files changed

+853
-0
lines changed

20 files changed

+853
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
platforms:
2+
rpipico:
3+
board: rp2040:rp2040:rpipico
4+
package: rp2040:rp2040
5+
gcc:
6+
features:
7+
defines:
8+
- ARDUINO_ARCH_RP2040
9+
warnings:
10+
flags:
11+
12+
packages:
13+
rp2040:rp2040:
14+
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
15+
16+
compile:
17+
# Choosing to run compilation tests on 2 different Arduino platforms
18+
platforms:
19+
- uno
20+
# - due
21+
# - zero
22+
# - leonardo
23+
- m4
24+
- esp32
25+
# - esp8266
26+
# - mega2560
27+
- rpipico
28+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
github: RobTillaart
4+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
name: Arduino-lint
3+
4+
on: [push, pull_request]
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: arduino/arduino-lint-action@v1
11+
with:
12+
library-manager: update
13+
compliance: strict
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Arduino CI
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
runTest:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: 2.6
15+
- run: |
16+
gem install arduino_ci
17+
arduino_ci.rb
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: JSON check
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.json'
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: json-syntax-check
15+
uses: limitusus/json-syntax-check@v1
16+
with:
17+
pattern: "\\.json$"
18+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Change Log SWSerialOut
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
5+
and this project adheres to [Semantic Versioning](http://semver.org/).
6+
7+
8+
## [0.1.0] - 2023-09-02
9+
- revitalized as transmit (TX) only SWSerial.
10+
- initial release
11+
12+
----
13+
14+
## [0.0.0] - 2012-12-21
15+
- proof of concept, baud rate by formula
16+
- https://forum.arduino.cc/t/softwareserial-magic-numbers/135211
17+

libraries/SWSerialOut/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023-2023 Rob Tillaart
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

libraries/SWSerialOut/README.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
2+
[![Arduino CI](https://github.com/RobTillaart/SWSerialOut/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
3+
[![Arduino-lint](https://github.com/RobTillaart/SWSerialOut/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/SWSerialOut/actions/workflows/arduino-lint.yml)
4+
[![JSON check](https://github.com/RobTillaart/SWSerialOut/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/SWSerialOut/actions/workflows/jsoncheck.yml)
5+
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/SWSerialOut.svg)](https://github.com/RobTillaart/SWSerialOut/issues)
6+
7+
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/SWSerialOut/blob/master/LICENSE)
8+
[![GitHub release](https://img.shields.io/github/release/RobTillaart/SWSerialOut.svg?maxAge=3600)](https://github.com/RobTillaart/SWSerialOut/releases)
9+
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/SWSerialOut.svg)](https://registry.platformio.org/libraries/robtillaart/SWSerialOut)
10+
11+
12+
# SWSerialOut
13+
14+
Arduino library for SWSerialOut, supports only data out (TX).
15+
16+
17+
## Description
18+
19+
**Experimental**
20+
21+
SWSerialOut is a library that only implements the transmit function.
22+
There are devices that do not send back information, or in some cases
23+
you do not use the "returned" information.
24+
In those cases there is no need for the receive function, interrupt
25+
handling, buffers etc.
26+
27+
This is where SWSerialOut comes in, it can only transmit data and does
28+
that by implementing the **public Stream** interface.
29+
So its interface is similar to any Stream like Serial or SoftwareSerial,
30+
as the user can use **print()** and **println()** for al the output.
31+
32+
The input side of the Stream interface, **available()**, **peek()**,
33+
and **read()** are stubs returning 0.
34+
35+
The library does not need to buffer incoming data, and it does not buffer outgoing data either. Therefore it can be blocking.
36+
So use the library with care.
37+
38+
39+
#### Test
40+
41+
Test are done with example sketch **SWSO_test.ino** et al which
42+
reads the send data back via hardware Serial.
43+
The serial pulses, especially baud rates above 19200, will improve
44+
with a proper pull up resistor e.g. 4K7.
45+
46+
| baud | UNO | ESP32 | other |
47+
|---------:|:-----:|:-------:|:-------:|
48+
| 300 | Y | Y |
49+
| 600 | Y | Y |
50+
| 1200 | Y | Y |
51+
| 2400 | Y | Y |
52+
| 4800 | Y | Y |
53+
| 7200 | Y | Y |
54+
| 9600 | Y | Y |
55+
| 19200 | Y | Y |
56+
| 38400 | - | Y |
57+
| 57600 | - | Y |
58+
| 76800 | - | Y |
59+
| 100000 | - | Y |
60+
61+
62+
Note: the code is not really optimized for any platform (yet).
63+
So the library will not match the top speed of other software serial implementations.
64+
65+
If you have tested this library with another platform, please let me know by
66+
opening an issue with the relevant data.
67+
68+
69+
#### Related
70+
71+
- https://github.com/RobTillaart/MiniMP3 - minimal version only needs serial out.
72+
73+
74+
## Interface
75+
76+
```cpp
77+
#include "SWSerialOut.h"
78+
```
79+
80+
#### Constructor
81+
82+
- **SWSerialOut(uint8_t TXpin)** constructor.
83+
- **void begin(uint32_t baudRate)** set baud rate (see table above)
84+
- **void begin(uint32_t baudRate, char \* params)** params implemented.
85+
however not tested yet.
86+
The params are range checked.
87+
88+
params is e.g. "8N1" = 8 bit, None parity, 1 stop-bit
89+
90+
| param | value | default | notes |
91+
|:---------:|:----------|:---------:|:--------|
92+
| bit | 5,6,7,8 | 8 | to be tested
93+
| parity | N,E,O,S,M | N | to be tested
94+
| stop bits | 0,1,2,3 | 1 | to be tested
95+
96+
97+
#### Stream interface
98+
99+
The SWSerialOut implements the **public Stream** interface, so
100+
it will support the following functions (indirect from Print):
101+
102+
- **size_t write(char c)** idem.
103+
- **size_t print(...)** idem.
104+
- **size_t println(...)** idem.
105+
106+
The input functions are stubs, just returning 0.
107+
108+
109+
#### Interrupts
110+
111+
To have a more constant timing while sending the bits one can disable
112+
interrupts during the transfer of the data.
113+
114+
- **void disableInterrupts(bool b)** enable/disable interrupts during send.
115+
116+
117+
#### Debug
118+
119+
- **void debug()** dump internal variables.
120+
121+
122+
## Future
123+
124+
125+
#### Must
126+
127+
- update documentation
128+
- test bits, parity, stop bits
129+
130+
131+
#### Should
132+
133+
- examples
134+
- performance sketch
135+
136+
137+
#### Could
138+
139+
- unit tests?
140+
- support inverse logic.
141+
- support 9 bits (low priority)
142+
- add RTS / CTS handshake?
143+
- investigate optimized transfer per platform
144+
- higher baud rates, especially AVR.
145+
146+
147+
#### Wont
148+
149+
- read()
150+
- non blocking version
151+
152+
153+
## Support
154+
155+
If you appreciate my libraries, you can support the development and maintenance.
156+
Improve the quality of the libraries by providing issues and Pull Requests, or
157+
donate through PayPal or GitHub sponsors.
158+
159+
Thank you,
160+

0 commit comments

Comments
 (0)