* Author: Miklos Maroti
*/
-#include <util/crc16.h>
-#include "Atm128Spi.h"
-
module HplRF230P
{
provides
{
interface GpioCapture as IRQ;
interface Init as PlatformInit;
-
- interface HplRF230;
}
uses
{
call Capture.stop();
}
-
- // TODO: Check why the default crcByte implementation is in a different endianness
- inline async command uint16_t HplRF230.crcByte(uint16_t crc, uint8_t data)
- {
- return _crc_ccitt_update(crc, data);
- }
-
- inline async command void HplRF230.spiSplitWrite(uint8_t data)
- {
- // the SPI must have been started, so do not waste time here
- // SET_BIT(SPCR, SPE);
-
- SPDR = data;
- }
-
- inline async command uint8_t HplRF230.spiSplitRead()
- {
- while( !( SPSR & 0x80 ) )
- ;
- return SPDR;
- }
-
- inline async command uint8_t HplRF230.spiSplitReadWrite(uint8_t data)
- {
- uint8_t b;
-
- while( !( SPSR & 0x80 ) )
- ;
- b = SPDR;
- SPDR = data;
-
- return b;
- }
-
- inline async command uint8_t HplRF230.spiWrite(uint8_t data)
- {
- // the SPI must have been started, so do not waste time here
- // SET_BIT(SPCR, SPE);
-
- SPDR = data;
- while( !( SPSR & 0x80 ) )
- ;
-
- return SPDR;
- }
}