/*******************************************************************************
 * @file	fstorage.h
 * @author	CandyPops Co.
 * @version V1.0.0
 * @date	2022-09-05
 * @brief	
 ******************************************************************************/

#ifndef IHP_FSTORAGE_H_
#define IHP_FSTORAGE_H_

#include "sdk_config.h"

#include "nordic_common.h"
#include <stdint.h>

#pragma pack(1)
typedef struct
{
	uint32_t 	magic_number;       /* 4B  - 0x20231226 */
	char        hw_no[12];          /* 12B - HW Number */
	char        serial_no[12];      /* 12B - Serial Number */
	uint8_t     static_passkey[6];  /* 6B  - BLE Passkey */
	uint8_t     bond_data_delete;   /* 1B  - Bond delete flag */
	int8_t      reset_status;       /* 1B  - Reset status */
	uint8_t     pd_adc_cnt;         /* 1B  - ADC sample count */
	uint16_t    pd_delay_us;        /* 2B  - PD delay (us) */
	uint32_t    life_cycle;         /* 4B  - Device usage count (sxz/syz command) */
} config_data_t;  /* Total: 45 bytes - FDS에 저장하는 디바이스 설정 */

extern config_data_t m_config;

void fds_default_value_set(void);
void config_load( void );
void config_save( void );

void fs_set_value(void);
void fs_storage_init(void);

#endif /* IHP_FSTORAGE_H_ */

