2021-01-29 06:31:58 -05:00
|
|
|
#pragma once
|
|
|
|
//
|
|
|
|
// FILE: MT8870.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
2023-11-13 11:37:07 -05:00
|
|
|
// VERSION: 0.1.6
|
2021-01-29 06:31:58 -05:00
|
|
|
// DATE: 2019-02-11
|
|
|
|
// PURPOSE: Arduino library for MT8870 DTMF decoder (breakout)
|
|
|
|
// URL: https://github.com/RobTillaart/MT8870
|
|
|
|
// https://www.tinytronics.nl/shop/nl/sensoren/geluid/mt8870-dtmf-module
|
|
|
|
|
2021-11-09 15:08:49 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
#include "Arduino.h"
|
|
|
|
|
2023-11-13 11:37:07 -05:00
|
|
|
#define MT8870_LIB_VERSION (F("0.1.6"))
|
2021-11-09 15:08:49 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
class MT8870
|
|
|
|
{
|
|
|
|
public:
|
2022-11-18 07:36:00 -05:00
|
|
|
// STQ - pin to see if new data arrived
|
|
|
|
// Q1 - Q4 data pins.
|
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);
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2021-11-09 15:08:49 -05:00
|
|
|
bool available();
|
|
|
|
char read();
|
|
|
|
uint8_t readRaw();
|
2022-11-18 07:36:00 -05:00
|
|
|
uint8_t lastRaw();
|
|
|
|
uint32_t lastTimeRead();
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
private:
|
2021-11-09 15:08:49 -05:00
|
|
|
uint8_t _val = 255;
|
|
|
|
uint8_t _STQ;
|
|
|
|
uint8_t _q[4];
|
|
|
|
uint32_t _lastTimeRead;
|
2021-01-29 06:31:58 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-11-13 11:37:07 -05:00
|
|
|
// -- END OF FILE --
|
2021-12-22 05:05:27 -05:00
|
|
|
|