zhaohe 1 year ago
parent
commit
1cfa54bb75
  1. 35
      app/src/ads1293_simple_tester.c

35
app/src/ads1293_simple_tester.c

@ -223,7 +223,7 @@ static uint8_t txcache[128];
void send_ads1293_error_state(ads1293_error_t* e0, ads1293_error_t* e1) { //
txcache[0] = 0xA5;
txcache[0] = 0xA1;
txcache[1] = 0x01;
memcpy(txcache + 2, e0, sizeof(ads1293_error_t));
memcpy(txcache + 2 + sizeof(ads1293_error_t), e1, sizeof(ads1293_error_t));
@ -255,16 +255,18 @@ void capture_error_state() {
}
#pragma pack(1)
typedef struct {
uint8_t frameH;
uint32_t sample0;
uint8_t frameE;
} one_ch_cache_t;
typedef struct {
uint8_t h1;
uint8_t h2;
one_ch_cache_t data[3];
uint8_t e1;
uint8_t e2;
} one_frame_cache_t;
typedef struct {
one_frame_cache_t frame[4];
one_frame_cache_t frame[8];
} one_packet_t;
#pragma unpack()
@ -278,24 +280,31 @@ void trigger_capture() {
ads1293_read_ecgs(&m_ads1293_0, &sample[0]);
ads1293_read_ecgs(&m_ads1293_1, &sample[3]);
// static int i = 0;
// static int j = 0;
// i++;
// if (i % 8 == 0) {
// j++;
// }
// sample[0] = j;
// sample[3] = j;
// sample[4] = j;
// TI_ADS1293_DATA_STATUS_REG
// readystatus[0] = ads1293_read_ready_status(&m_ads1293_0);
// readystatus[1] = ads1293_read_ready_status(&m_ads1293_1);
{
txpacket.frame[cache_data_size].data[0].frameH = 0xA1;
txpacket.frame[cache_data_size].h1 = 0xA2;
txpacket.frame[cache_data_size].h2 = 0x2;
txpacket.frame[cache_data_size].data[0].sample0 = sample[0];
txpacket.frame[cache_data_size].data[0].frameE = 0x1A;
txpacket.frame[cache_data_size].data[1].frameH = 0xA2;
txpacket.frame[cache_data_size].data[1].sample0 = sample[3];
txpacket.frame[cache_data_size].data[1].frameE = 0x2A;
txpacket.frame[cache_data_size].data[2].frameH = 0xA3;
txpacket.frame[cache_data_size].data[2].sample0 = sample[4];
txpacket.frame[cache_data_size].data[2].frameE = 0x3A;
txpacket.frame[cache_data_size].e1 = 0x2;
txpacket.frame[cache_data_size].e2 = 0xA2;
cache_data_size++;
if (cache_data_size == 4) {
if (cache_data_size == 8) {
zdatachannel_data_send2((uint8_t*)&txpacket, sizeof(one_packet_t));
cache_data_size = 0;
}

Loading…
Cancel
Save