telemetrum-v1.1 telemetrum-v1.0 \
teledongle-v0.2 teledongle-v0.1 \
telemini-v0.1 telenano-v0.1 \
+ telebt-v0.0 \
telemetrum-v0.1-sky telemetrum-v0.1-sirf \
tidongle test
#
SIRF_DRIVER_SRC = \
ao_gps_sirf.c
+
#
# Skytraq driver source
#
SKY_DRIVER_SRC = \
ao_gps_skytraq.c
+
+#
+# BTM-182 driver source
+#
+BTM_DRIVER_SRC = \
+ ao_btm.c
+
#
# Tasks run on TeleMetrum
#
$(TNANO_TASK_SRC) \
$(TNANO_MAIN_SRC)
+#
+# Sources for TeleDongle
+#
+
+TBT_MAIN_SRC = \
+ ao_telebt.c
+
+TBT_BASE_SRC = \
+ $(ALTOS_SRC) \
+ $(ALTOS_DRIVER_SRC) \
+ $(TELE_RECEIVER_SRC) \
+ $(TELE_COMMON_SRC) \
+ $(SERIAL_DRIVER_SRC) \
+ $(USB_DRIVER_SRC) \
+ $(BTM_DRIVER_SRC) \
+ $(DBG_SRC) \
+ $(TBT_MAIN_SRC)
+
#
# TI Dongle sources
#
#endif
#if HAS_SERIAL_1
+#ifndef USE_SERIAL_STDIN
+#error Please define USE_SERIAL_STDIN
+#endif
+
void
ao_serial_rx1_isr(void) __interrupt 3;
char
ao_serial_getchar(void) __critical;
+#if USE_SERIAL_STDIN
+char
+ao_serial_pollchar(void) __critical;
+
+void
+ao_serial_set_stdin(uint8_t stdin);
+#endif
+
void
ao_serial_putchar(char c) __critical;
#define AO_SERIAL_SPEED_4800 0
#define AO_SERIAL_SPEED_9600 1
-#define AO_SERIAL_SPEED_57600 2
+#define AO_SERIAL_SPEED_19200 2
+#define AO_SERIAL_SPEED_57600 3
void
ao_serial_set_speed(uint8_t speed);
void
ao_packet_slave_init(uint8_t enable);
+/* ao_btm.c */
+
+void
+ao_btm_init(void);
+
#endif /* _AO_H_ */
--- /dev/null
+/*
+ * 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"
+
+uint8_t ao_btm_enable;
+extern volatile __xdata struct ao_fifo ao_usart1_rx_fifo;
+
+void
+ao_btm(void)
+{
+ char c;
+ while (ao_btm_enable) {
+ c = ao_serial_pollchar();
+ if (c != AO_READ_AGAIN)
+ ao_usb_putchar(c);
+ else {
+ ao_usb_flush();
+ ao_sleep(&ao_usart1_rx_fifo);
+ }
+ }
+ ao_exit();
+}
+
+__xdata struct ao_task ao_btm_task;
+
+static void
+ao_btm_forward(void)
+{
+ char c;
+ ao_btm_enable = 1;
+ flush();
+ ao_add_task(&ao_btm_task, ao_btm, "btm");
+
+ while ((c = ao_usb_getchar()) != '~') {
+ if (c == '\n') c = '\r';
+ ao_serial_putchar(c);
+ }
+ ao_btm_enable = 0;
+ while (ao_btm_task.wchan) {
+ ao_wakeup(&ao_usart1_rx_fifo);
+ ao_delay(AO_MS_TO_TICKS(10));
+ }
+}
+
+__code struct ao_cmds ao_btm_cmds[] = {
+ { ao_btm_forward, "B <data>\0BTM serial link." },
+ { 0, NULL },
+};
+
+
+void
+ao_btm_init (void)
+{
+ ao_serial_init();
+ ao_serial_set_speed(AO_SERIAL_SPEED_19200);
+ ao_cmd_register(&ao_btm_cmds[0]);
+}
#define HAS_GPS 1
#define HAS_SERIAL_1 1
#define HAS_ADC 1
+ #define USE_SERIAL_STDIN 0
#define HAS_EEPROM 1
#define USE_INTERNAL_FLASH 0
#define HAS_DBG 1
#define HAS_BEEP 1
#define HAS_GPS 1
#define HAS_SERIAL_1 1
+ #define USE_SERIAL_STDIN 0
#define HAS_ADC 1
#define HAS_EEPROM 1
#define USE_INTERNAL_FLASH 0
#define HAS_USB 1
#define HAS_BEEP 0
#define HAS_SERIAL_1 0
+ #define USE_SERIAL_STDIN 0
#define HAS_ADC 0
#define HAS_DBG 1
#define HAS_EEPROM 0
#define HAS_BEEP 0
#define HAS_GPS 0
#define HAS_SERIAL_1 0
+ #define USE_SERIAL_STDIN 0
#define HAS_ADC 1
#define HAS_EEPROM 1
#define USE_INTERNAL_FLASH 1
#define HAS_BEEP 0
#define HAS_GPS 0
#define HAS_SERIAL_1 0
+ #define USE_SERIAL_STDIN 0
#define HAS_ADC 1
#define HAS_EEPROM 1
#define USE_INTERNAL_FLASH 1
#define HAS_BEEP 1
#define HAS_GPS 1
#define HAS_SERIAL_1 1
+ #define USE_SERIAL_STDIN 0
#define HAS_ADC 1
#define HAS_DBG 0
#define HAS_EEPROM 1
#define HAS_USB 1
#define HAS_BEEP 0
#define HAS_SERIAL_1 0
+ #define USE_SERIAL_STDIN 0
#define HAS_ADC 0
#define HAS_DBG 0
#define HAS_EEPROM 0
#define HAS_USB 1
#define HAS_BEEP 0
#define HAS_SERIAL_1 0
+ #define USE_SERIAL_STDIN 0
#define HAS_ADC 0
#define HAS_DBG 1
#define HAS_EEPROM 0
#define HAS_IGNITE 0
#endif
+#if defined(TELEBT_V_0_0)
+ #define HAS_FLIGHT 0
+ #define HAS_USB 1
+ #define HAS_BEEP 0
+ #define HAS_SERIAL_1 1
+ #define USE_SERIAL_STDIN 1
+ #define HAS_ADC 0
+ #define HAS_DBG 1
+ #define HAS_EEPROM 0
+ #define DBG_ON_P1 0
+ #define DBG_ON_P0 1
+ #define IGNITE_ON_P2 0
+ #define IGNITE_ON_P0 0
+ #define PACKET_HAS_MASTER 1
+ #define PACKET_HAS_SLAVE 0
+ #define AO_LED_RED 2
+ #define AO_LED_GREEN 1
+ #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN)
+ #define SPI_CS_ON_P1 1
+ #define SPI_CS_ON_P0 0
+ #define HAS_IGNITE 0
+#endif
+
#if DBG_ON_P1
#define DBG_CLOCK (1 << 4) /* mi0 */
#error Please define HAS_SERIAL_1
#endif
+#ifndef USE_SERIAL_STDIN
+#error Please define USE_SERIAL_STDIN
+#endif
+
#ifndef HAS_ADC
#error Please define HAS_ADC
#endif
volatile __xdata struct ao_fifo ao_usart1_rx_fifo;
volatile __xdata struct ao_fifo ao_usart1_tx_fifo;
+#if USE_SERIAL_STDIN
+__pdata uint8_t ao_serial_stdin;
+#endif
+
void
ao_serial_rx1_isr(void) __interrupt 3
{
if (!ao_fifo_full(ao_usart1_rx_fifo))
ao_fifo_insert(ao_usart1_rx_fifo, U1DBUF);
ao_wakeup(&ao_usart1_rx_fifo);
+#if USE_SERIAL_STDIN
+ if (ao_serial_stdin)
+ ao_wakeup(&ao_stdin_ready);
+#endif
}
static __xdata uint8_t ao_serial_tx1_started;
return c;
}
+#if USE_SERIAL_STDIN
+char
+ao_serial_pollchar(void) __critical
+{
+ char c;
+#if 0
+ if (!ao_serial_stdin)
+ return AO_READ_AGAIN;
+#endif
+ if (ao_fifo_empty(ao_usart1_rx_fifo))
+ return AO_READ_AGAIN;
+ ao_fifo_remove(ao_usart1_rx_fifo,c);
+ return c;
+}
+
+void
+ao_serial_set_stdin(uint8_t stdin)
+{
+ ao_serial_stdin = stdin;
+}
+
+#endif
+
void
ao_serial_putchar(char c) __critical
{
/* .baud = */ 163,
/* .gcr = */ (8 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB
},
+ /* [AO_SERIAL_SPEED_19200] = */ {
+ /* .baud = */ 163,
+ /* .gcr = */ (9 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB
+ },
/* [AO_SERIAL_SPEED_57600] = */ {
/* .baud = */ 59,
/* .gcr = */ (11 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB
IEN2 |= IEN2_UTX1IE;
ao_cmd_register(&ao_serial_cmds[0]);
+#if 0
+#if USE_SERIAL_STDIN
+ ao_add_stdio(ao_serial_pollchar,
+ ao_serial_putchar,
+ NULL);
+#endif
+#endif
}
* Basic I/O functions to support SDCC stdio package
*/
-#define AO_NUM_STDIOS 2
+#define AO_NUM_STDIOS (HAS_USB + PACKET_HAS_SLAVE + USE_SERIAL_STDIN)
static __xdata struct ao_stdio stdios[AO_NUM_STDIOS];
static __data int8_t ao_cur_stdio;
--- /dev/null
+/*
+ * 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"
+
+void
+main(void)
+{
+ ao_clock_init();
+
+ /* Turn on the LED until the system is stable */
+ ao_led_init(LEDS_AVAILABLE);
+ ao_led_on(AO_LED_RED);
+ ao_timer_init();
+ ao_cmd_init();
+ ao_usb_init();
+ ao_monitor_init(AO_LED_GREEN, TRUE);
+ ao_rssi_init(AO_LED_RED);
+ ao_radio_init();
+ ao_packet_master_init();
+ ao_btm_init();
+#if HAS_DBG
+ ao_dbg_init();
+#endif
+ ao_config_init();
+ ao_start_scheduler();
+}
--- /dev/null
+telebt-*
+ao_product.h
--- /dev/null
+--directory=..
--- /dev/null
+PROG = telebt-v0.0-$(VERSION).ihx
+
+SRC = \
+ $(TBT_BASE_SRC)
+
+PRODUCT=TeleBT-v0.0
+PRODUCT_DEF=-DTELEBT_V_0_0
+IDPRODUCT=0x000e