17 #ifndef __BLUENRG_UTILS_H 18 #define __BLUENRG_UTILS_H 41 typedef __packed
struct{
68 #define FROM_US_TO_SYS_TIME(us) ((uint16_t)(us/2.4414)+1) 69 #define FROM_SYS_TIME_TO_US(sys) ((uint16_t)(sys*2.4414)) 72 #define BCD_TO_INT(bcd) ((bcd & 0xF) + ((bcd & 0xF0) >> 4)*10) 75 #define INT_TO_BCD(n) ((((uint8_t)n/10)<<4) + (uint8_t)n%10) 80 #define BLE_UTIL_SUCCESS 0 81 #define BLE_UTIL_UNSUPPORTED_VERSION 1 82 #define BLE_UTIL_WRONG_IMAGE_SIZE 2 83 #define BLE_UTIL_ACI_ERROR 3 84 #define BLE_UTIL_CRC_ERROR 4 85 #define BLE_UTIL_PARSE_ERROR 5 86 #define BLE_UTIL_WRONG_VERIFY 6 118 uint8_t
verify_IFR(
const IFR_config_TypeDef *ifr_data);
126 int program_IFR(
const IFR_config_TypeDef *ifr_image);
uint16_t hs_startup_time
Definition: bluenrg_utils.h:54
uint32_t unused[5]
Definition: bluenrg_utils.h:61
uint8_t cold_ana_act_config_table[64]
Definition: bluenrg_utils.h:42
uint8_t isHWBootloader_Patched(void)
Verifies if the bootloader is patched or not. This function shall be used to fix a bug on the HW boot...
Definition: bluenrg_utils.c:388
uint16_t slave_sca_ppm
Definition: bluenrg_utils.h:51
void change_IFR_data_config(IFR_config2_TypeDef *IFR_config, uint8_t data[64])
Modify IFR data. (Last 64-bytes block).
Definition: bluenrg_utils.c:236
uint8_t rsrvd1[2]
Definition: bluenrg_utils.h:46
uint8_t rsrvd5
Definition: bluenrg_utils.h:57
uint8_t hot_ana_config_table[64]
Definition: bluenrg_utils.h:43
int program_device(const uint8_t *fw_image, uint32_t fw_size)
Flash a new firmware using internal bootloader.
Definition: bluenrg_utils.c:87
int read_IFR(uint8_t data[192])
Read raw data from IFR (3 64-bytes blocks).
int IFR_validate(IFR_config2_TypeDef *IFR_config)
Check for the correctness of parsed data.
Definition: bluenrg_utils.c:214
uint32_t ls_crystal_period
Definition: bluenrg_utils.h:49
uint8_t master_sca
Definition: bluenrg_utils.h:52
uint16_t slave_sca_ppm
Definition: bluenrg_utils.h:33
int program_IFR(const IFR_config_TypeDef *ifr_image)
Program raw data to IFR (3 64-bytes blocks).
Definition: bluenrg_utils.c:248
void parse_IFR_data_config(const uint8_t data[64], IFR_config2_TypeDef *IFR_config)
Parse IFR raw data.
Definition: bluenrg_utils.c:203
uint8_t gpio_config
Definition: bluenrg_utils.h:45
uint32_t uid
Definition: bluenrg_utils.h:56
uint8_t day
Definition: bluenrg_utils.h:30
uint8_t day
Definition: bluenrg_utils.h:60
uint8_t getBlueNRGUpdaterVersion(uint8_t *version)
Get BlueNRG updater version.
Definition: bluenrg_utils.c:370
Definition: bluenrg_utils.h:28
uint32_t max_conn_event_time
Definition: bluenrg_utils.h:48
uint8_t stack_mode
Definition: bluenrg_utils.h:44
uint8_t month
Definition: bluenrg_utils.h:31
uint8_t rsrvd4[2]
Definition: bluenrg_utils.h:55
uint8_t month
Definition: bluenrg_utils.h:59
#define PACKED
Definition: bluenrg_types.h:63
uint8_t getBlueNRGVersion(uint8_t *hwVersion, uint16_t *fwVersion)
Get BlueNRG hardware and firmware version.
Definition: bluenrg_utils.c:351
uint8_t rsrvd3
Definition: bluenrg_utils.h:53
uint8_t master_sca
Definition: bluenrg_utils.h:34
uint32_t ls_crystal_freq
Definition: bluenrg_utils.h:50
uint8_t verify_IFR(const IFR_config_TypeDef *ifr_data)
Verify raw data from IFR (3 64-bytes blocks).
Definition: bluenrg_utils.c:325
uint32_t rsrvd2[3]
Definition: bluenrg_utils.h:47
__packed struct @0 IFR_config_TypeDef
const IFR_config_TypeDef IFR_config
uint8_t year
Definition: bluenrg_utils.h:32
uint8_t stack_mode
Definition: bluenrg_utils.h:29
uint8_t year
Definition: bluenrg_utils.h:58
uint16_t hs_startup_time
Definition: bluenrg_utils.h:35