Skip to content

Instantly share code, notes, and snippets.

@electronut
Created August 19, 2017 03:16
Show Gist options
  • Save electronut/b161cdec307fc711ca17c4229aa85767 to your computer and use it in GitHub Desktop.
Save electronut/b161cdec307fc711ca17c4229aa85767 to your computer and use it in GitHub Desktop.
NUS I2s
volatile uint8_t g_demo_mode = 0;
volatile bool g_i2s_start = true;
volatile bool g_i2s_running = false;
static void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length)
{
switch(p_data[0]) {
case '1':
{
g_demo_mode = 0;
}
break;
case '2':
{
g_demo_mode = 1;
}
break;
case '3':
{
g_demo_mode = 2;
}
break;
case 'S':
{
g_i2s_start = false;
}
break;
case 'P':
{
g_i2s_start = true;
}
break;
}
// send to UART
for (uint32_t i = 0; i < length; i++)
{
while (app_uart_put(p_data[i]) != NRF_SUCCESS);
}
while (app_uart_put('\r') != NRF_SUCCESS);
while (app_uart_put('\n') != NRF_SUCCESS);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment