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.
|
|
#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() |
| |
|
| enum | ErrorStatus { ERROR = 0
, SUCCESS = !ERROR
} |
| |
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:
- ErrorStatus MeIR::decode();
- void MeIR::begin();
- void MeIR::end();
- void MeIR::loop();
- boolean MeIR::keyPressed(unsigned char r);
- String MeIR::getString();
- unsigned char MeIR::getCode()
- void MeIR::sendString(String s);
- void MeIR::sendString(float v);
- void MeIR::sendNEC(unsigned long data, int nbits);
- void MeIR::sendRaw(unsigned int buf[], int len, uint8_t hz);
- void MeIR::enableIROut(uint8_t khz);
- void MeIR::enableIRIn();
- void MeIR::mark(uint16_t us);
- 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.
◆ TIMER_CONFIG_KHZ
| #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; \
})
◆ TIMER_CONFIG_NORMAL
| #define TIMER_CONFIG_NORMAL |
( |
| ) |
|
Value: ({ \
TCCR2A = _BV(WGM21); \
TCCR2B = _BV(CS21); \
OCR2A = TIMER_COUNT_TOP / 8; \
TCNT2 = 0; \
})