Library to read 433MHz codes with decoder HT6P20

Dependents:   Gateway_Cotosys Gateway_Cotosys_os5

Committer:
Thrillex13
Date:
Tue Jun 11 00:23:55 2019 +0000
Revision:
1:adf26c4f20cd
Parent:
0:bcd4927f951a
Initial. Library to read 433MHz RF transmitters with decoder HT6P20

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Thrillex13 0:bcd4927f951a 1 /*
Thrillex13 0:bcd4927f951a 2 RFDecoder - Ported from the Lucas Maziero Arduino libary to decode RF controls based on chip HT6P20
Thrillex13 0:bcd4927f951a 3 Copyright (c) 2011 Miguel Maldonado. All right reserved.
Thrillex13 0:bcd4927f951a 4
Thrillex13 0:bcd4927f951a 5 Project home: https://github.com/lucasmaziero/RF_HT6P20
Thrillex13 0:bcd4927f951a 6
Thrillex13 0:bcd4927f951a 7 This library is free software; you can redistribute it and/or
Thrillex13 0:bcd4927f951a 8 modify it under the terms of the GNU Lesser General Public
Thrillex13 0:bcd4927f951a 9 License as published by the Free Software Foundation; either
Thrillex13 0:bcd4927f951a 10 version 2.1 of the License, or (at your option) any later version.
Thrillex13 0:bcd4927f951a 11
Thrillex13 0:bcd4927f951a 12 This library is distributed in the hope that it will be useful,
Thrillex13 0:bcd4927f951a 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
Thrillex13 0:bcd4927f951a 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Thrillex13 0:bcd4927f951a 15 Lesser General Public License for more details.
Thrillex13 0:bcd4927f951a 16 */
Thrillex13 0:bcd4927f951a 17 #ifndef MBED_RF_HT6P20_H
Thrillex13 0:bcd4927f951a 18 #define MBED_RF_HT6P20_H
Thrillex13 0:bcd4927f951a 19
Thrillex13 0:bcd4927f951a 20 #include "mbed.h"
Thrillex13 0:bcd4927f951a 21 #include <Pulse.h>
Thrillex13 0:bcd4927f951a 22
Thrillex13 0:bcd4927f951a 23
Thrillex13 0:bcd4927f951a 24 class RFDecoder {
Thrillex13 0:bcd4927f951a 25
Thrillex13 0:bcd4927f951a 26 public:
Thrillex13 0:bcd4927f951a 27 /** Class constructor.
Thrillex13 0:bcd4927f951a 28 * The constructor assigns the specified pinout, attatches
Thrillex13 0:bcd4927f951a 29 * an Interrupt to the receive pin.
Thrillex13 0:bcd4927f951a 30 * @param tx Transmitter pin of the RF module.
Thrillex13 0:bcd4927f951a 31 * @param rx Receiver pin of the RF module.
Thrillex13 0:bcd4927f951a 32 */
Thrillex13 0:bcd4927f951a 33 RFDecoder(PinName tx, PinName rx);
Thrillex13 0:bcd4927f951a 34
Thrillex13 0:bcd4927f951a 35 /**
Thrillex13 0:bcd4927f951a 36 * Get Code Value
Thrillex13 0:bcd4927f951a 37 * @return unsigned long The code received
Thrillex13 0:bcd4927f951a 38 */
Thrillex13 0:bcd4927f951a 39 unsigned long getCode();
Thrillex13 0:bcd4927f951a 40
Thrillex13 0:bcd4927f951a 41 /**
Thrillex13 0:bcd4927f951a 42 * Code available
Thrillex13 0:bcd4927f951a 43 * @return bool Code availiability
Thrillex13 0:bcd4927f951a 44 */
Thrillex13 0:bcd4927f951a 45 bool available();
Thrillex13 0:bcd4927f951a 46 bool bitRead( int N, int pos);
Thrillex13 0:bcd4927f951a 47
Thrillex13 0:bcd4927f951a 48
Thrillex13 0:bcd4927f951a 49 private:
Thrillex13 0:bcd4927f951a 50 DigitalOut _tx;
Thrillex13 0:bcd4927f951a 51 PulseInOut _rx;
Thrillex13 0:bcd4927f951a 52
Thrillex13 0:bcd4927f951a 53 unsigned long addressFull;
Thrillex13 0:bcd4927f951a 54 int lambda_RX;
Thrillex13 0:bcd4927f951a 55
Thrillex13 0:bcd4927f951a 56
Thrillex13 0:bcd4927f951a 57 };
Thrillex13 0:bcd4927f951a 58
Thrillex13 0:bcd4927f951a 59 #endif
Thrillex13 0:bcd4927f951a 60