summaryrefslogtreecommitdiff
path: root/libraries/NewSoftSerial
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2014-08-12 08:27:34 -0700
committerJesse Morgan <jesse@jesterpm.net>2014-08-12 08:27:34 -0700
commitb6b6bdcf8256c635caeaa53c227e2444ed36c5b4 (patch)
tree176169d5a891dd7ba354082e4269f0a1b65e2132 /libraries/NewSoftSerial
parent3439e192069f315e986f7b51b6e68c41983138bc (diff)
Getting the box ready for Daniel.
This is a first pass at cleaning up the code and getting the libraries to build with Arduino 1.0. I've started reworking the code for the new adventure. Dialog notes are in notes.txt. I've also added a Makefile to build from the command line.
Diffstat (limited to 'libraries/NewSoftSerial')
-rw-r--r--libraries/NewSoftSerial/NewSoftSerial.cpp9
-rw-r--r--libraries/NewSoftSerial/NewSoftSerial.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/libraries/NewSoftSerial/NewSoftSerial.cpp b/libraries/NewSoftSerial/NewSoftSerial.cpp
index 463ab01..54cb41e 100644
--- a/libraries/NewSoftSerial/NewSoftSerial.cpp
+++ b/libraries/NewSoftSerial/NewSoftSerial.cpp
@@ -36,8 +36,7 @@ http://arduiniana.org.
//
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
-#include "WConstants.h"
-#include "pins_arduino.h"
+#include "Arduino.h"
#include "NewSoftSerial.h"
// Abstractions for maximum portability between processors
@@ -458,10 +457,10 @@ uint8_t NewSoftSerial::available(void)
return (_receive_buffer_tail + _NewSS_MAX_RX_BUFF - _receive_buffer_head) % _NewSS_MAX_RX_BUFF;
}
-void NewSoftSerial::write(uint8_t b)
+size_t NewSoftSerial::write(uint8_t b)
{
if (_tx_delay == 0)
- return;
+ return 0;
activate();
@@ -504,6 +503,8 @@ void NewSoftSerial::write(uint8_t b)
SREG = oldSREG; // turn interrupts back on
tunedDelay(_tx_delay);
+
+ return 1;
}
#if !defined(cbi)
diff --git a/libraries/NewSoftSerial/NewSoftSerial.h b/libraries/NewSoftSerial/NewSoftSerial.h
index 1e39201..dd80c40 100644
--- a/libraries/NewSoftSerial/NewSoftSerial.h
+++ b/libraries/NewSoftSerial/NewSoftSerial.h
@@ -68,7 +68,7 @@ private:
// private methods
void recv();
bool activate();
- virtual void write(uint8_t byte);
+ virtual size_t write(uint8_t byte);
uint8_t rx_pin_read();
void tx_pin_write(uint8_t pin_state);
void setTX(uint8_t transmitPin);