diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-12-28 12:56:25 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-12-28 12:56:25 +0100 |
commit | e8486623b0111eb722a3823c8f079d86ff436278 (patch) | |
tree | d75da2f9ae5e8143ffcc33a73647cf4421ea6dd2 /firmware | |
parent | 3afffdf991d2248cf3aa525a6b1d1d3cd1dbb8f2 (diff) |
Add debug info.
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/src/p2m.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/firmware/src/p2m.c b/firmware/src/p2m.c index 95acc21..c43488e 100644 --- a/firmware/src/p2m.c +++ b/firmware/src/p2m.c @@ -140,6 +140,7 @@ int main (void) #include <GPIO.h>
#include <wm8523.h>
#include <led.h>
+#include <cli.h>
int main (void)
{
@@ -147,18 +148,26 @@ int main (void) // SystemInit();
led_init();
+ cli_init();
uint8_t portnum = 0;
+ cli_printf("Init:\n");
wm8523_init(portnum, WM8523_FS_44K1);
- if(wm8523_get_chip_id(portnum) != WM8532_CHIP_ID) goto fail;
+ if(wm8523_get_chip_id(portnum) != WM8532_CHIP_ID) {
+ cli_printf("Bad chip ID\n");
+ goto fail;
+ }
+ cli_printf("Reset registers:\n");
wm8523_reset_registers(portnum);
+ cli_printf("Power up:\n");
wm8523_power_mode_t pwr = WM8523_PWR_POWER_UP_TO_UNMUTE;
wm8523_set_power_mode(portnum, pwr);
+ cli_printf("Set aif control:\n");
wm8523_aif_ctrl1_t ctl1;
ctl1.fmt = WM8523_FMT_I2S;
ctl1.wlen = WM8523_WLEN_32;
@@ -168,12 +177,14 @@ int main (void) ctl1.deemp = WM8523_DEEMPH_ENABLED;
wm8523_set_aif_ctrl1(portnum, ctl1);
+ cli_printf("Set aif control2:\n");
wm8523_aif_ctrl2_t ctl2;
ctl2.clkratio = WM8523_CLKRATIO_AUTO;
ctl2.clkdiv = WM8523_CLKDIV_MCLK_4;
ctl2.mix = WM8523_MIX_STEREO;
wm8523_set_aif_ctrl2(portnum, ctl2);
+ cli_printf("Set dac control3\n");
wm8523_dac_ctrl3_t ctl3;
ctl3.downramp = WM8523_VOL_DOWN_INSTANT;
ctl3.upramp = WM8523_VOL_UP_INSTANT;
@@ -222,8 +233,11 @@ int main (void) //_delay(1 << 5);
+ cli_printf("Play tone...\n");
wm8523_tone();
+ cli_printf("Blink!\n");
+
// Indicate that we didn't crash before the end...
while(1) { // slow blink
led_toggle();
@@ -231,6 +245,7 @@ int main (void) }
fail:
+ cli_printf("Error loop of death...\n");
while(1) { // fast blink
led_toggle();
_delay(1 << 17);
|