Skip to content

Commit 6f2cc90

Browse files
committed
0.3.0 KT0803
1 parent 7e418fc commit 6f2cc90

File tree

14 files changed

+227
-76
lines changed

14 files changed

+227
-76
lines changed

libraries/KT0803/.github/workflows/arduino-lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on: [push, pull_request]
55
jobs:
66
lint:
77
runs-on: ubuntu-latest
8+
timeout-minutes: 5
89
steps:
910
- uses: actions/checkout@v4
1011
- uses: arduino/arduino-lint-action@v1

libraries/KT0803/.github/workflows/arduino_test_runner.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ on: [push, pull_request]
66
jobs:
77
runTest:
88
runs-on: ubuntu-latest
9+
timeout-minutes: 20
910

1011
steps:
1112
- uses: actions/checkout@v4
1213
- uses: ruby/setup-ruby@v1
1314
with:
1415
ruby-version: 2.6
1516
- run: |
17+
# sudo sysctl vm.mmap_rnd_bits=28
1618
gem install arduino_ci
1719
arduino_ci.rb

libraries/KT0803/.github/workflows/jsoncheck.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ on:
99
jobs:
1010
test:
1111
runs-on: ubuntu-latest
12+
timeout-minutes: 5
1213
steps:
1314
- uses: actions/checkout@v4
1415
- name: json-syntax-check
15-
uses: limitusus/json-syntax-check@v1
16+
uses: limitusus/json-syntax-check@v2
1617
with:
1718
pattern: "\\.json$"
1819

libraries/KT0803/CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.3.0] - 2024-03-27
10+
- fix #5, getChannel()
11+
- fix KT0803K setChannel()
12+
- fix readData()
13+
- add several KT0803K specific functions (experimental)
14+
- bool setMono()
15+
- bool setStereo()
16+
- bool isStereo()
17+
- bool setBass(uint8_t bass)
18+
- uint8_t getBass()
19+
- bool powerOK()
20+
- bool silenceDetected()
21+
- update GitHub actions
22+
- update readme.md
23+
- update keywords.txt
24+
- minor edits
25+
26+
----
27+
928
## [0.2.0] - 2024-03-09
1029
- Fix #2 frequency to channel formula
1130
- add derived **class KT0803K**
@@ -16,7 +35,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1635
- update GitHub actions
1736
- minor edits
1837

19-
2038
----
2139

2240
## [0.1.0] - 2023-12-27

libraries/KT0803/README.md

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,20 @@ It is primary written to understand the possibilities and the interface of the d
3131

3232
The library is not tested by me with hardware yet. See future below.
3333

34-
There are some newer, more capable, follow up devices like model K, L and M.
35-
From these only the KT0803K is supported since 0.2.0.
36-
The others are not supported (yet) although they might work as they seem backwards compatible.
34+
There are newer, more capable, follow up devices like model K, L and M.
35+
From these only the KT0803K is supported as a derived class.
36+
The L and the M versions of the device will work with the KT0803K class too
37+
as their functionality is equal or exceeds the K version.
38+
As far as investigated the L and M versions are backwards compatible.
3739

40+
Version 0.3.0 implements a few KT0803K specific functions, see section below.
41+
These will work for L and M devices too.
42+
43+
For ATTinyX5 series there exists the TinyKT0803 class which is derived from this one.
44+
It uses a different I2C implementation. See - https://github.com/RobTillaart/TinyKT0803
3845

39-
#### Hardware
4046

47+
#### Hardware
4148

4249
Read datasheet for details.
4350

@@ -66,17 +73,19 @@ The KT0803 is an 3.3 Volt device and cannot be connected directly to 5V MCU's.
6673
The frequency range stated on the front page of the datasheet ==> 70 MHz - 108 MHz.
6774
The frequency range stated in table 2 ==> 76 MHz - 108 MHz.
6875
So the datasheet is at least ambiguous on this point.
69-
Also keep in mind that the
76+
77+
Keep in mind that the frequency range allowed differs per country.
78+
The library does not provide this filtering, explicit responsibility of the user.
7079

7180

7281
#### Differences
7382

74-
The KT0803K device has far more options, which are not implemented yet except one.
75-
The resolution or step-size of the frequency.
83+
The KT0803K device has far more options, which are not all implemented.
84+
There is one important, the resolution or step-size of the frequency.
7685

7786
| device | step-size | Notes |
7887
|:---------:|:-----------:|:--------|
79-
| KT0803 | 100 KHz | in code the math is done with 50 KHz
88+
| KT0803 | 100 KHz | in code all math is done with 50 KHz
8089
| KT0803K | 50 KHz |
8190

8291
Backwards compatible.
@@ -111,13 +120,14 @@ Some examples:
111120
#### Related
112121

113122
- https://github.com/RobTillaart/KT0803
123+
- https://github.com/RobTillaart/TinyKT0803
114124
- https://www.hackster.io/hesam-moshiri/stereo-digital-fm-transmitter-circuit-arduino-code-2dbd8d
115125
- https://www.hackster.io/hesam-moshiri/full-digital-fm-receiver-with-arduino-and-tea5767-52be37
116126
- https://www.hackerstore.nl/Artikel/388
117127
- https://en.wikipedia.org/wiki/FM_broadcasting
118128

119129

120-
## Interface
130+
## Interface KT0803
121131

122132
```cpp
123133
#include "KT0803.h"
@@ -261,16 +271,37 @@ A minimal hardcoded preset sketch is in the examples.
261271

262272
## Derived classes
263273

264-
Since 0.2.0 the KT0803K class is created, although minimally implemented.
274+
A derived class KT0803K class is created, with some extended
275+
functions.
265276

266-
The KT0803L might work as it seems backwards compatible. It has far more
267-
registers in use than the KT0803/K.
268-
At the moment there is no intention to implement this KT0803L version.
277+
The KT0803L will work as it is backwards compatible with KT0803K.
278+
It has far more registers in use than the KT0803/K.
269279

270-
The KT0803M looks almost identical to the KT0803K (no new registers), so
280+
The KT0803M is identical to the KT0803K (no new registers), so
271281
a derived class is straightforward.
272282

273283

284+
## Interface KT0803K
285+
286+
Added functions in 0.3.0 (not tested), check datasheet.
287+
288+
#### Mono Stereo
289+
290+
- **bool setMono()** idem
291+
- **bool setStereo()** idem
292+
- **bool isStereo()** idem
293+
294+
#### Bass
295+
296+
- **bool setBass(uint8_t bass); // 0..3 = 0, 5, 11, 17 dB
297+
- **uint8_t getBass()** idem
298+
299+
#### Misc
300+
301+
- **bool powerOK()** idem
302+
- **bool silenceDetected()** idem
303+
304+
274305
## Future
275306

276307
#### Must
@@ -282,6 +313,10 @@ a derived class is straightforward.
282313

283314
#### Should
284315

316+
- update readme.md
317+
- KT0803K specific functions.
318+
- add examples for KT0803K specific functions.
319+
285320

286321
#### Could
287322

@@ -291,7 +326,8 @@ a derived class is straightforward.
291326
- what is impact on settings?
292327
- call begin () again? => default
293328
- explain well doc.
294-
- derived class KT0803M (== K check)
329+
- derived class KT0803M == KT0803K
330+
- derived class KT0803L >= KT0803K (compatible)
295331
- improve error handling
296332
- unit tests possible?
297333
- extend settings upon request **bold** are interesting, see table
@@ -300,14 +336,10 @@ a derived class is straightforward.
300336
|:---------:|:-------------:|:---------------:|:--------|
301337
| KT0803 | PA_CTRL | 13, bit 2 | **WARNING in datasheet**
302338
| | | | Should it be added in API?
303-
| KT0803K | MONO/STEREO | 04, bit 6 | **idem**
304339
| KT0803K | PGA_LSB | 04, bit 4+5 | gain fine tuning -> see PGA_MOD
305340
| KT0803K | FDEV | 04, bit 2+3 | Frequency deviation adjustment
306-
| KT0803K | BASS | 04, bit 0+1 | **Bass boost control**
307341
| KT0803K | PDPA | 0B, bit 5 | Power Amplifier Power Down ?
308342
| KT0803K | PA_BIAS | 0E, bit 1 | PA bias current enhancement.
309-
| KT0803K | PW_OK (RO) | 0F, bit 4 | **Power OK indicator**
310-
| KT0803K | SLNCID (RO) | 0F, bit 2 | 1 when Silence is detected
311343
| KT0803K | LMTLVL | 10, bit 3+4 | **Internal audio limiter level control**
312344
| KT0803K | PGAMOD | 10, bit 0 | PGA mode selection (use PGA_LSB/ not)
313345
| KT0803K | SLNCDIS | 12, bit 7 | Silence detection disable
@@ -322,7 +354,6 @@ a derived class is straightforward.
322354
#### Wont (for now)
323355

324356
- investigate tea5767 FM receiver (Out of scope for this lib).
325-
- implement KT0803L
326357
- investigate efficiency of register access.
327358
- caching all (allowed) registers in **begin()**
328359
- 3 bytes for KT0803

libraries/KT0803/examples/KT0803K_setFrequency/KT0803K_setFrequency.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void setup()
1919
while(!Serial);
2020

2121
Wire.begin();
22-
22+
2323
FM_SEND.begin();
2424
FM_SEND.setFrequency(105.75);
2525
FM_SEND.setMute(false);

libraries/KT0803/examples/KT0803_minimal/KT0803_minimal.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void setup()
1919
while(!Serial);
2020

2121
Wire.begin();
22-
22+
2323
FM_SEND.begin();
2424
FM_SEND.setChannel(2000); // * 0.05 = 100.00 MHz
2525
FM_SEND.setMute(false);

libraries/KT0803/examples/KT0803_setFrequency/KT0803_setFrequency.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void setup()
1919
while(!Serial);
2020

2121
Wire.begin();
22-
22+
2323
FM_SEND.begin();
2424
FM_SEND.setFrequency(105.75);
2525
FM_SEND.setMute(false);

libraries/KT0803/examples/KT0803_up_down/KT0803_up_down.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void setup()
3232
FM_SEND.begin(freq, false);
3333
}
3434

35+
3536
void loop()
3637
{
3738
// adjust frequency with up and down button.

libraries/KT0803/keywords.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ setMute KEYWORD2
3535
getMute KEYWORD2
3636

3737

38+
# KT0803K specific
39+
setMono KEYWORD2
40+
setStereo KEYWORD2
41+
isStereo KEYWORD2
42+
43+
setBass KEYWORD2
44+
getBass KEYWORD2
45+
46+
powerOK KEYWORD2
47+
silenceDetected KEYWORD2
48+
49+
3850
# Constants (LITERAL1)
3951
KT0803_LIB_VERSION LITERAL1
4052

0 commit comments

Comments
 (0)