added guhRF; added atmega256rfr2 support

This commit is contained in:
Boernsman 2016-03-19 14:18:51 +01:00 committed by Ralf Schlatterbeck
parent 9a3c6adf8d
commit 79df347afa
115 changed files with 13276 additions and 23 deletions

View file

@ -76,6 +76,9 @@ extern uint8_t debugflowsize,debugflow[DEBUGFLOWSIZE];
#if defined(__AVR_ATmega128RFA1__)
#include <avr/io.h>
#include "atmega128rfa1_registermap.h"
#elif defined(__AVR_ATmega256RFR2__)
#include <avr/io.h>
#include "atmega256rfr2_registermap.h"
#else
#include "at86rf230_registermap.h"
#endif
@ -88,7 +91,7 @@ volatile extern signed char rf230_last_rssi;
/*============================ IMPLEMENTATION ================================*/
#if defined(__AVR_ATmega128RFA1__)
#if defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)
/* AVR1281 with internal RF231 radio */
#include <avr/interrupt.h>
@ -158,7 +161,7 @@ inline uint8_t spiWrite(uint8_t byte)
/** \brief This function initializes the Hardware Abstraction Layer.
*/
#if defined(__AVR_ATmega128RFA1__)
#if defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)
void
hal_init(void)
@ -242,7 +245,7 @@ hal_init(void)
#endif /* !__AVR__ */
#if defined(__AVR_ATmega128RFA1__)
#if defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)
/* Hack for internal radio registers. hal_register_read and hal_register_write are
handled through defines, but the preprocesser can't parse a macro containing
another #define with multiple arguments, e.g. using
@ -279,7 +282,7 @@ hal_subregister_write(uint16_t address, uint8_t mask, uint8_t position,
HAL_LEAVE_CRITICAL_REGION();
}
#else /* defined(__AVR_ATmega128RFA1__) */
#else /* defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)*/
/*----------------------------------------------------------------------------*/
/** \brief This function reads data from one of the radio transceiver's registers.
*
@ -383,7 +386,7 @@ hal_subregister_write(uint8_t address, uint8_t mask, uint8_t position,
/* Write the modified register value. */
hal_register_write(address, value);
}
#endif /* defined(__AVR_ATmega128RFA1__) */
#endif /* defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__) */
/*----------------------------------------------------------------------------*/
/** \brief Transfer a frame from the radio transceiver to a RAM buffer
*
@ -399,7 +402,7 @@ hal_subregister_write(uint8_t address, uint8_t mask, uint8_t position,
void
hal_frame_read(hal_rx_frame_t *rx_frame)
{
#if defined(__AVR_ATmega128RFA1__)
#if defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)
uint8_t frame_length,*rx_data,*rx_buffer;
@ -431,8 +434,8 @@ hal_frame_read(hal_rx_frame_t *rx_frame)
* Else show the crc has passed the hardware check.
*/
rx_frame->crc = true;
#else /* defined(__AVR_ATmega128RFA1__) */
#else /* defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__) */
uint8_t frame_length, *rx_data;
@ -487,7 +490,7 @@ hal_frame_read(hal_rx_frame_t *rx_frame)
HAL_SPI_TRANSFER_CLOSE();
#endif /* defined(__AVR_ATmega128RFA1__) */
#endif /* defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__) */
}
/*----------------------------------------------------------------------------*/
@ -500,7 +503,7 @@ hal_frame_read(hal_rx_frame_t *rx_frame)
void
hal_frame_write(uint8_t *write_buffer, uint8_t length)
{
#if defined(__AVR_ATmega128RFA1__)
#if defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)
uint8_t *tx_buffer;
tx_buffer=(uint8_t *)0x180; //start of fifo in i/o space
/* Write frame length, including the two byte checksum */
@ -632,7 +635,7 @@ volatile char rf230interruptflag;
#define INTERRUPTDEBUG(arg)
#endif
#if defined(__AVR_ATmega128RFA1__)
#if defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)
/* The atmega128rfa1 has individual interrupts for the integrated radio'
* Whichever are enabled by the RF230 driver must be present even if not used!
*/
@ -715,7 +718,7 @@ ISR(TRX24_CCA_ED_DONE_vect)
rf230_ccawait=0;
}
#else /* defined(__AVR_ATmega128RFA1__) */
#else /* defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)*/
/* Separate RF230 has a single radio interrupt and the source must be read from the IRQ_STATUS register */
HAL_RF230_ISR()
{
@ -805,7 +808,7 @@ HAL_RF230_ISR()
;
}
}
#endif /* defined(__AVR_ATmega128RFA1__) */
#endif /* defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)*/
# endif /* defined(DOXYGEN) */
/** @} */