C4EV3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Typedefs | Enumerations | Functions
ev3_timer.h File Reference

Functions and constants for controlling EV3 timers. More...

#include <unistd.h>
#include <sys/time.h>
#include <signal.h>
#include <string.h>
#include <stdbool.h>
#include "../include/ev3_constants.h"

Go to the source code of this file.

Macros

#define ev3_timer_h
 

Typedefs

typedef void(* TimerCallback )(int sig)
 

Enumerations

enum  TimerInterval {
  ti10ms, ti50ms, ti100ms, ti250ms,
  ti500ms, ti1sec
}
 

Functions

unsigned long TimerWait (unsigned long Time)
 
void TimerReady (unsigned long Timer)
 
unsigned long TimerMS (uint8_t timerId)
 
void ClearTimerMS (uint8_t timerId)
 
unsigned long TimerUS (uint8_t timerId)
 
void ClearTimerUS (uint8_t timerId)
 
void TimerInit (unsigned long interval_multiplier)
 
bool AddTimerCallback (TimerInterval interval, TimerCallback callback)
 
unsigned long long TimerGetUS ()
 
unsigned long long TimerGetMS ()
 

Detailed Description

Functions and constants for controlling EV3 timers.

ev3_timer.h contains declarations for the EV3 C API timer functions.

License:

The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Initial Developer of this code is John Hansen. Portions created by John Hansen are Copyright (C) 2009-2013 John Hansen. All Rights Reserved.


Author
John Hansen (bricxcc_at_comcast.net)
Date
2013-07-10
Version
1

Macro Definition Documentation

#define ev3_timer_h

Typedef Documentation

typedef void(* TimerCallback)(int sig)

Enumeration Type Documentation

Enumerator
ti10ms 
ti50ms 
ti100ms 
ti250ms 
ti500ms 
ti1sec 

Function Documentation

bool AddTimerCallback ( TimerInterval  interval,
TimerCallback  callback 
)

Adds a callback that will be called every specified interval

Parameters
interval
callback
Returns
true if the callback was added, false otherwise
void ClearTimerMS ( uint8_t  timerId)

Clears the timer

Parameters
timerIdId of the timer, between 0 and (NUM_MS_TIMERS - 1)
void ClearTimerUS ( uint8_t  timerId)

Clears the timer

Parameters
timerIdId of the timer, between 0 and (NUM_US_TIMERS - 1)
unsigned long long TimerGetMS ( )
unsigned long long TimerGetUS ( )
void TimerInit ( unsigned long  interval_multiplier)
unsigned long TimerMS ( uint8_t  timerId)

Return the value of the timer

Parameters
timerIdId of the timer, between 0 and (NUM_MS_TIMERS - 1)
Returns
void TimerReady ( unsigned long  Timer)

Blocks until the time has elapsed

Parameters
Timertime to wait for
unsigned long TimerUS ( uint8_t  timerId)

Return the value of the timer

Parameters
timerIdId of the timer, between 0 and (NUM_US_TIMERS - 1)
Returns
unsigned long TimerWait ( unsigned long  Time)

Creates a new timer that will expire after the specified amount of time. Call TimerReady to wait for the times to elapse

Parameters
Timein ms
Returns