Main Page | File List | Globals

ir.c File Reference

The functions for the ir-transmitting and receiving. Hopefully the same file as the Robot gets. More...

#include "ir.h"
#include <avr/interrupt.h>
#include <avr/eeprom.h>

Go to the source code of this file.

Defines

#define IRON   (PORTB |= _BV(PB4))
#define IROFF   (PORTB &= ~_BV(PB4))
#define IRTOGGLE   (PORTB ^= _BV(PB4))
#define DATA(x)   (data[x>>3]&(1<<(7-(x%8))))
#define IRSBUF(x)   (irsbuf[x>>3]&(1<<(7-(x%8))))

Functions

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

u08 * val_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 ir_send (u08 *irbuf_)
 sends one pulse of ir ("<length>blablabla")

void start_ir_r ()
 starts the receiving of a pulse

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

void do_ir_string ()
 handles string sending

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

void ir_and (irdatatype res, irdatatype and2)
 builds a mask for the ir-pulses. Only important in the Station.


Variables

u16 irtime
s16 irbit
volatile irdatatype irrbuf
 received single ir-pulse ("<length>blablabla")

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

volatile u08 * irsbuf
volatile u08 * senddata
 pointer to the data to send just for the INT-function

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.

irdatatype cmp_target [IRKEYS]


Detailed Description

The functions for the ir-transmitting and receiving. Hopefully the same file as the Robot gets.

Definition in file ir.c.


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.

Referenced by ir_comp(), and main().

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(), and ir_send().

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 21:19:13 2005 for Station by doxygen 1.3.6