pirblaster
0.01
Use the pi as a remote control for your TV, DVD player etc.
Main Page
Files
File List
Globals
Blast
InitCarrier.c
Go to the documentation of this file.
1
/********************************************************************************/
2
/* Use a raspberry pi with a IR led as remote control for your Tv, Dvd etc. */
3
/* Copyright (C) 2016 Ed Kapitein */
4
/* */
5
/* This program is free software: you can redistribute it and/or modify */
6
/* it under the terms of the GNU General Public License as published by */
7
/* the Free Software Foundation, either version 3 of the License, or */
8
/* (at your option) any later version. */
9
/* */
10
/* This program is distributed in the hope that it will be useful, */
11
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13
/* GNU General Public License for more details. */
14
/* */
15
/* You should have received a copy of the GNU General Public License */
16
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
/********************************************************************************/
18
#include <stdio.h>
19
#include <fcntl.h>
20
#include <sys/ioctl.h>
21
#include <unistd.h>
22
23
#include "../Kmod/Kmod.h"
33
int
InitCarrier
(
int
Range,
int
Divisor,
int
DutyCycle )
34
{
35
int
fd;
36
fd = open(
"/dev/MyIrMod"
, O_WRONLY);
37
38
if
(fd == -1)
39
{
40
fprintf( stderr,
"201608202233 Error in opening file /dev/MyIrMod\n"
);
41
return
(-1);
42
}
43
44
ioctl(fd,
IOCTL_RANGE
,Range);
/*ioctl call to set the frequency */
45
ioctl(fd,
IOCTL_DIVISOR
,Divisor);
/*ioctl call to set the frequency */
46
ioctl(fd,
IOCTL_DUTY
,DutyCycle);
/*ioctl call to set the duty cycle, must be called after setting the frequency */
47
48
close(fd);
49
50
return
(0);
51
}
IOCTL_DUTY
#define IOCTL_DUTY
Definition:
Kmod.h:42
IOCTL_RANGE
#define IOCTL_RANGE
Definition:
Kmod.h:40
IOCTL_DIVISOR
#define IOCTL_DIVISOR
Definition:
Kmod.h:41
InitCarrier
int InitCarrier(int Range, int Divisor, int DutyCycle)
Wrapper to ioctl.
Definition:
InitCarrier.c:33
Generated on Sun Oct 2 2016 22:23:06 for pirblaster by
1.8.10