mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Add version field, make it bitfield struct
This commit is contained in:
@@ -5,12 +5,11 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "tag_base_type.h"
|
||||
|
||||
// 最多八张卡槽
|
||||
#define TAG_MAX_SLOT_NUM 8
|
||||
// u32 size align.
|
||||
#define ALIGN_U32 __attribute__((aligned(4)))
|
||||
|
||||
extern bool g_is_tag_emulating;
|
||||
|
||||
|
||||
@@ -53,11 +53,10 @@ uint8_t settings_save_config(void)
|
||||
|
||||
uint8_t settings_get_animation_config()
|
||||
{
|
||||
return config & 0x3;
|
||||
return config.animation_config;
|
||||
}
|
||||
|
||||
void settings_set_animation_config(uint8_t value)
|
||||
{
|
||||
config &= ~(0x3);
|
||||
config |= value;
|
||||
config.animation_config = value;
|
||||
}
|
||||
|
||||
@@ -3,15 +3,17 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#define SETTINGS_ANIMATION_FULL 0
|
||||
#define SETTINGS_ANIMATION_MINIMAL 1
|
||||
#define SETTINGS_ANIMATION_NONE 2
|
||||
|
||||
/*
|
||||
* bits [0-1]: animation config
|
||||
* bits [2-31]: reserved
|
||||
*/
|
||||
typedef uint32_t settings_data_t;
|
||||
|
||||
typedef struct ALIGN_U32 {
|
||||
uint16_t version;
|
||||
uint16_t animation_config : 2;
|
||||
} settings_data_t;
|
||||
|
||||
void settings_load_config(void);
|
||||
uint8_t settings_save_config(void);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef UTILS_H_
|
||||
#define UTILS_H_
|
||||
|
||||
// u32 size align.
|
||||
#define ALIGN_U32 __attribute__((aligned(4)))
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user