[FL-3260] Added API version to device info (#2611)

* hal: device_info: added API version to "firmware.api.major" & "firmware.api.minor"
* FuriHal: bump device info version

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger 2023-05-03 06:58:59 +03:00 committed by GitHub
parent 5c09bc5b2d
commit c5b460b416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 4 deletions

View File

@ -6,6 +6,8 @@
/* Generated table */
#include <firmware_api_table.h>
#include <furi_hal_info.h>
static_assert(!has_hash_collisions(elf_api_table), "Detected API method hash collision!");
constexpr HashtableApiInterface elf_api_interface{
@ -19,3 +21,8 @@ constexpr HashtableApiInterface elf_api_interface{
};
const ElfApiInterface* const firmware_api_interface = &elf_api_interface;
extern "C" void furi_hal_info_get_api_version(uint16_t* major, uint16_t* minor) {
*major = elf_api_interface.api_version_major;
*minor = elf_api_interface.api_version_minor;
}

View File

@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,23.0,,
Version,+,23.1,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
@ -960,6 +960,7 @@ Function,+,furi_hal_i2c_write_mem,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t,
Function,+,furi_hal_i2c_write_reg_16,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t, uint32_t"
Function,+,furi_hal_i2c_write_reg_8,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t, uint32_t"
Function,+,furi_hal_info_get,void,"PropertyValueCallback, char, void*"
Function,+,furi_hal_info_get_api_version,void,"uint16_t*, uint16_t*"
Function,-,furi_hal_init,void,
Function,-,furi_hal_init_early,void,
Function,-,furi_hal_interrupt_init,void,

1 entry status name type params
2 Version + 23.0 23.1
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
960 Function + furi_hal_i2c_write_reg_16 _Bool FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t, uint32_t
961 Function + furi_hal_i2c_write_reg_8 _Bool FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t, uint32_t
962 Function + furi_hal_info_get void PropertyValueCallback, char, void*
963 Function + furi_hal_info_get_api_version void uint16_t*, uint16_t*
964 Function - furi_hal_init void
965 Function - furi_hal_init_early void
966 Function - furi_hal_interrupt_init void

View File

@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,23.0,,
Version,+,23.1,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
@ -1148,6 +1148,7 @@ Function,+,furi_hal_ibutton_pin_configure,void,
Function,+,furi_hal_ibutton_pin_reset,void,
Function,+,furi_hal_ibutton_pin_write,void,const _Bool
Function,+,furi_hal_info_get,void,"PropertyValueCallback, char, void*"
Function,+,furi_hal_info_get_api_version,void,"uint16_t*, uint16_t*"
Function,+,furi_hal_infrared_async_rx_set_capture_isr_callback,void,"FuriHalInfraredRxCaptureCallback, void*"
Function,+,furi_hal_infrared_async_rx_set_timeout,void,uint32_t
Function,+,furi_hal_infrared_async_rx_set_timeout_isr_callback,void,"FuriHalInfraredRxTimeoutCallback, void*"

1 entry status name type params
2 Version + 23.0 23.1
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
1148 Function + furi_hal_ibutton_pin_reset void
1149 Function + furi_hal_ibutton_pin_write void const _Bool
1150 Function + furi_hal_info_get void PropertyValueCallback, char, void*
1151 Function + furi_hal_info_get_api_version void uint16_t*, uint16_t*
1152 Function + furi_hal_infrared_async_rx_set_capture_isr_callback void FuriHalInfraredRxCaptureCallback, void*
1153 Function + furi_hal_infrared_async_rx_set_timeout void uint32_t
1154 Function + furi_hal_infrared_async_rx_set_timeout_isr_callback void FuriHalInfraredRxTimeoutCallback, void*

View File

@ -8,6 +8,11 @@
#include <furi.h>
#include <protobuf_version.h>
FURI_WEAK void furi_hal_info_get_api_version(uint16_t* major, uint16_t* minor) {
*major = 0;
*minor = 0;
}
void furi_hal_info_get(PropertyValueCallback out, char sep, void* context) {
FuriString* key = furi_string_alloc();
FuriString* value = furi_string_alloc();
@ -18,10 +23,10 @@ void furi_hal_info_get(PropertyValueCallback out, char sep, void* context) {
// Device Info version
if(sep == '.') {
property_value_out(&property_context, NULL, 2, "format", "major", "3");
property_value_out(&property_context, NULL, 2, "format", "minor", "0");
property_value_out(&property_context, NULL, 2, "format", "minor", "1");
} else {
property_value_out(&property_context, NULL, 3, "device", "info", "major", "2");
property_value_out(&property_context, NULL, 3, "device", "info", "minor", "0");
property_value_out(&property_context, NULL, 3, "device", "info", "minor", "1");
}
// Model name
@ -161,6 +166,13 @@ void furi_hal_info_get(PropertyValueCallback out, char sep, void* context) {
version_get_builddate(firmware_version));
property_value_out(
&property_context, "%d", 2, "firmware", "target", version_get_target(firmware_version));
uint16_t api_version_major, api_version_minor;
furi_hal_info_get_api_version(&api_version_major, &api_version_minor);
property_value_out(
&property_context, "%d", 3, "firmware", "api", "major", api_version_major);
property_value_out(
&property_context, "%d", 3, "firmware", "api", "minor", api_version_minor);
}
if(furi_hal_bt_is_alive()) {

View File

@ -14,6 +14,8 @@
extern "C" {
#endif
void furi_hal_info_get_api_version(uint16_t* major, uint16_t* minor);
/** Get device information
*
* @param[in] callback callback to provide with new data

View File

@ -15,6 +15,10 @@ extern "C" {
#define FURI_WARN_UNUSED __attribute__((warn_unused_result))
#endif
#ifndef FURI_WEAK
#define FURI_WEAK __attribute__((weak))
#endif
#ifndef FURI_IS_IRQ_MASKED
#define FURI_IS_IRQ_MASKED() (__get_PRIMASK() != 0U)
#endif