Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix digitalPinToBitMask(), portOutputRegister(), portInputRegister() … #4964

Merged
merged 5 commits into from
Jul 28, 2018
Merged
Changes from all commits
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))
#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