Skip to content

fix bug #159 #160

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 2, 2015
Merged
Show file tree
Hide file tree
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: 5 additions & 6 deletions hardware/esp8266com/esp8266/cores/esp8266/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion hardware/esp8266com/esp8266/platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions libraries/OneWire/OneWire.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down