Revision b49ed442

View differences:

unittests/periphery-lld/src/ut_alld_P9221R_v1.c
54 54
    // local variables
55 55
    aos_utresult_t result = {0, 0};
56 56
    uint32_t status;
57
    uint16_t data[19];
57
    uint16_t data[40] = {0xAA55};
58 58

  
59 59
    chprintf(stream, "read registers...\n");
60
    status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_BATTERY_STATUS_SENT, data, 19, ((ut_p9221rdata_t*)ut->data)->timeout);
60
    status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_PARTNUMBER, data, 2*40, ((ut_p9221rdata_t*)ut->data)->timeout);
61 61
    if (status == APAL_STATUS_SUCCESS) {
62 62
      aosUtPassed(stream, &result);
63
      for(int i=0; i<19; i++){
64
          chprintf(stream, "register: %02x, data: %u \n", 0x3A+i, data[i]);
63
      for(int i=0; i<40; i++){
64
          chprintf(stream, "register: 0x%02x, data: 0x%04X \n", 0x00+(2*i), data[i]);
65 65
      }
66 66
    } else {
67 67
      aosUtFailed(stream, &result);
68 68
    }
69 69

  
70
    chprintf(stream, "read IE registers...\n");
71
    status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_INTERRUPTENABLE, data, 1, ((ut_p9221rdata_t*)ut->data)->timeout);
72
    if (status == APAL_STATUS_SUCCESS) {
73
      aosUtPassed(stream, &result);
74
      chprintf(stream, "register: 0x%02X, data: 0x%04X \n", (uint16_t)P9221R_LLD_REGISTER_INTERRUPTENABLE, data[0]);
75
    } else {
76
      aosUtFailed(stream, &result);
77
    }
78

  
70 79
    return result;
71 80
}
72 81
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) && defined(AMIROLLD_CFG_P9221R) && (AMIROLLD_CFG_P9221R == 1) */

Also available in: Unified diff