Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions cores/esp8266/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,13 @@ void loop(void);
void yield(void);
void optimistic_yield(uint32_t interval_us);

#define digitalPinToPort(pin) (0)
#define digitalPinToBitMask(pin) (1UL << (pin))
#define _PORT_GPIO16 1
#define digitalPinToPort(pin) (pin==16)?(_PORT_GPIO16):(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was just about to merge this but realized that all these macros have now lost their (..) parenthesis. In the rest of this header all macros are completely enclosed in parens. ex #define bit and #define _min. The port*Register(port) macros all had them as well.

Can we bracket these ternary operators with parens, just to avoid any weirdness later on if they're used in operations and simply assigned to a value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I fix it now.

#define digitalPinToBitMask(pin) (pin==16)?(1):(1UL << (pin))
#define digitalPinToTimer(pin) (0)
#define portOutputRegister(port) ((volatile uint32_t*) &GPO)
#define portInputRegister(port) ((volatile uint32_t*) &GPI)
#define portModeRegister(port) ((volatile uint32_t*) &GPE)
#define portOutputRegister(port) (port==_PORT_GPIO16)?((volatile uint32_t*) &GP16O):((volatile uint32_t*) &GPO)
#define portInputRegister(port) (port==_PORT_GPIO16)?((volatile uint32_t*) &GP16I):((volatile uint32_t*) &GPI)
#define portModeRegister(port) (port==_PORT_GPIO16)?((volatile uint32_t*) &GP16E):((volatile uint32_t*) &GPE)

#define NOT_A_PIN -1
#define NOT_A_PORT -1
Expand Down