From 621d0930244f25165d2ac5da596dcc87e253b965 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 27 Aug 2012 13:52:11 -0700 Subject: [PATCH 1/1] altos: Add spiradio product Implements the SPI radio protocol Signed-off-by: Keith Packard --- src/spiradio-v0.1/.sdcdbrc | 2 ++ src/spiradio-v0.1/ao_pins.h | 61 +++++++++++++++++++++++++++++++++ src/spiradio-v0.1/ao_spiradio.c | 37 ++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 src/spiradio-v0.1/.sdcdbrc create mode 100644 src/spiradio-v0.1/ao_pins.h create mode 100644 src/spiradio-v0.1/ao_spiradio.c diff --git a/src/spiradio-v0.1/.sdcdbrc b/src/spiradio-v0.1/.sdcdbrc new file mode 100644 index 00000000..b9f6129c --- /dev/null +++ b/src/spiradio-v0.1/.sdcdbrc @@ -0,0 +1,2 @@ +--directory=../cc1111:../product:../core:../drivers:. + diff --git a/src/spiradio-v0.1/ao_pins.h b/src/spiradio-v0.1/ao_pins.h new file mode 100644 index 00000000..363eafa4 --- /dev/null +++ b/src/spiradio-v0.1/ao_pins.h @@ -0,0 +1,61 @@ +/* + * 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. + */ + +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ + +#define HAS_RADIO 1 + +#define HAS_FLIGHT 0 +#define HAS_USB 0 +#define HAS_BEEP 0 +#define HAS_GPS 0 +#define HAS_SERIAL_0 1 +#define HAS_SERIAL_0_ALT_1 1 +#define HAS_SERIAL_0_HW_FLOW 0 +#define USE_SERIAL_0_STDIN 1 +#define DELAY_SERIAL_0_STDIN 0 +#define HAS_SERIAL_1 0 +#define HAS_ADC 0 +#define HAS_DBG 0 +#define HAS_EEPROM 0 +#define HAS_LOG 0 +#define USE_INTERNAL_FLASH 0 +#define DBG_ON_P1 0 +#define PACKET_HAS_MASTER 0 +#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 HAS_EXTERNAL_TEMP 0 +#define HAS_ACCEL_REF 0 +#define SPI_CS_ON_P1 1 +#define HAS_AES 1 + +#define SPI_CS_PORT P1 +#define SPI_CS_SEL P1SEL +#define SPI_CS_DIR P1DIR +#define AO_SPI_SLAVE 1 +#define HAS_SPI_0 1 +#define SPI_0_ALT_2 1 +#define HAS_SPI_1 0 + +#define AO_RADIO_SLAVE_INT_PORT P1 +#define AO_RADIO_SLAVE_INT_BIT 6 +#define AO_RADIO_SLAVE_INT_PIN P1_6 + +#endif /* _AO_PINS_H_ */ diff --git a/src/spiradio-v0.1/ao_spiradio.c b/src/spiradio-v0.1/ao_spiradio.c new file mode 100644 index 00000000..d3647cc7 --- /dev/null +++ b/src/spiradio-v0.1/ao_spiradio.c @@ -0,0 +1,37 @@ +/* + * Copyright © 2012 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 +#include + +void +main(void) +{ + ao_clock_init(); + + ao_led_init(LEDS_AVAILABLE); + + ao_serial_init(); + ao_timer_init(); + ao_cmd_init(); + ao_spi_init(); + ao_radio_init(); + ao_aes_init(); + ao_config_init(); + ao_radio_slave_init(); + ao_start_scheduler(); +} -- 2.30.2