swixteen  0.03
Switch a lamp on/off with X10 RF commands
 All Files Functions Variables Macros Pages
SendPreamble.c
Go to the documentation of this file.
1 #include <stdio.h>
2 
3 #include "../config.h"
4 #include "../Common/Common.h"
5 #include "../Sysfs/Sysfs.h"
6 #include "../MarmitekX10/MarmitekX10.h"
7 
12 int SendPreamble( void )
13  {
14  int rc=0;
15 
16  /* Set sender on */
18 
19  /*
20  * Preamble is high for 9 mS and low for 4.5 mS
21  */
22  Timing.tv_sec = 0;
23  Timing.tv_nsec = 9000000;
24  if( nanosleep( &Timing, &Remaining) != 0 )
25  {
26  fprintf( stderr, "201309131153 Timing failed\n" );
27  rc=-1;
28  }
29 
30  /* Set sender off */
32 
33  Timing.tv_sec = 0;
34  Timing.tv_nsec = 4500000;
35  if( nanosleep( &Timing, &Remaining) != 0 )
36  {
37  fprintf( stderr, "201309131154 Timing failed\n" );
38  rc=-1;
39  }
40 
41  return(rc);
42  }