Nfc: switch to HAL ticks. ApiHal: small cleanup and refactoring. (#609)

This commit is contained in:
あく
2021-07-28 11:45:42 +03:00
committed by GitHub
parent 4c1ac2a13d
commit 1c58de24f5
21 changed files with 36 additions and 41 deletions

View File

@@ -3,20 +3,18 @@
static const uint32_t clocks_in_ms = 64 * 1000;
ReturnCode api_hal_nfc_init() {
// Check if Nfc worker was started
rfalNfcState state = rfalNfcGetState();
if(state == RFAL_NFC_STATE_NOTINIT) {
return rfalNfcInitialize();
} else if(state == RFAL_NFC_STATE_IDLE) {
return ERR_NONE;
void api_hal_nfc_init() {
ReturnCode ret = rfalNfcInitialize();
if(ret == ERR_NONE) {
api_hal_nfc_start_sleep();
FURI_LOG_I("FuriHalNfc", "Init OK");
} else {
return ERR_BUSY;
FURI_LOG_W("FuriHalNfc", "Initialization failed, RFAL returned: %d", ret);
}
}
bool api_hal_nfc_is_busy() {
return rfalNfcGetState() > RFAL_NFC_STATE_IDLE;
return rfalNfcGetState() != RFAL_NFC_STATE_IDLE;
}
void api_hal_nfc_field_on() {