adc UT partially coded
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 9 Jun 2013 23:17:03 +0000 (23:17 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 9 Jun 2013 23:17:03 +0000 (23:17 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1313 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/stm32/Makefile
codec2-dev/stm32/src/stm32f4_adc.c

index b5bc98016be32dc1e52f159a0d3db83e716d047c..9fa388617e453ff842cf714a9cf1fbc7a8c751b8 100644 (file)
@@ -110,7 +110,7 @@ OBJS = $(SRCS:.c=.o)
 
 ###################################################
 
-all: libstm32f4.a $(PROJ_NAME).elf fft_test.elf dac_ut.elf dac_play.elf
+all: libstm32f4.a $(PROJ_NAME).elf fft_test.elf dac_ut.elf dac_play.elf adc_ut.elf
 
 dl/$(PERIPHLIBZIP):
        mkdir -p dl
@@ -155,6 +155,16 @@ src/init.c
 dac_play.elf: $(DAC_PLAY_SRCS)
        $(CC) $(CFLAGS) -O0 $^ -o $@ $(LIBPATHS) $(LIBS)
 
+ADC_UT_SRCS=\
+gdb_stdio.c \
+src/stm32f4_adc.c \
+src/system_stm32f4xx.c \
+src/startup_stm32f4xx.s \
+src/init.c
+
+adc_ut.elf: $(ADC_UT_SRCS)
+       $(CC) $(CFLAGS) -O0 $^ -o $@ $(LIBPATHS) $(LIBS)
+
 clean:
        rm -f *.o
        rm -f *.elf
index e0fb5e990392c7aa1d316a538991ebbc4e901026..bebd157fbb9d1bde6abb7d481cbc732654170bbf 100644 (file)
 TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
 TIM_OCInitTypeDef  TIM_OCInitStructure;
 
+unsigned short uhADCxConvertedValue;
+
 static void ADC_Config(void);
 void Timer1Config();
 static void TIM_Config(void);
 
 int main(void) {
+    /* check ADC value changes with GND and VCC sampled */
+    /* look for 17kHz (ish) on timer pins */
+
     ADC_Config();
 
+    Timer1Config();
+
+    /* todo: that start up cmd here */
+
+    while(1) {
+        printf("ADC; %d\n", uhADCxConvertedValue);
+    }
+
 }
 
 /**
@@ -133,7 +146,7 @@ static void ADC_Config(void)
   /* ADC3 regular channel7 configuration *************************************/
   ADC_RegularChannelConfig(ADCx, ADC_CHANNEL, 1, ADC_SampleTime_3Cycles);
 
- /* Enable DMA request after last transfer (Single-ADC mode) */
 /* Enable DMA request after last transfer (Single-ADC mode) */
   ADC_DMARequestAfterLastTransferCmd(ADCx, ENABLE);
 
   /* Enable ADC3 DMA */