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