mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-05 13:16:13 +03:00
Merge branch 'new-extension' of https://github.com/arduino/Arduino into new-extension
Conflicts: build/linux/dist/tools/avrdude.conf
This commit is contained in:
@@ -176,14 +176,17 @@ public class AvrdudeUploader extends Uploader {
|
|||||||
|
|
||||||
public boolean avrdude(Collection params) throws RunnerException {
|
public boolean avrdude(Collection params) throws RunnerException {
|
||||||
List commandDownloader = new ArrayList();
|
List commandDownloader = new ArrayList();
|
||||||
commandDownloader.add("avrdude");
|
|
||||||
|
if(Base.isLinux()) {
|
||||||
// Point avrdude at its config file since it's in a non-standard location.
|
if ((new File(Base.getHardwarePath() + "/tools/" + "avrdude")).exists()) {
|
||||||
if (Base.isLinux()) {
|
commandDownloader.add(Base.getHardwarePath() + "/tools/" + "avrdude");
|
||||||
// ???: is it better to have Linux users install avrdude themselves, in
|
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avrdude.conf");
|
||||||
// a way that it can find its own configuration file?
|
} else {
|
||||||
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avrdude.conf");
|
commandDownloader.add("avrdude");
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
commandDownloader.add(Base.getHardwarePath() + "/tools/avr/bin/" + "avrdude");
|
||||||
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avr/etc/avrdude.conf");
|
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avr/etc/avrdude.conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -380,28 +380,60 @@ public class Compiler implements MessageConsumer {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (pieces != null) {
|
if (pieces != null) {
|
||||||
RunnerException e = sketch.placeException(pieces[3], pieces[1], PApplet.parseInt(pieces[2]) - 1);
|
String error = pieces[3], msg = "";
|
||||||
|
|
||||||
|
if (pieces[3].trim().equals("SPI.h: No such file or directory")) {
|
||||||
|
error = "Please import the SPI library from the Sketch > Import Library menu.";
|
||||||
|
msg = "\nAs of Arduino 0019, the Ethernet library depends on the SPI library." +
|
||||||
|
"\nYou appear to be using it or another library that depends on the SPI library.\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pieces[3].trim().equals("'BYTE' was not declared in this scope")) {
|
||||||
|
error = "The 'BYTE' keyword is no longer supported.";
|
||||||
|
msg = "\nAs of Arduino 1.0, the 'BYTE' keyword is no longer supported." +
|
||||||
|
"\nPlease use Serial.write() instead.\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pieces[3].trim().equals("no matching function for call to 'Server::Server(int)'")) {
|
||||||
|
error = "The Server class has been renamed EthernetServer.";
|
||||||
|
msg = "\nAs of Arduino 1.0, the Server class in the Ethernet library " +
|
||||||
|
"has been renamed to EthernetServer.\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pieces[3].trim().equals("no matching function for call to 'Client::Client(byte [4], int)'")) {
|
||||||
|
error = "The Client class has been renamed EthernetClient.";
|
||||||
|
msg = "\nAs of Arduino 1.0, the Client class in the Ethernet library " +
|
||||||
|
"has been renamed to EthernetClient.\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pieces[3].trim().equals("'Udp' was not declared in this scope")) {
|
||||||
|
error = "The Udp class has been renamed EthernetUdp.";
|
||||||
|
msg = "\nAs of Arduino 1.0, the Udp class in the Ethernet library " +
|
||||||
|
"has been renamed to EthernetClient.\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pieces[3].trim().equals("'class TwoWire' has no member named 'send'")) {
|
||||||
|
error = "Wire.send() has been renamed Wire.write().";
|
||||||
|
msg = "\nAs of Arduino 1.0, the Wire.send() function was renamed " +
|
||||||
|
"to Wire.write() for consistency with other libraries.\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pieces[3].trim().equals("'class TwoWire' has no member named 'receive'")) {
|
||||||
|
error = "Wire.receive() has been renamed Wire.read().";
|
||||||
|
msg = "\nAs of Arduino 1.0, the Wire.receive() function was renamed " +
|
||||||
|
"to Wire.read() for consistency with other libraries.\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
RunnerException e = sketch.placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1);
|
||||||
|
|
||||||
// replace full file path with the name of the sketch tab (unless we're
|
// replace full file path with the name of the sketch tab (unless we're
|
||||||
// in verbose mode, in which case don't modify the compiler output)
|
// in verbose mode, in which case don't modify the compiler output)
|
||||||
if (e != null && !verbose) {
|
if (e != null && !verbose) {
|
||||||
SketchCode code = sketch.getCode(e.getCodeIndex());
|
SketchCode code = sketch.getCode(e.getCodeIndex());
|
||||||
String fileName = code.isExtension(sketch.getDefaultExtension()) ? code.getPrettyName() : code.getFileName();
|
String fileName = code.isExtension(sketch.getDefaultExtension()) ? code.getPrettyName() : code.getFileName();
|
||||||
s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage();
|
s = fileName + ":" + e.getCodeLine() + ": error: " + pieces[3] + msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pieces[3].trim().equals("SPI.h: No such file or directory")) {
|
|
||||||
e = new RunnerException("Please import the SPI library from the Sketch > Import Library menu.");
|
|
||||||
s += "\nAs of Arduino 0019, the Ethernet library depends on the SPI library." +
|
|
||||||
"\nYou appear to be using it or another library that depends on the SPI library.";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pieces[3].trim().equals("'BYTE' was not declared in this scope")) {
|
|
||||||
e = new RunnerException("The 'BYTE' keyword is no longer supported.");
|
|
||||||
s += "\nAs of Arduino 1.0, the 'BYTE' keyword is no longer supported." +
|
|
||||||
"\nPlease use Serial.write() instead.";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (exception == null && e != null) {
|
if (exception == null && e != null) {
|
||||||
exception = e;
|
exception = e;
|
||||||
exception.hideStackTrace();
|
exception.hideStackTrace();
|
||||||
|
@@ -114,17 +114,6 @@ public abstract class Uploader implements MessageConsumer {
|
|||||||
String[] commandArray = new String[commandDownloader.size()];
|
String[] commandArray = new String[commandDownloader.size()];
|
||||||
commandDownloader.toArray(commandArray);
|
commandDownloader.toArray(commandArray);
|
||||||
|
|
||||||
String avrBasePath;
|
|
||||||
|
|
||||||
if(Base.isLinux()) {
|
|
||||||
avrBasePath = new String(Base.getHardwarePath() + "/tools/");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
avrBasePath = new String(Base.getHardwarePath() + "/tools/avr/bin/");
|
|
||||||
}
|
|
||||||
|
|
||||||
commandArray[0] = avrBasePath + commandArray[0];
|
|
||||||
|
|
||||||
if (verbose || Preferences.getBoolean("upload.verbose")) {
|
if (verbose || Preferences.getBoolean("upload.verbose")) {
|
||||||
for(int i = 0; i < commandArray.length; i++) {
|
for(int i = 0; i < commandArray.length; i++) {
|
||||||
System.out.print(commandArray[i] + " ");
|
System.out.print(commandArray[i] + " ");
|
||||||
|
BIN
build/linux/dist/tools/avrdude
vendored
BIN
build/linux/dist/tools/avrdude
vendored
Binary file not shown.
5085
build/linux/dist/tools/avrdude.conf
vendored
5085
build/linux/dist/tools/avrdude.conf
vendored
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@ buttons.status.font = SansSerif,plain,12
|
|||||||
buttons.status.color = #ffffff
|
buttons.status.color = #ffffff
|
||||||
|
|
||||||
# GUI - LINESTATUS
|
# GUI - LINESTATUS
|
||||||
linestatus.color = #17A1A5
|
linestatus.color = #ffffff
|
||||||
linestatus.bgcolor = #006468
|
linestatus.bgcolor = #006468
|
||||||
|
|
||||||
# EDITOR - DETAILS
|
# EDITOR - DETAILS
|
||||||
|
@@ -10,7 +10,6 @@ public:
|
|||||||
virtual int connect(IPAddress ip, uint16_t port) =0;
|
virtual int connect(IPAddress ip, uint16_t port) =0;
|
||||||
virtual int connect(const char *host, uint16_t port) =0;
|
virtual int connect(const char *host, uint16_t port) =0;
|
||||||
virtual size_t write(uint8_t) =0;
|
virtual size_t write(uint8_t) =0;
|
||||||
virtual size_t write(const char *str) =0;
|
|
||||||
virtual size_t write(const uint8_t *buf, size_t size) =0;
|
virtual size_t write(const uint8_t *buf, size_t size) =0;
|
||||||
virtual int available() = 0;
|
virtual int available() = 0;
|
||||||
virtual int read() = 0;
|
virtual int read() = 0;
|
||||||
|
@@ -95,7 +95,6 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
|||||||
#else
|
#else
|
||||||
void serialEvent() __attribute__((weak));
|
void serialEvent() __attribute__((weak));
|
||||||
void serialEvent() {}
|
void serialEvent() {}
|
||||||
volatile static unsigned char serialEvent_flag = 0;
|
|
||||||
#define serialEvent_implemented
|
#define serialEvent_implemented
|
||||||
#if defined(USART_RX_vect)
|
#if defined(USART_RX_vect)
|
||||||
SIGNAL(USART_RX_vect)
|
SIGNAL(USART_RX_vect)
|
||||||
@@ -117,7 +116,6 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
|||||||
#error UDR not defined
|
#error UDR not defined
|
||||||
#endif
|
#endif
|
||||||
store_char(c, &rx_buffer);
|
store_char(c, &rx_buffer);
|
||||||
serialEvent_flag = 1;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -125,13 +123,11 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
|||||||
#if defined(USART1_RX_vect)
|
#if defined(USART1_RX_vect)
|
||||||
void serialEvent1() __attribute__((weak));
|
void serialEvent1() __attribute__((weak));
|
||||||
void serialEvent1() {}
|
void serialEvent1() {}
|
||||||
volatile static unsigned char serialEvent1_flag = 0;
|
|
||||||
#define serialEvent1_implemented
|
#define serialEvent1_implemented
|
||||||
SIGNAL(USART1_RX_vect)
|
SIGNAL(USART1_RX_vect)
|
||||||
{
|
{
|
||||||
unsigned char c = UDR1;
|
unsigned char c = UDR1;
|
||||||
store_char(c, &rx_buffer1);
|
store_char(c, &rx_buffer1);
|
||||||
serialEvent1_flag = 1;
|
|
||||||
}
|
}
|
||||||
#elif defined(SIG_USART1_RECV)
|
#elif defined(SIG_USART1_RECV)
|
||||||
#error SIG_USART1_RECV
|
#error SIG_USART1_RECV
|
||||||
@@ -140,13 +136,11 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
|||||||
#if defined(USART2_RX_vect) && defined(UDR2)
|
#if defined(USART2_RX_vect) && defined(UDR2)
|
||||||
void serialEvent2() __attribute__((weak));
|
void serialEvent2() __attribute__((weak));
|
||||||
void serialEvent2() {}
|
void serialEvent2() {}
|
||||||
volatile static unsigned char serialEvent2_flag = 0;
|
|
||||||
#define serialEvent2_implemented
|
#define serialEvent2_implemented
|
||||||
SIGNAL(USART2_RX_vect)
|
SIGNAL(USART2_RX_vect)
|
||||||
{
|
{
|
||||||
unsigned char c = UDR2;
|
unsigned char c = UDR2;
|
||||||
store_char(c, &rx_buffer2);
|
store_char(c, &rx_buffer2);
|
||||||
serialEvent2_flag = 1;
|
|
||||||
}
|
}
|
||||||
#elif defined(SIG_USART2_RECV)
|
#elif defined(SIG_USART2_RECV)
|
||||||
#error SIG_USART2_RECV
|
#error SIG_USART2_RECV
|
||||||
@@ -155,13 +149,11 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
|||||||
#if defined(USART3_RX_vect) && defined(UDR3)
|
#if defined(USART3_RX_vect) && defined(UDR3)
|
||||||
void serialEvent3() __attribute__((weak));
|
void serialEvent3() __attribute__((weak));
|
||||||
void serialEvent3() {}
|
void serialEvent3() {}
|
||||||
volatile static unsigned char serialEvent3_flag = 0;
|
|
||||||
#define serialEvent3_implemented
|
#define serialEvent3_implemented
|
||||||
SIGNAL(USART3_RX_vect)
|
SIGNAL(USART3_RX_vect)
|
||||||
{
|
{
|
||||||
unsigned char c = UDR3;
|
unsigned char c = UDR3;
|
||||||
store_char(c, &rx_buffer3);
|
store_char(c, &rx_buffer3);
|
||||||
serialEvent3_flag = 1;
|
|
||||||
}
|
}
|
||||||
#elif defined(SIG_USART3_RECV)
|
#elif defined(SIG_USART3_RECV)
|
||||||
#error SIG_USART3_RECV
|
#error SIG_USART3_RECV
|
||||||
@@ -169,38 +161,17 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
|||||||
|
|
||||||
void serialEventRun(void)
|
void serialEventRun(void)
|
||||||
{
|
{
|
||||||
unsigned char flag, oldSREG;
|
|
||||||
#ifdef serialEvent_implemented
|
#ifdef serialEvent_implemented
|
||||||
oldSREG = SREG;
|
if (Serial.available()) serialEvent();
|
||||||
noInterrupts();
|
|
||||||
flag = serialEvent_flag;
|
|
||||||
serialEvent_flag = 0;
|
|
||||||
SREG = oldSREG;
|
|
||||||
if (flag) serialEvent();
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef serialEvent1_implemented
|
#ifdef serialEvent1_implemented
|
||||||
oldSREG = SREG;
|
if (Serial1.available()) serialEvent1();
|
||||||
noInterrupts();
|
|
||||||
flag = serialEvent1_flag;
|
|
||||||
serialEvent1_flag = 0;
|
|
||||||
SREG = oldSREG;
|
|
||||||
if (flag) serialEvent1();
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef serialEvent2_implemented
|
#ifdef serialEvent2_implemented
|
||||||
oldSREG = SREG;
|
if (Serial2.available()) serialEvent2();
|
||||||
noInterrupts();
|
|
||||||
flag = serialEvent2_flag;
|
|
||||||
serialEvent2_flag = 0;
|
|
||||||
SREG = oldSREG;
|
|
||||||
if (flag) serialEvent2();
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef serialEvent3_implemented
|
#ifdef serialEvent3_implemented
|
||||||
oldSREG = SREG;
|
if (Serial3.available()) serialEvent3();
|
||||||
noInterrupts();
|
|
||||||
flag = serialEvent3_flag;
|
|
||||||
serialEvent3_flag = 0;
|
|
||||||
SREG = oldSREG;
|
|
||||||
if (flag) serialEvent3();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,6 +75,6 @@ class HardwareSerial : public Stream
|
|||||||
extern HardwareSerial Serial3;
|
extern HardwareSerial Serial3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void serialEventRun(void);
|
extern void serialEventRun(void) __attribute__((weak));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -29,16 +29,6 @@
|
|||||||
|
|
||||||
// Public Methods //////////////////////////////////////////////////////////////
|
// Public Methods //////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/* default implementation: may be overridden */
|
|
||||||
size_t Print::write(const char *str)
|
|
||||||
{
|
|
||||||
size_t n = 0;
|
|
||||||
while (*str) {
|
|
||||||
n += write(*str++);
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* default implementation: may be overridden */
|
/* default implementation: may be overridden */
|
||||||
size_t Print::write(const uint8_t *buffer, size_t size)
|
size_t Print::write(const uint8_t *buffer, size_t size)
|
||||||
{
|
{
|
||||||
|
@@ -46,7 +46,7 @@ class Print
|
|||||||
void clearWriteError() { setWriteError(0); }
|
void clearWriteError() { setWriteError(0); }
|
||||||
|
|
||||||
virtual size_t write(uint8_t) = 0;
|
virtual size_t write(uint8_t) = 0;
|
||||||
virtual size_t write(const char *str);
|
size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); }
|
||||||
virtual size_t write(const uint8_t *buffer, size_t size);
|
virtual size_t write(const uint8_t *buffer, size_t size);
|
||||||
|
|
||||||
size_t print(const __FlashStringHelper *);
|
size_t print(const __FlashStringHelper *);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef server_h
|
#ifndef server_h
|
||||||
#define server_h
|
#define server_h
|
||||||
|
|
||||||
class Server {
|
class Server : public Print {
|
||||||
public:
|
public:
|
||||||
virtual void begin() =0;
|
virtual void begin() =0;
|
||||||
};
|
};
|
||||||
|
@@ -57,8 +57,6 @@ public:
|
|||||||
virtual int endPacket() =0;
|
virtual int endPacket() =0;
|
||||||
// Write a single byte into the packet
|
// Write a single byte into the packet
|
||||||
virtual size_t write(uint8_t) =0;
|
virtual size_t write(uint8_t) =0;
|
||||||
// Write a string of characters into the packet
|
|
||||||
virtual size_t write(const char *str) =0;
|
|
||||||
// Write size bytes from buffer into the packet
|
// Write size bytes from buffer into the packet
|
||||||
virtual size_t write(const uint8_t *buffer, size_t size) =0;
|
virtual size_t write(const uint8_t *buffer, size_t size) =0;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ int main(void)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
loop();
|
loop();
|
||||||
serialEventRun();
|
if (serialEventRun) serialEventRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -74,10 +74,6 @@ size_t EthernetClient::write(uint8_t b) {
|
|||||||
return write(&b, 1);
|
return write(&b, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t EthernetClient::write(const char *str) {
|
|
||||||
return write((const uint8_t *) str, strlen(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t EthernetClient::write(const uint8_t *buf, size_t size) {
|
size_t EthernetClient::write(const uint8_t *buf, size_t size) {
|
||||||
if (_sock == MAX_SOCK_NUM) {
|
if (_sock == MAX_SOCK_NUM) {
|
||||||
setWriteError();
|
setWriteError();
|
||||||
|
@@ -15,7 +15,6 @@ public:
|
|||||||
virtual int connect(IPAddress ip, uint16_t port);
|
virtual int connect(IPAddress ip, uint16_t port);
|
||||||
virtual int connect(const char *host, uint16_t port);
|
virtual int connect(const char *host, uint16_t port);
|
||||||
virtual size_t write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
virtual size_t write(const char *str);
|
|
||||||
virtual size_t write(const uint8_t *buf, size_t size);
|
virtual size_t write(const uint8_t *buf, size_t size);
|
||||||
virtual int available();
|
virtual int available();
|
||||||
virtual int read();
|
virtual int read();
|
||||||
@@ -27,6 +26,8 @@ public:
|
|||||||
virtual operator bool();
|
virtual operator bool();
|
||||||
|
|
||||||
friend class EthernetServer;
|
friend class EthernetServer;
|
||||||
|
|
||||||
|
using Print::write;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uint16_t _srcport;
|
static uint16_t _srcport;
|
||||||
|
@@ -72,11 +72,6 @@ size_t EthernetServer::write(uint8_t b)
|
|||||||
write(&b, 1);
|
write(&b, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t EthernetServer::write(const char *str)
|
|
||||||
{
|
|
||||||
write((const uint8_t *)str, strlen(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t EthernetServer::write(const uint8_t *buffer, size_t size)
|
size_t EthernetServer::write(const uint8_t *buffer, size_t size)
|
||||||
{
|
{
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
|
@@ -15,8 +15,8 @@ public:
|
|||||||
EthernetClient available();
|
EthernetClient available();
|
||||||
virtual void begin();
|
virtual void begin();
|
||||||
virtual size_t write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
virtual size_t write(const char *str);
|
|
||||||
virtual size_t write(const uint8_t *buf, size_t size);
|
virtual size_t write(const uint8_t *buf, size_t size);
|
||||||
|
using Print::write;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -107,12 +107,6 @@ size_t EthernetUDP::write(uint8_t byte)
|
|||||||
return write(&byte, 1);
|
return write(&byte, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t EthernetUDP::write(const char *str)
|
|
||||||
{
|
|
||||||
size_t len = strlen(str);
|
|
||||||
return write((const uint8_t *)str, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t EthernetUDP::write(const uint8_t *buffer, size_t size)
|
size_t EthernetUDP::write(const uint8_t *buffer, size_t size)
|
||||||
{
|
{
|
||||||
uint16_t bytes_written = bufferData(_sock, _offset, buffer, size);
|
uint16_t bytes_written = bufferData(_sock, _offset, buffer, size);
|
||||||
|
@@ -67,10 +67,10 @@ public:
|
|||||||
virtual int endPacket();
|
virtual int endPacket();
|
||||||
// Write a single byte into the packet
|
// Write a single byte into the packet
|
||||||
virtual size_t write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
// Write a string of characters into the packet
|
|
||||||
virtual size_t write(const char *str);
|
|
||||||
// Write size bytes from buffer into the packet
|
// Write size bytes from buffer into the packet
|
||||||
virtual size_t write(const uint8_t *buffer, size_t size);
|
virtual size_t write(const uint8_t *buffer, size_t size);
|
||||||
|
|
||||||
|
using Print::write;
|
||||||
|
|
||||||
// Start processing the next available incoming packet
|
// Start processing the next available incoming packet
|
||||||
// Returns the size of the packet in bytes, or 0 if no packets are available
|
// Returns the size of the packet in bytes, or 0 if no packets are available
|
||||||
|
@@ -81,6 +81,8 @@ public:
|
|||||||
void setCursor(uint8_t, uint8_t);
|
void setCursor(uint8_t, uint8_t);
|
||||||
virtual size_t write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
void command(uint8_t);
|
void command(uint8_t);
|
||||||
|
|
||||||
|
using Print::write;
|
||||||
private:
|
private:
|
||||||
void send(uint8_t, uint8_t);
|
void send(uint8_t, uint8_t);
|
||||||
void write4bits(uint8_t);
|
void write4bits(uint8_t);
|
||||||
|
@@ -62,10 +62,6 @@ size_t File::write(uint8_t val) {
|
|||||||
return write(&val, 1);
|
return write(&val, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t File::write(const char *str) {
|
|
||||||
return write((const uint8_t *) str, strlen(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t File::write(const uint8_t *buf, size_t size) {
|
size_t File::write(const uint8_t *buf, size_t size) {
|
||||||
size_t t;
|
size_t t;
|
||||||
if (!_file) {
|
if (!_file) {
|
||||||
|
@@ -33,7 +33,6 @@ public:
|
|||||||
File(void); // 'empty' constructor
|
File(void); // 'empty' constructor
|
||||||
~File(void); // destructor
|
~File(void); // destructor
|
||||||
virtual size_t write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
virtual size_t write(const char *str);
|
|
||||||
virtual size_t write(const uint8_t *buf, size_t size);
|
virtual size_t write(const uint8_t *buf, size_t size);
|
||||||
virtual int read();
|
virtual int read();
|
||||||
virtual int peek();
|
virtual int peek();
|
||||||
@@ -50,6 +49,8 @@ public:
|
|||||||
boolean isDirectory(void);
|
boolean isDirectory(void);
|
||||||
File openNextFile(uint8_t mode = O_RDONLY);
|
File openNextFile(uint8_t mode = O_RDONLY);
|
||||||
void rewindDirectory(void);
|
void rewindDirectory(void);
|
||||||
|
|
||||||
|
using Print::write;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SDClass {
|
class SDClass {
|
||||||
|
@@ -93,6 +93,8 @@ public:
|
|||||||
virtual int read();
|
virtual int read();
|
||||||
virtual int available();
|
virtual int available();
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
|
using Print::write;
|
||||||
|
|
||||||
// public only for easy access by interrupt handlers
|
// public only for easy access by interrupt handlers
|
||||||
static inline void handle_interrupt();
|
static inline void handle_interrupt();
|
||||||
|
@@ -164,14 +164,6 @@ size_t TwoWire::write(const uint8_t *data, size_t quantity)
|
|||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// must be called in:
|
|
||||||
// slave tx event callback
|
|
||||||
// or after beginTransmission(address)
|
|
||||||
size_t TwoWire::write(const char *data)
|
|
||||||
{
|
|
||||||
return write((uint8_t*)data, strlen(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
// must be called in:
|
// must be called in:
|
||||||
// slave rx event callback
|
// slave rx event callback
|
||||||
// or after requestFrom(address, numBytes)
|
// or after requestFrom(address, numBytes)
|
||||||
|
@@ -53,7 +53,6 @@ class TwoWire : public Stream
|
|||||||
uint8_t requestFrom(uint8_t, uint8_t);
|
uint8_t requestFrom(uint8_t, uint8_t);
|
||||||
uint8_t requestFrom(int, int);
|
uint8_t requestFrom(int, int);
|
||||||
virtual size_t write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
virtual size_t write(const char *);
|
|
||||||
virtual size_t write(const uint8_t *, size_t);
|
virtual size_t write(const uint8_t *, size_t);
|
||||||
virtual int available(void);
|
virtual int available(void);
|
||||||
virtual int read(void);
|
virtual int read(void);
|
||||||
@@ -61,6 +60,8 @@ class TwoWire : public Stream
|
|||||||
virtual void flush(void);
|
virtual void flush(void);
|
||||||
void onReceive( void (*)(int) );
|
void onReceive( void (*)(int) );
|
||||||
void onRequest( void (*)(void) );
|
void onRequest( void (*)(void) );
|
||||||
|
|
||||||
|
using Print::write;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TwoWire Wire;
|
extern TwoWire Wire;
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
|
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "pins_arduino.h"
|
||||||
#include "twi.h"
|
#include "twi.h"
|
||||||
|
|
||||||
static volatile uint8_t twi_state;
|
static volatile uint8_t twi_state;
|
||||||
@@ -63,18 +64,10 @@ void twi_init(void)
|
|||||||
{
|
{
|
||||||
// initialize state
|
// initialize state
|
||||||
twi_state = TWI_READY;
|
twi_state = TWI_READY;
|
||||||
|
|
||||||
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328P__)
|
// activate internal pullups for twi.
|
||||||
// activate internal pull-ups for twi
|
digitalWrite(SDA, 1);
|
||||||
// as per note from atmega8 manual pg167
|
digitalWrite(SCL, 1);
|
||||||
sbi(PORTC, 4);
|
|
||||||
sbi(PORTC, 5);
|
|
||||||
#else
|
|
||||||
// activate internal pull-ups for twi
|
|
||||||
// as per note from atmega128 manual pg204
|
|
||||||
sbi(PORTD, 0);
|
|
||||||
sbi(PORTD, 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// initialize twi prescaler and bit rate
|
// initialize twi prescaler and bit rate
|
||||||
cbi(TWSR, TWPS0);
|
cbi(TWSR, TWPS0);
|
||||||
|
Reference in New Issue
Block a user