Main Page | File List | Globals

ir.h File Reference

#include <avr/io.h>
#include "basic.h"

Go to the source code of this file.

Defines

#define IRMLENGTH   20 /*!< maximum pulse length in bytes */
#define IRMSLENGTH   30 /*!< maximum string length in bytes */
#define IRDATABITTIME   12 /*!< bit time in 36kHz cycles for data transmiting */
#define IRDATABYTETIME   128 /*!< time to wait while a byte is transmitted */
#define IRKEYS   4 /*!< number of recognized keys <=5 */
#define ISIRON   ((PIND & _BV(PD4))==0) /*!< 1: ir-on, 0: ir-off */
#define WAITIR   {sei(); while (sendready == 0) _NOP; cli(); } while (0)

Typedefs

typedef u08 irdatatype [IRMLENGTH]
 type to store the information from IR


Functions

void ir_send (u08 *irbuf_)
 sends one pulse of ir ("<length>blablabla")

void ir_string_send (u08 *se)
 sends a string of ir-datas ( "blablabla\0")

u08 ir_comp (irdatatype cmp_target, irdatatype read_ir)
 Compares two IR pulses.

u08 ir_to_val (irdatatype data)
 Converts and returns an ir-impuls as value.

u08val_to_ir (u08 dat)
 Converts a byte-value to an ir-impuls stored in irdata.

void do_ir ()
 handles the lowlevel tranmission and receiving

void start_ir_r ()
 starts the receiving of a pulse

void do_ir_string ()
 handles string sending


Variables

u08 irerror
 error code of last ir pulse conversation

u08 irbittime
 length of one bit in 36kHz cycles

irdatatype cmp_target [IRKEYS]
 datas read from eeprom for ircont (ir_load())

volatile irdatatype irrbuf
 received single ir-pulse ("<length>blablabla")

volatile u08 irrstring [IRMSLENGTH]
 received string. ("<length>blablabla")

volatile u08 pulsevalid
 pointer to the data to send

volatile u08 stringvalid
 Is set 1 if a valid string is received. Set it to 0 if computated. But also reset irrstring[0]!

volatile u08 sendready
 This variable is used to wait for the IR-String send routines. It's used in WAITIR.

volatile u08senddata
 pointer to the data to send just for the INT-function


Detailed Description

Definition in file ir.h.


Define Documentation

#define IRDATABITTIME   12 /*!< bit time in 36kHz cycles for data transmiting */
 

bit time in 36kHz cycles for data transmiting

Definition at line 19 of file ir.h.

#define IRDATABYTETIME   128 /*!< time to wait while a byte is transmitted */
 

time to wait while a byte is transmitted

Definition at line 21 of file ir.h.

Referenced by do_ir_string().

#define IRKEYS   4 /*!< number of recognized keys <=5 */
 

number of recognized keys <=5

Definition at line 23 of file ir.h.

#define IRMLENGTH   20 /*!< maximum pulse length in bytes */
 

maximum pulse length in bytes

Definition at line 15 of file ir.h.

Referenced by do_ir(), and start_ir_r().

#define IRMSLENGTH   30 /*!< maximum string length in bytes */
 

maximum string length in bytes

Definition at line 17 of file ir.h.

Referenced by do_ir().

#define ISIRON   ((PIND & _BV(PD4))==0) /*!< 1: ir-on, 0: ir-off */
 

1: ir-on, 0: ir-off

Definition at line 30 of file ir.h.

Referenced by do_ir(), and SIGNAL().


Typedef Documentation

irdatatype
 

type to store the information from IR

The bits are written/read from left to right. A '0' means signal 'off' a '1' means 'on'. The timing is determined by irbittime and the 36kHz clock from modulation. The first byte is the length of the string (including it self). So the string "04 aa 00 aa ff" wouldn't send the last FF!

Definition at line 35 of file ir.h.

Referenced by ir_comp(), ir_to_val(), and val_to_ir().


Function Documentation

void do_ir  ) 
 

handles the lowlevel tranmission and receiving

The results of receiving are stored in irbuf and irstring. The values pulsevalid and stringvalid return if any data was received.

Definition at line 75 of file ir.c.

Referenced by SIGNAL().

u08 ir_comp irdatatype  cmp_target,
irdatatype  read_ir
 

Compares two IR pulses.

This is used for ircont. The bigger the result the narrower the pulses.

Parameters:
read_ir The received pulse.
cmp_target The stored "and"-array. It is generated by the loading station.

Definition at line 166 of file ir.c.

void ir_send u08 irbuf_  ) 
 

sends one pulse of ir ("<length>blablabla")

This will last (irbuf_[0] * irbittime /36000) while nothing else will be computated. The data is given in irbuf_

< send an ir pulse

Definition at line 119 of file ir.c.

Referenced by do_ir_string().

void start_ir_r  ) 
 

starts the receiving of a pulse

This will last maximum (irlength * irbittime / 36000) while nothing else will be computated. The result will be writte to irbuf

Definition at line 130 of file ir.c.

Referenced by SIGNAL().


Generated on Wed Feb 2 20:03:50 2005 for Robot by doxygen 1.3.6