Permalink
Browse files

[ add ] audio/adc8327 unit test. wip.

  • Loading branch information...
1 parent 9425ee5 commit 801cbe4962b692f749145ec6afd3a254fad0402e @texane committed Nov 22, 2012
Showing with 170 additions and 0 deletions.
  1. +146 −0 src/atmega328p/audio/adc8327/Makefile
  2. +22 −0 src/atmega328p/audio/adc8327/main.c
  3. +2 −0 src/atmega328p/audio/adc8327/upload.sh
@@ -0,0 +1,146 @@
+PRG = main
+OBJ = main.o
+#MCU_TARGET = at90s2313
+#MCU_TARGET = at90s2333
+#MCU_TARGET = at90s4414
+#MCU_TARGET = at90s4433
+#MCU_TARGET = at90s4434
+#MCU_TARGET = at90s8515
+#MCU_TARGET = at90s8535
+#MCU_TARGET = atmega128
+#MCU_TARGET = atmega1280
+#MCU_TARGET = atmega1281
+#MCU_TARGET = atmega1284p
+#MCU_TARGET = atmega16
+#MCU_TARGET = atmega163
+#MCU_TARGET = atmega164p
+#MCU_TARGET = atmega165
+#MCU_TARGET = atmega165p
+#MCU_TARGET = atmega168
+#MCU_TARGET = atmega169
+#MCU_TARGET = atmega169p
+#MCU_TARGET = atmega2560
+#MCU_TARGET = atmega2561
+#MCU_TARGET = atmega32
+#MCU_TARGET = atmega324p
+#MCU_TARGET = atmega325
+#MCU_TARGET = atmega3250
+#MCU_TARGET = atmega329
+#MCU_TARGET = atmega3290
+#MCU_TARGET = atmega48
+#MCU_TARGET = atmega64
+#MCU_TARGET = atmega640
+#MCU_TARGET = atmega644
+#MCU_TARGET = atmega644p
+#MCU_TARGET = atmega645
+#MCU_TARGET = atmega6450
+#MCU_TARGET = atmega649
+#MCU_TARGET = atmega6490
+#MCU_TARGET = atmega8
+#MCU_TARGET = atmega8515
+#MCU_TARGET = atmega8535
+#MCU_TARGET = atmega88
+#MCU_TARGET = attiny2313
+#MCU_TARGET = attiny24
+#MCU_TARGET = attiny25
+#MCU_TARGET = attiny26
+#MCU_TARGET = attiny261
+#MCU_TARGET = attiny44
+#MCU_TARGET = attiny45
+#MCU_TARGET = attiny461
+#MCU_TARGET = attiny84
+#MCU_TARGET = attiny85
+#MCU_TARGET = attiny861
+MCU_TARGET = atmega328p
+OPTIMIZE = -O2
+
+DEFS = -DF_CPU=16000000L
+LIBS =
+
+# You should not have to change anything below here.
+
+CC = avr-gcc
+
+# Override is only needed by avr-lib build system.
+
+override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) -Wno-unused-function
+override LDFLAGS = -Wl,-Map,$(PRG).map
+
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+
+all: $(PRG).elf lst text eeprom
+
+$(PRG).elf: $(OBJ)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+# dependency:
+demo.o: main.c
+
+clean:
+ rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
+ rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
+
+lst: $(PRG).lst
+
+%.lst: %.elf
+ $(OBJDUMP) -h -S $< > $@
+
+# Rules for building the .text rom images
+
+text: hex bin srec
+
+hex: $(PRG).hex
+bin: $(PRG).bin
+srec: $(PRG).srec
+
+%.hex: %.elf
+ $(OBJCOPY) -j .text -j .data -O ihex $< $@
+
+%.srec: %.elf
+ $(OBJCOPY) -j .text -j .data -O srec $< $@
+
+%.bin: %.elf
+ $(OBJCOPY) -j .text -j .data -O binary $< $@
+
+# Rules for building the .eeprom rom images
+
+eeprom: ehex ebin esrec
+
+ehex: $(PRG)_eeprom.hex
+ebin: $(PRG)_eeprom.bin
+esrec: $(PRG)_eeprom.srec
+
+%_eeprom.hex: %.elf
+ $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ \
+ || { echo empty $@ not generated; exit 0; }
+
+%_eeprom.srec: %.elf
+ $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@ \
+ || { echo empty $@ not generated; exit 0; }
+
+%_eeprom.bin: %.elf
+ $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ \
+ || { echo empty $@ not generated; exit 0; }
+
+# Every thing below here is used by avr-libc's build system and can be ignored
+# by the casual user.
+
+FIG2DEV = fig2dev
+EXTRA_CLEAN_FILES = *.hex *.bin *.srec
+
+dox: eps png pdf
+
+eps: $(PRG).eps
+png: $(PRG).png
+pdf: $(PRG).pdf
+
+%.eps: %.fig
+ $(FIG2DEV) -L eps $< $@
+
+%.pdf: %.fig
+ $(FIG2DEV) -L pdf $< $@
+
+%.png: %.fig
+ $(FIG2DEV) -L png $< $@
+
@@ -0,0 +1,22 @@
+#include <stdint.h>
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include "../tx/adc8327.c"
+#include "../../common/uart.c"
+
+
+int main(void)
+{
+ volatile uint16_t x;
+
+ uart_setup();
+
+ while (1)
+ {
+ for (x = 0; x < 10000; ++x) ;
+ uart_write(uint16_to_string(adc8327_read()), 4);
+ uart_write((uint8_t*)"\r\n", 2);
+ }
+
+ return 0;
+}
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+/home/texane/repo/arduino/arduino-0022/hardware/tools/avrdude -C/home/texane/repo/arduino/arduino-0022/hardware/tools/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P/dev/ttyACM0 -b115200 -D -Uflash:w:main.hex:i

0 comments on commit 801cbe4

Please sign in to comment.