Skip to content

Commit

Permalink
codec read command (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
divkam authored and plasticchris committed Jan 26, 2017
1 parent 5dbfbe1 commit 1aa0fe8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kitsune/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,6 +1984,7 @@ int cmd_ch(int argc, char *argv[]) {
int cmd_codec(int argc, char *argv[]);
int cmd_confidence(int argc, char *argv[]);
int cmd_pwr_speaker(int argc, char * argv[]);
int cmd_codec_read(int argc, char *argv[]);


int cmd_button(int argc, char *argv[]) {
Expand Down Expand Up @@ -2156,6 +2157,7 @@ tCmdLineEntry g_sCmdTable[] = {
{"pn",cmd_audio_self_test,""},
{"tap", cmd_tap, ""},
{"flipped", cmd_flipped, ""},
{"codecr", cmd_codec_read, ""},
{"dbgfeats",cmd_set_debug_streaming,""},
{ 0, 0, 0 } };

Expand Down
23 changes: 23 additions & 0 deletions kitsune/i2c_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,29 @@ int cmd_codec(int argc, char *argv[]) {
return 0;
}

int cmd_codec_read(int argc, char *argv[]) {
unsigned char cmd[2]={0xFF,0xFF};
if(argc < 4){
LOGF("Usage: codecr <book> <page> <reg>\n");
return -1;
}
if( xSemaphoreTakeRecursive(i2c_smphr, 1000)){

codec_set_book(atoi(argv[1]));

codec_set_page(atoi(argv[2]));

cmd[0] = atoi(argv[3]);
I2C_IF_Write(Codec_addr, &cmd[0],1,1);
I2C_IF_Read(Codec_addr, &cmd[1], 1);
xSemaphoreGiveRecursive(i2c_smphr);
}

LOGI("Codecr [%u][%u][%u] = 0x%x\n",atoi(argv[2]),atoi(argv[1]),cmd[0],cmd[1]);

return 0;
}

static void codec_sw_reset(void)
{
char send_stop = 1;
Expand Down

0 comments on commit 1aa0fe8

Please sign in to comment.