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:
@@ -42,7 +42,7 @@ bool bq27220_set_parameter_u16(FuriHalI2cBusHandle* handle, uint16_t address, ui
|
||||
ret = furi_hal_i2c_write_mem(
|
||||
handle, BQ27220_ADDRESS, CommandSelectSubclass, buffer, 4, BQ27220_I2C_TIMEOUT);
|
||||
|
||||
delay_us(10000);
|
||||
furi_hal_delay_us(10000);
|
||||
|
||||
uint8_t checksum = bq27220_get_checksum(buffer, 4);
|
||||
buffer[0] = checksum;
|
||||
@@ -50,7 +50,7 @@ bool bq27220_set_parameter_u16(FuriHalI2cBusHandle* handle, uint16_t address, ui
|
||||
ret = furi_hal_i2c_write_mem(
|
||||
handle, BQ27220_ADDRESS, CommandMACDataSum, buffer, 2, BQ27220_I2C_TIMEOUT);
|
||||
|
||||
delay_us(10000);
|
||||
furi_hal_delay_us(10000);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ bool bq27220_init(FuriHalI2cBusHandle* handle, const ParamCEDV* cedv) {
|
||||
bq27220_set_parameter_u16(handle, AddressEDV2, cedv->EDV2);
|
||||
|
||||
bq27220_control(handle, Control_EXIT_CFG_UPDATE_REINIT);
|
||||
delay_us(10000);
|
||||
furi_hal_delay_us(10000);
|
||||
design_cap = bq27220_get_design_capacity(handle);
|
||||
if(cedv->design_cap == design_cap) {
|
||||
FURI_LOG_I(TAG, "Battery profile update success");
|
||||
|
@@ -8,7 +8,7 @@ CC1101Status cc1101_strobe(FuriHalSpiBusHandle* handle, uint8_t strobe) {
|
||||
uint8_t tx[1] = {strobe};
|
||||
CC1101Status rx[1] = {0};
|
||||
|
||||
while(hal_gpio_read(handle->miso))
|
||||
while(furi_hal_gpio_read(handle->miso))
|
||||
;
|
||||
furi_hal_spi_bus_trx(handle, tx, (uint8_t*)rx, 1, CC1101_TIMEOUT);
|
||||
|
||||
@@ -20,7 +20,7 @@ CC1101Status cc1101_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t
|
||||
uint8_t tx[2] = {reg, data};
|
||||
CC1101Status rx[2] = {0};
|
||||
|
||||
while(hal_gpio_read(handle->miso))
|
||||
while(furi_hal_gpio_read(handle->miso))
|
||||
;
|
||||
furi_hal_spi_bus_trx(handle, tx, (uint8_t*)rx, 2, CC1101_TIMEOUT);
|
||||
|
||||
@@ -33,7 +33,7 @@ CC1101Status cc1101_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t*
|
||||
uint8_t tx[2] = {reg | CC1101_READ, 0};
|
||||
CC1101Status rx[2] = {0};
|
||||
|
||||
while(hal_gpio_read(handle->miso))
|
||||
while(furi_hal_gpio_read(handle->miso))
|
||||
;
|
||||
furi_hal_spi_bus_trx(handle, tx, (uint8_t*)rx, 2, CC1101_TIMEOUT);
|
||||
|
||||
@@ -128,7 +128,7 @@ void cc1101_set_pa_table(FuriHalSpiBusHandle* handle, const uint8_t value[8]) {
|
||||
|
||||
memcpy(&tx[1], &value[0], 8);
|
||||
|
||||
while(hal_gpio_read(handle->miso))
|
||||
while(furi_hal_gpio_read(handle->miso))
|
||||
;
|
||||
furi_hal_spi_bus_trx(handle, tx, (uint8_t*)rx, sizeof(rx), CC1101_TIMEOUT);
|
||||
|
||||
@@ -143,7 +143,7 @@ uint8_t cc1101_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* data, uint
|
||||
|
||||
// Start transaction
|
||||
// Wait IC to become ready
|
||||
while(hal_gpio_read(handle->miso))
|
||||
while(furi_hal_gpio_read(handle->miso))
|
||||
;
|
||||
// Tell IC what we want
|
||||
furi_hal_spi_bus_trx(handle, buff_tx, (uint8_t*)buff_rx, size + 1, CC1101_TIMEOUT);
|
||||
@@ -158,7 +158,7 @@ uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* si
|
||||
|
||||
// Start transaction
|
||||
// Wait IC to become ready
|
||||
while(hal_gpio_read(handle->miso))
|
||||
while(furi_hal_gpio_read(handle->miso))
|
||||
;
|
||||
|
||||
// First byte - packet length
|
||||
|
@@ -26,7 +26,7 @@ void lp5562_enable(FuriHalI2cBusHandle* handle) {
|
||||
Reg00_Enable reg = {.CHIP_EN = true, .LOG_EN = true};
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, 0x00, *(uint8_t*)®, LP5562_I2C_TIMEOUT);
|
||||
//>488μs delay is required after writing to 0x00 register, otherwise program engine will not work
|
||||
delay_us(500);
|
||||
furi_hal_delay_us(500);
|
||||
}
|
||||
|
||||
void lp5562_set_channel_current(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value) {
|
||||
@@ -121,7 +121,7 @@ void lp5562_execute_program(
|
||||
reg_val &= ~(0x3 << bit_offset);
|
||||
reg_val |= (0x01 << bit_offset); // load
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, 0x01, reg_val, LP5562_I2C_TIMEOUT);
|
||||
delay_us(100);
|
||||
furi_hal_delay_us(100);
|
||||
|
||||
// Program load
|
||||
for(uint8_t i = 0; i < 16; i++) {
|
||||
|
Reference in New Issue
Block a user