From 3f53e5daeca4d9257aef017594fd65b379b97a1e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 30 Oct 2010 19:36:29 -0700 Subject: [PATCH] Add initial teleterra implementation. Not a lot of new code here, but it does test the teleterra audio system. Signed-off-by: Keith Packard --- src/Makefile | 2 +- src/Makefile.proto | 8 ++++-- src/ao.h | 8 ++++++ src/ao_pins.h | 14 ++++++++++ src/ao_teleterra.c | 2 ++ src/ao_terraui.c | 50 +++++++++++++++++++++++++++++++++++ src/teleterra-v0.1/.gitignore | 2 ++ src/teleterra-v0.1/.sdcdbrc | 1 + src/teleterra-v0.1/Makefile | 1 + 9 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 src/ao_terraui.c create mode 100644 src/teleterra-v0.1/.gitignore create mode 100644 src/teleterra-v0.1/.sdcdbrc create mode 100644 src/teleterra-v0.1/Makefile diff --git a/src/Makefile b/src/Makefile index 95d24425..c02b3d73 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,7 +6,7 @@ CC=sdcc include Version -SUBDIRS=telemetrum-v1.0 teledongle-v0.2 telemetrum-v0.1-sky telemetrum-v0.1-sirf teledongle-v0.1 tidongle test +SUBDIRS=telemetrum-v1.0 teledongle-v0.2 telemetrum-v0.1-sky telemetrum-v0.1-sirf teledongle-v0.1 teleterra-v0.1 tidongle test all: all-recursive diff --git a/src/Makefile.proto b/src/Makefile.proto index b23eb257..2365030b 100644 --- a/src/Makefile.proto +++ b/src/Makefile.proto @@ -147,6 +147,10 @@ TI_SRC = \ TT_MAIN_SRC = \ ao_teleterra.c + +TT_TASK_SRC = \ + ao_terraui.c + # # All sources for TeleTerra # @@ -156,8 +160,8 @@ TT_SRC = \ $(TELE_RECEIVER_SRC) \ $(TELE_DRIVER_SRC) \ $(TELE_COMMON_SRC) \ - $(TT_MAIN_SRC) - + $(TT_MAIN_SRC) \ + $(TT_TASK_SRC) # # Sources for TeleDongle diff --git a/src/ao.h b/src/ao.h index 5b174947..a952c50d 100644 --- a/src/ao.h +++ b/src/ao.h @@ -1104,4 +1104,12 @@ ao_packet_slave_stop(void); void ao_packet_slave_init(void); +/* ao_terraui.c */ + +void +ao_terraui(void); + +void +ao_terraui_init(void); + #endif /* _AO_H_ */ diff --git a/src/ao_pins.h b/src/ao_pins.h index e9a265b0..7836d95a 100644 --- a/src/ao_pins.h +++ b/src/ao_pins.h @@ -76,6 +76,20 @@ #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) #endif +#if defined(TELETERRA_V_0_1) + #define HAS_SERIAL_1 1 + #define HAS_ADC 0 + #define HAS_DBG 1 + #define HAS_EEPROM 0 + #define DBG_ON_P1 1 + #define DBG_ON_P0 0 + #define PACKET_HAS_MASTER 1 + #define PACKET_HAS_SLAVE 0 + #define AO_LED_RED 1 + #define AO_LED_GREEN 2 + #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) +#endif + #if defined(TIDONGLE) #define HAS_SERIAL_1 0 #define HAS_ADC 0 diff --git a/src/ao_teleterra.c b/src/ao_teleterra.c index d696b914..422bd06a 100644 --- a/src/ao_teleterra.c +++ b/src/ao_teleterra.c @@ -31,8 +31,10 @@ main(void) ao_cmd_init(); ao_usb_init(); ao_serial_init(); + ao_gps_init(); ao_monitor_init(AO_LED_GREEN, TRUE); ao_radio_init(); ao_config_init(); + ao_terraui_init(); ao_start_scheduler(); } diff --git a/src/ao_terraui.c b/src/ao_terraui.c new file mode 100644 index 00000000..4837273d --- /dev/null +++ b/src/ao_terraui.c @@ -0,0 +1,50 @@ +/* + * Copyright © 2010 Keith Packard + * + * 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 __code uint8_t ready_beeps[] = { + AO_BEEP_g, AO_MS_TO_TICKS(100), + AO_BEEP_bb, AO_MS_TO_TICKS(100), + AO_BEEP_dd, AO_MS_TO_TICKS(100), + AO_BEEP_gg, AO_MS_TO_TICKS(200), + AO_BEEP_dd, AO_MS_TO_TICKS(100), + AO_BEEP_gg, AO_MS_TO_TICKS(400), +}; + +#define NUM_READY (sizeof(ready_beeps) / 2) + +__xdata uint8_t ao_terraui_wakeup; + +void +ao_terraui(void) +{ + uint8_t i; + + for (i = 0; i < sizeof(ready_beeps); i += 2) + ao_beep_for(ready_beeps[i], ready_beeps[i+1]); + for (;;) + ao_sleep(&ao_terraui_wakeup); +} + +static __xdata struct ao_task terraui_task; + +void +ao_terraui_init(void) +{ + ao_add_task(&terraui_task, ao_terraui, "terraui"); +} diff --git a/src/teleterra-v0.1/.gitignore b/src/teleterra-v0.1/.gitignore new file mode 100644 index 00000000..37c290ae --- /dev/null +++ b/src/teleterra-v0.1/.gitignore @@ -0,0 +1,2 @@ +teleterra-* +ao_product.h diff --git a/src/teleterra-v0.1/.sdcdbrc b/src/teleterra-v0.1/.sdcdbrc new file mode 100644 index 00000000..710b4a2f --- /dev/null +++ b/src/teleterra-v0.1/.sdcdbrc @@ -0,0 +1 @@ +--directory=.. diff --git a/src/teleterra-v0.1/Makefile b/src/teleterra-v0.1/Makefile new file mode 100644 index 00000000..d8867b19 --- /dev/null +++ b/src/teleterra-v0.1/Makefile @@ -0,0 +1 @@ +include ../Makefile.proto -- 2.30.2