mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Added setting option for BLE connection key.
This commit is contained in:
@@ -41,12 +41,19 @@ void settings_init_button_long_press_config(void) {
|
||||
config.button_b_long_press = SettingsButtonCloneIcUid;
|
||||
}
|
||||
|
||||
// add on version4
|
||||
void settings_init_ble_connect_key_config(void) {
|
||||
uint8_t p_key_u8[] = DEFAULT_BLE_CONNECT_KEY;
|
||||
settings_set_ble_connect_key(p_key_u8);
|
||||
}
|
||||
|
||||
void settings_init_config(void) {
|
||||
settings_update_version_for_config();
|
||||
// add on version1
|
||||
config.animation_config = SettingsAnimationModeFull;
|
||||
settings_init_button_press_config();
|
||||
settings_init_button_long_press_config();
|
||||
settings_init_ble_connect_key_config();
|
||||
}
|
||||
|
||||
void settings_migrate(void) {
|
||||
@@ -61,6 +68,9 @@ void settings_migrate(void) {
|
||||
case 2:
|
||||
settings_init_button_long_press_config();
|
||||
|
||||
case 3:
|
||||
settings_init_ble_connect_key_config();
|
||||
|
||||
/*
|
||||
* Add new migration steps ABOVE THIS COMMENT
|
||||
* `settings_update_version_for_config()` and `break` statements should only be used on the last migration step, all the previous steps must fall
|
||||
@@ -243,3 +253,16 @@ void settings_set_long_button_press_config(char which, uint8_t value) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t* settings_get_ble_connect_key(void) {
|
||||
return config.ble_connect_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pointer to 6-digit ASCII string (digit 0..9 only, no NULL termination) passkey to be used during pairing.
|
||||
*
|
||||
* @param key Ble connect key for your device
|
||||
*/
|
||||
void settings_set_ble_connect_key(uint8_t* key) {
|
||||
memcpy(config.ble_connect_key, key, BLE_CONNECT_KEY_LEN_MAX);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#define SETTINGS_CURRENT_VERSION 3
|
||||
#define SETTINGS_CURRENT_VERSION 4
|
||||
#define BLE_CONNECT_KEY_LEN_MAX 6
|
||||
#define DEFAULT_BLE_CONNECT_KEY "123456" // length must == 6
|
||||
|
||||
typedef enum {
|
||||
SettingsAnimationModeFull = 0U,
|
||||
@@ -40,9 +42,11 @@ typedef struct ALIGN_U32 {
|
||||
uint8_t button_a_long_press : 4;
|
||||
uint8_t button_b_long_press : 4;
|
||||
|
||||
// 7 byte
|
||||
uint32_t reserved1 : 24; // If you are add bigValue(not 1 or 0) field, reallocating me.
|
||||
uint32_t reserved2; // see top.
|
||||
// 6 byte
|
||||
uint8_t ble_connect_key[6];
|
||||
|
||||
// 1 byte
|
||||
uint8_t reserved1; // see bottom.
|
||||
|
||||
/*
|
||||
* Warning !!!!!!!!!!!!!!!!!!!!!! <-------------
|
||||
@@ -63,5 +67,6 @@ uint8_t settings_get_long_button_press_config(char which);
|
||||
void settings_set_button_press_config(char which, uint8_t value);
|
||||
void settings_set_long_button_press_config(char which, uint8_t value);
|
||||
bool is_settings_button_type_valid(char type);
|
||||
|
||||
uint8_t* settings_get_ble_connect_key(void);
|
||||
void settings_set_ble_connect_key(uint8_t* key);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user