Skip to content

Commit 205959f

Browse files
fixed silly errors
1 parent 9124319 commit 205959f

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

general/src/lan8670.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -506,28 +506,31 @@ int32_t LAN8670_PLCA_Set_Node_Id(lan8670_t *lan, uint8_t id)
506506
/* false=The PLCA reconciliation sublayer is not regularly receiving or transmitting the BEACON, true=The PLCA reconciliation sublayer is regularly receiving or transmitting the BEACON. */
507507
int32_t LAN8670_PLCA_Get_Status(lan8670_t *lan, bool *status) {
508508
uint16_t reading = 0;
509-
int status = mmd_read_register_field(lan, MMD_MISC, MISC_PLCA_STS, 15, 15, &reading);
510-
if(status != LAN8670_STATUS_OK) {
511-
PRINTLN_ERROR("Failed to call mmd_read_register_field() (Status: %d).", status);
512-
return status;
509+
int error = mmd_read_register_field(lan, MMD_MISC, MISC_PLCA_STS, 15, 15, &reading);
510+
if(error != LAN8670_STATUS_OK) {
511+
PRINTLN_ERROR("Failed to call mmd_read_register_field() (Status: %d).", error);
512+
return error;
513513
}
514514

515-
if(reading == 0) {
516-
return false;
515+
if(reading == 1) {
516+
*status = true;
517+
} else {
518+
*status = false;
517519
}
518-
return true;
520+
521+
return LAN8670_STATUS_OK;
519522
}
520523

521524
/* Reads the value of the TOMTR register. Should be 32 bit-times by default. */
522525
int32_t LAN8670_PLCA_ReadTOTMR(lan8670_t *lan, uint8_t *buffer) {
523-
uint8_t reading = 0;
526+
uint16_t reading = 0;
524527
int status = mmd_read_register_field(lan, MMD_MISC, MISC_PLCA_TOTMR, 0, 7, &reading);
525528
if(status != LAN8670_STATUS_OK) {
526529
PRINTLN_ERROR("Failed to call mmd_read_register_field() (Status: %d).", status);
527530
return status;
528531
}
529532

530-
*buffer = reading;
533+
*buffer = (uint8_t)reading;
531534
return LAN8670_STATUS_OK;
532535
}
533536

0 commit comments

Comments
 (0)