Added SAMSUNG48 protocol and sendSamsung48() function.

This commit is contained in:
Armin 2022-12-27 16:59:32 +01:00
parent b7592e7586
commit 83387a8493
16 changed files with 229 additions and 123 deletions

View File

@ -106,7 +106,8 @@ body:
- label: ReceiveDemo
- label: SendRawDemo
- label: ReceiverTimingAnalysis
- label: MinimalReceiver
- label: TinyReceiver
- label: TinySender
- label: ReceiveAndSend
- label: SimpleSender
- label: SendDemo
@ -126,7 +127,8 @@ body:
- label: ReceiveDemo
- label: SendRawDemo
- label: ReceiverTimingAnalysis
- label: MinimalReceiver
- label: TinyReceiver
- label: TinySender
- label: ReceiveAndSend
- label: SimpleSender
- label: SendDemo

View File

@ -121,19 +121,19 @@ jobs:
# sketches-exclude: ReceiveAndSend # Not enough RAM for default RAW_BUFFER_LENGTH
- arduino-boards-fqbn: arduino:megaavr:nona4809:mode=off
sketches-exclude: MinimalReceiver,IRDispatcherDemo
sketches-exclude: TinyReceiver,IRDispatcherDemo
build-properties: # the flags were put in compiler.cpp.extra_flags
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
SimpleSender: -DSEND_PWM_BY_TIMER
- arduino-boards-fqbn: arduino:samd:arduino_zero_native
sketches-exclude: MinimalReceiver,IRDispatcherDemo
sketches-exclude: TinyReceiver,IRDispatcherDemo
build-properties: # the flags were put in compiler.cpp.extra_flags
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
- arduino-boards-fqbn: adafruit:samd:adafruit_metro_m4:cache=on,speed=120,opt=small,maxqspi=50,usbstack=arduino,debug=off
platform-url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
sketches-exclude: MinimalReceiver,IRDispatcherDemo
sketches-exclude: TinyReceiver,IRDispatcherDemo
build-properties: # the flags were put in compiler.cpp.extra_flags
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
@ -171,28 +171,28 @@ jobs:
- arduino-boards-fqbn: digistump:avr:digispark-tiny:clock=clock16
platform-url: https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json
required-libraries: ATtinySerialOut
sketch-names: MinimalReceiver.ino,IRremoteInfo.ino,SimpleReceiver.ino,ControlRelay.ino,SimpleSender.ino,SendDemo.ino,SendRawDemo.ino,SendAndReceive.ino
sketch-names: TinyReceiver.ino,IRremoteInfo.ino,SimpleReceiver.ino,ControlRelay.ino,SimpleSender.ino,SendDemo.ino,SendRawDemo.ino,SendAndReceive.ino
build-properties: # the flags were put in compiler.cpp.extra_flags
SimpleSender: -DSEND_PWM_BY_TIMER
- arduino-boards-fqbn: ATTinyCore:avr:attinyx5micr:LTO=enable,sketchclock=16pll
platform-url: http://drazzy.com/package_drazzy.com_index.json
required-libraries: ATtinySerialOut
sketch-names: MinimalReceiver.ino,IRremoteInfo.ino,SimpleReceiver.ino,ReceiveDemo.ino,ControlRelay.ino,SimpleSender.ino,SendDemo.ino,SendRawDemo.ino,SendAndReceive.ino
sketch-names: TinyReceiver.ino,IRremoteInfo.ino,SimpleReceiver.ino,ReceiveDemo.ino,ControlRelay.ino,SimpleSender.ino,SendDemo.ino,SendRawDemo.ino,SendAndReceive.ino
build-properties: # the flags were put in compiler.cpp.extra_flags
SimpleSender: -DSEND_PWM_BY_TIMER
- arduino-boards-fqbn: ATTinyCore:avr:attinyx7micr:LTO=enable,sketchclock=16external,pinmapping=new,millis=enabled
platform-url: http://drazzy.com/package_drazzy.com_index.json
required-libraries: ATtinySerialOut
sketch-names: MinimalReceiver.ino,IRremoteInfo.ino,SimpleReceiver.ino,ReceiveDemo.ino,ControlRelay.ino,SimpleSender.ino,SendDemo.ino,SendRawDemo.ino,SendAndReceive.ino
sketch-names: TinyReceiver.ino,IRremoteInfo.ino,SimpleReceiver.ino,ReceiveDemo.ino,ControlRelay.ino,SimpleSender.ino,SendDemo.ino,SendRawDemo.ino,SendAndReceive.ino
build-properties: # the flags were put in compiler.cpp.extra_flags
SimpleSender: -DSEND_PWM_BY_TIMER
- arduino-boards-fqbn: ATTinyCore:avr:attinyx8micr:LTO=enable,sketchclock=16external,pinmapping=mhtiny,millis=enabled # ATtiny88 China clone board @16 MHz
platform-url: http://drazzy.com/package_drazzy.com_index.json
required-libraries: ATtinySerialOut
sketch-names: MinimalReceiver.ino,IRremoteInfo.ino,SimpleReceiver.ino,ReceiveDemo.ino,ControlRelay.ino,SimpleSender.ino,SendDemo.ino,SendRawDemo.ino,SendAndReceive.ino
sketch-names: TinyReceiver.ino,IRremoteInfo.ino,SimpleReceiver.ino,ReceiveDemo.ino,ControlRelay.ino,SimpleSender.ino,SendDemo.ino,SendRawDemo.ino,SendAndReceive.ino
build-properties: # the flags were put in compiler.cpp.extra_flags
SimpleSender: -DSEND_PWM_BY_TIMER
@ -206,35 +206,35 @@ jobs:
- arduino-boards-fqbn: esp8266:esp8266:d1_mini:eesz=4M3M,xtal=80
platform-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
sketches-exclude: MinimalReceiver
sketches-exclude: TinyReceiver
build-properties: # the flags were put in compiler.cpp.extra_flags
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=200
All: -DRAW_BUFFER_LENGTH=300
- arduino-boards-fqbn: esp32:esp32:featheresp32:FlashFreq=80
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
sketches-exclude: MinimalReceiver # undefined reference to `TwoWire::onReceive(void (*)(int))'
sketches-exclude: TinyReceiver # undefined reference to `TwoWire::onReceive(void (*)(int))'
build-properties: # the flags were put in compiler.cpp.extra_flags. SEND_PWM_BY_TIMER is always enabled!
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=500 -Wno-error=maybe-uninitialized
All: -DRAW_BUFFER_LENGTH=300 -Wno-error=maybe-uninitialized # https://github.com/espressif/arduino-esp32/issues/7024
- arduino-boards-fqbn: STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 # ST version
platform-url: https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json
sketches-exclude: MinimalReceiver
sketches-exclude: TinyReceiver
build-properties: # the flags were put in compiler.cpp.extra_flags
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
All: -DRAW_BUFFER_LENGTH=300
- arduino-boards-fqbn: STMicroelectronics:stm32:GenL0:pnum=THUNDERPACK_L072 # ST version
platform-url: https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json
sketches-exclude: MinimalReceiver,IRDispatcherDemo
sketches-exclude: TinyReceiver,IRDispatcherDemo
build-properties: # the flags were put in compiler.cpp.extra_flags
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
All: -DRAW_BUFFER_LENGTH=300
- arduino-boards-fqbn: stm32duino:STM32F1:genericSTM32F103C # Roger Clark version
platform-url: http://dan.drown.org/stm32duino/package_STM32duino_index.json
sketches-exclude: MinimalReceiver
sketches-exclude: TinyReceiver
build-properties: # the flags were put in compiler.cpp.extra_flags
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
All: -DRAW_BUFFER_LENGTH=300
@ -248,7 +248,7 @@ jobs:
- arduino-boards-fqbn: sandeepmistry:nRF5:BBCmicrobit
platform-url: https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json
sketches-exclude: IRDispatcherDemo,MicroGirs,MinimalReceiver
sketches-exclude: IRDispatcherDemo,MicroGirs,TinyReceiver
build-properties: # the flags were put in compiler.cpp.extra_flags
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
All: -DRAW_BUFFER_LENGTH=300

View File

@ -314,11 +314,11 @@ IrReceiver.printIRResultRawFormatted(&Serial, true);`
<br/>
# Minimal NEC receiver
# Tiny NEC receiver
For applications only requiring NEC protocol, there is a special receiver included,<br/>
which has very **small code size of 500 bytes and does NOT require any timer**.
Check out the [MinimalReceiver](https://github.com/Arduino-IRremote/Arduino-IRremote#minimalreceiver) and [IRDispatcherDemo](https://github.com/Arduino-IRremote/Arduino-IRremote#irdispatcherdemo) examples.
Check out the [TinyReceiver](https://github.com/Arduino-IRremote/Arduino-IRremote#tinyreceiver--tinysender) and [IRDispatcherDemo](https://github.com/Arduino-IRremote/Arduino-IRremote#irdispatcherdemo) examples.
<br/>
@ -445,28 +445,25 @@ In order to fit the examples to the 8K flash of ATtiny85 and ATtiny88, the [Ardu
This examples are a good starting point.
A simple example can be tested online with [WOKWI](https://wokwi.com/projects/338611596994544210).
#### MinimalReceiver + MinimalSender
#### TinyReceiver + TinySender
If **code size** matters, look at these examples.<br/>
The **MinimalReceiver** example uses the **TinyReceiver** library which can **only receive NEC and FAST codes, but does not require any timer**.<br/>
MinimalReceiver can be tested online with [WOKWI](https://wokwi.com/arduino/projects/339264565653013075).
The **[TinyReceiver](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/TinyReceiver/TinyReceiver.ino)** example uses the **TinyIRReceiver** library which can **only receive NEC and FAST codes, but does not require any timer**.<br/>
TinyReceiver can be tested online with [WOKWI](https://wokwi.com/arduino/projects/339264565653013075).
Click on the receiver while simulation is running to specify individual IR codes.
The **MinimalSender** example uses the **TinySender** library which can **only send NEC and FAST codes**.<br/>
The **[TinySender](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/TinySender/TinySender.ino)** example uses the **TinyIRSender** library which can **only send NEC and FAST codes**.<br/>
Sending NEC protocol codes in standard format with 8 bit address and 8 bit command as in SimpleSender example.
Saves 780 bytes program memory and 26 bytes RAM compared to SimpleSender, which does the same, but uses the IRRemote library (and is therefore much more flexible).
#### SmallReceiver
If the protocol is not NEC and code size matters, look at this example.<br/>
If the protocol is not NEC and code size matters, look at this [example](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/SmallReceiver/SmallReceiver.ino).<br/>
#### ReceiveDemo + AllProtocolsOnLCD
Receives all protocols and **generates a beep with the Arduino tone() function** on each packet received.<br/>
AllProtocolsOnLCD additionally **displays the short result on a 1602 LCD**. The LCD can be connected parallel or serial (I2C).<br/>
[ReceiveDemo](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/ReceiveDemo/ReceiveDemo.ino) receives all protocols and **generates a beep with the Arduino tone() function** on each packet received.<br/>
[AllProtocolsOnLCD](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/AllProtocolsOnLCD/AllProtocolsOnLCD.ino) additionally **displays the short result on a 1602 LCD**. The LCD can be connected parallel or serial (I2C).<br/>
By connecting pin debug pin to ground, you can see the raw values for each packet. The pin number of the debug pin is printed during setup, because it depends on board and LCD connection type.<br/>
This example also serves as an **example how to use IRremote and tone() together**.
#### AllProtocolsOnLCD
Like ReceiveDemo but with 1604 LCD output and without tone().
#### ReceiveDump
Receives all protocols and dumps the received signal in different flavors. Since the printing takes so much time, repeat signals may be skipped or interpreted as UNKNOWN.
@ -490,10 +487,10 @@ Framework for **calling different functions of your program** for different IR c
**Control a relay** (connected to an output pin) with your remote.
#### IRremoteExtensionTest
Example for a user defined class, which itself uses the IRrecv class from IRremote.
[Example](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/IRremoteExtensionTest/IRremoteExtensionTest.ino) for a user defined class, which itself uses the IRrecv class from IRremote.
#### SendLGAirConditionerDemo
Example for sending LG air conditioner IR codes controlled by Serial input.<br/>
[Example](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/SendLGAirConditionerDemo/SendLGAirConditionerDemo.ino) for sending LG air conditioner IR codes controlled by Serial input.<br/>
By just using the function `bool Aircondition_LG::sendCommandAndParameter(char aCommand, int aParameter)` you can control the air conditioner by any other command source.<br/>
The file *acLG.h* contains the command documentation of the LG air conditioner IR protocol. Based on reverse engineering of the LG AKB73315611 remote.
![LG AKB73315611 remote](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/pictures/LG_AKB73315611.jpg)<br/>
@ -501,7 +498,7 @@ IReceiverTimingAnalysis can be tested online with [WOKWI](https://wokwi.com/proj
Click on the receiver while simulation is running to specify individual IR codes.
#### ReceiverTimingAnalysis
This example analyzes the signal delivered by your IR receiver module.
This [example](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/ReceiverTimingAnalysis/ReceiverTimingAnalysis.ino) analyzes the signal delivered by your IR receiver module.
Values can be used to determine the stability of the received signal as well as a hint for determining the protocol.<br/>
It also computes the `MARK_EXCESS_MICROS` value, which is the extension of the mark (pulse) duration introduced by the IR receiver module.<br/>
It can be tested online with [WOKWI](https://wokwi.com/arduino/projects/299033930562011656).
@ -512,7 +509,7 @@ ReceiveDemo + SendDemo in one program. Demonstrates **receiving while sending**.
# WOKWI online examples
- [Simple receiver](https://wokwi.com/projects/338611596994544210).
- [MinimalReceiver](https://wokwi.com/arduino/projects/339264565653013075)
- [TinyReceiver](https://wokwi.com/arduino/projects/339264565653013075)
- [ReceiverTimingAnalysis](https://wokwi.com/projects/299033930562011656)
- [Receiver with LCD output and switch statement](https://wokwi.com/projects/298934082074575369)
@ -614,7 +611,7 @@ If you can provide **examples of using a periodic timer for interrupts** for the
The **receiver sample interval of 50 &micro;s is generated by a timer**. On many boards this must be a hardware timer. On some boards where a software timer is available, the software timer is used.<br/>
Every pin can be used for receiving.
The MinimalReceiver example uses the **TinyReceiver** library, which can **only receive NEC codes, but does not require any timer**.
The TinyReceiver example uses the **TinyReceiver** library, which can **only receive NEC codes, but does not require any timer**.
The code for the timer and the **timer selection** is located in [private/IRTimer.hpp](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/private/IRTimer.hpp). It can be adjusted here.<br/>
**Be aware that the hardware timer used for receiving should not be used for analogWrite()!**.<br/>
@ -735,7 +732,7 @@ Created with sigrok PulseView with IR_NEC decoder by DjordjeMandic.<br/>
I created this comparison matrix for [myself](https://github.com/ArminJo) in order to choose a small IR lib for my project and to have a quick overview, when to choose which library.<br/>
It is dated from **24.06.2022**. If you have complains about the data or request for extensions, please send a PM or open a discussion.
| Subject | [IRMP](https://github.com/IRMP-org/IRMP) | [IRLremote](https://github.com/NicoHood/IRLremote) | [IRLib2](https://github.com/cyborg5/IRLib2)<br/>**mostly unmaintained** | [IRremote](https://github.com/Arduino-IRremote/Arduino-IRremote) | [Minimal NEC](https://github.com/Arduino-IRremote/Arduino-IRremote/tree/master/examples/MinimalReceiver) | [IRsmallDecoder](https://github.com/LuisMiCa/IRsmallDecoder)
| Subject | [IRMP](https://github.com/IRMP-org/IRMP) | [IRLremote](https://github.com/NicoHood/IRLremote) | [IRLib2](https://github.com/cyborg5/IRLib2)<br/>**mostly unmaintained** | [IRremote](https://github.com/Arduino-IRremote/Arduino-IRremote) | [Minimal NEC](https://github.com/Arduino-IRremote/Arduino-IRremote/tree/master/examples/TinyReceiver) | [IRsmallDecoder](https://github.com/LuisMiCa/IRsmallDecoder)
|---------|------|-----------|--------|----------|----------|----------|
| Number of protocols | **50** | Nec + Panasonic + Hash \* | 12 + Hash \* | 17 + PulseDistance + Hash \* | NEC | NEC + RC5 + Sony + Samsung |
| Timing method receive | Timer2 or interrupt for pin 2 or 3 | **Interrupt** | Timer2 or interrupt for pin 2 or 3 | Timer2 | **Interrupt** | **Interrupt** |

View File

@ -20,8 +20,7 @@ See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-I
- Merged the 2 decode pulse width and distance functions.
- Added receiver callback functionality and registerReceiveCompleteCallback() function.
- Changed macro names _REPEAT_SPACE to _REPEAT_DISTANCE.
- Improved TinyIRReceiver and added FAST protocol for it.
- Added TinyIRSender.hpp and MinimalSender example, renamed TinyReceiver.h to TinyIR.h and added TinySender.hpp.
- Improved TinyIRReceiver,added FAST protocol for it and added TinyIRSender.hpp and TinySender example, renamed TinyReceiver.h to TinyIR.h.
- Removed static function printIRSendUsage(), but kept class function printIRSendUsage().
- Added DISABLE_CODE_FOR_RECEIVER to save program memory and RAM if receiving functionality is not required.
- Extracted protocol functions used by receive and send to IRProtocol.hpp.
@ -33,6 +32,7 @@ See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-I
- Fixed SEND_PWM_BY_TIMER for ATtiny167 thanks to freskpe.
- Improved SHARP repeat decoding.
- Replaced macros TIMER_EN/DISABLE_RECEIVE_INTR and EN/DISABLE_SEND_PWM_BY_TIMER by functions.
- Added SAMSUNG48 protocol and sendSamsung48().
## 3.9.0
- Improved documentation with the help of [ElectronicsArchiver}(https://github.com/ElectronicsArchiver).

View File

@ -91,6 +91,7 @@ void setup() {
*/
uint16_t sAddress = 0x0102;
uint8_t sCommand = 0x34;
uint16_t s16BitCommand = 0x5634;
uint8_t sRepeats = 0;
void loop() {
@ -242,7 +243,7 @@ void loop() {
Serial.println(F("Send Onkyo (NEC with 16 bit command)"));
Serial.flush();
IrSender.sendOnkyo(sAddress, (sCommand + 1) << 8 | sCommand, sRepeats);
IrSender.sendOnkyo(sAddress, s16BitCommand, sRepeats);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Apple"));
@ -290,6 +291,21 @@ void loop() {
IrSender.sendSony(sAddress & 0x1FFF, sCommand & 0x7F, sRepeats, SIRCS_20_PROTOCOL);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Samsung 8 bit command"));
Serial.flush();
IrSender.sendSamsung(sAddress, sCommand, sRepeats);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Samsung 16 bit command"));
Serial.flush();
IrSender.sendSamsung(sAddress, s16BitCommand, sRepeats);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Samsung48 16 bit command"));
Serial.flush();
IrSender.sendSamsung48(sAddress, s16BitCommand, sRepeats);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send RC5"));
Serial.flush();
IrSender.sendRC5(sAddress & 0x1F, sCommand & 0x3F, sRepeats, true); // 5 address, 6 command bits
@ -329,7 +345,7 @@ void loop() {
IrSender.write(&IRSendData, sRepeats);
delay(DELAY_AFTER_SEND);
IRSendData.command = (sCommand + 1) << 8 | sCommand; // Samsung48, LG and MAGIQUEST support more than 8 bit command
IRSendData.command = s16BitCommand; // LG support more than 8 bit command
IRSendData.protocol = SAMSUNG;
Serial.print(F("Send "));
@ -347,7 +363,7 @@ void loop() {
Serial.println(F("Send MagiQuest"));
Serial.flush();
IrSender.sendMagiQuest(0x6BCD0000 | (uint32_t) sAddress, IRSendData.command); // we have 31 bit address
IrSender.sendMagiQuest(0x6BCD0000 | (uint32_t) sAddress, s16BitCommand); // we have 31 bit address
delay(DELAY_AFTER_SEND);
// Bang&Olufsen must be sent with 455 kHz
@ -389,6 +405,7 @@ void loop() {
*/
sAddress += 0x0101;
sCommand += 0x11;
s16BitCommand += 0x1111;
sRepeats++;
// clip repeats at 4
if (sRepeats > 4) {

View File

@ -1,5 +1,5 @@
/*
* MinimalReceiver.cpp
* TinyReceiver.cpp
*
* Small memory footprint and no timer usage!
*
@ -18,7 +18,7 @@
* This file is part of IRMP https://github.com/IRMP-org/IRMP.
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* MinimalReceiver is free software: you can redistribute it and/or modify
* TinyIRReceiver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -1,5 +1,5 @@
/*
* MinimalSender.cpp
* TinySender.cpp
*
* Sending NEC protocol codes in standard format with 8bit address and 8 bit command as in SimpleSender example.
* Saves 780 bytes program memory and 26 bytes RAM compared to SimpleSender, which does the same, but uses the IRRemote library (and is therefore much more flexible).

View File

@ -339,6 +339,7 @@ void checkReceive(uint16_t aSentAddress, uint16_t aSentCommand) {
*/
uint16_t sAddress = 0xFFF1;
uint8_t sCommand = 0x76;
uint16_t s16BitCommand = 0x9876;
#define sRepeats 0 // no unit test for repeats
void loop() {
@ -621,6 +622,26 @@ void loop() {
delay(DELAY_AFTER_SEND);
#endif
#if defined(DECODE_SAMSUNG)
Serial.println(F("Send Samsung 8 bit command"));
Serial.flush();
IrSender.sendSamsung(sAddress, sCommand, sRepeats);
checkReceive(sAddress, sCommand);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Samsung 16 bit command"));
Serial.flush();
IrSender.sendSamsung(sAddress, s16BitCommand, sRepeats);
checkReceive(sAddress, s16BitCommand);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Samsung48 16 bit command"));
Serial.flush();
IrSender.sendSamsung48(sAddress, s16BitCommand, sRepeats);
checkReceive(sAddress, s16BitCommand);
delay(DELAY_AFTER_SEND);
#endif
#if defined(DECODE_RC5)
Serial.println(F("Send RC5"));
Serial.flush();
@ -653,16 +674,6 @@ void loop() {
IRSendData.command = sCommand;
IRSendData.flags = IRDATA_FLAGS_EMPTY;
#if defined(DECODE_SAMSUNG)
IRSendData.protocol = SAMSUNG;
Serial.print(F("Send "));
Serial.println(getProtocolString(IRSendData.protocol));
Serial.flush();
IrSender.write(&IRSendData, sRepeats);
checkReceive(IRSendData.address, IRSendData.command);
delay(DELAY_AFTER_SEND);
#endif
#if defined(DECODE_JVC)
IRSendData.protocol = JVC; // switch protocol
Serial.print(F("Send "));
@ -674,7 +685,7 @@ void loop() {
#endif
#if defined(DECODE_LG) || defined(DECODE_MAGIQUEST)
IRSendData.command = (sCommand + 1) << 8 | sCommand; // Samsung48, LG and MAGIQUEST support more than 8 bit command
IRSendData.command = s16BitCommand; // LG support more than 8 bit command
#endif
#if defined(DECODE_SAMSUNG)
@ -700,8 +711,8 @@ void loop() {
#if defined(DECODE_MAGIQUEST)
Serial.println(F("Send MagiQuest"));
Serial.flush();
IrSender.sendMagiQuest(0x6BCD0000 | (uint32_t) sAddress, IRSendData.command); // we have 31 bit address
checkReceive(sAddress, IRSendData.command & 0x1FF); // we have 9 bit command
IrSender.sendMagiQuest(0x6BCD0000 | (uint32_t) sAddress, s16BitCommand); // we have 31 bit address
checkReceive(sAddress, s16BitCommand & 0x1FF); // we have 9 bit command
delay(DELAY_AFTER_SEND);
#endif
@ -764,6 +775,7 @@ void loop() {
*/
sAddress += 0x0101;
sCommand += 0x11;
s16BitCommand += 0x1111;
delay(DELAY_AFTER_LOOP); // additional delay at the end of each loop
}

View File

@ -395,6 +395,61 @@ rawData[42]:
+1250,- 550 +1250,- 550 +1250,- 550 +1250
Sum: 35400
Send Samsung 8 bit command
Protocol=Samsung Address=0xFFF1 Command=0x76 Raw-Data=0x8976FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x76, <numberOfRepeats>);
rawData[68]:
-1039650
+4400,-4450
+ 600,-1650 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 550,-1700 + 550,-1650 + 600,-1650
+ 600,-1650 + 550,-1650 + 550,-1700 + 600,-1650
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,-1800
+ 450,- 550 + 600,-1650 + 550,-1650 + 600,- 550
+ 550,-1700 + 550,-1650 + 600,-1650 + 600,- 550
+ 550,-1700 + 550,- 550 + 550,- 600 + 550,-1650
+ 600,- 500 + 600,- 550 + 600,- 550 + 550,-1650
+ 600
Sum: 68750
Send Samsung 16 bit command
Protocol=Samsung Address=0xFFF1 Command=0x9876 Raw-Data=0x9876FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x9876, <numberOfRepeats>);
rawData[68]:
-1056300
+4400,-4450
+ 600,-1650 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 600,-1650 + 550,-1700 + 550,-1650
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,-1650
+ 550,-1700 + 550,-1650 + 600,-1650 + 550,-1650
+ 600,- 550 + 550,-1650 + 600,-1650 + 550,- 550
+ 600,-1650 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,- 550 + 600,- 550 + 550,- 550 + 550,-1700
+ 550,-1650 + 550,- 600 + 550,- 550 + 600,-1650
+ 600
Sum: 68750
Send Samsung48 16 bit command
Protocol=Samsung48 Address=0xFFF1 Command=0x9876 Raw-Data=0x6798 48 bits LSB first
Send with: IrSender.sendSamsung48(0xFFF1, 0x9876, <numberOfRepeats>);
rawData[100]:
-1056750
+4450,-4500
+ 550,-1650 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,-1650
+ 550,-1650 + 600,-1650 + 550,-1700 + 550,-1650
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,-1650
+ 600,- 500 + 600,-1650 + 600,-1650 + 600,- 500
+ 600,-1700 + 550,-1650 + 600,-1650 + 550,- 550
+ 600,-1650 + 550,- 550 + 600,- 550 + 550,-1650
+ 600,- 550 + 600,- 650 + 450,- 600 + 500,-1700
+ 600,- 500 + 600,- 550 + 600,- 550 + 550,-1650
+ 600,-1650 + 600,- 550 + 550,- 550 + 600,-1650
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,- 550 + 550,-1650 + 600,-1650 + 600,- 550
+ 600
Sum: 95700
Send RC5
Protocol=RC5 Address=0x11 Command=0x36 Raw-Data=0x1476 13 bits MSB first
Send with: IrSender.sendRC5(0x11, 0x36, <numberOfRepeats>);
@ -430,23 +485,6 @@ rawData[36]:
+ 450
Sum: 23150
Send Samsung
Protocol=Samsung Address=0xFFF1 Command=0x76 Raw-Data=0x8976FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x76, <numberOfRepeats>);
rawData[68]:
-1027000
+4500,-4400
+ 600,-1600 + 650,- 500 + 600,- 500 + 650,- 500
+ 600,-1650 + 600,-1600 + 650,-1600 + 600,-1650
+ 600,-1600 + 600,-1650 + 600,-1650 + 600,-1600
+ 600,-1650 + 600,-1650 + 600,-1600 + 600,-1650
+ 600,- 500 + 650,-1600 + 600,-1650 + 600,- 500
+ 650,-1600 + 600,-1650 + 600,-1650 + 600,- 500
+ 600,-1650 + 600,- 500 + 600,- 550 + 600,-1600
+ 600,- 550 + 600,- 550 + 550,- 550 + 600,-1650
+ 550
Sum: 68750
Send JVC
Protocol=JVC Address=0xF1 Command=0x76 Raw-Data=0x76F1 16 bits LSB first
Send with: IrSender.sendJVC(0xF1, 0x76, <numberOfRepeats>);

View File

@ -394,6 +394,40 @@ rawData[42]:
+1250,- 550 +1250,- 550 +1300,- 500 +1300
Sum: 35600
Send Samsung 8 bit command
Protocol=Samsung Address=0xFFF1 Command=0x76 Raw-Data=0x8976FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x76, <numberOfRepeats>);
rawData[68]:
-1017650
+4550,-4450
+ 600,-1650 + 600,- 500 + 650,- 500 + 650,- 450
+ 600,-1650 + 650,-1600 + 650,-1600 + 650,-1600
+ 650,-1600 + 650,-1600 + 650,-1600 + 650,-1600
+ 650,-1600 + 650,-1600 + 650,-1600 + 650,-1600
+ 650,- 450 + 650,-1600 + 600,-1650 + 650,- 500
+ 600,-1650 + 600,-1650 + 600,-1600 + 650,- 500
+ 650,-1600 + 650,- 450 + 650,- 500 + 650,-1600
+ 650,- 450 + 650,- 500 + 650,- 500 + 600,-1650
+ 600
Sum: 69200
Send Samsung 16 bit command
Protocol=Samsung Address=0xFFF1 Command=0x9876 Raw-Data=0x9876FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x9876, <numberOfRepeats>);
rawData[68]:
-1056300
+4400,-4450
+ 600,-1650 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 600,-1650 + 550,-1700 + 550,-1650
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,-1650
+ 550,-1700 + 550,-1650 + 600,-1650 + 550,-1650
+ 600,- 550 + 550,-1650 + 600,-1650 + 550,- 550
+ 600,-1650 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,- 550 + 600,- 550 + 550,- 550 + 550,-1700
+ 550,-1650 + 550,- 600 + 550,- 550 + 600,-1650
+ 600
Sum: 68750
Send RC5
Protocol=RC5 Address=0x11 Command=0x36 Raw-Data=0x1476 13 bits MSB first
Send with: IrSender.sendRC5(0x11, 0x36, <numberOfRepeats>);
@ -429,23 +463,6 @@ rawData[36]:
+ 500
Sum: 23300
Send Samsung
Protocol=Samsung Address=0xFFF1 Command=0x76 Raw-Data=0x8976FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x76, <numberOfRepeats>);
rawData[68]:
-1017650
+4550,-4450
+ 600,-1650 + 600,- 500 + 650,- 500 + 650,- 450
+ 600,-1650 + 650,-1600 + 650,-1600 + 650,-1600
+ 650,-1600 + 650,-1600 + 650,-1600 + 650,-1600
+ 650,-1600 + 650,-1600 + 650,-1600 + 650,-1600
+ 650,- 450 + 650,-1600 + 600,-1650 + 650,- 500
+ 600,-1650 + 600,-1650 + 600,-1600 + 650,- 500
+ 650,-1600 + 650,- 450 + 650,- 500 + 650,-1600
+ 650,- 450 + 650,- 500 + 650,- 500 + 600,-1650
+ 600
Sum: 69200
Send JVC
Protocol=JVC Address=0xF1 Command=0x76 Raw-Data=0x76F1 16 bits LSB first
Send with: IrSender.sendJVC(0xF1, 0x76, <numberOfRepeats>);

View File

@ -58,6 +58,7 @@ typedef enum {
RC5,
RC6,
SAMSUNG,
SAMSUNG48,
SAMSUNG_LG,
SHARP,
SONY,
@ -90,6 +91,7 @@ const char string_Kaseikyo_Mitsubishi[] PROGMEM = "Kaseikyo_Mitsubishi";
const char string_RC5[] PROGMEM = "RC5";
const char string_RC6[] PROGMEM = "RC6";
const char string_Samsung[] PROGMEM = "Samsung";
const char string_Samsung48[] PROGMEM = "Samsung48";
const char string_SamsungLG[] PROGMEM = "SamsungLG";
const char string_Sharp[] PROGMEM = "Sharp";
const char string_Sony[] PROGMEM = "Sony";

View File

@ -54,7 +54,7 @@
const char *const ProtocolNames[]
PROGMEM = { string_Unknown, string_PulseWidth, string_PulseDistance, string_Apple, string_Denon, string_JVC, string_LG, string_LG2,
string_NEC, string_NEC2, string_Onkyo, string_Panasonic, string_Kaseikyo, string_Kaseikyo_Denon, string_Kaseikyo_Sharp,
string_Kaseikyo_JVC, string_Kaseikyo_Mitsubishi, string_RC5, string_RC6, string_Samsung, string_SamsungLG, string_Sharp,
string_Kaseikyo_JVC, string_Kaseikyo_Mitsubishi, string_RC5, string_RC6, string_Samsung, string_Samsung48, string_SamsungLG, string_Sharp,
string_Sony
#if !defined(EXCLUDE_EXOTIC_PROTOCOLS)
, string_BangOlufsen, string_BoseWave, string_Lego, string_MagiQuest, string_Whynter

View File

@ -202,6 +202,9 @@ size_t IRsend::write(IRData *aIRSendData, int_fast8_t aNumberOfRepeats) {
} else if (tProtocol == SAMSUNG) {
sendSamsung(tAddress, tCommand, aNumberOfRepeats);
} else if (tProtocol == SAMSUNG48) {
sendSamsung48(tAddress, tCommand, aNumberOfRepeats);
} else if (tProtocol == SAMSUNG_LG) {
sendSamsungLG(tAddress, tCommand, aNumberOfRepeats);

View File

@ -499,6 +499,7 @@ public:
void sendRC6(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle = true);
void sendSamsungLGRepeat();
void sendSamsung(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats);
void sendSamsung48(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats);
void sendSamsungLG(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats);
void sendSharp(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats); // redirected to sendDenon
void sendSony(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, uint8_t numberOfBits = 12); // SIRCS_12_PROTOCOL

View File

@ -251,7 +251,7 @@ bool IRrecv::decodeKaseikyo() {
tValue.ULong = decodedIRData.decodedRawData;
#if __INT_WIDTH__ >= 32
// workaround until complete refactoring for 64 bit
decodedIRData.decodedRawData = (decodedIRData.decodedRawData << 16) | tVendorId;
decodedIRData.decodedRawData = (decodedIRData.decodedRawData << 16) | tVendorId; // store all 48 bits in decodedRawData
#endif
decodedIRData.address = (tValue.UWord.LowWord >> KASEIKYO_VENDOR_ID_PARITY_BITS); // remove 4 bit vendor parity
decodedIRData.command = tValue.UByte.MidHighByte;

View File

@ -69,10 +69,12 @@
*/
// see http://www.hifi-remote.com/wiki/index.php?title=DecodeIR#Samsung
// https://www.mikrocontroller.net/articles/IRMP_-_english#SAMSUNG32
// LSB first, 1 start bit + 16 bit address + 16,32 bit data + 1 stop bit.
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:8,~F:8,1,^110)+ ==> 8 bit data
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:16,1,^110)+ ==> 16 bit data
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:32,1,^110)+ ==> 32 bit data
// https://www.mikrocontroller.net/articles/IRMP_-_english#SAMSUNG48
// LSB first, 1 start bit + 16 bit address + 16 or 32 bit data + 1 stop bit.
// Here https://forum.arduino.cc/t/klimaanlage-per-ir-steuern/1051381/10 the address (0xB24D) is also 8 bits and then 8 inverted bits
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:8,~F:8,1,^110)+ ==> 8 bit + 8 bit inverted data - Samsung32
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:16,1,^110)+ ==> 16 bit data - still Samsung32
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:8,~F:8,G:8,~G:8,1,^110)+ ==> 2 x (8 bit + 8 bit inverted data) - Samsung48
//
#define SAMSUNG_ADDRESS_BITS 16
#define SAMSUNG_COMMAND16_BITS 16
@ -153,46 +155,57 @@ void IRsend::sendSamsungLG(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNu
sendPulseDistanceWidth(&SamsungProtocolConstants, tRawData.ULong, SAMSUNG_BITS, aNumberOfRepeats);
}
/**
* Here we send Samsung32
* If we get a command < 0x100, we send command and then ~command
*/
void IRsend::sendSamsung(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats) {
// send 16 bit address and 8 command bits and then 8 inverted command bits LSB first
LongUnion tSendValue;
tSendValue.UWords[0] = aAddress;
if (aCommand < 0x100) {
tSendValue.UBytes[2] = aCommand;
tSendValue.UBytes[3] = ~aCommand;
} else {
tSendValue.UWords[1] = aCommand;
}
IrSender.sendPulseDistanceWidth(&SamsungProtocolConstants, tSendValue.ULong, SAMSUNG_BITS, aNumberOfRepeats);
}
/**
* Here we send Samsung48
* We send 2 x (8 bit command and then ~command)
*/
void IRsend::sendSamsung48(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats) {
// send 16 bit address and 2 x ( 8 command bits and then 8 inverted command bits) LSB first
#if __INT_WIDTH__ < 32
uint32_t tRawSamsungData[2]; // prepare 2 long for Samsung48
LongUnion tSendValue;
tSendValue.UWords[0] = aAddress;
tSendValue.UBytes[2] = aCommand;
tSendValue.UBytes[3] = ~aCommand;
uint32_t tRawSamsungData[2];
uint8_t tUpper8BitsOfCommand = aCommand >> 8;
tRawSamsungData[1] = tUpper8BitsOfCommand | (~tUpper8BitsOfCommand) << 8;
tRawSamsungData[0] = tSendValue.ULong;
uint8_t tProtocolLength = SAMSUNG_BITS;
if (aCommand >= 0x100) {
// Here we have Samsung48 -> send the upper byte of command
aCommand = aCommand >> 8;
tSendValue.UBytes[0] = aCommand;
tSendValue.UBytes[1] = ~aCommand;
tRawSamsungData[1] = tSendValue.UWord.LowWord;
tProtocolLength = SAMSUNG48_BITS;
}
IrSender.sendPulseDistanceWidthFromArray(&SamsungProtocolConstants, &tRawSamsungData[0], tProtocolLength, aNumberOfRepeats);
IrSender.sendPulseDistanceWidthFromArray(&SamsungProtocolConstants, &tRawSamsungData[0], SAMSUNG48_BITS, aNumberOfRepeats);
#else
LongLongUnion tSendValue;
tSendValue.UWords[0] = aAddress;
tSendValue.UBytes[2] = aCommand;
tSendValue.UBytes[3] = ~aCommand;
uint8_t tProtocolLength;
if (aCommand >= 0x100) {
// Here we have Samsung48 -> send the upper byte of command
aCommand = aCommand >> 8;
tSendValue.UBytes[4] = aCommand;
tSendValue.UBytes[5] = ~aCommand;
tProtocolLength = SAMSUNG48_BITS;
if (aCommand < 0x10000) {
tSendValue.UBytes[2] = aCommand;
tSendValue.UBytes[3] = ~aCommand;
uint8_t tUpper8BitsOfCommand = aCommand >> 8;
tSendValue.UBytes[4] = tUpper8BitsOfCommand;
tSendValue.UBytes[5] = ~tUpper8BitsOfCommand;
} else {
tProtocolLength = SAMSUNG_BITS;
tSendValue.ULongLong = aAddress | aCommand << 16;
}
IrSender.sendPulseDistanceWidth(&SamsungProtocolConstants, tSendValue.ULongLong, tProtocolLength, aNumberOfRepeats);
IrSender.sendPulseDistanceWidth(&SamsungProtocolConstants, tSendValue.ULongLong, SAMSUNG_BITS, aNumberOfRepeats);
#endif
}
@ -238,7 +251,6 @@ bool IRrecv::decodeSamsung() {
if (decodedIRData.rawDataPtr->rawlen == (2 * SAMSUNG48_BITS) + 4) {
/*
* Samsung48
* Here https://forum.arduino.cc/t/klimaanlage-per-ir-steuern/1051381/10 is the address also 8 bits and then 8 inverted bits
*/
// decode additional 16 bit
if (!decodePulseDistanceWidthData(&SamsungProtocolConstants, (SAMSUNG_COMMAND32_BITS - SAMSUNG_COMMAND16_BITS),
@ -254,10 +266,14 @@ bool IRrecv::decodeSamsung() {
* LSB data is already in tValue.UWord.HighWord!
* Put latest (MSB) bits in LowWord, LSB first would have them expect in HighWord so keep this in mind for decoding below
*/
tValue.UWord.LowWord = decodedIRData.decodedRawData;
tValue.UWord.LowWord = decodedIRData.decodedRawData; // We have only 16 bit in decodedRawData here
#if __INT_WIDTH__ >= 32
// workaround until complete refactoring for 64 bit
decodedIRData.decodedRawData = (decodedIRData.decodedRawData << 32)| tValue.UWord.HighWord << 16 | decodedIRData.address; // store all 48 bits in decodedRawData
#endif
/*
* Check parity
* Check parity of 32 bit command
*/
// receive 2 * (8 bits then 8 inverted bits) LSB first
if (tValue.UByte.MidHighByte != (uint8_t)(~tValue.UByte.HighByte)
@ -267,6 +283,7 @@ bool IRrecv::decodeSamsung() {
decodedIRData.command = tValue.UByte.LowByte << 8 | tValue.UByte.MidHighByte; // low and high word are swapped here, so fetch it this way
decodedIRData.numberOfBits = SAMSUNG48_BITS;
decodedIRData.protocol = SAMSUNG48;
} else {
/*
@ -280,8 +297,8 @@ bool IRrecv::decodeSamsung() {
decodedIRData.command = tValue.UWord.HighWord; // first 16 bit
}
decodedIRData.numberOfBits = SAMSUNG_BITS;
decodedIRData.protocol = SAMSUNG;
}
decodedIRData.protocol = SAMSUNG;
// check for repeat
checkForRepeatSpaceAndSetFlag(SAMSUNG_REPEAT_DISTANCE / MICROS_IN_ONE_MILLI);