104 lines
2.9 KiB
C
104 lines
2.9 KiB
C
|
|
/* USER CODE BEGIN Header */
|
|||
|
|
/**
|
|||
|
|
******************************************************************************
|
|||
|
|
* @file : ht24lc02_eeprom.h
|
|||
|
|
* @brief : <EFBFBD><EFBFBD><EFBFBD>ݴ洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* @version : 1.0
|
|||
|
|
* @changelog : version 1.0 <EFBFBD><EFBFBD>ʼ<EFBFBD>汾 2025.11.13
|
|||
|
|
******************************************************************************
|
|||
|
|
* @attention
|
|||
|
|
*
|
|||
|
|
* Copyright (c) 2025 Yuwell Software Danyang.Jiangsu.China
|
|||
|
|
* THIS SOFTWARE is licensed under the Mulan PSL v1.
|
|||
|
|
* can use this software according to the terms and conditions of the Mulan PSL v1.
|
|||
|
|
* You may obtain a copy of Mulan PSL v1 at:
|
|||
|
|
* http://license.coscl.org.cn/MulanPSL
|
|||
|
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
|||
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
|||
|
|
* PURPOSE.
|
|||
|
|
* See the Mulan PSL v1 for more details.
|
|||
|
|
*
|
|||
|
|
******************************************************************************
|
|||
|
|
*/
|
|||
|
|
/* USER CODE END Header */
|
|||
|
|
|
|||
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|||
|
|
#ifndef __HT24LC02_EEPROM_H
|
|||
|
|
#define __HT24LC02_EEPROM_H
|
|||
|
|
|
|||
|
|
#ifdef __cplusplus
|
|||
|
|
extern "C" {
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#include <stdint.h>
|
|||
|
|
#include "fm33lg0xx_fl.h"
|
|||
|
|
#include "fm33lg0xx_queue.h"
|
|||
|
|
#include "fm33lg0xx_event.h"
|
|||
|
|
|
|||
|
|
/*************** Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *******************/
|
|||
|
|
#define EEPROM_24LC02_SDA_GROUP GPIOB
|
|||
|
|
#define EEPROM_24LC02_SDA_PIN FL_GPIO_PIN_3
|
|||
|
|
|
|||
|
|
#define EEPROM_24LC02_SCL_GROUP GPIOB
|
|||
|
|
#define EEPROM_24LC02_SCL_PIN FL_GPIO_PIN_1
|
|||
|
|
|
|||
|
|
#define EEPROM_24LC02_WP_GROUP GPIOB
|
|||
|
|
#define EEPROM_24LC02_WP_PIN FL_GPIO_PIN_0
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*************** <20>洢оƬ<D0BE><C6AC><EFBFBD><EFBFBD> *******************/
|
|||
|
|
#define HT24LC02_ADDR 0xA0 // I2C<32><43>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д0 <20><>1<EFBFBD><31>
|
|||
|
|
|
|||
|
|
#define BLOCK_INDEX_SAVE_ADDR 0x00 // ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
#define HT24LC02_ADDR_MAX 0xFF // оƬ<D0BE><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2>ַ
|
|||
|
|
|
|||
|
|
#define EEPROM_TOTAL_BYTES 256
|
|||
|
|
#define BLOCK_NUM 64 // 4<>ֽ<EFBFBD>/<2F>飬<EFBFBD><E9A3AC>64<36><34>
|
|||
|
|
#define BLOCK_SIZE 4 // ÿ<><C3BF><EFBFBD>洢1<E6B4A2><31>uint32_t<5F><74>4<EFBFBD>ֽڣ<D6BD>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#define ADC_BOUNDARY_ELEC_LOW_INDEX (3)
|
|||
|
|
|
|||
|
|
|
|||
|
|
typedef enum
|
|||
|
|
{
|
|||
|
|
INDEX_TOTAL_HOURS = 1,
|
|||
|
|
INDEX_TOTAL_MINUTES,
|
|||
|
|
INDEX_E1_PRESS_LOW,
|
|||
|
|
INDEX_E2_PRESS_HIGH,
|
|||
|
|
INDEX_E4_ELEC_HIGH,
|
|||
|
|
INDEX_E7_220V_LOW,
|
|||
|
|
INDEX_LAST_CLEAN_FILTER_HOURS, // <20>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
INDEX_LAST_REPLACE_FILTER_HOURS, // <20>ϴθ<CFB4><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
|
|||
|
|
}EEPROM_SAVED_PARAM_INDEX;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#define EEPROM_E5_NTC_HIGH_VALUE (65) // <20><><EFBFBD>϶<EFBFBD>
|
|||
|
|
#define EEPROM_E3_ELEC_LOW_VALUE (100) // mA
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*************** <20><><EFBFBD><EFBFBD>API<50><49><EFBFBD><EFBFBD> *******************/
|
|||
|
|
void eeprom_ht24lc02_init(void);
|
|||
|
|
void eeprom_ht24lc02_save_task(MessageQueue* queue);
|
|||
|
|
|
|||
|
|
void ht24lc02_word_write(uint32_t word, uint8_t addr_index);
|
|||
|
|
|
|||
|
|
|
|||
|
|
#ifdef __cplusplus
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#endif /* __HT24LC02_EEPROM_H */
|
|||
|
|
|
|||
|
|
/************************ (C) COPYRIGHT Yuwell *****END OF FILE****/
|