Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of RemoteIR by
ReceiverIR.h
- Committer:
- mskamoona
- Date:
- 2015-04-27
- Revision:
- 13:ddc6f7c92583
- Parent:
- 12:0651f02169ee
File content as of revision 13:ddc6f7c92583:
/**
* IR receiver (Version 0.0.4)
*
* Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
* http://shinta.main.jp/
*/
#ifndef _RECEIVER_IR_H_
#define _RECEIVER_IR_H_
#include <mbed.h>
#include "RemoteIR.h"
/**
* IR receiver class.
*/
class ReceiverIR {
public:
/**
* Constructor.
*
* @param rxpin Pin for receive IR signal.
*/
explicit ReceiverIR(PinName rxpin);
/**
* Destructor.
*/
~ReceiverIR();
/**
* State.
*/
typedef enum {
Idle,
// Receiving,
Received
} State;
/**
* Get state.
*
* @return Current state.
*/
State getState();
/**
* Get data.
*
* @param format Pointer to format.
* @param buf Buffer of a data.
* @param bitlength Bit length of the buffer.
*
* @return Data bit length.
*/
int getData(RemoteIR::Format *format);
private:
typedef struct {
RemoteIR::Format format;
// int bitcount;
// uint8_t buffer[64];
} data_t;
typedef struct {
State state;
int c1;
int c2;
// int c3;
/* int d1;
int d2;
int d3; */
} work_t;
InterruptIn evt; /**< Interrupt based input for input. */
Timer timer; /**< Timer for WDT. */
Ticker ticker; /**< Tciker for tick. */
Timeout timeout; /**< Timeout for tail. */
data_t data;
work_t work;
void init_state(void);
void isr_wdt(void);
void isr_fall(void);
void isr_rise(void);
/**
* ISR timeout for tail detection.
*/
void isr_timeout(void);
};
#endif
