wip
This commit is contained in:
parent
370858ce8e
commit
a43019e565
18
src/irmc.c
18
src/irmc.c
@ -24,10 +24,10 @@
|
||||
#include "beep.h"
|
||||
#include "util.h"
|
||||
|
||||
//#define RASPI
|
||||
// http://raspberrypiguide.de/howtos/raspberry-pi-gpio-how-to/
|
||||
#ifdef RASPI
|
||||
#include <wiringPi.h>
|
||||
#define TX_RASPI_PIN 5
|
||||
#endif
|
||||
|
||||
|
||||
@ -60,7 +60,9 @@ void inthandler(int sig)
|
||||
signal(sig, SIG_IGN);
|
||||
send(fd_socket, &disconnect_packet, SIZE_COMMAND_PACKET, 0);
|
||||
close(fd_socket);
|
||||
#ifdef TX_SERIAL
|
||||
close(fd_serial);
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -78,7 +80,7 @@ void txloop (void)
|
||||
while(serial_status & TIOCM_DSR) ioctl(fd_serial, TIOCMGET, &serial_status);
|
||||
#endif
|
||||
#ifdef RASPI
|
||||
while(digitalRead(5)==1)
|
||||
while(digitalRead(TX_RASPI_PIN)==1)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@ -95,7 +97,7 @@ void txloop (void)
|
||||
if(serial_status & TIOCM_DSR) break;
|
||||
#endif
|
||||
#ifdef RASPI
|
||||
if(digitalRead(5)==1) break;
|
||||
if(digitalRead(TX_RASPI_PIN)==1) break;
|
||||
#endif
|
||||
tx_timeout = fastclock() - key_release_t1;
|
||||
if(tx_timeout > TX_TIMEOUT) return;
|
||||
@ -252,13 +254,13 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
#ifdef RASPI
|
||||
// Starte die WiringPi-Api (wichtig)
|
||||
if (wiringPiSetup() == -1)
|
||||
return 1;
|
||||
// Schalte GPIO 24 (=WiringPi Pin 5) auf Eingang
|
||||
pinMode(5, INPUT);
|
||||
{
|
||||
fprintf(stderr,"Unable to setup wiringPi for PIN %d\n", TX_RASPI_PIN);
|
||||
exit (1);
|
||||
}
|
||||
pinMode(TX_RASPI_PIN, INPUT);
|
||||
|
||||
//if (digitalRead(5)==1)
|
||||
#endif
|
||||
|
||||
freeaddrinfo(servinfo); /* all done with this structure */
|
||||
|
Loading…
Reference in New Issue
Block a user