Удалить 'device_address.c'
This commit is contained in:
parent
7819975461
commit
8fcf65ba66
@ -1,41 +0,0 @@
|
|||||||
#include "device_address.h"
|
|
||||||
|
|
||||||
#define DEFAULT_MODBUS_ADDRESS (32)
|
|
||||||
|
|
||||||
uint8_t EEPROM_ReadByte(uint8_t __eeprom*adr)
|
|
||||||
{
|
|
||||||
while (EECR & (1<<EEWE));
|
|
||||||
EEAR = (uint16_t)adr;
|
|
||||||
EECR |= (1<<EERE);
|
|
||||||
return EEDR;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EEPROM_WriteByte(uint8_t __eeprom*adr, uint8_t value)
|
|
||||||
{
|
|
||||||
while (EECR & (1<<EEWE));
|
|
||||||
EEAR = (uint16_t)adr;
|
|
||||||
EEDR = value;
|
|
||||||
EECR |= (1<<EEMWE);
|
|
||||||
EECR |= (1<<EEWE);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_device_address(void)
|
|
||||||
{
|
|
||||||
return EEPROM_ReadByte(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_device_address(uint8_t address)
|
|
||||||
{
|
|
||||||
EEPROM_WriteByte(0, address);
|
|
||||||
EEPROM_WriteByte(1, ~address);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_default_address(void)
|
|
||||||
{
|
|
||||||
return DEFAULT_MODBUS_ADDRESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int is_valid_device_address(void)
|
|
||||||
{
|
|
||||||
return (EEPROM_ReadByte(0) ^ EEPROM_ReadByte(1) == 0xFF);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user