embedded system library for e-puck  1.0.1
A redesigned API library for the e-puck robot platform
 All Data Structures Files Functions Variables Enumerations Enumerator Modules Pages
Functions
el_ir_receiver.h File Reference
#include "el_common.h"
#include "el_clock.h"
#include "el_trigger.h"

Go to the source code of this file.

Functions

void el_enable_ir_receiver ()
 enable the ir receiver
 
void el_disable_ir_receiver ()
 disable the ir receiver
 
void el_ir_receiver_reset ()
 reset the ir receiver to prepare for any incoming message More...
 
el_uint8 el_ir_receiver_get_check ()
 get the check bit in the message while 2 means no message More...
 
el_uint8 el_ir_receiver_get_address ()
 get the address field in the message More...
 
el_uint8 el_ir_receiver_get_data ()
 get the data field in the message More...
 
el_uint16 el_ir_receiver_get_counter ()
 get the number of messages received since initialization
 

Detailed Description

Author
Jianing Chen

Function Documentation

void el_ir_receiver_reset ( )

reset the ir receiver to prepare for any incoming message

Once a message is received, the ir receiver must be reset before it can receive any further messages. The general usage is that: always reset the ir receiver before a receiving needed.

el_uint8 el_ir_receiver_get_check ( )

get the check bit in the message while 2 means no message

Returns
0, 1 and 2

For a common TV remote, the 'check' bit in the message is often used to determine whether the message is issued from a new button click or a re-transmission of a same click (holding a button). For example, if the user hold a button on the remote, the receiver will receive a series of same data with same 'check' bit (0,0,0 ... or 1,1,1 ...). Whereas, it the user is click the button repeatedly, the received messages will contain same data but their 'check' bit will be altered (0,1,0,1,0 ...).

The function will return 2 if there is no message.

el_uint8 el_ir_receiver_get_address ( )

get the address field in the message

Returns
the address, a 5-bit integer

The message should also contain a address field, which is a 5-bit integer. One can use this to receive the message from a specific remote only. For example, use a TV remote with a unique address number so it won't turn on other appliances in the room where the robots are used.

el_uint8 el_ir_receiver_get_data ( )

get the data field in the message

Returns
the data, a 6-bit integer

The payload of a incoming message is the 'data'. It is be a 6-bit integer. When the message is transmitted from a TV remote, the 'data' is usually the code of the key that is pressed.

In Display the Data Received, an example is given to display all contents in a incoming message.