* 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>
		
			
				
	
	
		
			35 lines
		
	
	
		
			825 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			825 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include <api-hal-version.h>
 | 
						|
#include <stm32wbxx.h>
 | 
						|
 | 
						|
typedef struct {
 | 
						|
    uint8_t version;
 | 
						|
    uint8_t target;
 | 
						|
    uint8_t body;
 | 
						|
    uint8_t connect;
 | 
						|
    uint32_t timestamp;
 | 
						|
} ApiHalVersionOTP;
 | 
						|
 | 
						|
bool api_hal_version_do_i_belong_here() {
 | 
						|
    return api_hal_version_get_hw_target() == 5;
 | 
						|
}
 | 
						|
 | 
						|
const uint8_t api_hal_version_get_hw_version() {
 | 
						|
    return ((ApiHalVersionOTP*)OTP_AREA_BASE)->version;
 | 
						|
}
 | 
						|
 | 
						|
const uint8_t api_hal_version_get_hw_target() {
 | 
						|
    return ((ApiHalVersionOTP*)OTP_AREA_BASE)->target;
 | 
						|
}
 | 
						|
 | 
						|
const uint8_t api_hal_version_get_hw_body() {
 | 
						|
    return ((ApiHalVersionOTP*)OTP_AREA_BASE)->body;
 | 
						|
}
 | 
						|
 | 
						|
const uint8_t api_hal_version_get_hw_connect() {
 | 
						|
    return ((ApiHalVersionOTP*)OTP_AREA_BASE)->connect;
 | 
						|
}
 | 
						|
 | 
						|
const uint32_t api_hal_version_get_hw_timestamp() {
 | 
						|
    return ((ApiHalVersionOTP*)OTP_AREA_BASE)->timestamp;
 | 
						|
}
 |