All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sos.c File Reference

Example: blink user LED 3. More...

`#include "stdio.h"`
`#include <termios.h>`
`#include <unistd.h>`
`#include <errno.h>`
`#include <sys/types.h>`
`#include <sys/time.h>`
`#include "../c_wrapper/pruio.h"`
Include dependency graph for sos.c:

Go to the source code of this file.

## Macros

#define | _GNU_SOURCE 1
| Message for the compiler.
#define | PIN 24
| The CPU ball to control (user LED 3).
#define | OUT_K pruio_gpio_setValue(io, PIN, 128 + pinmode) ; isleep(150) ; pruio_gpio_setValue(io, PIN, pinmode) ; isleep(100) ;
| Output a short blink.
#define | OUT_L pruio_gpio_setValue(io, PIN, 128 + pinmode) ; isleep(350) ; pruio_gpio_setValue(io, PIN, pinmode) ; isleep(100) ;
| Output a long blink.
#define | OUT_S OUT_K ; OUT_K ; OUT_K ; isleep(150)
| Output a 'S' (short - short - short).
#define | OUT_O OUT_L ; OUT_L ; OUT_L ; isleep(150)
| Output an 'O' (long - long - long).

## Functions

int | isleep (unsigned int mseconds)
| Wait for keystroke or timeout. More...
int | main (int argc, char **argv)
| The main function. More...

## Detailed Description

Example: blink user LED 3.

This file contains an example on how to use libpruio to control the user LED 3 (near ethernet connector) on the beaglebone board. It shows how to unlock a CPU ball that is used by the system. And it shows how to control the unlocked ball.

Licence: GPLv3

Copyright 2014 by Thomas{ dOt ]Freiherr[ At ]gmx[ DoT }net

Compile by: `gcc -Wall -o sos sos.c -lpruio`

Definition in file sos.c.

## Function Documentation

int isleep | ( | unsigned int | mseconds | ) |

Wait for keystroke or timeout.

Parameters

  mseconds | Timeout value in milliseconds.

Returns
  0 if timeout, 1 if input available, -1 on error.

Wait for a keystroke or timeout and return which of the events happened.

Definition at line 37 of file sos.c.

Here is the caller graph for this function:

int main | ( | int | argc,
|  | char ** | argv
| ) |  |

The main function.

< Create a PruIo structure, wakeup subsystems.

< The current pin mode.

Definition at line 68 of file sos.c.

Here is the call graph for this function: