Documentation

This commit is contained in:
Armin 2024-04-07 20:20:49 +02:00
parent b962db8f4e
commit aa7edfe96f
4 changed files with 39 additions and 7 deletions

View File

@ -508,6 +508,10 @@ void loop() {}
The FAST protocol can be received by IRremote and TinyIRReceiver.
# FAQ and hints
## Receiving does not run if analogWrite() or tone() is used.
The receiver sample interval of 50 µs is generated by a timer. On many boards this must be a [hardware timer](https://github.com/Arduino-IRremote/Arduino-IRremote?tab=readme-ov-file#timer-and-pin-usage). On some boards where a software timer is available, the software timer is used.<br/>
Be aware that the hardware timer used for receiving should not be used for analogWrite().<br/>
On the Uno and other AVR boards the receiver timer ist the same as the tone timer, so receiving will stop after a tone() command. See [ReceiveDemo example](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/b962db8f4e47408df01474a57f313f5a6bbe39a1/examples/ReceiveDemo/ReceiveDemo.ino#L257) how to deal with it.
## Problems with Neopixels, FastLed etc.
IRremote will not work right when you use **Neopixels** (aka WS2811/WS2812/WS2812B) or other libraries blocking interrupts for a longer time (> 50 &micro;s).<br/>
@ -695,7 +699,7 @@ Here you see the delay of the receiver output (blue) from the IR diode input (ye
# Issues and discussions
- Do not open an issue without first testing some of the examples!
- If you have a problem, please post the MCVE (Minimal Complete Verifiable Example) showing this problem. My experience is, that most of the times you will find the problem while creating this MCVE :smile:.
- [Use code blocks](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code); **it helps us help you when we can read your code!**
- [Use code blocks](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code); **it helps us to help you when we can read your code!**
<br/>
@ -963,4 +967,4 @@ From the version 2.8.0, the license is the MIT license.
# Copyright
Initially coded 2009 Ken Shirriff http://www.righto.com<br/>
Copyright (c) 2016-2017 Rafi Khan<br/>
Copyright (c) 2020-2023 [Armin Joachimsmeyer](https://github.com/ArminJo)
Copyright (c) 2020-2024 [Armin Joachimsmeyer](https://github.com/ArminJo)

View File

@ -1,4 +1,12 @@
// Based on the work by DFRobot
/*
* Extensions made by AJ 2023
* Removed Arduino 0.x support
* Added SoftI2CMaste support, which drastically reduces program size.
* Added OLED stuff
* Added createChar() with PROGMEM input
* Added fast timing
*/
#include "Arduino.h"
@ -23,6 +31,18 @@ inline size_t LiquidCrystal_I2C::write(uint8_t value) {
#include "SoftWire.h"
#endif
#if defined(__AVR__)
/*
* The datasheet says: a command need > 37us to settle. Enable pulse must be > 450ns.
* Use no delay for enable pulse after each command,
* because the overhead of this library seems to be using the 37 us and 450 ns.
* At least it works perfectly for all my LCD's connected to Uno, Nano etc.
* and it saves a lot of time in realtime applications using LCD as display,
* like https://github.com/ArminJo/Arduino-DTSU666H_PowerMeter
*/
#define USE_FAST_TIMING
#endif
// When the display powers up, it is configured as follows:
//
// 1. Display clear
@ -131,7 +151,11 @@ void LiquidCrystal_I2C::begin(uint8_t cols __attribute__((unused)), uint8_t line
/********** high level commands, for the user! */
void LiquidCrystal_I2C::clear() {
command(LCD_CLEARDISPLAY); // clear display, set cursor position to zero
#if defined(USE_FAST_TIMING)
delayMicroseconds(1500); // this command takes a long time! // AJ 20.9.23 1200 is too short for my 2004 LCD's, 1400 is OK
#else
delayMicroseconds(2000); // this command takes a long time!
#endif
if (_oled)
setCursor(0, 0);
}
@ -274,10 +298,13 @@ void LiquidCrystal_I2C::expanderWrite(uint8_t _data) {
void LiquidCrystal_I2C::pulseEnable(uint8_t _data) {
expanderWrite(_data | En); // En high
// delayMicroseconds(1); // enable pulse must be >450ns // AJ 20.9.23 not required for my LCD's
#if !defined(USE_FAST_TIMING)
delayMicroseconds(1); // enable pulse must be > 450ns // AJ 20.9.23 not required for my LCD's
#endif
expanderWrite(_data & ~En); // En low
// delayMicroseconds(50); // commands need > 37us to settle // AJ 20.9.23 not required for my LCD's
#if !defined(USE_FAST_TIMING)
delayMicroseconds(50); // commands need > 37us to settle // AJ 20.9.23 not required for my LCD's
#endif
}
// Alias functions

View File

@ -772,7 +772,7 @@ bool IRrecv::decodePulseDistanceWidthData(uint_fast8_t aNumberOfBits, IRRawlenTy
} else {
tDecodedData |= tMask;
}
IR_TRACE_PRINTLN('1');
IR_TRACE_PRINTLN(F("=> 1"));
} else {
#if defined DECODE_STRICT_CHECKS
/*
@ -811,7 +811,7 @@ bool IRrecv::decodePulseDistanceWidthData(uint_fast8_t aNumberOfBits, IRRawlenTy
}
#endif
// do not set the bit
IR_TRACE_PRINTLN('0');
IR_TRACE_PRINTLN(F("=> 0"));
}
#if defined DECODE_STRICT_CHECKS
// If we have no stop bit, assume that last space, which is not recorded, is correct, since we can not check it

View File

@ -45,6 +45,7 @@
// from LEGO Power Functions RC Manual 26.02.2010 Version 1.20
// https://github.com/jurriaan/Arduino-PowerFunctions/raw/master/LEGO_Power_Functions_RC_v120.pdf
// https://oberguru.net/elektronik/ir/codes/lego_power_functions_train.lircd.conf
// For original LEGO receiver see: https://www.philohome.com/pfrec/pfrec.htm and https://www.youtube.com/watch?v=KCM4Ug1bPrM
//
// To ensure correct detection of IR messages six 38 kHz cycles are transmitted as mark.
// Low bit consists of 6 cycles of IR and 10 <20>cycles<65> of pause,