libpruio  0.0.2
AM33xx-PRU driver for digital input / output and analog input
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
button.c File Reference

Example: get state of pullup input. 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_c_wrapper.h"
#include "../c_wrapper/pruio_pins.h"
Include dependency graph for button.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE   1
 
#define PIN   P8_07
 

Functions

int isleep (unsigned int mseconds)
 wait for keystroke or timeout More...
 
int main (int argc, char **argv)
 

Detailed Description

Example: get state of pullup input.

This file contains an example on how to use libpruio to print out the state of the digital GPIOs and the analog input lines.

Licence: GPLv3

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

Compile by:

gcc -Wall -o button button.c -lpruio -L"/usr/local/lib/freebasic/" -lfb -lpthread -lprussdrv -ltermcap -lsupc++ -Wno-unused-variable

Definition in file button.c.

Macro Definition Documentation

#define _GNU_SOURCE   1

Definition at line 19 of file button.c.

#define PIN   P8_07

Definition at line 29 of file button.c.

Function Documentation

int isleep ( unsigned int  mseconds)

wait for keystroke or timeout

Parameters
msecondstimeout value in milliseconds
Returns
0 if timeout, 1 if input available, -1 if error

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

Definition at line 39 of file button.c.

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 57 of file button.c.

Here is the call graph for this function: