Shinichiro Nakamura
/
StarBoardOrangeExample2
StarBoard Orange - Example application No.2 (Version 0.0.4)
Diff: RemoteIR/ReceiverIR.h
- Revision:
- 3:469de11d1e1d
- Parent:
- 2:d4625043c895
--- a/RemoteIR/ReceiverIR.h Sun Aug 15 10:41:12 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/** - * IR receiver (Version 0.0.2) - * - * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems) - * http://shinta.main.jp/ - */ - -#ifndef _RECEIVER_IR_H_ -#define _RECEIVER_IR_H_ - -#include <mbed.h> - -#include "Semaphore.h" - -class ReceiverIR { -public: - ReceiverIR(PinName rx); - ~ReceiverIR(); - - typedef enum { - Idle, - Receiving, - Received - } State; - - typedef enum { - UNKNOWN, - NEC, - AEHA, - SONY - } Format; - - State getState(); - int getData(Format *format, uint8_t *buf, int bufsiz); -private: - typedef struct { - State state; - Format format; - int bitcount; - uint8_t buffer[64]; - } data_t; - typedef struct { - int c1; - int c2; - int c3; - int d1; - int d2; - } work_t; - - static const int TUS_NEC = 562; - static const int TUS_AEHA = 425; - static const int TUS_SONY = 600; - - InterruptIn evt; - Timer timer; - Ticker ticker; - Semaphore sem; - - data_t data; - work_t work; - - void init_state(void); - - void isr_wdt(void); - void isr_fall(void); - void isr_rise(void); - -}; - -#endif