Revision 4684a9d9

View differences:

unittests/periphery-lld/src/ut_alld_P9221R_v1.c
73 73
      aosUtFailed(stream, &result);
74 74
    }
75 75

  
76
    chprintf(stream, "read registers...\n");
77
    status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_BATTERY_STATUS_SENT, alignment, 20, ((ut_p9221rdata_t*)ut->data)->timeout);
78
    if (status == APAL_STATUS_SUCCESS) {
76
    chprintf(stream, "read x_alignment for five seconds, move receiver ... \n");
77
    status = APAL_STATUS_SUCCESS;
78
    for (uint32_t i = 0; i <= 5; i++) {
79
        status |=   p9221r_lld_read_x_alignment(((ut_p9221rdata_t*)ut->data)->PRd, x_alignment, ((ut_p9221rdata_t*)ut->data)->timeout);
80
        chprintf(stream, "x_alignment %d \n", x_alignment);
81
        //aosUtPassed(stream, &result);
82
        aosThdSSleep(1);
83
    }
84
    if(status == APAL_STATUS_SUCCESS) {
79 85
      aosUtPassed(stream, &result);
80
      for(int i=0; i<20; i++){
81
          chprintf(stream, "register: 0x%02x, data: 0x%02X \n", P9221R_LLD_REGISTER_BATTERY_STATUS_SENT+i, alignment[i]);
82
      }
83 86
    } else {
84 87
      aosUtFailed(stream, &result);
85 88
    }
86 89

  
87
    chprintf(stream, "read all registers...\n");
88
    status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_PARTNUMBER, data, 79, ((ut_p9221rdata_t*)ut->data)->timeout);
89
    if (status == APAL_STATUS_SUCCESS) {
90
    chprintf(stream, "read y_alignment for five seconds, move receiver ... \n");
91
    status = APAL_STATUS_SUCCESS;
92
    for (uint32_t i = 0; i <= 5; i++) {
93
        status |= p9221r_lld_read_y_alignment(((ut_p9221rdata_t*)ut->data)->PRd, y_alignment, ((ut_p9221rdata_t*)ut->data)->timeout);
94
        chprintf(stream, "y_alignment: %d \n", y_alignment);
95
        //aosUtPassed(stream, &result);
96
        aosThdSSleep(1);
97
    }
98
    if(status == APAL_STATUS_SUCCESS) {
90 99
      aosUtPassed(stream, &result);
91
      for(int i=0; i<79; i++){
92
          chprintf(stream, "register: 0x%02x, data: 0x%02X \n", 0x00+i, data[i]);
93
      }
94 100
    } else {
95 101
      aosUtFailed(stream, &result);
96 102
    }
97 103

  
98
//    chprintf(stream, "read x_alignment... \n");
99
//    status =  p9221r_lld_read_x_alignment(((ut_p9221rdata_t*)ut->data)->PRd, x_alignment, ((ut_p9221rdata_t*)ut->data)->timeout);
100
//    if (status == APAL_STATUS_SUCCESS) {
101
//      aosUtPassed(stream, &result);
102
//      chprintf(stream, "x_alignment %d \n", x_alignment);
103
//    } else {
104
//      aosUtFailed(stream, &result);
105
//    }
106

  
107 104
//     chprintf(stream, "read y_alignment... \n");
108 105
//     status =  p9221r_lld_read_y_alignment(((ut_p9221rdata_t*)ut->data)->PRd, y_alignment, ((ut_p9221rdata_t*)ut->data)->timeout);
109 106
//     if (status == APAL_STATUS_SUCCESS) {

Also available in: Unified diff