| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #ifndef __SOFT_FLASH_H
- #define __SOFT_FLASH_H
- #include "pilot_navigation.h"
- #include <stdbool.h>
- #include <stdint.h>
- #define TOTAL_PAGE 4096
- //前10页用来存储用户配置。
- #define pidinf_addr (512 * 16)
- #define verinf_addr (512 * 24)
- #define confinf_addr (512 * 32)
- //===IAP地址不能更改,更改后BOOTLOADER也要改
- #define IAP_ADDR (512 * 5)
- #define caminf_addr (512 * 40)
- #define parinf_addr (512 * 48)
- //第11页,一整页用来存储数据的结束地址。一整页写入比字节写入要节约一半时间
- // #define DATA_END_ADDR (512 * 11)
- // #define DATA_END_PAGE (11)
- //第12页,一整页用来存储POS总数。一整页写入比字节写入要节约一半时间
- #define POS_TOTAL_ADDR (512 * 56)
- #define POS_TOTAL_PAGE (12)
- // 禁飞区存储地址
- #define NO_FLY_ZONE_ADDR (512 * 64)
- // 每条禁飞区占用的长度为 2字节是否有效标志 + 1 字节总条数 +
- // 1 字节当前条顶点个数 + (8 × 3 × 4) 字节数据 = 100 字节
- #define SIZE_OF_ONE_NO_FLY_ZONE (2 + 1 + 1 + (8 * 3 * 4))
- // 第一点调整的高度
- #define FPALTCHANGE_ADDR (512 * 80)
- #define BREAKPOINT_ADDR (512 * 88)
- //第一个航点存储在 WAYPOINT_ADDR+sizeof(waypoint)中,预留100页用来存储航点
- //按照最多1500个航点,sizeof(waypoint) =
- // 28,每页512字节,总共需要83页的FLASH空间。
- #define WAYPOINT_ADDR (512 * 96)
- //存储POS的开始地址,预留100页用来记录POS,
- //按照sizeof(photopoint) =
- // 32,每页512字节,200页可以记录3200个POS信息,暂时限制记录3000POS
- #define POS_START_PAGE 200
- //数据记录的开始地址
- // #define DATA_START_PAGE 400
- extern bool write_pid_information, write_conf_information,
- write_par_information, write_cam_information, write_ver_information,
- write_waypoint_information, write_breakpoint_information,
- write_pos_information, write_postotal_information, write_iap_flag,
- write_rcfactor_flag, write_custom_noflyzone;
- void flash_at45db_initial(void);
- bool flash_isexist(void);
- bool flash_isbusy(void);
- void flash_read_bytes(unsigned int add, unsigned char *pdata,
- unsigned short len);
- void flash_write_bytes(unsigned int add, unsigned char *pdata,
- unsigned short len);
- short flash_read_int16(unsigned int add);
- void flash_write_int16(unsigned int add, short wvalue);
- void flash_read_page(unsigned short Page_Add, unsigned char *pdata);
- void flash_write_page(unsigned short page, unsigned char *Data);
- void flash_write_bytes_ononepage(unsigned short page, unsigned char *pdata,
- unsigned short len);
- void initial_parameters(void);
- void write_par_to_flash(void);
- #endif
|