
/*
//ECG read
void ecg_read(uint8_t ecg_addr)
{
    spi_xfer_done = false;//transfer done flag --> reset
    m_tx_buf[0]=(ecg_addr<<1) | 0x01;
    m_tx_buf[1]=0x00;
    m_tx_buf[2]=0x00;
    m_tx_buf[3]=0x00;
    m_length_rx=4;
    m_length_tx=4;

    ecg_cs_low();
    APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, m_length_tx, m_rx_buf, m_length_rx));

    //wait for transfer to finish
    while (!spi_xfer_done)
    {
        __WFE();
    }
    ecg_cs_high();
    sprintf(bletext,"ECG '%02x %02x %02x %02x",m_rx_buf[0],m_rx_buf[1],m_rx_buf[2],m_rx_buf[3]);
    lcd2_write_string(bletext);//BLE_TEXT(bletext);
}


//ECG Write
void ecg_write(uint8_t ecg_addr, uint8_t data0, uint8_t data1, uint8_t data2)
{
    spi_xfer_done = false;//transfer done flag --> reset
    m_tx_buf[0]=ecg_addr<<1;
    m_tx_buf[1]=data0;
    m_tx_buf[2]=data1;
    m_tx_buf[3]=data2;
    m_length_rx=4;
    m_length_tx=4;

    ecg_cs_low();
    APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, m_length_tx, m_rx_buf, m_length_rx));

    //wait for transfer to finish
    while (!spi_xfer_done)
    {
        __WFE();
    }
    ecg_cs_high();
    //sprintf(bletext,"%02x %02x %02x %02x",m_rx_buf[0],m_rx_buf[1],m_rx_buf[2],m_rx_buf[3]);
    //lcd2_write_string(bletext);//BLE_TEXT(bletext);
}*/
