mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
commit
c3b559b6e0
@ -180,12 +180,11 @@ void loop(void);
|
||||
|
||||
// Get the bit location within the hardware port of the given virtual pin.
|
||||
// This comes from the pins_*.c file for the active board configuration.
|
||||
|
||||
uint32_t digitalPinToPort(uint32_t pin);
|
||||
uint32_t digitalPinToBitMask(uint32_t pin);
|
||||
volatile uint32_t* portOutputRegister(uint32_t port);
|
||||
volatile uint32_t* portInputRegister(uint32_t port);
|
||||
volatile uint32_t* portModeRegister(uint32_t port);
|
||||
#define digitalPinToPort(pin) (0)
|
||||
#define digitalPinToBitMask(pin) (1UL << (pin))
|
||||
#define portOutputRegister(port) ((volatile uint32_t*) GPO)
|
||||
#define portInputRegister(port) ((volatile uint32_t*) GPI)
|
||||
#define portModeRegister(port) ((volatile uint32_t*) GPE)
|
||||
|
||||
#define NOT_A_PIN -1
|
||||
#define NOT_A_PORT -1
|
||||
|
@ -25,26 +25,6 @@
|
||||
#include "eagle_soc.h"
|
||||
#include "ets_sys.h"
|
||||
|
||||
uint32_t digitalPinToPort(uint32_t pin) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t digitalPinToBitMask(uint32_t pin) {
|
||||
return 1 << pin;
|
||||
}
|
||||
|
||||
volatile uint32_t* portOutputRegister(uint32_t port) {
|
||||
return (volatile uint32_t*)GPO;
|
||||
}
|
||||
|
||||
volatile uint32_t* portInputRegister(uint32_t port) {
|
||||
return (volatile uint32_t*)GPI;
|
||||
}
|
||||
|
||||
volatile uint32_t* portModeRegister(uint32_t port) {
|
||||
return (volatile uint32_t*)GPE;
|
||||
}
|
||||
|
||||
extern void __pinMode(uint8_t pin, uint8_t mode) {
|
||||
if(pin < 16){
|
||||
if(mode == SPECIAL){
|
||||
|
@ -105,16 +105,15 @@
|
||||
#define DIRECT_WRITE_HIGH(base, mask) ((*(base+8+2)) = (mask)) //LATXSET + 0x28
|
||||
|
||||
#elif defined(ARDUINO_ARCH_ESP8266)
|
||||
#define PIN_TO_BASEREG(pin) (portOutputRegister(digitalPinToPort(pin)))
|
||||
#define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
|
||||
#define PIN_TO_BASEREG(pin) ((volatile uint32_t*) GPO)
|
||||
#define PIN_TO_BITMASK(pin) (1 << pin)
|
||||
#define IO_REG_TYPE uint32_t
|
||||
#define IO_REG_ASM
|
||||
#define DIRECT_READ(base, mask) (((*(base+6)) & (mask)) ? 1 : 0) //GPIO_IN_ADDRESS
|
||||
#define DIRECT_MODE_INPUT(base, mask) ((*(base+5)) = (mask)) //GPIO_ENABLE_W1TC_ADDRESS
|
||||
#define DIRECT_MODE_OUTPUT(base, mask) ((*(base+4)) = (mask)) //GPIO_ENABLE_W1TS_ADDRESS
|
||||
#define DIRECT_WRITE_LOW(base, mask) ((*(base+2)) = (mask)) //GPIO_OUT_W1TC_ADDRESS
|
||||
#define DIRECT_WRITE_HIGH(base, mask) ((*(base+1)) = (mask)) //GPIO_OUT_W1TS_ADDRESS
|
||||
|
||||
#define DIRECT_READ(base, mask) ((GPI & (mask)) ? 1 : 0) //GPIO_IN_ADDRESS
|
||||
#define DIRECT_MODE_INPUT(base, mask) (GPE &= ~(mask)) //GPIO_ENABLE_W1TC_ADDRESS
|
||||
#define DIRECT_MODE_OUTPUT(base, mask) (GPE |= (mask)) //GPIO_ENABLE_W1TS_ADDRESS
|
||||
#define DIRECT_WRITE_LOW(base, mask) (GPOC = (mask)) //GPIO_OUT_W1TC_ADDRESS
|
||||
#define DIRECT_WRITE_HIGH(base, mask) (GPOS = (mask)) //GPIO_OUT_W1TS_ADDRESS
|
||||
|
||||
#else
|
||||
#error "Please define I/O register types here"
|
||||
|
@ -12,7 +12,7 @@ compiler.tools.path={runtime.ide.path}/hardware/tools/esp8266/
|
||||
compiler.path={compiler.tools.path}xtensa-lx106-elf/bin/
|
||||
compiler.sdk.path={compiler.tools.path}sdk/
|
||||
|
||||
compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH "-I{compiler.sdk.path}/include"
|
||||
compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include"
|
||||
|
||||
compiler.c.cmd=xtensa-lx106-elf-gcc
|
||||
compiler.c.flags=-c -Os -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -MMD -std=c99
|
||||
|
Loading…
x
Reference in New Issue
Block a user