reformat in uvostyle
This commit is contained in:
@ -7,63 +7,63 @@ unsigned char _pin = PB5;
|
||||
|
||||
void WirelessRelay::sendId()
|
||||
{
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(LARGE_TIME);
|
||||
|
||||
for(short i = 0; i<10; i++)
|
||||
{
|
||||
sendBit( id & 1 << (15 - i) );
|
||||
}
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(LARGE_TIME);
|
||||
|
||||
for(short i = 0; i<10; i++)
|
||||
{
|
||||
sendBit( id & 1 << (15 - i) );
|
||||
}
|
||||
}
|
||||
|
||||
void WirelessRelay::sendBit(const bool in)
|
||||
{
|
||||
switch(in)
|
||||
{
|
||||
case true:
|
||||
//Der Code fuer '0'
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(LARGE_TIME);
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(LARGE_TIME);
|
||||
break;
|
||||
void WirelessRelay::sendBit(const bool in)
|
||||
{
|
||||
switch(in)
|
||||
{
|
||||
case true:
|
||||
//Der Code fuer '0'
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(LARGE_TIME);
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(LARGE_TIME);
|
||||
break;
|
||||
|
||||
case false:
|
||||
//Der Code fuer '1'
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(LARGE_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(LARGE_TIME);
|
||||
break;
|
||||
}
|
||||
case false:
|
||||
//Der Code fuer '1'
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(LARGE_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,true);
|
||||
_delay_us(SMALL_TIME);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(LARGE_TIME);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WirelessRelay::sync()
|
||||
{
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(SMALL_TIME*31);
|
||||
writePin(_port,_pin,false);
|
||||
_delay_us(SMALL_TIME*31);
|
||||
}
|
||||
|
||||
void WirelessRelay::setValue(const uint8_t value)
|
||||
{
|
||||
lastValue = value;
|
||||
for(short z = 0; z<10; z++)
|
||||
{
|
||||
sendId();
|
||||
sendBit(value);
|
||||
sendBit(!value);
|
||||
sync();
|
||||
}
|
||||
for(short z = 0; z<10; z++)
|
||||
{
|
||||
sendId();
|
||||
sendBit(value);
|
||||
sendBit(!value);
|
||||
sync();
|
||||
}
|
||||
}
|
||||
|
||||
void WirelessRelay::resend()
|
||||
@ -73,13 +73,13 @@ void WirelessRelay::resend()
|
||||
|
||||
WirelessRelay::WirelessRelay(const uint16_t idIn, char nameIn[])
|
||||
{
|
||||
id = idIn;
|
||||
setName(nameIn);
|
||||
type = 0;
|
||||
id = idIn;
|
||||
setName(nameIn);
|
||||
type = 0;
|
||||
}
|
||||
|
||||
WirelessRelay::WirelessRelay(const Item& item)
|
||||
{
|
||||
Item::operator=(item);
|
||||
type = 0;
|
||||
Item::operator=(item);
|
||||
type = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user