Makeblock-library-for-Arduino  V3.2.4
It's a library for arduino application developers
Classes | Macros | Enumerations
MeIR.h File Reference

Header for MeIR.cpp module. More...

#include <stdint.h>
#include <stdbool.h>
#include <Arduino.h>
#include "MeConfig.h"
#include "MePort.h"

Go to the source code of this file.

Classes

struct  irparams_t
 
class  MeIR
 Driver for Me IR module. More...
 

Macros

#define MARK   0
 
#define SPACE   1
 
#define NEC_BITS   32
 
#define USECPERTICK   50
 
#define RAWBUF   100
 
#define NEC_HDR_MARK   9000
 
#define NEC_HDR_SPACE   4500
 
#define NEC_BIT_MARK   560
 
#define NEC_ONE_SPACE   1600
 
#define NEC_ZERO_SPACE   560
 
#define NEC_RPT_SPACE   2250
 
#define NEC_RPT_PERIOD   110000
 
#define _GAP   5000
 
#define STATE_IDLE   2
 
#define STATE_MARK   3
 
#define STATE_SPACE   4
 
#define STATE_STOP   5
 
#define NEC   1
 
#define SONY   2
 
#define RC5   3
 
#define RC6   4
 
#define DISH   5
 
#define SHARP   6
 
#define PANASONIC   7
 
#define JVC   8
 
#define SANYO   9
 
#define MITSUBISHI   10
 
#define SAMSUNG   11
 
#define LG   12
 
#define UNKNOWN   -1
 
#define TOPBIT   0x80000000
 
#define SYSCLOCK   16000000
 
#define _GAP   5000
 
#define GAP_TICKS   (_GAP/USECPERTICK)
 
#define TIMER_DISABLE_INTR   (TIMSK2 = 0)
 
#define TIMER_ENABLE_PWM   (TCCR2A |= _BV(COM2B1))
 
#define TIMER_DISABLE_PWM   (TCCR2A &= ~(_BV(COM2B1)))
 
#define TIMER_ENABLE_INTR   (TIMSK2 = _BV(OCIE2A))
 
#define TIMER_DISABLE_INTR   (TIMSK2 = 0)
 
#define TIMER_INTR_NAME   TIMER2_COMPA_vect
 
#define TIMER_CONFIG_KHZ(val)
 
#define TIMER_COUNT_TOP   (SYSCLOCK * USECPERTICK / 1000000)
 
#define TIMER_CONFIG_NORMAL()
 

Enumerations

enum  ErrorStatus { ERROR = 0, SUCCESS = !ERROR }
 

Detailed Description

Header for MeIR.cpp module.

Author
MakeBlock
Version
V1.0.4
Date
2015/11/16
Copyright
This software is Copyright (C), 2012-2016, MakeBlock. Use is subject to license
conditions. The main licensing options available are GPL V2 or Commercial:
Open Source Licensing GPL V2
This is the appropriate option if you want to share the source code of your
application with everyone you distribute it to, and you also want to give them
the right to share who uses it. If you wish to use this software under Open
Source Licensing, you must contribute all your source code to the open source
community in accordance with the GPL Version 2 when your application is
distributed. See http://www.gnu.org/copyleft/gpl.html
Description
This file is a drive for Me IR device, The IR inherited the MeSerial class from SoftwareSerial.
Method List:
  1. ErrorStatus MeIR::decode();
  2. void MeIR::begin();
  3. void MeIR::end();
  4. void MeIR::loop();
  5. boolean MeIR::keyPressed(unsigned char r);
  6. String MeIR::getString();
  7. unsigned char MeIR::getCode()
  8. void MeIR::sendString(String s);
  9. void MeIR::sendString(float v);
  10. void MeIR::sendNEC(unsigned long data, int nbits);
  11. void MeIR::sendRaw(unsigned int buf[], int len, uint8_t hz);
  12. void MeIR::enableIROut(uint8_t khz);
  13. void MeIR::enableIRIn();
  14. void MeIR::mark(uint16_t us);
  15. void MeIR::space(uint16_t us);
History:
<Author>         <Time>        <Version>        <Descr>
Mark Yan        2015/10/09     1.0.0            Bulid the new.
Mark Yan        2015/10/29     1.0.1            Fix minor errors on format.
Mark Yan        2015/11/02     1.0.2            Fix bug that IRsend and IRreceive can't work at the same time.
forfish         2015/11/09     1.0.3            Add description.
Mark Yan        2015/11/16     1.0.4            add data recovery when timeout.

Macro Definition Documentation

#define _GAP   5000
#define _GAP   5000
#define DISH   5
#define GAP_TICKS   (_GAP/USECPERTICK)
#define JVC   8
#define LG   12
#define MARK   0
#define MITSUBISHI   10
#define NEC   1
#define NEC_BIT_MARK   560
#define NEC_BITS   32
#define NEC_HDR_MARK   9000
#define NEC_HDR_SPACE   4500
#define NEC_ONE_SPACE   1600
#define NEC_RPT_PERIOD   110000
#define NEC_RPT_SPACE   2250
#define NEC_ZERO_SPACE   560
#define PANASONIC   7
#define RAWBUF   100
#define RC5   3
#define RC6   4
#define SAMSUNG   11
#define SANYO   9
#define SHARP   6
#define SONY   2
#define SPACE   1
#define STATE_IDLE   2
#define STATE_MARK   3
#define STATE_SPACE   4
#define STATE_STOP   5
#define SYSCLOCK   16000000
#define TIMER_CONFIG_KHZ (   val)
Value:
({ \
const uint8_t pwmval = F_CPU / 2000 / (val); \
TCCR2A = _BV(WGM20); \
TCCR2B = _BV(WGM22) | _BV(CS20); \
OCR2A = pwmval; \
OCR2B = pwmval / 3; \
})
#define TIMER_CONFIG_NORMAL ( )
Value:
({ \
TCCR2A = _BV(WGM21); \
TCCR2B = _BV(CS21); \
OCR2A = TIMER_COUNT_TOP / 8; \
TCNT2 = 0; \
})
#define TIMER_COUNT_TOP
Definition: MeIR.h:148
#define TIMER_COUNT_TOP   (SYSCLOCK * USECPERTICK / 1000000)
#define TIMER_DISABLE_INTR   (TIMSK2 = 0)
#define TIMER_DISABLE_INTR   (TIMSK2 = 0)
#define TIMER_DISABLE_PWM   (TCCR2A &= ~(_BV(COM2B1)))
#define TIMER_ENABLE_INTR   (TIMSK2 = _BV(OCIE2A))
#define TIMER_ENABLE_PWM   (TCCR2A |= _BV(COM2B1))
#define TIMER_INTR_NAME   TIMER2_COMPA_vect
#define TOPBIT   0x80000000
#define UNKNOWN   -1
#define USECPERTICK   50

Enumeration Type Documentation

Enumerator
ERROR 
SUCCESS