swixteen
0.03
Switch a lamp on/off with X10 RF commands
Main Page
Files
File List
Globals
All
Files
Functions
Variables
Macros
Pages
Sysfs
SwitchSender.c
Go to the documentation of this file.
1
#include <fcntl.h>
2
#include <stdio.h>
3
#include <sys/stat.h>
4
#include <sys/types.h>
5
#include <unistd.h>
6
7
#include "../Sysfs/Sysfs.h"
8
#include "../config.h"
9
15
int
SwitchSender
(
int
State)
16
{
17
/* fprintf( stderr, "State will be: %i\n", State); */
18
switch
( State )
19
{
20
case
0:
21
if
( write(
GpioPinFd
,
"0"
, 1 ) != 1)
22
{
23
fprintf(stderr,
"201309202359 Failed to write State!\n"
);
24
return
(-1);
25
}
26
break
;
27
case
1:
28
if
( write(
GpioPinFd
,
"1"
, 1 ) != 1)
29
{
30
fprintf(stderr,
"201309231036 Failed to write State!\n"
);
31
return
(-1);
32
}
33
break
;
34
default
:
35
fprintf(stderr,
"201309231037 unkown State!\n"
);
36
break
;
37
}
38
39
return
(0);
40
}
41
Generated on Sat Oct 5 2013 21:30:15 for swixteen by
1.8.3.1