23 #include <sys/types.h>
25 #include "libpruio/pruio.h"
39 struct timeval timeout;
43 FD_SET(STDIN_FILENO, &set);
47 timeout.tv_usec = mseconds * 1000;
50 return TEMP_FAILURE_RETRY(select(FD_SETSIZE,
58 #define OUT_K pruio_gpio_setValue(io, PIN, 128 + pinmode) ; isleep(150) ; pruio_gpio_setValue(io, PIN, pinmode) ; isleep(100) ;
60 #define OUT_L pruio_gpio_setValue(io, PIN, 128 + pinmode) ; isleep(350) ; pruio_gpio_setValue(io, PIN, pinmode) ; isleep(100) ;
62 #define OUT_S OUT_K ; OUT_K ; OUT_K ; isleep(150)
64 #define OUT_O OUT_L ; OUT_L ; OUT_L ; isleep(150)
67 int main(
int argc,
char **argv)
72 printf(
"initialisation failed (%s)\n",
io->Errr);
break;}
77 printf(
"config failed (%s)\n",
io->Errr);
break;}
79 printf(
"watch SOS code on user LED 3 (near ethernet connector)\n\n");
80 printf(
"execute the following command to get rid of mmc1 triggers\n");
81 printf(
" sudo su && echo none > /sys/class/leds/beaglebone:green:usr3/trigger && echo 0 > /sys/class/leds/beaglebone:green:usr3/brightness && exit\n\n");
82 printf(
"press any key to quit");
84 struct termios oldt, newt;
85 tcgetattr( STDIN_FILENO, &oldt );
87 newt.c_lflag &= ~( ICANON | ECHO );
90 tcsetattr( STDIN_FILENO, TCSANOW, &newt );
92 while(0 >= getchar()) {
99 tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
VAR io
create new driver UDT
char * pruio_config(pruIo *Io, uint32 Samp, uint32 Mask, uint32 Tmr, uint16 Mds)
Wrapper function for PruIo::config().
pruIo * pruio_new(uint16 Act, uint8 Av, uint32 OpD, uint8 SaD)
Wrapper function for the constructor PruIo::PruIo().
void pruio_destroy(pruIo *Io)
Wrapper function for the destructor PruIo::~PruIo().
unsigned char uint8
8 bit unsigned integer data type.
@ PRUIO_DEF_ACTIVE
Activate all subsystems.
char * pruio_gpio_setValue(pruIo *Io, uint8 Ball, uint8 Modus)
Wrapper function for GpioUdt::setValue().
const ANY_PTR NULL
The NULL pointer.
VAR pinmode
The current pinmode.
#define OUT_O
Output an 'O' (long - long - long).
int isleep(unsigned int mseconds)
Wait for keystroke or timeout.
int main(int argc, char **argv)
The main function.
#define OUT_S
Output a 'S' (short - short - short).
#define PIN
The CPU ball to control (user LED 3).
Wrapper structure for PruIo.