1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-30 23:24:49 +03:00

Merge pull request #12 from esp8266/esp8266

pull latest changes
This commit is contained in:
ficeto 2015-05-06 11:47:26 +03:00
commit 5daf774c5b
6 changed files with 93 additions and 79 deletions

View File

@ -57,12 +57,12 @@ generic.menu.FlashSize.4M=4M
generic.menu.FlashSize.4M.build.flash_size=4M generic.menu.FlashSize.4M.build.flash_size=4M
############################################################## ##############################################################
nodemcu.name=NODEMCU ESP8266 Module (v0.9) nodemcu.name=NodeMCU (ESP8266 ESP-12 Module)
nodemcu.upload.tool=esptool nodemcu.upload.tool=esptool
nodemcu.upload.speed=115200 nodemcu.upload.speed=115200
nodemcu.upload.resetmethod=ck nodemcu.upload.resetmethod=ck
nodemcu.upload.maximum_size=524288 nodemcu.upload.maximum_size=4194304
nodemcu.upload.wait_for_upload_port=true nodemcu.upload.wait_for_upload_port=true
nodemcu.serial.disableDTR=true nodemcu.serial.disableDTR=true
nodemcu.serial.disableRTS=true nodemcu.serial.disableRTS=true
@ -73,7 +73,7 @@ nodemcu.build.board=ESP8266_ESP12
nodemcu.build.core=esp8266 nodemcu.build.core=esp8266
nodemcu.build.variant=nodemcu nodemcu.build.variant=nodemcu
nodemcu.build.flash_mode=qio nodemcu.build.flash_mode=qio
nodemcu.build.flash_size=512K nodemcu.build.flash_size=4M
nodemcu.build.flash_freq=40 nodemcu.build.flash_freq=40
nodemcu.menu.CpuFrequency.80=80 MHz nodemcu.menu.CpuFrequency.80=80 MHz
@ -101,14 +101,6 @@ nodemcu.menu.UploadSpeed.512000.upload.speed=512000
nodemcu.menu.UploadSpeed.921600=921600 nodemcu.menu.UploadSpeed.921600=921600
nodemcu.menu.UploadSpeed.921600.upload.speed=921600 nodemcu.menu.UploadSpeed.921600.upload.speed=921600
nodemcu.menu.FlashSize.512K=512K
nodemcu.menu.FlashSize.512K.build.flash_size=512K
nodemcu.menu.FlashSize.256K=256K
nodemcu.menu.FlashSize.256K.build.flash_size=256K
nodemcu.menu.FlashSize.1M=1M
nodemcu.menu.FlashSize.1M.build.flash_size=1M
nodemcu.menu.FlashSize.2M=2M
nodemcu.menu.FlashSize.2M.build.flash_size=2M
nodemcu.menu.FlashSize.4M=4M nodemcu.menu.FlashSize.4M=4M
nodemcu.menu.FlashSize.4M.build.flash_size=4M nodemcu.menu.FlashSize.4M.build.flash_size=4M

View File

@ -223,10 +223,13 @@ FlashMode_t EspClass::getFlashChipMode(void)
* Infos from * Infos from
* http://www.wlxmall.com/images/stock_item/att/A1010004.pdf * http://www.wlxmall.com/images/stock_item/att/A1010004.pdf
* http://www.gigadevice.com/product-series/5.html?locale=en_US * http://www.gigadevice.com/product-series/5.html?locale=en_US
* http://www.elinux.org/images/f/f5/Winbond-w25q32.pdf
*/ */
uint32_t EspClass::getFlashChipSizeByChipId(void) { uint32_t EspClass::getFlashChipSizeByChipId(void) {
uint32_t chipId = getFlashChipId(); uint32_t chipId = getFlashChipId();
switch(chipId) { switch(chipId) {
// GigaDevice
case 0x1740C8: // GD25Q64B case 0x1740C8: // GD25Q64B
return (8_MB); return (8_MB);
case 0x1640C8: // GD25Q32B case 0x1640C8: // GD25Q32B
@ -243,6 +246,15 @@ uint32_t EspClass::getFlashChipSizeByChipId(void) {
return (128_kB); return (128_kB);
case 0x1040C8: // GD25Q12 case 0x1040C8: // GD25Q12
return (64_kB); return (64_kB);
// Winbond
case 0x1640EF: // W25Q32
return (4_MB);
case 0x1540EF: // W25Q16
return (2_MB);
case 0x1440EF: // W25Q80
return (1_MB);
default: default:
return 0; return 0;
} }

View File

@ -41,6 +41,20 @@ extern "C" {
#define UART_TX_FIFO_SIZE 0x80 #define UART_TX_FIFO_SIZE 0x80
struct uart_ {
int uart_nr;
int baud_rate;
bool rxEnabled;
bool txEnabled;
uint8_t rxPin;
uint8_t txPin;
};
static const int UART0 = 0;
static const int UART1 = 1;
static const int UART_NO = -1;
/** /**
* UART GPIOs * UART GPIOs
* *
@ -86,7 +100,7 @@ void uart_disarm_tx_interrupt(uart_t* uart);
void uart_set_baudrate(uart_t* uart, int baud_rate); void uart_set_baudrate(uart_t* uart, int baud_rate);
int uart_get_baudrate(uart_t* uart); int uart_get_baudrate(uart_t* uart);
uart_t* uart_init(UARTnr_t uart_nr, int baudrate, byte config); uart_t* uart_init(int uart_nr, int baudrate, byte config);
void uart_uninit(uart_t* uart); void uart_uninit(uart_t* uart);
void uart_swap(uart_t* uart); void uart_swap(uart_t* uart);
@ -94,8 +108,8 @@ void uart_ignore_char(char c);
void uart0_write_char(char c); void uart0_write_char(char c);
void uart1_write_char(char c); void uart1_write_char(char c);
void uart_set_debug(UARTnr_t uart_nr); void uart_set_debug(int uart_nr);
UARTnr_t uart_get_debug(); int uart_get_debug();
// #################################################################################################### // ####################################################################################################
// #################################################################################################### // ####################################################################################################
@ -108,12 +122,12 @@ void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
if(Serial.isRxEnabled()) { if(Serial.isRxEnabled()) {
if(status & (1 << UIFF)) { if(status & (1 << UIFF)) {
while(true) { while(true) {
int rx_count = (U0S >> USTXC) & 0xFF; int rx_count = (U0S >> USTXC) & 0xff;
if(!rx_count) if(!rx_count)
break; break;
while(rx_count--) { while(rx_count--) {
char c = U0F & 0xFF; char c = U0F & 0xff;
Serial._rx_complete_irq(c); Serial._rx_complete_irq(c);
} }
} }
@ -133,12 +147,12 @@ void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
if(Serial1.isRxEnabled()) { if(Serial1.isRxEnabled()) {
if(status & (1 << UIFF)) { if(status & (1 << UIFF)) {
while(true) { while(true) {
int rx_count = (U1S >> USTXC) & 0xFF; int rx_count = (U1S >> USTXC) & 0xff;
if(!rx_count) if(!rx_count)
break; break;
while(rx_count--) { while(rx_count--) {
char c = U1F & 0xFF; char c = U1F & 0xff;
Serial1._rx_complete_irq(c); Serial1._rx_complete_irq(c);
} }
} }
@ -156,28 +170,28 @@ void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
// #################################################################################################### // ####################################################################################################
void ICACHE_FLASH_ATTR uart_wait_for_tx_fifo(uart_t* uart, size_t size_needed) { void uart_wait_for_tx_fifo(uart_t* uart, size_t size_needed) {
if(uart == 0) if(uart == 0)
return; return;
if(uart->txEnabled) { if(uart->txEnabled) {
while(true) { while(true) {
size_t tx_count = (USS(uart->uart_nr) >> USTXC) & 0xFF; size_t tx_count = (USS(uart->uart_nr) >> USTXC) & 0xff;
if(tx_count <= (UART_TX_FIFO_SIZE - size_needed)) if(tx_count <= (UART_TX_FIFO_SIZE - size_needed))
break; break;
} }
} }
} }
size_t ICACHE_FLASH_ATTR uart_get_tx_fifo_room(uart_t* uart) { size_t uart_get_tx_fifo_room(uart_t* uart) {
if(uart == 0) if(uart == 0)
return 0; return 0;
if(uart->txEnabled) { if(uart->txEnabled) {
return UART_TX_FIFO_SIZE - ((USS(uart->uart_nr) >> USTXC) & 0xFF); return UART_TX_FIFO_SIZE - ((USS(uart->uart_nr) >> USTXC) & 0xff);
} }
return 0; return 0;
} }
void ICACHE_FLASH_ATTR uart_wait_for_transmit(uart_t* uart) { void uart_wait_for_transmit(uart_t* uart) {
if(uart == 0) if(uart == 0)
return; return;
if(uart->txEnabled) { if(uart->txEnabled) {
@ -185,7 +199,7 @@ void ICACHE_FLASH_ATTR uart_wait_for_transmit(uart_t* uart) {
} }
} }
void ICACHE_FLASH_ATTR uart_transmit_char(uart_t* uart, char c) { void uart_transmit_char(uart_t* uart, char c) {
if(uart == 0) if(uart == 0)
return; return;
if(uart->txEnabled) { if(uart->txEnabled) {
@ -193,7 +207,7 @@ void ICACHE_FLASH_ATTR uart_transmit_char(uart_t* uart, char c) {
} }
} }
void ICACHE_FLASH_ATTR uart_transmit(uart_t* uart, const char* buf, size_t size) { void uart_transmit(uart_t* uart, const char* buf, size_t size) {
if(uart == 0) if(uart == 0)
return; return;
if(uart->txEnabled) { if(uart->txEnabled) {
@ -208,7 +222,7 @@ void ICACHE_FLASH_ATTR uart_transmit(uart_t* uart, const char* buf, size_t size)
} }
} }
void ICACHE_FLASH_ATTR uart_flush(uart_t* uart) { void uart_flush(uart_t* uart) {
uint32_t tmp = 0x00000000; uint32_t tmp = 0x00000000;
if(uart == 0) if(uart == 0)
@ -226,7 +240,7 @@ void ICACHE_FLASH_ATTR uart_flush(uart_t* uart) {
USC0(uart->uart_nr) &= ~(tmp); USC0(uart->uart_nr) &= ~(tmp);
} }
void ICACHE_FLASH_ATTR uart_interrupt_enable(uart_t* uart) { void uart_interrupt_enable(uart_t* uart) {
if(uart == 0) if(uart == 0)
return; return;
USIC(uart->uart_nr) = 0x1ff; USIC(uart->uart_nr) = 0x1ff;
@ -237,7 +251,7 @@ void ICACHE_FLASH_ATTR uart_interrupt_enable(uart_t* uart) {
ETS_UART_INTR_ENABLE(); ETS_UART_INTR_ENABLE();
} }
void ICACHE_FLASH_ATTR uart_interrupt_disable(uart_t* uart) { void uart_interrupt_disable(uart_t* uart) {
if(uart == 0) if(uart == 0)
return; return;
if(uart->rxEnabled) { if(uart->rxEnabled) {
@ -249,7 +263,7 @@ void ICACHE_FLASH_ATTR uart_interrupt_disable(uart_t* uart) {
//ETS_UART_INTR_DISABLE(); // never disable irq complete may its needed by the other Serial Interface! //ETS_UART_INTR_DISABLE(); // never disable irq complete may its needed by the other Serial Interface!
} }
void ICACHE_FLASH_ATTR uart_arm_tx_interrupt(uart_t* uart) { void uart_arm_tx_interrupt(uart_t* uart) {
if(uart == 0) if(uart == 0)
return; return;
if(uart->txEnabled) { if(uart->txEnabled) {
@ -257,7 +271,7 @@ void ICACHE_FLASH_ATTR uart_arm_tx_interrupt(uart_t* uart) {
} }
} }
void ICACHE_FLASH_ATTR uart_disarm_tx_interrupt(uart_t* uart) { void uart_disarm_tx_interrupt(uart_t* uart) {
if(uart == 0) if(uart == 0)
return; return;
if(uart->txEnabled) { if(uart->txEnabled) {
@ -265,20 +279,20 @@ void ICACHE_FLASH_ATTR uart_disarm_tx_interrupt(uart_t* uart) {
} }
} }
void ICACHE_FLASH_ATTR uart_set_baudrate(uart_t* uart, int baud_rate) { void uart_set_baudrate(uart_t* uart, int baud_rate) {
if(uart == 0) if(uart == 0)
return; return;
uart->baud_rate = baud_rate; uart->baud_rate = baud_rate;
USD(uart->uart_nr) = (80000000UL / uart->baud_rate); USD(uart->uart_nr) = (80000000UL / uart->baud_rate);
} }
int ICACHE_FLASH_ATTR uart_get_baudrate(uart_t* uart) { int uart_get_baudrate(uart_t* uart) {
if(uart == 0) if(uart == 0)
return 0; return 0;
return uart->baud_rate; return uart->baud_rate;
} }
uart_t* ICACHE_FLASH_ATTR uart_init(UARTnr_t uart_nr, int baudrate, byte config) { uart_t* uart_init(int uart_nr, int baudrate, byte config) {
uint32_t conf1 = 0x00000000; uint32_t conf1 = 0x00000000;
uart_t* uart = (uart_t*) os_malloc(sizeof(uart_t)); uart_t* uart = (uart_t*) os_malloc(sizeof(uart_t));
@ -329,7 +343,7 @@ uart_t* ICACHE_FLASH_ATTR uart_init(UARTnr_t uart_nr, int baudrate, byte config)
return uart; return uart;
} }
void ICACHE_FLASH_ATTR uart_uninit(uart_t* uart) { void uart_uninit(uart_t* uart) {
if(uart == 0) if(uart == 0)
return; return;
uart_interrupt_disable(uart); uart_interrupt_disable(uart);
@ -358,7 +372,7 @@ void ICACHE_FLASH_ATTR uart_uninit(uart_t* uart) {
os_free(uart); os_free(uart);
} }
void ICACHE_FLASH_ATTR uart_swap(uart_t* uart) { void uart_swap(uart_t* uart) {
if(uart == 0) if(uart == 0)
return; return;
switch(uart->uart_nr) { switch(uart->uart_nr) {
@ -394,10 +408,10 @@ void ICACHE_FLASH_ATTR uart_swap(uart_t* uart) {
// #################################################################################################### // ####################################################################################################
// #################################################################################################### // ####################################################################################################
void ICACHE_FLASH_ATTR uart_ignore_char(char c) { void uart_ignore_char(char c) {
} }
void ICACHE_FLASH_ATTR uart0_write_char(char c) { void uart0_write_char(char c) {
if(&Serial != NULL && Serial.isTxEnabled()) { if(&Serial != NULL && Serial.isTxEnabled()) {
if(c == '\n') { if(c == '\n') {
Serial.write('\r'); Serial.write('\r');
@ -411,7 +425,7 @@ void ICACHE_FLASH_ATTR uart0_write_char(char c) {
} }
} }
void ICACHE_FLASH_ATTR uart1_write_char(char c) { void uart1_write_char(char c) {
if(&Serial1 != NULL && Serial1.isTxEnabled()) { if(&Serial1 != NULL && Serial1.isTxEnabled()) {
if(c == '\n') { if(c == '\n') {
Serial1.write('\r'); Serial1.write('\r');
@ -425,8 +439,9 @@ void ICACHE_FLASH_ATTR uart1_write_char(char c) {
} }
} }
static UARTnr_t s_uart_debug_nr = UART0; static int s_uart_debug_nr = UART0;
void ICACHE_FLASH_ATTR uart_set_debug(UARTnr_t uart_nr) {
void uart_set_debug(int uart_nr) {
s_uart_debug_nr = uart_nr; s_uart_debug_nr = uart_nr;
switch(s_uart_debug_nr) { switch(s_uart_debug_nr) {
case UART0: case UART0:
@ -445,7 +460,7 @@ void ICACHE_FLASH_ATTR uart_set_debug(UARTnr_t uart_nr) {
} }
} }
UARTnr_t ICACHE_FLASH_ATTR uart_get_debug() { int uart_get_debug() {
return s_uart_debug_nr; return s_uart_debug_nr;
} }
@ -453,12 +468,11 @@ UARTnr_t ICACHE_FLASH_ATTR uart_get_debug() {
// #################################################################################################### // ####################################################################################################
// #################################################################################################### // ####################################################################################################
ICACHE_FLASH_ATTR HardwareSerial::HardwareSerial(UARTnr_t uart_nr) : HardwareSerial::HardwareSerial(int uart_nr) :
_uart(0), _tx_buffer(0), _rx_buffer(0), _written(false) { _uart_nr(uart_nr), _uart(0), _tx_buffer(0), _rx_buffer(0), _written(false) {
_uart_nr = uart_nr;
} }
void ICACHE_FLASH_ATTR HardwareSerial::begin(unsigned long baud, byte config) { void HardwareSerial::begin(unsigned long baud, byte config) {
// disable debug for this interface // disable debug for this interface
if(uart_get_debug() == _uart_nr) { if(uart_get_debug() == _uart_nr) {
@ -472,16 +486,18 @@ void ICACHE_FLASH_ATTR HardwareSerial::begin(unsigned long baud, byte config) {
} }
if(_uart->rxEnabled) { if(_uart->rxEnabled) {
_rx_buffer = new cbuf(SERIAL_RX_BUFFER_SIZE); if (!_rx_buffer)
_rx_buffer = new cbuf(SERIAL_RX_BUFFER_SIZE);
} }
if(_uart->txEnabled) { if(_uart->txEnabled) {
_tx_buffer = new cbuf(SERIAL_TX_BUFFER_SIZE); if (!_tx_buffer)
_tx_buffer = new cbuf(SERIAL_TX_BUFFER_SIZE);
} }
_written = false; _written = false;
delay(1); delay(1);
} }
void ICACHE_FLASH_ATTR HardwareSerial::end() { void HardwareSerial::end() {
if(uart_get_debug() == _uart_nr) { if(uart_get_debug() == _uart_nr) {
uart_set_debug(UART_NO); uart_set_debug(UART_NO);
} }
@ -493,13 +509,13 @@ void ICACHE_FLASH_ATTR HardwareSerial::end() {
_tx_buffer = 0; _tx_buffer = 0;
} }
void ICACHE_FLASH_ATTR HardwareSerial::swap() { void HardwareSerial::swap() {
if(_uart == 0) if(_uart == 0)
return; return;
uart_swap(_uart); uart_swap(_uart);
} }
void ICACHE_FLASH_ATTR HardwareSerial::setDebugOutput(bool en) { void HardwareSerial::setDebugOutput(bool en) {
if(_uart == 0) if(_uart == 0)
return; return;
if(en) { if(en) {
@ -512,19 +528,19 @@ void ICACHE_FLASH_ATTR HardwareSerial::setDebugOutput(bool en) {
} }
} }
bool ICACHE_FLASH_ATTR HardwareSerial::isTxEnabled(void) { bool HardwareSerial::isTxEnabled(void) {
if(_uart == 0) if(_uart == 0)
return false; return false;
return _uart->txEnabled; return _uart->txEnabled;
} }
bool ICACHE_FLASH_ATTR HardwareSerial::isRxEnabled(void) { bool HardwareSerial::isRxEnabled(void) {
if(_uart == 0) if(_uart == 0)
return false; return false;
return _uart->rxEnabled; return _uart->rxEnabled;
} }
int ICACHE_FLASH_ATTR HardwareSerial::available(void) { int HardwareSerial::available(void) {
if(_uart == 0) if(_uart == 0)
return 0; return 0;
if(_uart->rxEnabled) { if(_uart->rxEnabled) {
@ -534,7 +550,7 @@ int ICACHE_FLASH_ATTR HardwareSerial::available(void) {
} }
} }
int ICACHE_FLASH_ATTR HardwareSerial::peek(void) { int HardwareSerial::peek(void) {
if(_uart == 0) if(_uart == 0)
return -1; return -1;
if(_uart->rxEnabled) { if(_uart->rxEnabled) {
@ -544,7 +560,7 @@ int ICACHE_FLASH_ATTR HardwareSerial::peek(void) {
} }
} }
int ICACHE_FLASH_ATTR HardwareSerial::read(void) { int HardwareSerial::read(void) {
if(_uart == 0) if(_uart == 0)
return -1; return -1;
if(_uart->rxEnabled) { if(_uart->rxEnabled) {
@ -554,7 +570,7 @@ int ICACHE_FLASH_ATTR HardwareSerial::read(void) {
} }
} }
int ICACHE_FLASH_ATTR HardwareSerial::availableForWrite(void) { int HardwareSerial::availableForWrite(void) {
if(_uart == 0) if(_uart == 0)
return 0; return 0;
if(_uart->txEnabled) { if(_uart->txEnabled) {
@ -564,7 +580,7 @@ int ICACHE_FLASH_ATTR HardwareSerial::availableForWrite(void) {
} }
} }
void ICACHE_FLASH_ATTR HardwareSerial::flush() { void HardwareSerial::flush() {
if(_uart == 0) if(_uart == 0)
return; return;
if(!_uart->txEnabled) if(!_uart->txEnabled)
@ -578,7 +594,7 @@ void ICACHE_FLASH_ATTR HardwareSerial::flush() {
_written = false; _written = false;
} }
size_t ICACHE_FLASH_ATTR HardwareSerial::write(uint8_t c) { size_t HardwareSerial::write(uint8_t c) {
if(_uart == 0 || !_uart->txEnabled) if(_uart == 0 || !_uart->txEnabled)
return 0; return 0;
_written = true; _written = true;
@ -599,17 +615,17 @@ size_t ICACHE_FLASH_ATTR HardwareSerial::write(uint8_t c) {
return 1; return 1;
} }
ICACHE_FLASH_ATTR HardwareSerial::operator bool() const { HardwareSerial::operator bool() const {
return _uart != 0; return _uart != 0;
} }
void ICACHE_FLASH_ATTR HardwareSerial::_rx_complete_irq(char c) { void HardwareSerial::_rx_complete_irq(char c) {
if(_rx_buffer) { if(_rx_buffer) {
_rx_buffer->write(c); _rx_buffer->write(c);
} }
} }
void ICACHE_FLASH_ATTR HardwareSerial::_tx_empty_irq(void) { void HardwareSerial::_tx_empty_irq(void) {
if(_uart == 0) if(_uart == 0)
return; return;
if(_tx_buffer == 0) if(_tx_buffer == 0)

View File

@ -62,29 +62,19 @@
class cbuf; class cbuf;
typedef enum { struct uart_;
UART0 = 0, UART1 = 1, UART_NO = 0xFF typedef struct uart_ uart_t;
} UARTnr_t;
typedef struct {
UARTnr_t uart_nr;
int baud_rate;
bool rxEnabled;
bool txEnabled;
uint8_t rxPin;
uint8_t txPin;
} uart_t;
class HardwareSerial: public Stream { class HardwareSerial: public Stream {
public: public:
HardwareSerial(UARTnr_t uart_nr); HardwareSerial(int uart_nr);
void begin(unsigned long baud) { void begin(unsigned long baud) {
begin(baud, SERIAL_8N1); begin(baud, SERIAL_8N1);
} }
void begin(unsigned long, uint8_t); void begin(unsigned long, uint8_t);
void end(); void end();
void swap(); //use GPIO13 and GPIO15 as RX and TX void swap(); //toggle between use of GPIO13/GPIO15 or GPIO3/GPIO1 as RX and TX
int available(void) override; int available(void) override;
int peek(void) override; int peek(void) override;
int read(void) override; int read(void) override;
@ -116,7 +106,7 @@ class HardwareSerial: public Stream {
void _tx_empty_irq(void); void _tx_empty_irq(void);
protected: protected:
UARTnr_t _uart_nr; int _uart_nr;
uart_t* _uart; uart_t* _uart;
cbuf* _tx_buffer; cbuf* _tx_buffer;
cbuf* _rx_buffer; cbuf* _rx_buffer;

View File

@ -19,7 +19,7 @@ void handleRoot() {
void handleNotFound(){ void handleNotFound(){
digitalWrite(led, 1); digitalWrite(led, 1);
String message += "File Not Found\n\n"; String message = "File Not Found\n\n";
message += "URI: "; message += "URI: ";
message += server.uri(); message += server.uri();
message += "\nMethod: "; message += "\nMethod: ";

View File

@ -45,6 +45,9 @@ uint8_t TwoWire::transmitting = 0;
void (*TwoWire::user_onRequest)(void); void (*TwoWire::user_onRequest)(void);
void (*TwoWire::user_onReceive)(int); void (*TwoWire::user_onReceive)(int);
static int default_sda_pin = SDA;
static int default_scl_pin = SCL;
// Constructors //////////////////////////////////////////////////////////////// // Constructors ////////////////////////////////////////////////////////////////
TwoWire::TwoWire(){} TwoWire::TwoWire(){}
@ -57,11 +60,12 @@ void TwoWire::begin(int sda, int scl){
} }
void TwoWire::pins(int sda, int scl){ void TwoWire::pins(int sda, int scl){
twi_init(sda, scl); default_sda_pin = sda;
default_scl_pin = scl;
} }
void TwoWire::begin(void){ void TwoWire::begin(void){
begin(SDA, SCL); begin(default_sda_pin, default_scl_pin);
} }
void TwoWire::begin(uint8_t address){ void TwoWire::begin(uint8_t address){