HAL to LL migration: GPIO, HSEM, AES (#1069)
* gpio, hsem, crypto: switch from HAL to LL/registers * Moved GPIO initialization to furi_hal * More HAL removed * All HAL modules disabled * HAL is finally removed * hal_gpio -> furi_hal_gpio, main.h removed * Bootloader build fix * RTOS config moved to freertos-glue * delay -> furi_hal_delay Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -83,7 +83,7 @@ bool ibutton_worker_read_comparator(iButtonWorker* worker) {
|
||||
furi_hal_rfid_comp_start();
|
||||
|
||||
// TODO: rework with thread events, "pulse_decoder_get_decoded_index_with_timeout"
|
||||
delay(100);
|
||||
furi_hal_delay_ms(100);
|
||||
int32_t decoded_index = pulse_decoder_get_decoded_index(worker->pulse_decoder);
|
||||
if(decoded_index >= 0) {
|
||||
pulse_decoder_get_data(
|
||||
@@ -118,7 +118,7 @@ bool ibutton_worker_read_comparator(iButtonWorker* worker) {
|
||||
bool ibutton_worker_read_dallas(iButtonWorker* worker) {
|
||||
bool result = false;
|
||||
onewire_host_start(worker->host);
|
||||
delay(100);
|
||||
furi_hal_delay_ms(100);
|
||||
FURI_CRITICAL_ENTER();
|
||||
if(onewire_host_search(worker->host, worker->key_data, NORMAL_SEARCH)) {
|
||||
onewire_host_reset_search(worker->host);
|
||||
|
@@ -11,13 +11,13 @@ struct iButtonWriter {
|
||||
|
||||
static void writer_write_one_bit(iButtonWriter* writer, bool value, uint32_t delay) {
|
||||
onewire_host_write_bit(writer->host, value);
|
||||
delay_us(delay);
|
||||
furi_hal_delay_us(delay);
|
||||
}
|
||||
|
||||
static void writer_write_byte_ds1990(iButtonWriter* writer, uint8_t data) {
|
||||
for(uint8_t n_bit = 0; n_bit < 8; n_bit++) {
|
||||
onewire_host_write_bit(writer->host, data & 1);
|
||||
delay_us(5000);
|
||||
furi_hal_delay_us(5000);
|
||||
data = data >> 1;
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ static bool writer_write_TM2004(iButtonWriter* writer, iButtonKey* key) {
|
||||
// TODO: check answer CRC
|
||||
|
||||
// pulse indicating that data is correct
|
||||
delay_us(600);
|
||||
furi_hal_delay_us(600);
|
||||
writer_write_one_bit(writer, 1, 50000);
|
||||
|
||||
// read writed key byte
|
||||
@@ -104,7 +104,7 @@ static bool writer_write_1990_1(iButtonWriter* writer, iButtonKey* key) {
|
||||
// unlock
|
||||
onewire_host_reset(writer->host);
|
||||
onewire_host_write(writer->host, RW1990_1_CMD_WRITE_RECORD_FLAG);
|
||||
delay_us(10);
|
||||
furi_hal_delay_us(10);
|
||||
writer_write_one_bit(writer, 0, 5000);
|
||||
|
||||
// write key
|
||||
@@ -113,7 +113,7 @@ static bool writer_write_1990_1(iButtonWriter* writer, iButtonKey* key) {
|
||||
for(uint8_t i = 0; i < ibutton_key_get_data_size(key); i++) {
|
||||
// inverted key for RW1990.1
|
||||
writer_write_byte_ds1990(writer, ~ibutton_key_get_data_p(key)[i]);
|
||||
delay_us(30000);
|
||||
furi_hal_delay_us(30000);
|
||||
}
|
||||
|
||||
// lock
|
||||
@@ -139,7 +139,7 @@ static bool writer_write_1990_2(iButtonWriter* writer, iButtonKey* key) {
|
||||
// unlock
|
||||
onewire_host_reset(writer->host);
|
||||
onewire_host_write(writer->host, RW1990_2_CMD_WRITE_RECORD_FLAG);
|
||||
delay_us(10);
|
||||
furi_hal_delay_us(10);
|
||||
writer_write_one_bit(writer, 1, 5000);
|
||||
|
||||
// write key
|
||||
@@ -147,7 +147,7 @@ static bool writer_write_1990_2(iButtonWriter* writer, iButtonKey* key) {
|
||||
onewire_host_write(writer->host, RW1990_2_CMD_WRITE_ROM);
|
||||
for(uint8_t i = 0; i < ibutton_key_get_data_size(key); i++) {
|
||||
writer_write_byte_ds1990(writer, ibutton_key_get_data_p(key)[i]);
|
||||
delay_us(30000);
|
||||
furi_hal_delay_us(30000);
|
||||
}
|
||||
|
||||
// lock
|
||||
@@ -191,7 +191,7 @@ static bool writer_write_TM01(
|
||||
//} else {
|
||||
for(uint8_t i = 0; i < key->get_type_data_size(); i++) {
|
||||
write_byte_ds1990(key->get_data()[i]);
|
||||
delay_us(10000);
|
||||
furi_hal_delay_us(10000);
|
||||
}
|
||||
//}
|
||||
|
||||
|
@@ -30,23 +30,23 @@ bool onewire_host_reset(OneWireHost* host) {
|
||||
furi_hal_ibutton_pin_high();
|
||||
do {
|
||||
if(--retries == 0) return 0;
|
||||
delay_us(2);
|
||||
furi_hal_delay_us(2);
|
||||
} while(!furi_hal_ibutton_pin_get_level());
|
||||
|
||||
// pre delay
|
||||
delay_us(OWH_RESET_DELAY_PRE);
|
||||
furi_hal_delay_us(OWH_RESET_DELAY_PRE);
|
||||
|
||||
// drive low
|
||||
furi_hal_ibutton_pin_low();
|
||||
delay_us(OWH_RESET_DRIVE);
|
||||
furi_hal_delay_us(OWH_RESET_DRIVE);
|
||||
|
||||
// release
|
||||
furi_hal_ibutton_pin_high();
|
||||
delay_us(OWH_RESET_RELEASE);
|
||||
furi_hal_delay_us(OWH_RESET_RELEASE);
|
||||
|
||||
// read and post delay
|
||||
r = !furi_hal_ibutton_pin_get_level();
|
||||
delay_us(OWH_RESET_DELAY_POST);
|
||||
furi_hal_delay_us(OWH_RESET_DELAY_POST);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -56,15 +56,15 @@ bool onewire_host_read_bit(OneWireHost* host) {
|
||||
|
||||
// drive low
|
||||
furi_hal_ibutton_pin_low();
|
||||
delay_us(OWH_READ_DRIVE);
|
||||
furi_hal_delay_us(OWH_READ_DRIVE);
|
||||
|
||||
// release
|
||||
furi_hal_ibutton_pin_high();
|
||||
delay_us(OWH_READ_RELEASE);
|
||||
furi_hal_delay_us(OWH_READ_RELEASE);
|
||||
|
||||
// read and post delay
|
||||
result = furi_hal_ibutton_pin_get_level();
|
||||
delay_us(OWH_READ_DELAY_POST);
|
||||
furi_hal_delay_us(OWH_READ_DELAY_POST);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -91,19 +91,19 @@ void onewire_host_write_bit(OneWireHost* host, bool value) {
|
||||
if(value) {
|
||||
// drive low
|
||||
furi_hal_ibutton_pin_low();
|
||||
delay_us(OWH_WRITE_1_DRIVE);
|
||||
furi_hal_delay_us(OWH_WRITE_1_DRIVE);
|
||||
|
||||
// release
|
||||
furi_hal_ibutton_pin_high();
|
||||
delay_us(OWH_WRITE_1_RELEASE);
|
||||
furi_hal_delay_us(OWH_WRITE_1_RELEASE);
|
||||
} else {
|
||||
// drive low
|
||||
furi_hal_ibutton_pin_low();
|
||||
delay_us(OWH_WRITE_0_DRIVE);
|
||||
furi_hal_delay_us(OWH_WRITE_0_DRIVE);
|
||||
|
||||
// release
|
||||
furi_hal_ibutton_pin_high();
|
||||
delay_us(OWH_WRITE_0_RELEASE);
|
||||
furi_hal_delay_us(OWH_WRITE_0_RELEASE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@ bool onewire_slave_show_presence(OneWireSlave* bus) {
|
||||
|
||||
// show presence
|
||||
furi_hal_ibutton_pin_low();
|
||||
delay_us(OWS_PRESENCE_MIN);
|
||||
furi_hal_delay_us(OWS_PRESENCE_MIN);
|
||||
furi_hal_ibutton_pin_high();
|
||||
|
||||
// somebody also can show presence
|
||||
@@ -126,7 +126,7 @@ bool onewire_slave_send_bit(OneWireSlave* bus, bool value) {
|
||||
}
|
||||
|
||||
// hold line for ZERO or ONE time
|
||||
delay_us(time);
|
||||
furi_hal_delay_us(time);
|
||||
furi_hal_ibutton_pin_high();
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user