Rename api-hal to furi-hal (#629)
This commit is contained in:
@@ -3,7 +3,7 @@ PROJECT = bootloader
|
||||
|
||||
include $(PROJECT_ROOT)/make/base.mk
|
||||
|
||||
CFLAGS += -I$(PROJECT_ROOT) -Itargets/api-hal-include
|
||||
CFLAGS += -I$(PROJECT_ROOT) -Itargets/furi-hal-include
|
||||
ASM_SOURCES += $(wildcard src/*.s)
|
||||
C_SOURCES += $(wildcard src/*.c)
|
||||
CPP_SOURCES += $(wildcard src/*.cpp)
|
||||
|
@@ -1,6 +0,0 @@
|
||||
#include <api-hal.h>
|
||||
|
||||
void api_hal_init() {
|
||||
api_hal_i2c_init();
|
||||
api_hal_light_init();
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <api-hal-i2c.h>
|
||||
#include <api-hal-light.h>
|
||||
|
||||
void api_hal_init();
|
@@ -1,4 +1,4 @@
|
||||
#include <api-hal-i2c.h>
|
||||
#include <furi-hal-i2c.h>
|
||||
|
||||
#include <stm32wbxx_ll_bus.h>
|
||||
#include <stm32wbxx_ll_i2c.h>
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <stm32wbxx_ll_gpio.h>
|
||||
#include <stm32wbxx_ll_cortex.h>
|
||||
|
||||
void api_hal_i2c_init() {
|
||||
void furi_hal_i2c_init() {
|
||||
LL_I2C_InitTypeDef I2C_InitStruct = {0};
|
||||
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
||||
@@ -38,7 +38,7 @@ void api_hal_i2c_init() {
|
||||
LL_I2C_EnableClockStretching(I2C1);
|
||||
}
|
||||
|
||||
bool api_hal_i2c_tx(
|
||||
bool furi_hal_i2c_tx(
|
||||
I2C_TypeDef* instance,
|
||||
uint8_t address,
|
||||
const uint8_t* data,
|
||||
@@ -79,7 +79,7 @@ bool api_hal_i2c_tx(
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool api_hal_i2c_rx(
|
||||
bool furi_hal_i2c_rx(
|
||||
I2C_TypeDef* instance,
|
||||
uint8_t address,
|
||||
uint8_t* data,
|
||||
@@ -120,7 +120,7 @@ bool api_hal_i2c_rx(
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool api_hal_i2c_trx(
|
||||
bool furi_hal_i2c_trx(
|
||||
I2C_TypeDef* instance,
|
||||
uint8_t address,
|
||||
const uint8_t* tx_data,
|
||||
@@ -128,8 +128,8 @@ bool api_hal_i2c_trx(
|
||||
uint8_t* rx_data,
|
||||
uint8_t rx_size,
|
||||
uint32_t timeout) {
|
||||
if(api_hal_i2c_tx(instance, address, tx_data, tx_size, timeout) &&
|
||||
api_hal_i2c_rx(instance, address, rx_data, rx_size, timeout)) {
|
||||
if(furi_hal_i2c_tx(instance, address, tx_data, tx_size, timeout) &&
|
||||
furi_hal_i2c_rx(instance, address, rx_data, rx_size, timeout)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
@@ -2,29 +2,29 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <api-hal-resources.h>
|
||||
#include <furi-hal-resources.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void api_hal_i2c_init();
|
||||
void furi_hal_i2c_init();
|
||||
|
||||
bool api_hal_i2c_tx(
|
||||
bool furi_hal_i2c_tx(
|
||||
I2C_TypeDef* instance,
|
||||
const uint8_t address,
|
||||
const uint8_t* data,
|
||||
const uint8_t size,
|
||||
uint32_t timeout);
|
||||
|
||||
bool api_hal_i2c_rx(
|
||||
bool furi_hal_i2c_rx(
|
||||
I2C_TypeDef* instance,
|
||||
const uint8_t address,
|
||||
uint8_t* data,
|
||||
const uint8_t size,
|
||||
uint32_t timeout);
|
||||
|
||||
bool api_hal_i2c_trx(
|
||||
bool furi_hal_i2c_trx(
|
||||
I2C_TypeDef* instance,
|
||||
const uint8_t address,
|
||||
const uint8_t* tx_data,
|
||||
@@ -33,7 +33,7 @@ bool api_hal_i2c_trx(
|
||||
const uint8_t rx_size,
|
||||
uint32_t timeout);
|
||||
|
||||
#define with_api_hal_i2c(type, pointer, function_body) \
|
||||
#define with_furi_hal_i2c(type, pointer, function_body) \
|
||||
{ \
|
||||
*pointer = ({ type __fn__ function_body __fn__; })(); \
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
#include <api-hal-light.h>
|
||||
#include <furi-hal-light.h>
|
||||
#include <lp5562.h>
|
||||
|
||||
#define LED_CURRENT_RED 50
|
||||
@@ -6,7 +6,7 @@
|
||||
#define LED_CURRENT_BLUE 50
|
||||
#define LED_CURRENT_WHITE 150
|
||||
|
||||
void api_hal_light_init() {
|
||||
void furi_hal_light_init() {
|
||||
lp5562_reset();
|
||||
|
||||
lp5562_set_channel_current(LP5562ChannelRed, LED_CURRENT_RED);
|
||||
@@ -23,7 +23,7 @@ void api_hal_light_init() {
|
||||
lp5562_configure();
|
||||
}
|
||||
|
||||
void api_hal_light_set(Light light, uint8_t value) {
|
||||
void furi_hal_light_set(Light light, uint8_t value) {
|
||||
switch(light) {
|
||||
case LightRed:
|
||||
lp5562_set_channel_value(LP5562ChannelRed, value);
|
@@ -2,15 +2,15 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <api-hal-resources.h>
|
||||
#include <furi-hal-resources.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void api_hal_light_init();
|
||||
void furi_hal_light_init();
|
||||
|
||||
void api_hal_light_set(Light light, uint8_t value);
|
||||
void furi_hal_light_set(Light light, uint8_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
6
bootloader/targets/f6/furi-hal/furi-hal.c
Normal file
6
bootloader/targets/f6/furi-hal/furi-hal.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <furi-hal.h>
|
||||
|
||||
void furi_hal_init() {
|
||||
furi_hal_i2c_init();
|
||||
furi_hal_light_init();
|
||||
}
|
6
bootloader/targets/f6/furi-hal/furi-hal.h
Normal file
6
bootloader/targets/f6/furi-hal/furi-hal.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <furi-hal-i2c.h>
|
||||
#include <furi-hal-light.h>
|
||||
|
||||
void furi_hal_init();
|
@@ -10,7 +10,7 @@
|
||||
#include <stm32wbxx_hal_flash.h>
|
||||
|
||||
#include <lib/toolbox/version.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
// Boot request enum
|
||||
#define BOOT_REQUEST_TAINTED 0x00000000
|
||||
@@ -28,32 +28,32 @@
|
||||
#define RTC_CLOCK_IS_READY() (LL_RCC_LSE_IsReady() && LL_RCC_LSI1_IsReady())
|
||||
|
||||
void target_led_control(char* c) {
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
furi_hal_light_set(LightRed, 0x00);
|
||||
furi_hal_light_set(LightGreen, 0x00);
|
||||
furi_hal_light_set(LightBlue, 0x00);
|
||||
do {
|
||||
if(*c == 'R') {
|
||||
api_hal_light_set(LightRed, 0xFF);
|
||||
furi_hal_light_set(LightRed, 0xFF);
|
||||
} else if(*c == 'G') {
|
||||
api_hal_light_set(LightGreen, 0xFF);
|
||||
furi_hal_light_set(LightGreen, 0xFF);
|
||||
} else if(*c == 'B') {
|
||||
api_hal_light_set(LightBlue, 0xFF);
|
||||
furi_hal_light_set(LightBlue, 0xFF);
|
||||
} else if(*c == '.') {
|
||||
LL_mDelay(125);
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
furi_hal_light_set(LightRed, 0x00);
|
||||
furi_hal_light_set(LightGreen, 0x00);
|
||||
furi_hal_light_set(LightBlue, 0x00);
|
||||
LL_mDelay(125);
|
||||
} else if(*c == '-') {
|
||||
LL_mDelay(250);
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
furi_hal_light_set(LightRed, 0x00);
|
||||
furi_hal_light_set(LightGreen, 0x00);
|
||||
furi_hal_light_set(LightBlue, 0x00);
|
||||
LL_mDelay(250);
|
||||
} else if(*c == '|') {
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
furi_hal_light_set(LightRed, 0x00);
|
||||
furi_hal_light_set(LightGreen, 0x00);
|
||||
furi_hal_light_set(LightBlue, 0x00);
|
||||
}
|
||||
c++;
|
||||
} while(*c != 0);
|
||||
@@ -125,7 +125,7 @@ void usb_wire_reset() {
|
||||
void target_init() {
|
||||
clock_init();
|
||||
gpio_init();
|
||||
api_hal_init();
|
||||
furi_hal_init();
|
||||
target_led_control("RGB");
|
||||
rtc_init();
|
||||
version_save();
|
||||
|
@@ -34,8 +34,8 @@ CFLAGS += -I$(DRIVERS_DIR)
|
||||
C_SOURCES += $(DRIVERS_DIR)/lp5562.c
|
||||
|
||||
# API-HAL
|
||||
CFLAGS += -I$(TARGET_DIR)/api-hal
|
||||
C_SOURCES += $(wildcard $(TARGET_DIR)/api-hal/*.c)
|
||||
CFLAGS += -I$(TARGET_DIR)/furi-hal
|
||||
C_SOURCES += $(wildcard $(TARGET_DIR)/furi-hal/*.c)
|
||||
|
||||
# Version generation
|
||||
C_SOURCES += $(PROJECT_ROOT)/lib/toolbox/version.c
|
||||
|
Reference in New Issue
Block a user