target/avr/asuro_avr_irrc5.c File Reference

AVR implementation of IR-RC5 decoding. More...

#include "asuro.h"

Go to the source code of this file.

private variables to the ISR

char AS_ir_lastsample = 0
 last read sample
unsigned char AS_ir_bittimer = 0
 call counter for AS_isr_irrc5()
unsigned short AS_ir_data_tmp = 0
 RC5 bit stream.
char AS_ir_bitcount = 0
 number of read bits

Defines

#define AS_IR_SAMPLES_PER_BIT   8
 8 samples per bit
#define AS_IR_SAMPLES_PER_BIT_EARLY   6
 edge not before the 6th sample
#define AS_IR_SAMPLES_PER_BIT_LATE   10
 edge after 10 samples at the latest
#define AS_IR_PAUSE_SAMPLES   200
 The start bit is only valid after 200 samples with unchanged edge.
#define AS_IR_PORT   PORTD
 port D
#define AS_IR_DDR   DDRD
 IO direction port D.
#define AS_IR_PINR   PIND
 input port D
#define AS_IR_PIN   PD0
 IO pin on port D.

Functions

void AS_isr_irrc5 (void)
 Read the last IR-RC5 code received.
unsigned short AS_Irrc5Read (void)
 Read the last RC5 code that was successfully received.

Variables

volatile unsigned short AS_ir_data = 0
 last completely read RC5 packet


Detailed Description

AVR implementation of IR-RC5 decoding.

Based on the c't-Bot version created by Benjamin Benz (bbe@heise.de).

Author:
Denis Martin
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

Definition in file asuro_avr_irrc5.c.


Define Documentation

#define AS_IR_PAUSE_SAMPLES   200
 

The start bit is only valid after 200 samples with unchanged edge.

According to Benz, this should be 50x1.778ms, but since we have an 8-bit counter for the samples, we are satisfied with about the half of it.

Definition at line 31 of file asuro_avr_irrc5.c.

Referenced by AS_isr_irrc5().


Function Documentation

unsigned short AS_Irrc5Read void   )  [inline]
 

Read the last RC5 code that was successfully received.

This will flush the input, thus subsequent calls will return 0 or a new value.

Returns:
Last IR RC5 code received

Definition at line 121 of file asuro_avr_irrc5.c.

References AS_ir_data.

void AS_isr_irrc5 void   ) 
 

Read the last IR-RC5 code received.

called about every 222.2us

Definition at line 53 of file asuro_avr_irrc5.c.

References AS_ir_bitcount, AS_ir_bittimer, AS_ir_data, AS_ir_data_tmp, AS_ir_lastsample, AS_IR_PAUSE_SAMPLES, AS_IR_SAMPLES_PER_BIT_EARLY, AS_IR_SAMPLES_PER_BIT_LATE, and AS_IRRX_SAMPLE.

Referenced by SIGNAL().


Generated on Fri May 12 10:11:15 2006 for simsuro by  doxygen 1.4.6