From 075faa4e2521b0d90df564516dfc618506cca8e9 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 13 Sep 2014 22:11:12 +0200 Subject: I2S test and a number of bugfixes. --- firmware/test/i2s/Makefile | 8 +++++--- firmware/test/i2s/i2stest.c | 25 ++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'firmware/test/i2s') diff --git a/firmware/test/i2s/Makefile b/firmware/test/i2s/Makefile index c88f443..ed7860c 100644 --- a/firmware/test/i2s/Makefile +++ b/firmware/test/i2s/Makefile @@ -42,7 +42,9 @@ LINKER_SCRIPT = ${LPC}/LPC17xx.ld CSRCS = \ ${LPC}/system_LPC17xx.c \ ${LPC}/startup_LPC17xx.c \ - ${DRV}/i2s.c + ${DRV}/led.c \ + ${DRV}/i2s.c \ + ../test.c CSRCS += ${PROJ}.c ASRCS = @@ -91,8 +93,8 @@ nuke: clean # openocd -f openocd.cfg -c 'flash write_image erase $(PROJ).hex' -c 'verify_image $(PROJ).hex' -c 'reset run' flash: $(EXECNAME) $(CP) -O binary $(EXECNAME) $(PROJ).bin - ./fix-lpcchecksum $(PROJ).bin - openocd -f openocd.cfg \ + ../../fix-lpcchecksum $(PROJ).bin + openocd -f ../../openocd.cfg \ -c 'flash write_image erase $(PROJ).bin' \ -c 'verify_image $(PROJ).bin' \ -c 'reset run' diff --git a/firmware/test/i2s/i2stest.c b/firmware/test/i2s/i2stest.c index 16ea291..31f5c20 100644 --- a/firmware/test/i2s/i2stest.c +++ b/firmware/test/i2s/i2stest.c @@ -25,13 +25,36 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include +#include + +#include "../test.h" int main (void) { - i2s_init(); + led_init(); + + // From: tools/clkcalc 48000 16 2 + int pclkdiv = 1; + int bitrate = 24; + int x = 96; + int y = 125; + + int bitwidth = 16; + int channels = 2; + + int res = i2s_init(pclkdiv, bitrate, x, y, bitwidth, channels); + + if(res) error(); i2s_tx_start(); + // success(); + + int16_t s = 0; while(1) { + //while(i2s_get_state_tx_level() < 3) {} + i2s_write_pcm_16_stereo(s, s); + if((s % 2) == 0) led_toggle(); + s++; } } -- cgit v1.2.3