Skip to content

Commit

Permalink
Insert the missing defined() Macro operator
Browse files Browse the repository at this point in the history
It was causing some issues with VSCode IntelliSense
  • Loading branch information
LuisMiCa committed Jan 30, 2022
1 parent 6540121 commit 86bf058
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/IRsmallDProtocolStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@
#ifndef IRsmallD_ProtocolStructs_h
#define IRsmallD_ProtocolStructs_h

#if IR_SMALLD_NEC || IR_SMALLD_RC5 || IR_SMALLD_SAMSUNG32
#if defined(IR_SMALLD_NEC) || defined(IR_SMALLD_RC5) || defined(IR_SMALLD_SAMSUNG32)
struct irSmallD_t {
uint8_t addr;
uint8_t cmd;
bool keyHeld;
};

#elif IR_SMALLD_NECx || IR_SMALLD_SAMSUNG
#elif defined(IR_SMALLD_NECx) || defined(IR_SMALLD_SAMSUNG)
struct irSmallD_t {
uint16_t addr;
uint8_t cmd;
bool keyHeld;
};

#elif IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15
#elif defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15)
struct irSmallD_t {
uint8_t addr;
uint8_t cmd;
};

#elif IR_SMALLD_SIRC20
#elif defined(IR_SMALLD_SIRC20)
struct irSmallD_t {
uint8_t ext; //extended data
uint8_t addr;
uint8_t cmd;
};

#elif IR_SMALLD_SIRC
#elif defined(IR_SMALLD_SIRC)
struct irSmallD_t {
uint8_t ext;
uint8_t addr;
Expand Down
6 changes: 3 additions & 3 deletions src/IRsmallD_SIRC_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void IRsmallDecoder::irISR() { //executed every time the IR signal goes down (bu
static uint8_t bitCount;
static unsigned long startTime = -1; //FFFF...
static union { //received bits are stored in reversed order (11000101... -> ...10100011)
#if (IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15)
#if defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15)
uint16_t all = 0; //Arduino uses Little Endian so, if all=ABCD then in memory it's CDAB (hex format)
uint8_t byt[2]; //then we get byt[0]=CD and byt[1]=AB (type punning with a union...)
#else //it must be IR_SMALLD_SIRC20
Expand Down Expand Up @@ -101,7 +101,7 @@ void IRsmallDecoder::irISR() { //executed every time the IR signal goes down (bu
irSignal.all >>= 1; //push a 0 from left to right (will be left at 0 if it's M0)
bitCount++;
if (duration >= c_M1min) { //it's a bit 1 mark, change Most Significant bit to 1
#if (IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15)
#if defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15)
irSignal.byt[1] |= 0x80;
#else //IR_SMALLD_SIRC20 uses 4 bytes
irSignal.byt[3] |= 0x80;
Expand All @@ -112,7 +112,7 @@ void IRsmallDecoder::irISR() { //executed every time the IR signal goes down (bu
#if defined(IR_SMALLD_SIRC12)
irSignal.all >>= 3; //adjust address in the high byte (SIRC15/20 don't need this)
#endif
#if (IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15)
#if defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15)
irSignal.byt[0] >>= 1; //adjust command in the low byte
_irData.addr = irSignal.byt[1]; //Little-Endian puts high byte in the array's second position
_irData.cmd = irSignal.byt[0];
Expand Down
8 changes: 4 additions & 4 deletions src/IRsmallDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@

// ****************************************************************************
// IR_ISR_MODE definition based on protocol:
#if IR_SMALLD_SAMSUNG || IR_SMALLD_SAMSUNG32
#if defined(IR_SMALLD_SAMSUNG) || defined(IR_SMALLD_SAMSUNG32)
#define IR_ISR_MODE FALLING
#elif IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15 || IR_SMALLD_SIRC20 || \
IR_SMALLD_SIRC || IR_SMALLD_NEC || IR_SMALLD_NECx
#elif defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15) || defined(IR_SMALLD_SIRC20) || \
defined(IR_SMALLD_SIRC) || defined(IR_SMALLD_NEC) || defined(IR_SMALLD_NECx)
#define IR_ISR_MODE RISING
#elif IR_SMALLD_RC5
#define IR_ISR_MODE CHANGE
Expand Down Expand Up @@ -164,7 +164,7 @@ bool IRsmallDecoder::dataAvailable() {

// ----------------------------------------------------------------------------
// Conditional inclusion of protocol specific ISR implementations:
#if IR_SMALLD_NEC || IR_SMALLD_NECx
#if defined(IR_SMALLD_NEC) || defined(IR_SMALLD_NECx)
#include "IRsmallD_NEC.h"
#elif IR_SMALLD_RC5
#include "IRsmallD_RC5.h"
Expand Down

0 comments on commit 86bf058

Please sign in to comment.