From: Keith Packard Date: Wed, 17 Oct 2012 05:21:04 +0000 (-0700) Subject: altos: Add telescience-pwm product X-Git-Tag: 1.1.9.1~2 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=f34f0ac7f355149446374a4c82dbf004919bc2dd;ds=sidebyside altos: Add telescience-pwm product Split out special PWM-sampling telescience product Signed-off-by: Keith Packard --- diff --git a/src/avr/ao_adc_avr.c b/src/avr/ao_adc_avr.c index 739a6d4a..231512b2 100644 --- a/src/avr/ao_adc_avr.c +++ b/src/avr/ao_adc_avr.c @@ -94,7 +94,7 @@ ISR(ADC_vect) value = ADCL; value |= (ADCH << 8); ao_data_ring[ao_data_head].adc.adc[ao_adc_channel] = value; - if (++ao_adc_channel < NUM_ADC - 1) + if (++ao_adc_channel < NUM_ADC - HAS_ICP3_COUNT) ao_adc_start(); else { #if HAS_ICP3_COUNT diff --git a/src/avr/ao_pwmin.h b/src/avr/ao_pwmin.h index bbab4ddc..8097d399 100644 --- a/src/avr/ao_pwmin.h +++ b/src/avr/ao_pwmin.h @@ -16,3 +16,5 @@ */ void ao_pwmin_init(void); + +extern volatile __data uint16_t ao_icp3_count; diff --git a/src/product/ao_telescience.c b/src/product/ao_telescience.c index 2d594d7f..d448d318 100644 --- a/src/product/ao_telescience.c +++ b/src/product/ao_telescience.c @@ -16,7 +16,9 @@ */ #include "ao.h" +#if HAS_ICP3_COUNT #include "ao_pwmin.h" +#endif int main(void) @@ -35,7 +37,9 @@ main(void) ao_usb_init(); ao_adc_init(); ao_log_single_init(); +#if HAS_ICP3_COUNT ao_pwmin_init(); +#endif ao_start_scheduler(); return 0; } diff --git a/src/telescience-pwm/.gitignore b/src/telescience-pwm/.gitignore new file mode 100644 index 00000000..dfccadf8 --- /dev/null +++ b/src/telescience-pwm/.gitignore @@ -0,0 +1,2 @@ +telescience-v0.1* +ao_product.h diff --git a/src/telescience-pwm/Makefile b/src/telescience-pwm/Makefile new file mode 100644 index 00000000..43d77e2e --- /dev/null +++ b/src/telescience-pwm/Makefile @@ -0,0 +1,116 @@ +# +# AltOS build +# +# +vpath % ..:../core:../product:../drivers:../avr +vpath ao-make-product.5c ../util + +MCU=atmega32u4 +DUDECPUTYPE=m32u4 +#PROGRAMMER=stk500v2 -P usb +PROGRAMMER=usbtiny +LOADCMD=avrdude +LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: +CC=avr-gcc +OBJCOPY=avr-objcopy + +ifndef VERSION +include ../Version +endif + +INC = \ + ao.h \ + ao_arch.h \ + ao_usb.h \ + ao_pins.h \ + ao_product.h + +# +# Common AltOS sources +# +TELESCIENCE_STORAGE= \ + ao_m25.c \ + ao_spi_usart.c \ + ao_storage.c + +TELESCIENCE_LOG= \ + ao_log_single.c \ + ao_log_telescience.c + +ALTOS_SRC = \ + ao_clock.c \ + ao_cmd.c \ + ao_mutex.c \ + ao_panic.c \ + ao_product.c \ + ao_stdio.c \ + ao_task.c \ + ao_timer.c \ + ao_led.c \ + ao_avr_stdio.c \ + ao_romconfig.c \ + ao_usb_avr.c \ + ao_adc_avr.c \ + ao_science_slave.c \ + ao_spi_slave.c \ + ao_pwmin.c \ + $(TELESCIENCE_STORAGE)\ + $(TELESCIENCE_LOG) + +PRODUCT=TeleScience-PWM +MCU=atmega32u4 +PRODUCT_DEF=-DTELESCIENCE -DTELESCIENCE_PWM +IDPRODUCT=0x0011 +CFLAGS = $(PRODUCT_DEF) -I. -I../avr -I../core -I.. +CFLAGS += -g -mmcu=$(MCU) -Wall -Wstrict-prototypes -O3 -mcall-prologues -DAVR + +NICKLE=nickle + +PROG=telescience-pwm + +SRC=$(ALTOS_SRC) ao_telescience.c +OBJ=$(SRC:.c=.o) + +V=0 +# The user has explicitly enabled quiet compilation. +ifeq ($(V),0) +quiet = @printf " $1 $2 $@\n"; $($1) +endif +# Otherwise, print the full command line. +quiet ?= $($1) + +all: $(PROG) + +CHECK=sh ../util/check-avr-mem + +$(PROG): Makefile $(OBJ) + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) + $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1) + +$(PROG).hex: $(PROG) + avr-size $(PROG) + $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@ + + +load: $(PROG).hex + $(LOADCMD) $(LOADARG)$(PROG).hex + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +ao_product.o: ao_product.c ao_product.h + +%.o : %.c $(INC) + $(call quiet,CC) -c $(CFLAGS) $< + +distclean: clean + +clean: + rm -f *.o $(PROG) $(PROG).hex + rm -f ao_product.h + +install: + +uninstall: + +$(OBJ): ao_product.h $(INC) diff --git a/src/telescience-v0.1/Makefile b/src/telescience-v0.1/Makefile index 5542913d..d24128ef 100644 --- a/src/telescience-v0.1/Makefile +++ b/src/telescience-v0.1/Makefile @@ -53,7 +53,6 @@ ALTOS_SRC = \ ao_adc_avr.c \ ao_science_slave.c \ ao_spi_slave.c \ - ao_pwmin.c \ $(TELESCIENCE_STORAGE)\ $(TELESCIENCE_LOG)