////////////////////////////////////////////////////////////////////////////////
// X10rf.c - X10 all-housecode RF interface & CM12U relay
// (c) ant.org 2004
//
////////////////////////////////////////////////////////////////////////////////
#ifndef _x10rf_H_
#define _x10rf_H_
#define OSC_FREQUENCY 4000000
// states
// enum rf_states { WAIT_START_BIT=0x0, WAIT_DATA_START, WAIT_DATA_BIT };
#define WAIT_START_BIT 0
#define WAIT_DATA_START 1
#define WAIT_DATA_BIT 2
// IO lines
// gah, preproc won't allow #define LED (portb, 0x7) !!
#define LED portb,0x7
#define X10_RX portb,0x5
#define PC_RX portb,0x4
#define TEST_POINT portb,0x1
#define RADIO_DATA portb,0x0
// OPTION_REG bitmasks
#define PORTB_PULLUPS_DISABLED (1<<NOT_RBPU)
#define PORTB_PULLUPS_ENABLED 0x0
#define INTEDGE_RISING (1<<INTEDG)
#define INTEDGE_FALLING 0x0
#define TIMER0_EXTERNAL (1<<T0CS)
#define TIMER0_INTERNAL 0x0
#define TIMER0_FALLING (1<<T0SE)
#define TIMER0_RISING 0x0
#define PRESCALER_WDT (1<<PSA)
#define PRESCALER_TIMER0 0x0
#define PRESCALER(x) ((x) & 7)
// INTCON bitmasks
#define GLOBAL_ENABLE (1<<GIE)
#define GLOBAL_DISABLE 0x0
#define EE_ENABLE (1<<EEIE)
#define EE_DISABLE 0x0
#define TIMER_ENABLE (1<<T0IE)
#define TIMER_DISABLE 0x0
#define EXTINT_ENABLE (1<<INTE)
#define EXTINT_DISABLE 0x0
#define PORTB_ENABLE (1<<RBIE)
#define PORTB_DISABLE 0x0
#define TIMER_INTERRUPT (1<<T0IF)
#define EXTINT_INTERRUPT (1<<INTF)
#define PORTB_INTERRUPT (1<<RBIF)
#endif //_x10rf_H_
Copyright © 2002-2006 SourceBoost Technologies