Revision a193bcf1
| periphery-lld/AMiRo-LLD | ||
|---|---|---|
| 1 |
Subproject commit 018286168437c08c9d93afc9ffab9fcb11fd9339 |
|
| 1 |
Subproject commit 1473a57f96b8bcbcac3400ca3458b7a08fed5881 |
|
| unittests/periphery-lld/src/ut_alld_A3906_v1.c | ||
|---|---|---|
| 249 | 249 |
|
| 250 | 250 |
_wheelSpeedTest(stream, (ut_a3906data_t*)ut->data, WHEEL_RIGHT, DIRECTION_BACKWARD, &result); |
| 251 | 251 |
|
| 252 |
chprintf(stream, "disable power... \n");
|
|
| 252 |
chprintf(stream, "disable power...\n"); |
|
| 253 | 253 |
power_state = A3906_LLD_POWER_OFF; |
| 254 | 254 |
status = a3906_lld_set_power(((ut_a3906data_t*)ut->data)->driver, power_state); |
| 255 | 255 |
status |= a3906_lld_get_power(((ut_a3906data_t*)ut->data)->driver, &power_state); |
| unittests/periphery-lld/src/ut_alld_DW1000_v1.c | ||
|---|---|---|
| 268 | 268 |
port_DisableEXT_IRQ(); |
| 269 | 269 |
|
| 270 | 270 |
setHighSpeed_SPI(false, (DW1000Driver*) ut->data); |
| 271 |
chprintf(stream, "expected device ID (LS SPI): 0xDECA0130 \n");
|
|
| 271 |
chprintf(stream, "expected device ID (LS SPI): 0xDECA0130\n"); |
|
| 272 | 272 |
aosThdMSleep(5); |
| 273 | 273 |
actual_deviceId = instancereaddeviceid(); |
| 274 | 274 |
chprintf(stream, "actual read ID: 0x%x\n", actual_deviceId); |
| ... | ... | |
| 286 | 286 |
if(DWT_DEVICE_ID != actual_deviceId){
|
| 287 | 287 |
chprintf(stream, "SPI is not working or Unsupported Device ID\n"); |
| 288 | 288 |
chprintf(stream, "actual device ID is: 0x%x\n", actual_deviceId); |
| 289 |
chprintf(stream, "expected device ID: 0xDECA0130 \n");
|
|
| 289 |
chprintf(stream, "expected device ID: 0xDECA0130\n"); |
|
| 290 | 290 |
aosThdMSleep(5); |
| 291 | 291 |
} |
| 292 | 292 |
|
| ... | ... | |
| 303 | 303 |
|
| 304 | 304 |
reset_DW1000(); |
| 305 | 305 |
|
| 306 |
chprintf(stream, "initialise instance for DW1000 \n");
|
|
| 306 |
chprintf(stream, "initialise instance for DW1000\n"); |
|
| 307 | 307 |
aosThdSleep(1); |
| 308 | 308 |
|
| 309 | 309 |
int x_init = instance_init((DW1000Driver*) ut->data) ; |
| 310 | 310 |
|
| 311 | 311 |
if (0 != x_init){
|
| 312 |
chprintf(stream, "init error with return value: %d \n", x_init);
|
|
| 312 |
chprintf(stream, "init error with return value: %d\n", x_init); |
|
| 313 | 313 |
aosThdSleep(1); |
| 314 | 314 |
} |
| 315 | 315 |
else {
|
| 316 |
chprintf(stream, "init success with return value: %d \n", x_init);
|
|
| 316 |
chprintf(stream, "init success with return value: %d\n", x_init); |
|
| 317 | 317 |
aosThdSleep(1); |
| 318 | 318 |
} |
| 319 | 319 |
|
| ... | ... | |
| 341 | 341 |
port_EnableEXT_IRQ(); |
| 342 | 342 |
reset_DW1000(); |
| 343 | 343 |
|
| 344 |
chprintf(stream, "initialise the configuration for UWB application \n");
|
|
| 344 |
chprintf(stream, "initialise the configuration for UWB application\n"); |
|
| 345 | 345 |
aosThdSleep(1); |
| 346 | 346 |
|
| 347 | 347 |
int uwb_init = UWB_Init((DW1000Driver*) ut->data); |
| 348 | 348 |
|
| 349 | 349 |
if (0 != uwb_init){
|
| 350 |
chprintf(stream, "UWB config error with return value: %d \n", uwb_init);
|
|
| 350 |
chprintf(stream, "UWB config error with return value: %d\n", uwb_init); |
|
| 351 | 351 |
aosThdSleep(1); |
| 352 | 352 |
} |
| 353 | 353 |
else {
|
| 354 |
chprintf(stream, "UWB config success with return value: %d \n", uwb_init);
|
|
| 354 |
chprintf(stream, "UWB config success with return value: %d\n", uwb_init); |
|
| 355 | 355 |
aosThdSleep(1); |
| 356 | 356 |
} |
| 357 | 357 |
|
| ... | ... | |
| 372 | 372 |
|
| 373 | 373 |
/*! RUN THE STATE MACHINE DEMO APP (RTLS) */ |
| 374 | 374 |
|
| 375 |
chprintf(stream, "initialise the State Machine \n");
|
|
| 375 |
chprintf(stream, "initialise the State Machine\n"); |
|
| 376 | 376 |
aosThdSleep(2); |
| 377 | 377 |
|
| 378 | 378 |
/* Initialize UWB system with user defined configuration */ |
| 379 | 379 |
int uwb_init = UWB_Init((DW1000Driver*) ut->data); |
| 380 | 380 |
|
| 381 | 381 |
if (0 != uwb_init){
|
| 382 |
chprintf(stream, "error in UWB config with return value: %d \n", uwb_init);
|
|
| 382 |
chprintf(stream, "error in UWB config with return value: %d\n", uwb_init); |
|
| 383 | 383 |
} |
| 384 | 384 |
else {
|
| 385 |
chprintf(stream, "succeed the init of UWB config \n");
|
|
| 385 |
chprintf(stream, "succeed the init of UWB config\n"); |
|
| 386 | 386 |
} |
| 387 | 387 |
aosThdSleep(1); |
| 388 | 388 |
|
| 389 |
chprintf(stream, "running the RTLS demo application ... \n");
|
|
| 389 |
chprintf(stream, "running the RTLS demo application ...\n"); |
|
| 390 | 390 |
aosThdSleep(1); |
| 391 | 391 |
|
| 392 | 392 |
/*! Run the localization system demo app as a thread */ |
| unittests/periphery-lld/src/ut_alld_LTC4412_v1.c | ||
|---|---|---|
| 53 | 53 |
aos_utresult_t result = {0,0};
|
| 54 | 54 |
uint32_t status; |
| 55 | 55 |
|
| 56 |
chprintf(stream, "read ctrl pin... \n");
|
|
| 56 |
chprintf(stream, "read ctrl pin...\n"); |
|
| 57 | 57 |
ltc4412_lld_ctrl_t ctrl; |
| 58 | 58 |
status = ltc4412_lld_get_ctrl((LTC4412Driver*)ut->data, &ctrl); |
| 59 | 59 |
if(status == APAL_STATUS_SUCCESS){
|
| ... | ... | |
| 62 | 62 |
aosUtFailedMsg(stream, &result, "0x%08X\n", status); |
| 63 | 63 |
} |
| 64 | 64 |
|
| 65 |
chprintf(stream, "write ctrl pin... \n");
|
|
| 65 |
chprintf(stream, "write ctrl pin...\n"); |
|
| 66 | 66 |
status = ltc4412_lld_set_ctrl((LTC4412Driver*)ut->data, LTC4412_LLD_CTRL_ACTIVE); |
| 67 | 67 |
status |= ltc4412_lld_get_ctrl((LTC4412Driver*)ut->data, &ctrl); |
| 68 | 68 |
if (status == APAL_STATUS_SUCCESS && ctrl == LTC4412_LLD_CTRL_ACTIVE) {
|
| ... | ... | |
| 71 | 71 |
aosUtFailedMsg(stream, &result, "0x%08X\n", status); |
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 |
chprintf(stream, "read stat pin... \n");
|
|
| 74 |
chprintf(stream, "read stat pin...\n"); |
|
| 75 | 75 |
ltc4412_lld_stat_t stat; |
| 76 | 76 |
status = ltc4412_lld_get_stat((LTC4412Driver*)ut->data, &stat); |
| 77 | 77 |
if(status == APAL_STATUS_SUCCESS){
|
| unittests/periphery-lld/src/ut_alld_TPS6211x_v1.c | ||
|---|---|---|
| 54 | 54 |
uint32_t status; |
| 55 | 55 |
tps6211x_lld_power_en_t power; |
| 56 | 56 |
|
| 57 |
chprintf(stream, "read pin... \n");
|
|
| 57 |
chprintf(stream, "read pin...\n"); |
|
| 58 | 58 |
status = tps6211x_lld_get_power_en((TPS6211xDriver*)ut->data, &power); |
| 59 | 59 |
if(status == APAL_STATUS_SUCCESS){
|
| 60 | 60 |
aosUtPassed(stream, &result); |
| ... | ... | |
| 62 | 62 |
aosUtFailedMsg(stream, &result, "0x%08X\n", status); |
| 63 | 63 |
} |
| 64 | 64 |
|
| 65 |
chprintf(stream, "write pin... \n");
|
|
| 65 |
chprintf(stream, "write pin...\n"); |
|
| 66 | 66 |
status = tps6211x_lld_set_power_en((TPS6211xDriver*)ut->data, TPS6211x_LLD_POWER_ENABLED); |
| 67 | 67 |
status |= tps6211x_lld_get_power_en((TPS6211xDriver*)ut->data, &power); |
| 68 | 68 |
if(status == APAL_STATUS_SUCCESS && power == TPS6211x_LLD_POWER_ENABLED){
|
| unittests/periphery-lld/src/ut_alld_TPS6211x_v1_INA219_v1.c | ||
|---|---|---|
| 55 | 55 |
tps6211x_lld_power_en_t power; |
| 56 | 56 |
uint32_t v_buson, v_busoff; |
| 57 | 57 |
|
| 58 |
chprintf(stream, "read pin... \n");
|
|
| 58 |
chprintf(stream, "read pin...\n"); |
|
| 59 | 59 |
status = tps6211x_lld_get_power_en(((ut_tps6211xina219data_t*)ut->data)->tps6211x, &power); |
| 60 | 60 |
aosThdSSleep(1); |
| 61 | 61 |
status |= ina219_lld_read_bus_voltage(((ut_tps6211xina219data_t*)ut->data)->ina219, &v_buson, ((ut_tps6211xina219data_t*)ut->data)->timeout); |
| ... | ... | |
| 65 | 65 |
aosUtFailedMsg(stream, &result, "0x%08X\n", status); |
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 |
chprintf(stream, "write pin... \n");
|
|
| 68 |
chprintf(stream, "write pin...\n"); |
|
| 69 | 69 |
status = tps6211x_lld_set_power_en(((ut_tps6211xina219data_t*)ut->data)->tps6211x, TPS6211x_LLD_POWER_DISABLED); |
| 70 | 70 |
status |= tps6211x_lld_get_power_en(((ut_tps6211xina219data_t*)ut->data)->tps6211x, &power); |
| 71 | 71 |
aosThdSSleep(1); |
| unittests/periphery-lld/src/ut_alld_bq27500_v1.c | ||
|---|---|---|
| 377 | 377 |
|
| 378 | 378 |
chprintf(stream, "ext command: device name length...\n"); |
| 379 | 379 |
status = bq27500_lld_ext_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_EXT_CMD_DeviceNameLength, BQ27500_LLD_EXT_CMD_READ, &original_length, 1, 0, ((ut_bq27500data_t*)ut->data)->timeout); |
| 380 |
chprintf(stream, "\t\tdevice name length: %d \n", original_length);
|
|
| 380 |
chprintf(stream, "\t\tdevice name length: %d\n", original_length); |
|
| 381 | 381 |
if (status == APAL_STATUS_SUCCESS && original_length <= 8) {
|
| 382 | 382 |
aosUtPassed(stream, &result); |
| 383 | 383 |
} else {
|
| ... | ... | |
| 396 | 396 |
} |
| 397 | 397 |
|
| 398 | 398 |
chprintf(stream, "battery info std commands...\n"); |
| 399 |
status = bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_Temperatur, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
|
| 400 |
chprintf(stream, "\t\ttemperature: %fK (%fC) \n", (float)dst/10.0f, (float)dst/10.0f-273.5f);
|
|
| 399 |
status = bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_Temperature, &dst, ((ut_bq27500data_t*)ut->data)->timeout);
|
|
| 400 |
chprintf(stream, "\t\ttemperature: %fK (%fC)\n", (float)dst/10.0f, (float)dst/10.0f-273.5f); |
|
| 401 | 401 |
status |= bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_FullAvailableCapacity, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
| 402 |
chprintf(stream, "\t\tfull available capacity: %umAh \n", dst);
|
|
| 402 |
chprintf(stream, "\t\tfull available capacity: %umAh\n", dst); |
|
| 403 | 403 |
status |= bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_FullChargeCapacity, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
| 404 |
chprintf(stream, "\t\tfull charge capacity: %umAh \n", dst);
|
|
| 404 |
chprintf(stream, "\t\tfull charge capacity: %umAh\n", dst); |
|
| 405 | 405 |
status |= bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_RemainingCapacity, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
| 406 |
chprintf(stream, "\t\tremaining capacity: %umAh \n", dst);
|
|
| 406 |
chprintf(stream, "\t\tremaining capacity: %umAh\n", dst); |
|
| 407 | 407 |
status |= bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_Voltage, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
| 408 |
chprintf(stream, "\t\tvoltage: %umV \n", dst);
|
|
| 408 |
chprintf(stream, "\t\tvoltage: %umV\n", dst); |
|
| 409 | 409 |
status |= bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_AverageCurrent, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
| 410 |
chprintf(stream, "\t\taverage current: %dmA \n", (int8_t)dst);
|
|
| 410 |
chprintf(stream, "\t\taverage current: %dmA\n", (int8_t)dst); |
|
| 411 | 411 |
status |= bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_AveragePower, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
| 412 |
chprintf(stream, "\t\taverage power: %dmW \n", (int8_t)dst); |
|
| 412 |
chprintf(stream, "\t\taverage power: %dmW\n", (int8_t)dst); |
|
| 413 |
status |= bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_StateOfCharge, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
|
| 414 |
chprintf(stream, "\t\tstate of charge: %u%%\n", dst); |
|
| 413 | 415 |
status |= bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_TimeToFull, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
| 414 | 416 |
if (dst != (uint16_t)~0) {
|
| 415 |
chprintf(stream, "\t\ttime to full: %umin \n", dst);
|
|
| 417 |
chprintf(stream, "\t\ttime to full: %umin\n", dst); |
|
| 416 | 418 |
} else {
|
| 417 |
chprintf(stream, "\t\ttime to full: (not charging) \n", dst);
|
|
| 419 |
chprintf(stream, "\t\ttime to full: (not charging)\n", dst); |
|
| 418 | 420 |
} |
| 419 | 421 |
status |= bq27500_lld_std_command(((ut_bq27500data_t*)ut->data)->driver, BQ27500_LLD_STD_CMD_TimeToEmpty, &dst, ((ut_bq27500data_t*)ut->data)->timeout); |
| 420 | 422 |
if (dst != (uint16_t)~0) {
|
| 421 |
chprintf(stream, "\t\ttime to empty: %umin \n", dst);
|
|
| 423 |
chprintf(stream, "\t\ttime to empty: %umin\n", dst); |
|
| 422 | 424 |
} else {
|
| 423 |
chprintf(stream, "\t\ttime to empty: (not discharging) \n", dst);
|
|
| 425 |
chprintf(stream, "\t\ttime to empty: (not discharging)\n", dst); |
|
| 424 | 426 |
} |
| 425 | 427 |
if (status == APAL_STATUS_SUCCESS) {
|
| 426 | 428 |
aosUtPassed(stream, &result); |
Also available in: Unified diff