⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 at45db161d.h

📁 通过车载终端采集GPS数据
💻 H
字号:
#ifndef AT45DB161D_HEADER
#define AT45DB161D_HEADER

/***********read commands**************/
#define READ_MAINPAGE 0xd2
#define READ_LEG_CONARRAY 0xe8
#define READ_LOW_CONARRAY 0x03
#define READ_HIGH_CONARRAY 0x0b
#define READ_LOW_BUF1 0xd1
#define READ_LOW_BUF2 0xd3
#define READ_BUF1 0xd4
#define READ_BUF2 0xd6


/**************program and erase commands**********/
#define WRITE_BUF1 0x84
#define WRITE_BUF2 0x87
#define PROGRAM_BUF1TOMAIN_IN 0x83
#define PROGRAM_BUF2TOMAIN_IN 0x86
#define PROGRAM_BUF1TOMAIN_OUT 0x88
#define PROGRAM_BUF2TOMAIN_OUT 0x89
#define ERASE_PAGE 0x81
#define ERASE_BLOCK 0x50
#define ERASE_SECTOR 0x7c
#define PROGRAM_PAGE_BYBUF1 0x82
#define PROGRAM_PAGE_BYBUF2 0x85

/**************additional commands***************/
#define READ_STATUS_REG 0xd7
#define READ_DEVICEID 0x9f

/******************manufacturer information****************/
#define MANU_ID 0x1f
#define DEVICE_ID1 0x26
#define DEVICE_ID2 0x0
#define DEVICE_ID3 0x0

/**********************
*在读flash时需要用到的初始化
**********************/
//void at45_init_read();

/*****************************
*在写flash时需要用到的初始化
*******************************/
void at45_init_write();

/***************************
*本函数需要在命令已经输入的情况下在调用
***************************/
void at45_readdataout(Byte nLen, Byte* pBuf);

/***********************************
*读数据命令输入
*************************************/
//void command_legacy_conread(Uint16 pageAddr, Uint16 byteAddr);

void command_high_conread(Uint16 pageAddr, Uint16 byteAddr);

void command_low_conread(Uint16 pageAddr, Uint16 byteAddr);

/**************buffer write***************/
/*bufNum:1 表示要写buffer1; 2 表示要写buffer2
/*startAddr:要写的buf首地址
/*pBuf:要写入的内容
/*nLen:需要写入的长度
/******************************************/
/*******15+9**********/
void buffer_write(Byte bufNum, Uint16 startAddr, Uint16 nLen, Byte* pBuf);

void buffer_write_onepage(Byte bufNum, Byte* pBuf1, Byte* pBuf2, Byte* pBuf3, Byte* pBuf4);


void buffer_to_mainPage_builtin(Byte bufNum, Uint16 pageAddr);

void buffer_to_mainPage_noErase(Byte bufNum, Uint16 pageAddr);

void page_erase(Uint16 pageAddr);

void block_erase(Uint16 BlockAddr);

/***************************************
sectorAddr:1-15   1-15个sector
           16     0a
           17     0b
*****************************************/
void sector_erase(Byte sectorAddr);

void chip_erase();

/********3+12+9***********/
void program_page_throughbuf(Byte bufNum, Uint16 bufAddr, Uint16 pageAddr, Uint16 nLen, Byte* pBuf);


/*********编程1页用四段缓冲*************/
/*每段缓冲的大小为128Byte
/*buffer起始地址为0
/****************************************/
void program_onepage_throughbuf(Byte bufNum, Uint16 pageAddr, Byte* pBuf1, Byte* pBuf2, Byte* pBuf3, Byte* pBuf4);

Byte read_status_register();

void  Program_configure_reg();

/*******************
*读取ID号
*返回值:OK表示值吻合
        KO表示不对
*******************/
Byte read_deviceid();

void check_toready();
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -