[FL-873] Add F5 target, lp5562 driver and api-hal-light (#347)
* Add F5 target, lp5562 driver and api-hal-light. Update api-usage, switch to F5 by default. * API HAL: add i2c and hardware version api. Dolphin: show hardware version. * OTP version generator and flashing utility. * Assets script: fix code formatting * Backport F5 changes to F4 * F4: disable insomnia, prevent damage to BLE RX path * F5 HAL API Light: remove magic delay to fix magic BLE * Dolphin: HW target validation on start * invert RSSI indication in sub-1 * API HAL: rename board to body in version api * Gpio tester: detach and release viewport on exit Co-authored-by: aanper <mail@s3f.ru>
This commit is contained in:
26
firmware/targets/api-hal-include/api-hal-i2c.h
Normal file
26
firmware/targets/api-hal-include/api-hal-i2c.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <i2c.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void api_hal_i2c_init();
|
||||
|
||||
void api_hal_i2c_lock();
|
||||
|
||||
void api_hal_i2c_unlock();
|
||||
|
||||
#define with_api_hal_i2c(type, pointer, function_body) \
|
||||
{ \
|
||||
api_hal_i2c_lock(); \
|
||||
*pointer = ({ type __fn__ function_body __fn__; })(); \
|
||||
api_hal_i2c_unlock(); \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
17
firmware/targets/api-hal-include/api-hal-light.h
Normal file
17
firmware/targets/api-hal-include/api-hal-light.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <api-hal-resources.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void api_hal_light_init();
|
||||
|
||||
void api_hal_light_set(Light light, uint8_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
25
firmware/targets/api-hal-include/api-hal-version.h
Normal file
25
firmware/targets/api-hal-include/api-hal-version.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool api_hal_version_do_i_belong_here();
|
||||
|
||||
const uint8_t api_hal_version_get_hw_version();
|
||||
|
||||
const uint8_t api_hal_version_get_hw_target();
|
||||
|
||||
const uint8_t api_hal_version_get_hw_body();
|
||||
|
||||
const uint8_t api_hal_version_get_hw_connect();
|
||||
|
||||
const uint32_t api_hal_version_get_hw_timestamp();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -6,14 +6,17 @@ template <unsigned int N> struct STOP_EXTERNING_ME {};
|
||||
|
||||
#include "api-hal-boot.h"
|
||||
#include "api-hal-os.h"
|
||||
#include "api-hal-i2c.h"
|
||||
#include "api-hal-resources.h"
|
||||
#include "api-hal-gpio.h"
|
||||
#include "api-hal-light.h"
|
||||
#include "api-hal-delay.h"
|
||||
#include "api-hal-pwm.h"
|
||||
#include "api-hal-task.h"
|
||||
#include "api-hal-tim.h"
|
||||
#include "api-hal-power.h"
|
||||
#include "api-hal-vcp.h"
|
||||
#include "api-hal-version.h"
|
||||
#include "api-hal-uid.h"
|
||||
#include "api-hal-bt.h"
|
||||
#include "api-hal-spi.h"
|
||||
|
Reference in New Issue
Block a user