summaryrefslogtreecommitdiff
path: root/src/teleshield-v0.1
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-01-03 20:41:15 -0800
committerKeith Packard <keithp@keithp.com>2012-01-03 20:41:15 -0800
commit7a42f2e0f145d2d520aed8e241fa39f7cb62b19f (patch)
treef4935b5c16a58849d8fb70d3831278efc57fd382 /src/teleshield-v0.1
parent085625ff3992454b59583d95a3c415597c51f754 (diff)
altos: Add support for UART0 in async mode
And copy bytes from it to stdout. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/teleshield-v0.1')
-rw-r--r--src/teleshield-v0.1/Makefile4
-rw-r--r--src/teleshield-v0.1/ao_ardu_serial.c38
-rw-r--r--src/teleshield-v0.1/ao_pins.h8
-rw-r--r--src/teleshield-v0.1/ao_teleshield.c1
4 files changed, 50 insertions, 1 deletions
diff --git a/src/teleshield-v0.1/Makefile b/src/teleshield-v0.1/Makefile
index b63a81d6..a21a6052 100644
--- a/src/teleshield-v0.1/Makefile
+++ b/src/teleshield-v0.1/Makefile
@@ -53,6 +53,7 @@ CC1111_SRC = \
ao_radio.c \
ao_romconfig.c \
ao_serial.c \
+ ao_serial0.c \
ao_string.c \
ao_timer.c \
ao_usb.c \
@@ -62,7 +63,8 @@ DRIVER_SRC = \
$(TELESHIELD_SRC)
PRODUCT_SRC = \
- ao_teleshield.c
+ ao_teleshield.c \
+ ao_ardu_serial.c
SRC = \
$(CORE_SRC) \
diff --git a/src/teleshield-v0.1/ao_ardu_serial.c b/src/teleshield-v0.1/ao_ardu_serial.c
new file mode 100644
index 00000000..7d4dc0db
--- /dev/null
+++ b/src/teleshield-v0.1/ao_ardu_serial.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2011 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+
+static void
+ao_ardu_serial_recv(void)
+{
+ char c;
+
+ for (;;) {
+ c = ao_serial0_getchar();
+ putchar (c);
+ }
+}
+
+static __xdata struct ao_task ao_ardu_serial_recv_task;
+
+void
+ao_ardu_serial_init (void)
+{
+ ao_serial0_init();
+ ao_add_task(&ao_ardu_serial_recv_task, ao_ardu_serial_recv, "recv");
+}
diff --git a/src/teleshield-v0.1/ao_pins.h b/src/teleshield-v0.1/ao_pins.h
index 1f659739..a907e2a5 100644
--- a/src/teleshield-v0.1/ao_pins.h
+++ b/src/teleshield-v0.1/ao_pins.h
@@ -27,6 +27,10 @@
#define HAS_SERIAL_1_ALT_2 0
#define HAS_SERIAL_1_HW_FLOW 1
#define USE_SERIAL_STDIN 1
+ #define HAS_SERIAL_0 1
+ #define HAS_SERIAL_0_ALT_1 0
+ #define HAS_SERIAL_0_ALT_2 1
+ #define HAS_SERIAL_0_HW_FLOW 0
#define HAS_ADC 0
#define HAS_DBG 1
#define HAS_EEPROM 0
@@ -214,4 +218,8 @@
#define AO_IGNITER_FIRE_TIME AO_MS_TO_TICKS(50)
#define AO_IGNITER_CHARGE_TIME AO_MS_TO_TICKS(2000)
+void
+ao_ardu_serial_init (void);
+
+
#endif /* _AO_PINS_H_ */
diff --git a/src/teleshield-v0.1/ao_teleshield.c b/src/teleshield-v0.1/ao_teleshield.c
index 3e07a955..fd12ce7a 100644
--- a/src/teleshield-v0.1/ao_teleshield.c
+++ b/src/teleshield-v0.1/ao_teleshield.c
@@ -43,6 +43,7 @@ main(void)
ao_aes_init();
ao_radio_cmac_init();
#endif
+ ao_ardu_serial_init();
ao_config_init();
ao_start_scheduler();
}