00001
00052 #ifndef RADIO_H
00053 #define RADIO_H
00054
00055 #include "common.h"
00056 #include "config.h"
00057
00058
00059
00060
00061
00062 #define RX_DATA_DDR_REG DDRB
00063 #define RX_DATA_PORT_REG PORTB
00064 #define RX_DATA_PIN_REG PINB
00065 #define RX_DATA_BIT_POS PB4
00066
00067 #define RX_CLOCK_DDR_REG DDRB
00068 #define RX_CLOCK_PORT_REG PORTB
00069 #define RX_CLOCK_PIN_REG PINB
00070 #define RX_CLOCK_BIT_POS PB2
00071
00073 #define RF_CLOCK_PCINT_VECT PCINT0_vect
00075 #define RF_CLOCK_PCINT_ENABLE_BIT PCIE0
00077 #define RF_CLOCK_PCINT_MASK_REG PCMSK0
00079 #define RF_CLOCK_PCINT_MASK_BIT PCINT2
00080
00081
00082
00083
00084
00086 #define INIT_RX_DATA() \
00087 RX_DATA_DDR_REG &= ~(1<<RX_DATA_BIT_POS); \
00088 RX_DATA_PORT_REG &= ~(1<<RX_DATA_BIT_POS);
00090 #define GET_RX_DATA() \
00091 (RX_DATA_PIN_REG & (1<<RX_DATA_BIT_POS))
00093 #define INIT_RX_CLOCK() \
00094 RX_CLOCK_DDR_REG &= ~(1<<RX_CLOCK_BIT_POS); \
00095 RX_CLOCK_PORT_REG &= ~(1<<RX_CLOCK_BIT_POS);
00097 #define GET_RX_CLOCK() \
00098 (RX_CLOCK_PIN_REG & (1<<RX_CLOCK_BIT_POS))
00099
00100
00101
00103 typedef struct {
00104 unsigned char baudRateRange;
00105 unsigned char bitCheck;
00106 bool amplitudeModulation;
00107 unsigned char sleepValue;
00108 bool sleepExtension;
00109 bool noiseSuppression;
00110 } rx_OPMODE_t;
00111
00113 typedef struct {
00114 unsigned char limMin;
00115 unsigned char limMax;
00116 } rx_LIMIT_t;
00117
00118
00119
00121 bool rx_CheckResetMarker( unsigned char checkCycles );
00123 bool rx_WriteOFF( bool longStartPulse );
00125 bool rx_WriteOPMODE( const rx_OPMODE_t * settings, bool longStartPulse, bool * equivalenceValue );
00127 bool rx_WriteLIMIT( const rx_LIMIT_t * settings, bool longStartPulse, bool * equivalenceValue );
00129 bool rx_WriteVerifySleep( const rx_OPMODE_t * opmode, const rx_LIMIT_t * limit );
00130
00131
00132 #endif
00133