2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
[![Arduino CI](https://github.com/RobTillaart/MT8870/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
2021-11-09 15:08:49 -05:00
|
|
|
[![Arduino-lint](https://github.com/RobTillaart/MT8870/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/MT8870/actions/workflows/arduino-lint.yml)
|
|
|
|
[![JSON check](https://github.com/RobTillaart/MT8870/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/MT8870/actions/workflows/jsoncheck.yml)
|
2021-01-29 06:31:58 -05:00
|
|
|
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/MT8870/blob/master/LICENSE)
|
|
|
|
[![GitHub release](https://img.shields.io/github/release/RobTillaart/MT8870.svg?maxAge=3600)](https://github.com/RobTillaart/MT8870/releases)
|
|
|
|
|
2021-11-09 15:08:49 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
# MT8870
|
|
|
|
|
2021-11-09 15:08:49 -05:00
|
|
|
Arduino library for MT8870 DTMF decoder (breakout).
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
## Description
|
|
|
|
|
|
|
|
This library reads the signals of the MT8870 chip.
|
|
|
|
If data is available one can read it raw or as text.
|
|
|
|
|
2022-11-18 07:36:00 -05:00
|
|
|
DTMF = Dual Tones Multiple Frequency.
|
|
|
|
These are the tones you hear when you press buttons on your phone.
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2022-11-18 07:36:00 -05:00
|
|
|
DTMF tones, uses one from A..D and one from E..H.
|
2021-11-09 15:08:49 -05:00
|
|
|
|
2022-11-18 07:36:00 -05:00
|
|
|
| Name | Frequency |
|
|
|
|
|:------:|------------:|
|
|
|
|
| A | 697 Hz |
|
|
|
|
| B | 770 Hz |
|
|
|
|
| C | 852 Hz |
|
|
|
|
| D | 941 Hz |
|
|
|
|
| E | 1209 Hz |
|
|
|
|
| F | 1336 Hz |
|
|
|
|
| G | 1477 Hz |
|
|
|
|
| H | 1633 Hz |
|
2021-11-09 15:08:49 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
## Interface
|
|
|
|
|
|
|
|
- **MT8870()** constructor
|
2021-11-09 15:08:49 -05:00
|
|
|
- **void begin(uint8_t STQ, uint8_t Q1, uint8_t Q2, uint8_t Q3, uint8_t Q4)** defines which pins to use.
|
2021-01-29 06:31:58 -05:00
|
|
|
Technically it is possible to have readout multiple decoders
|
|
|
|
with one MT8870 object by calling **begin()** with other pins.
|
|
|
|
- **STQ** = data available signal
|
2021-11-09 15:08:49 -05:00
|
|
|
- **Q1..Q4** = data pins.
|
2021-01-29 06:31:58 -05:00
|
|
|
- Calling begin resets the **lastRead** char
|
|
|
|
- **bool available()** returns true if there is a DMTF signal
|
|
|
|
- **char read()** reads the character available. returns 255 if no signal available.
|
|
|
|
- **uint8_t readRaw()** returns 0 .. 15 or 255 if no signal is available.
|
2021-11-09 15:08:49 -05:00
|
|
|
- **uint8_t lastRaw()** returns the last code read 0 .. 15 or 255 if no signal available.
|
2021-01-29 06:31:58 -05:00
|
|
|
Note this is a cached value from a readRaw / read call.
|
2021-11-09 15:08:49 -05:00
|
|
|
- **uint32_t lastTimeRead()** returns the timestamp of last **read()** or **readRaw()**.
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
2021-12-22 05:05:27 -05:00
|
|
|
## Operations
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2021-12-22 05:05:27 -05:00
|
|
|
See examples.
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
2022-11-18 07:36:00 -05:00
|
|
|
## Future
|
2021-12-22 05:05:27 -05:00
|
|
|
|
2022-11-18 07:36:00 -05:00
|
|
|
#### must
|
2021-12-22 05:05:27 -05:00
|
|
|
- improve documentation
|
2022-11-18 07:36:00 -05:00
|
|
|
- keypad matrix, which key generates which tones
|
|
|
|
|
|
|
|
#### should
|
2021-12-22 05:05:27 -05:00
|
|
|
- test setup
|
2022-11-18 07:36:00 -05:00
|
|
|
- add examples
|
2021-12-22 05:05:27 -05:00
|
|
|
- DMTF with a PCF8574
|
|
|
|
- DMTF as secret key
|
|
|
|
- DMTF with less keys (less pins)
|
|
|
|
- DMTF over interrupt triggered by STQ line
|
2022-11-18 07:36:00 -05:00
|
|
|
|
|
|
|
#### could
|
|
|
|
- buffer like Serial? (how to fill? interrupt? example sketch?)
|
|
|
|
- read part of stream interface?
|
2021-12-22 05:05:27 -05:00
|
|
|
- DMTF tone generation?
|
2022-11-18 07:36:00 -05:00
|
|
|
- MCP_DAC
|
|
|
|
- PWM + HW?
|
2021-01-29 06:31:58 -05:00
|
|
|
|