summaryrefslogtreecommitdiff
path: root/firmware/test/i2s
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/test/i2s')
-rw-r--r--firmware/test/i2s/Makefile8
-rw-r--r--firmware/test/i2s/i2stest.c25
2 files changed, 29 insertions, 4 deletions
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 <i2s.h>
+#include <led.h>
+
+#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++;
}
}