File tree 4 files changed +13
-35
lines changed
4 files changed +13
-35
lines changed Original file line number Diff line number Diff line change @@ -180,12 +180,11 @@ void loop(void);
180
180
181
181
// Get the bit location within the hardware port of the given virtual pin.
182
182
// This comes from the pins_*.c file for the active board configuration.
183
-
184
- uint32_t digitalPinToPort (uint32_t pin );
185
- uint32_t digitalPinToBitMask (uint32_t pin );
186
- volatile uint32_t * portOutputRegister (uint32_t port );
187
- volatile uint32_t * portInputRegister (uint32_t port );
188
- volatile uint32_t * portModeRegister (uint32_t port );
183
+ #define digitalPinToPort (pin ) (0)
184
+ #define digitalPinToBitMask (pin ) (1UL << (pin))
185
+ #define portOutputRegister (port ) ((volatile uint32_t*) GPO)
186
+ #define portInputRegister (port ) ((volatile uint32_t*) GPI)
187
+ #define portModeRegister (port ) ((volatile uint32_t*) GPE)
189
188
190
189
#define NOT_A_PIN -1
191
190
#define NOT_A_PORT -1
Original file line number Diff line number Diff line change 25
25
#include "eagle_soc.h"
26
26
#include "ets_sys.h"
27
27
28
- uint32_t digitalPinToPort (uint32_t pin ) {
29
- return 0 ;
30
- }
31
-
32
- uint32_t digitalPinToBitMask (uint32_t pin ) {
33
- return 1 << pin ;
34
- }
35
-
36
- volatile uint32_t * portOutputRegister (uint32_t port ) {
37
- return (volatile uint32_t * )GPO ;
38
- }
39
-
40
- volatile uint32_t * portInputRegister (uint32_t port ) {
41
- return (volatile uint32_t * )GPI ;
42
- }
43
-
44
- volatile uint32_t * portModeRegister (uint32_t port ) {
45
- return (volatile uint32_t * )GPE ;
46
- }
47
-
48
28
extern void __pinMode (uint8_t pin , uint8_t mode ) {
49
29
if (pin < 16 ){
50
30
if (mode == SPECIAL ){
Original file line number Diff line number Diff line change 105
105
#define DIRECT_WRITE_HIGH (base, mask ) ((*(base+8 +2 )) = (mask)) // LATXSET + 0x28
106
106
107
107
#elif defined(ARDUINO_ARCH_ESP8266)
108
- #define PIN_TO_BASEREG (pin ) (portOutputRegister(digitalPinToPort(pin)) )
109
- #define PIN_TO_BITMASK (pin ) (digitalPinToBitMask( pin) )
108
+ #define PIN_TO_BASEREG (pin ) (( volatile uint32_t *) GPO )
109
+ #define PIN_TO_BITMASK (pin ) (1 << pin)
110
110
#define IO_REG_TYPE uint32_t
111
111
#define IO_REG_ASM
112
- #define DIRECT_READ (base, mask ) (((*(base+6 )) & (mask)) ? 1 : 0 ) // GPIO_IN_ADDRESS
113
- #define DIRECT_MODE_INPUT (base, mask ) ((*(base+5 )) = (mask)) // GPIO_ENABLE_W1TC_ADDRESS
114
- #define DIRECT_MODE_OUTPUT (base, mask ) ((*(base+4 )) = (mask)) // GPIO_ENABLE_W1TS_ADDRESS
115
- #define DIRECT_WRITE_LOW (base, mask ) ((*(base+2 )) = (mask)) // GPIO_OUT_W1TC_ADDRESS
116
- #define DIRECT_WRITE_HIGH (base, mask ) ((*(base+1 )) = (mask)) // GPIO_OUT_W1TS_ADDRESS
117
-
112
+ #define DIRECT_READ (base, mask ) ((GPI & (mask)) ? 1 : 0 ) // GPIO_IN_ADDRESS
113
+ #define DIRECT_MODE_INPUT (base, mask ) (GPE &= ~(mask)) // GPIO_ENABLE_W1TC_ADDRESS
114
+ #define DIRECT_MODE_OUTPUT (base, mask ) (GPE |= (mask)) // GPIO_ENABLE_W1TS_ADDRESS
115
+ #define DIRECT_WRITE_LOW (base, mask ) (GPOC = (mask)) // GPIO_OUT_W1TC_ADDRESS
116
+ #define DIRECT_WRITE_HIGH (base, mask ) (GPOS = (mask)) // GPIO_OUT_W1TS_ADDRESS
118
117
119
118
#else
120
119
#error "Please define I/O register types here"
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ compiler.tools.path={runtime.ide.path}/hardware/tools/esp8266/
12
12
compiler.path={compiler.tools.path}xtensa-lx106-elf/bin/
13
13
compiler.sdk.path={compiler.tools.path}sdk/
14
14
15
- compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH "-I{compiler.sdk.path}/include"
15
+ compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include"
16
16
17
17
compiler.c.cmd=xtensa-lx106-elf-gcc
18
18
compiler.c.flags=-c -Os -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -MMD -std=c99
You can’t perform that action at this time.
0 commit comments