Exemplo n.º 1
0
uint8_t VS_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io)
{
  const uint8_t *p;
  uint32_t val32u;

  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "VS1053 help")==0) {
    *handled = TRUE;
    return PrintHelp(io);
  } else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "VS1053 status")==0)) {
    *handled = TRUE;
    return PrintStatus(io);
  } else if (UTIL1_strncmp((char*)cmd, "VS1053 volume ", sizeof("VS1053 volume ")-1)==0) {
    *handled = TRUE;
    p = cmd+sizeof("VS1053 volume ")-1;
    if (UTIL1_xatoi(&p, &val32u)==ERR_OK) {
      return VS_SetVolume((uint16_t)val32u);
    } else {
      CLS1_SendStr("Failed reading volume", io->stdErr);
      return ERR_FAILED;
    }
  } else if (UTIL1_strncmp((char*)cmd, "VS1053 play ", sizeof("VS1053 play ")-1)==0) {
    *handled = TRUE;
    p = cmd+sizeof("VS1053 play ")-1;
    return VS_PlaySong(p, io);
  }
  return ERR_OK;
}
Exemplo n.º 2
0
static portTASK_FUNCTION( playerTask, pvParameters) {

	(void) pvParameters; /* not used */

	//VS_SetVolume(0x2014);
	VS_SetVolume(0x0000);
	for (;;) {
		turnlight();
        feedDataStream();
		FRTOS1_vTaskDelay(TASKDEL_MS / portTICK_RATE_MS);
	}
}
Exemplo n.º 3
0
uint8_t PLR_ParseCommand(const unsigned char *cmd, bool *handled,
		const CLS1_StdIOType *io) {
	const uint8_t *p;
	uint32_t val32u;

	if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP) == 0
			|| UTIL1_strcmp((char*)cmd, "player help") == 0) {
		*handled = TRUE;
		return PrintHelp(io);
	} else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS) == 0)
			|| (UTIL1_strcmp((char*)cmd, "player status") == 0)) {
		*handled = TRUE;
		return PrintStatus(io);
	} else if (UTIL1_strncmp((char* )cmd, "player volume ",
			sizeof("player volume ") - 1) == 0) {
		*handled = TRUE;
		p = cmd + sizeof("player volume ") - 1;
		if (UTIL1_xatoi(&p, &val32u) == ERR_OK) {
			return VS_SetVolume((uint16_t) val32u);
		} else {
			CLS1_SendStr("Failed reading volume", io->stdErr);
			return ERR_FAILED;
		}
	} else if (UTIL1_strncmp((char* )cmd, "player play ",
			sizeof("player play ") - 1) == 0) {
		*handled = TRUE;
		p = cmd + sizeof("player play ") - 1;
		return PLR_StartNewFile(p,FALSE);
	}else if (UTIL1_strncmp((char* )cmd, "player pause on",
			sizeof("player pause on") - 1) == 0) {
		*handled = TRUE;
		PLR_PausePlayback(TRUE);
	}else if (UTIL1_strncmp((char* )cmd, "player pause off",
			sizeof("player pause off") - 1) == 0) {
		*handled = TRUE;
		PLR_PausePlayback(FALSE);
	}else if (UTIL1_strncmp((char* )cmd, "player stop",
			sizeof("player stop") - 1) == 0) {
		*handled = TRUE;
		PLR_StopPlayback();
	}else if (UTIL1_strncmp((char*)cmd, "player setval", sizeof("player setval")-1)==0) {
	    p = cmd+sizeof("player setval")-1;
	    uint8_t res = UTIL1_xatoi(&p, &val32u);
	    if (res==ERR_OK) {
	      config_turnval = val32u;
	      *handled = TRUE;
	    }
	}

	return ERR_OK;
}