swixteen  0.03
Switch a lamp on/off with X10 RF commands
 All Files Functions Variables Macros Pages
SendOldElroRfCode.c
Go to the documentation of this file.
1 #include <stdio.h>
2 
3 #include "../config.h"
4 #include "../OldElro/OldElro.h"
5 #include "../Commands/Commands.h"
6 
11 int SendOldElroRfCode( unsigned char Address, unsigned char Action )
12  {
13  unsigned char BitMask;
14 
15  /* send Address */
16  BitMask=128; /* Start reading the byte at bit 7 */
17  while( BitMask > 0 )
18  {
19  SendOldElroBit(Address & BitMask); /* if Mask and Addres are not 0, the bit is on */
20  BitMask = BitMask >> 1; /* shift mask to the right, bit 7 is send first */
21  }
22 
23  /* send Action */
24  BitMask=8; /* Start reading the nibble at bit 3 */
25  while( BitMask > 0 )
26  {
27  SendOldElroBit(Action & BitMask); /* if Mask and Addres are not 0, the bit is on */
28  BitMask = BitMask >> 1; /* shift mask to the right, bit 4 is send first */
29  }
30 
32 
33  return(0);
34  }