eeprom.c
来自「一个完整的用AVR写的电话交换机程序 希望对从事安防的开发者有用」· C语言 代码 · 共 51 行
C
51 行
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/wdt.h>
#include <avr/eeprom.h>
#include "main.h"
unsigned char Id1_Eeprom[cIDMax] __attribute__((section(".eeprom")));
unsigned char Id2_Eeprom[cIDMax] __attribute__((section(".eeprom")));
unsigned char Key_Eeprom[cIDMax] __attribute__((section(".eeprom")));
unsigned char Path_Eeprom[cIDMax] __attribute__((section(".eeprom"))); // Sav the senses
unsigned char Path2_Eeprom[cIDMax] __attribute__((section(".eeprom"))); // Sav the senses
unsigned char RecodeNM_Eeprom __attribute__((section(".eeprom")));
unsigned char LeftNM_Eeprom[4] __attribute__((section(".eeprom")));
//unsigned char RightNM_Eeprom[4] __attribute__((section(".eeprom")));
unsigned char ID_HEeprom __attribute__((section(".eeprom")));
unsigned char ID_LEeprom __attribute__((section(".eeprom")));
//unsigned char RFKey_Eeprom __attribute__((section(".eeprom")));
void Eeprom_Init(void)
{
uint8_t i;
eeprom_busy_wait(); //-----------网络按钮ID
Recode_Count=eeprom_read_byte(&RecodeNM_Eeprom);
if ( Recode_Count > cIDMax ) Recode_Count =0;
for(i=0;i<Recode_Count;i++)
{
eeprom_busy_wait();
Information_Id1[i]=eeprom_read_byte(Id1_Eeprom+i);
eeprom_busy_wait();
Information_Id2[i]=eeprom_read_byte(Id2_Eeprom+i);
eeprom_busy_wait();
Information_Key[i]=eeprom_read_byte(Key_Eeprom+i);
eeprom_busy_wait();
Information_Path[i]=eeprom_read_byte(Path_Eeprom+i);
eeprom_busy_wait();
Information_Path2[i]=eeprom_read_byte(Path2_Eeprom+i);
}
for(i=0;i<4;i++) //-------------设备名称
{
eeprom_busy_wait();
mName[i]=eeprom_read_byte(LeftNM_Eeprom+i);
}
//--------------设备ID号
eeprom_busy_wait(); mID[0]=eeprom_read_byte(&ID_HEeprom);
eeprom_busy_wait(); mID[1]=eeprom_read_byte(&ID_LEeprom);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?