读取ads1299设备的id
int test_adc_read_id(int argc, char **argv){ rt_uint32_t test_num = 10; rt_uint32_t i; rt_uint8_t id; rt_uint32_t failed_num = 0; rt_uint32_t success_num = 0;
if (argc > 2) { rt_kprintf("The most numbers of args is two.\n"); } else if (argc == 2) { test_num = atoi(argv[1]); rt_kprintf("The test times is: %d.\n", test_num); } else { rt_kprintf("The test times is: %d.\n", test_num); }
/* close the read data continue mode */ SampleStop();
for (i = 0; i < test_num; i ) { id = ADS1299_read_id(); if ((id & 0x1f) != 0x1e) { failed_num ; } else { success_num ; } }
rt_kprintf("test read id, success times: %d, failed times: %d\n", success_num, failed_num);
return 0;}
评论