diff options
author | Keith Packard <keithp@keithp.com> | 2011-09-21 11:30:43 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-09-21 11:45:05 -0700 |
commit | 7a02d4bace05cc829522933b9df6b82a9e17336f (patch) | |
tree | 1d702f5e92a9f0c1288551486233d944e0f2d5c4 /src/avr | |
parent | 0820f5c6dfe067590f36e8201a4049719dcf3d7c (diff) |
altos: Add TelePyro v0.1 support
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/avr')
-rw-r--r-- | src/avr/ao_adc_avr.c | 21 | ||||
-rw-r--r-- | src/avr/ao_pins.h | 24 |
2 files changed, 43 insertions, 2 deletions
diff --git a/src/avr/ao_adc_avr.c b/src/avr/ao_adc_avr.c index 5afced74..9f45acaf 100644 --- a/src/avr/ao_adc_avr.c +++ b/src/avr/ao_adc_avr.c @@ -20,6 +20,7 @@ volatile __xdata struct ao_adc ao_adc_ring[AO_ADC_RING]; volatile __data uint8_t ao_adc_head; +#ifdef TELESCIENCE const uint8_t adc_channels[AO_LOG_TELESCIENCE_NUM_ADC] = { 0x00, 0x01, @@ -34,6 +35,22 @@ const uint8_t adc_channels[AO_LOG_TELESCIENCE_NUM_ADC] = { 0x24, 0x25, }; +#endif + +#ifdef TELEPYRO +const uint8_t adc_channels[AO_TELEPYRO_NUM_ADC] = { + 0x00, /* ADC0 v_batt */ + 0x04, /* ADC4 sense_a */ + 0x05, /* ADC5 sense_b */ + 0x06, /* ADC6 sense_c */ + 0x07, /* ADC7 sense_d */ + 0x23, /* ADC11 sense_e */ + 0x22, /* ADC10 sense_f */ + 0x21, /* ADC9 sense_g */ +}; +#endif + +#define NUM_ADC (sizeof (adc_channels) / sizeof (adc_channels[0])) static uint8_t ao_adc_channel; @@ -75,7 +92,7 @@ ISR(ADC_vect) value = ADCL; value |= (ADCH << 8); ao_adc_ring[ao_adc_head].adc[ao_adc_channel] = value; - if (++ao_adc_channel < AO_TELESCIENCE_NUM_ADC) + if (++ao_adc_channel < NUM_ADC) ao_adc_start(); else { ADCSRA = ADCSRA_INIT; @@ -108,7 +125,7 @@ ao_adc_dump(void) __reentrant uint8_t i; ao_adc_get(&packet); printf("tick: %5u", packet.tick); - for (i = 0; i < AO_TELESCIENCE_NUM_ADC; i++) + for (i = 0; i < NUM_ADC; i++) printf (" %2d: %5u", i, packet.adc[i]); printf ("\n"); } diff --git a/src/avr/ao_pins.h b/src/avr/ao_pins.h index 88f03829..6b72530b 100644 --- a/src/avr/ao_pins.h +++ b/src/avr/ao_pins.h @@ -61,4 +61,28 @@ #define SPI_SLAVE_PIN_2_5 0 #endif +#ifdef TELEPYRO + #define LEDS_AVAILABLE 0 + #define HAS_USB 1 + #define HAS_LOG 0 + #define TEENSY 0 + #define USE_SERIAL_STDIN 1 + #define HAS_SERIAL_1 1 + #define HAS_USB 1 + #define HAS_ADC 1 + #define PACKET_HAS_SLAVE 0 + #define HAS_BEEP 0 + + #define AVR_VCC_5V 0 + #define AVR_VCC_3V3 1 + #define AVR_CLOCK 8000000UL + + #define SPI_SLAVE_CS_PORT PORTB + #define SPI_SLAVE_CS_PIN PINB + #define SPI_SLAVE_CS_PIN_NO PINB0 + + #define SPI_SLAVE_PIN_0_3 1 + #define SPI_SLAVE_PIN_2_5 0 +#endif + #endif /* _AO_PINS_H_ */ |