|
|
@ -96,7 +96,8 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// empty constructor for child classes
|
|
|
|
// empty constructor for child classes
|
|
|
|
AP_Param() {} |
|
|
|
AP_Param() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// a token used for first()/next() state
|
|
|
|
// a token used for first()/next() state
|
|
|
|
typedef struct { |
|
|
|
typedef struct { |
|
|
@ -108,7 +109,8 @@ public: |
|
|
|
// return true if AP_Param has been initialised via setup()
|
|
|
|
// return true if AP_Param has been initialised via setup()
|
|
|
|
static bool initialised(void); |
|
|
|
static bool initialised(void); |
|
|
|
|
|
|
|
|
|
|
|
/// Copy the variable's name, prefixed by any containing group name, to a buffer.
|
|
|
|
/// Copy the variable's name, prefixed by any containing group name, to a
|
|
|
|
|
|
|
|
/// buffer.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// If the variable has no name, the buffer will contain an empty string.
|
|
|
|
/// If the variable has no name, the buffer will contain an empty string.
|
|
|
|
///
|
|
|
|
///
|
|
|
@ -199,16 +201,16 @@ private: |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* This header is prepended to a variable stored in EEPROM.
|
|
|
|
/* This header is prepended to a variable stored in EEPROM.
|
|
|
|
The meaning is as follows: |
|
|
|
* The meaning is as follows: |
|
|
|
|
|
|
|
* |
|
|
|
- key: the k_param enum value from Parameter.h in the sketch |
|
|
|
* - key: the k_param enum value from Parameter.h in the sketch |
|
|
|
|
|
|
|
* |
|
|
|
- group_element: This is zero for top level parameters. For |
|
|
|
* - group_element: This is zero for top level parameters. For |
|
|
|
parameters stored within an object this is divided |
|
|
|
* parameters stored within an object this is divided |
|
|
|
into 3 lots of 6 bits, allowing for three levels |
|
|
|
* into 3 lots of 6 bits, allowing for three levels |
|
|
|
of object to be stored in the eeprom |
|
|
|
* of object to be stored in the eeprom |
|
|
|
|
|
|
|
* |
|
|
|
- type: the ap_var_type value for the variable |
|
|
|
* - type: the ap_var_type value for the variable |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
struct Param_header { |
|
|
|
struct Param_header { |
|
|
|
uint32_t key : 8; |
|
|
|
uint32_t key : 8; |
|
|
@ -227,29 +229,48 @@ private: |
|
|
|
static bool check_group_info(const struct GroupInfo *group_info, uint16_t *total_size, uint8_t max_bits); |
|
|
|
static bool check_group_info(const struct GroupInfo *group_info, uint16_t *total_size, uint8_t max_bits); |
|
|
|
static bool duplicate_key(uint8_t vindex, uint8_t key); |
|
|
|
static bool duplicate_key(uint8_t vindex, uint8_t key); |
|
|
|
static bool check_var_info(void); |
|
|
|
static bool check_var_info(void); |
|
|
|
const struct Info *find_var_info_group(const struct GroupInfo *group_info, |
|
|
|
const struct Info * find_var_info_group( |
|
|
|
|
|
|
|
const struct GroupInfo * group_info, |
|
|
|
uint8_t vindex, |
|
|
|
uint8_t vindex, |
|
|
|
uint8_t group_base, |
|
|
|
uint8_t group_base, |
|
|
|
uint8_t group_shift, |
|
|
|
uint8_t group_shift, |
|
|
|
uint8_t * group_element, |
|
|
|
uint8_t * group_element, |
|
|
|
const struct GroupInfo ** group_ret, |
|
|
|
const struct GroupInfo ** group_ret, |
|
|
|
uint8_t * idx); |
|
|
|
uint8_t * idx); |
|
|
|
const struct Info *find_var_info(uint8_t *group_element, |
|
|
|
const struct Info * find_var_info( |
|
|
|
|
|
|
|
uint8_t * group_element, |
|
|
|
const struct GroupInfo ** group_ret, |
|
|
|
const struct GroupInfo ** group_ret, |
|
|
|
uint8_t * idx); |
|
|
|
uint8_t * idx); |
|
|
|
static const struct Info *find_by_header_group(struct Param_header phdr, void **ptr, |
|
|
|
static const struct Info * find_by_header_group( |
|
|
|
|
|
|
|
struct Param_header phdr, void **ptr, |
|
|
|
uint8_t vindex, |
|
|
|
uint8_t vindex, |
|
|
|
const struct GroupInfo *group_info, |
|
|
|
const struct GroupInfo *group_info, |
|
|
|
uint8_t group_base, |
|
|
|
uint8_t group_base, |
|
|
|
uint8_t group_shift); |
|
|
|
uint8_t group_shift); |
|
|
|
static const struct Info *find_by_header(struct Param_header phdr, void **ptr); |
|
|
|
static const struct Info * find_by_header( |
|
|
|
void add_vector3f_suffix(char *buffer, size_t buffer_size, uint8_t idx); |
|
|
|
struct Param_header phdr, |
|
|
|
static AP_Param *find_group(const char *name, uint8_t vindex, const struct GroupInfo *group_info, enum ap_var_type *ptype); |
|
|
|
void **ptr); |
|
|
|
|
|
|
|
void add_vector3f_suffix( |
|
|
|
|
|
|
|
char *buffer, |
|
|
|
|
|
|
|
size_t buffer_size, |
|
|
|
|
|
|
|
uint8_t idx); |
|
|
|
|
|
|
|
static AP_Param * find_group( |
|
|
|
|
|
|
|
const char *name, |
|
|
|
|
|
|
|
uint8_t vindex, |
|
|
|
|
|
|
|
const struct GroupInfo *group_info, |
|
|
|
|
|
|
|
enum ap_var_type *ptype); |
|
|
|
static void write_sentinal(uint16_t ofs); |
|
|
|
static void write_sentinal(uint16_t ofs); |
|
|
|
bool scan(const struct Param_header *phdr, uint16_t *pofs); |
|
|
|
bool scan( |
|
|
|
|
|
|
|
const struct Param_header *phdr, |
|
|
|
|
|
|
|
uint16_t *pofs); |
|
|
|
static const uint8_t type_size(enum ap_var_type type); |
|
|
|
static const uint8_t type_size(enum ap_var_type type); |
|
|
|
static void eeprom_write_check(const void *ptr, uint16_t ofs, uint8_t size); |
|
|
|
static void eeprom_write_check( |
|
|
|
static AP_Param *next_group(uint8_t vindex, const struct GroupInfo *group_info, |
|
|
|
const void *ptr, |
|
|
|
|
|
|
|
uint16_t ofs, |
|
|
|
|
|
|
|
uint8_t size); |
|
|
|
|
|
|
|
static AP_Param * next_group( |
|
|
|
|
|
|
|
uint8_t vindex,
|
|
|
|
|
|
|
|
const struct GroupInfo *group_info, |
|
|
|
bool *found_current, |
|
|
|
bool *found_current, |
|
|
|
uint8_t group_base, |
|
|
|
uint8_t group_base, |
|
|
|
uint8_t group_shift, |
|
|
|
uint8_t group_shift, |
|
|
|