RocketLogger  1.1.6
rl_deamon.c File Reference
#include "gpio.h"
+ Include dependency graph for rl_deamon.c:

Go to the source code of this file.

Macros

#define GPIO_BUTTON   26
 Linux GPIO number of start/stop button. More...
 
#define MIN_INTERVAL   1
 Minimal time interval between two interrupts (in seconds) More...
 

Functions

int gpio_setup (void)
 
void interrupt_handler (int value)
 
int main (void)
 

Macro Definition Documentation

#define GPIO_BUTTON   26

Linux GPIO number of start/stop button.

Copyright (c) 2016-2019, Swiss Federal Institute of Technology (ETH Zurich) All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 35 of file rl_deamon.c.

Referenced by gpio_setup(), and main().

#define MIN_INTERVAL   1

Minimal time interval between two interrupts (in seconds)

Definition at line 37 of file rl_deamon.c.

Referenced by interrupt_handler().

Function Documentation

int gpio_setup ( void  )

Setup button GPIO

Returns
SUCCESS on success, FAILURE otherwise

Definition at line 43 of file rl_deamon.c.

References FAILURE, FALLING, GPIO_BUTTON, gpio_dir(), gpio_export(), gpio_interrupt(), IN, and SUCCESS.

Referenced by main().

+ Here is the call graph for this function:

void interrupt_handler ( int  value)

GPIO interrupt handler

Parameters
valueGPIO value after interrupt

Definition at line 60 of file rl_deamon.c.

References MIN_INTERVAL, and status.

Referenced by main().

int main ( void  )

RocketLogger deamon program. Continuously waits on interrupt on button GPIO and starts/stops RocketLogger

Arguments: none

Returns
standard Linux return codes

Definition at line 85 of file rl_deamon.c.

References FAILURE, GPIO_BUTTON, gpio_setup(), gpio_wait_interrupt(), and interrupt_handler().

+ Here is the call graph for this function: