COSA
An Object-Oriented Platform for Arduino Programming
|
#include <RFM69.hh>
Public Member Functions | |
RFM69 (uint16_t net, uint8_t dev, Board::DigitalPin csn=Board::D10, Board::ExternalInterruptPin irq=Board::EXT0) | |
virtual bool | begin (const void *config=NULL) |
virtual bool | end () |
virtual int | send (uint8_t dest, uint8_t port, const iovec_t *vec) |
virtual int | send (uint8_t dest, uint8_t port, const void *buf, size_t len) |
virtual int | recv (uint8_t &src, uint8_t &port, void *buf, size_t len, uint32_t ms=0L) |
virtual void | powerdown () |
virtual void | wakeup_on_radio () |
virtual void | output_power_level (int8_t dBm) |
virtual int | input_power_level () |
int | temperature () |
void | recalibrate () |
uint8_t | channel () const |
void | channel (uint8_t channel) |
int16_t | network_address () const |
uint8_t | device_address () const |
void | address (int16_t net, uint8_t dev) |
virtual void | powerup () |
virtual bool | available () |
virtual bool | room () |
virtual int | broadcast (uint8_t port, const iovec_t *vec) |
virtual int | broadcast (uint8_t port, const void *buf, size_t len) |
virtual bool | is_broadcast () |
virtual int | link_quality_indicator () |
Static Public Attributes | |
static const size_t | HEADER_MAX = 3 |
static const size_t | PAYLOAD_MAX = 66 - HEADER_MAX |
static const uint8_t | BROADCAST = 0x00 |
Protected Attributes | |
uint8_t | m_channel |
Current channel (device dependent. More... | |
addr_t | m_addr |
Current network and device address. More... | |
volatile bool | m_avail |
Message available. May be set by ISR. More... | |
uint8_t | m_dest |
Latest message destination device address. More... | |
Private Member Functions | |
void | set_clock (Clock rate) |
void | set_clock (uint32_t freq) |
Static Private Member Functions | |
static Clock | clock (uint32_t freq) |
static Clock | cycle (uint16_t ns) |
Private Attributes | |
Driver * | m_next |
List of drivers. More... | |
OutputPin | m_cs |
Device chip select pin. More... | |
Pulse | m_pulse |
Chip select pulse width. More... | |
uint8_t | m_spcr |
SPI/SPCR hardware control register setting. More... | |
uint8_t | m_spsr |
SPI/SPSR hardware status register. More... | |
Cosa Device Driver for RFM69W/HW, Low-Power Sub-1 GHz RF Transceiver. Note that this device requires data in big endian order.
This is the pin-out for the RFM69W/HW module.
RFM69::RFM69 | ( | uint16_t | net, |
uint8_t | dev, | ||
Board::DigitalPin | csn = Board::D10 , |
||
Board::ExternalInterruptPin | irq = Board::EXT0 |
||
) |
Construct RFM69 device driver with given network and device address. Connected to SPI bus and given chip select pin. Default pins are Arduino Nano IO Shield for RFM69 module are D10 chip select (RFM69:NSS) and D2/EXT0 external interrupt pin (RFM69:DIO0).
[in] | net | network address. |
[in] | dev | device address. |
[in] | csn | chip select pin (Default D2/D10/D53). |
[in] | irq | interrupt pin (Default EXT0). |
|
inlineinherited |
Set network and device address. Do not use the broadcast address(0). Should be used before calling begin().
[in] | net | network address. |
[in] | dev | device address. |
Definition at line 106 of file Wireless.hh.
|
inlinevirtualinherited |
Return true(1) if a message is available otherwise false(0).
Reimplemented in VWI, and NRF24L01P.
Definition at line 165 of file Wireless.hh.
|
virtual |
Start and configure RFM69 device driver. The configuration must set DIO0 to assert on received message. This device pin is assumed to be connected the device driver interrupt pin (EXTn). Return true(1) if successful othewise false(0).
[in] | config | configuration vector (default NULL) |
Implements Wireless::Driver.
|
inlinevirtualinherited |
Broadcast message in given null terminated io vector. Returns number of bytes sent if successful otherwise a negative error code.
[in] | port | device port (or message type). |
[in] | vec | null termianted io vector. |
Definition at line 220 of file Wireless.hh.
|
inlinevirtualinherited |
Boardcast message in given buffer, with given number of bytes. Returns number of bytes sent if successful otherwise a negative error code.
[in] | port | device port (or message type). |
[in] | buf | buffer to transmit. |
[in] | len | number of bytes in buffer. |
Definition at line 235 of file Wireless.hh.
|
inlineinherited |
|
inlineinherited |
Set device transmission channel. Should be used before calling begin().
[in] | channel. |
Definition at line 117 of file Wireless.hh.
|
inlineinherited |
|
virtual |
Shut down the device driver. Return true(1) if successful otherwise false(0).
Reimplemented from Wireless::Driver.
|
virtual |
Return estimated input power level (dBm) from latest successful message received.
Reimplemented from Wireless::Driver.
|
inlinevirtualinherited |
Return true(1) if the latest received message was a broadcast otherwise false(0).
Definition at line 262 of file Wireless.hh.
|
inlinevirtualinherited |
Return link quality indicator. Default zero(0).
Reimplemented in VWI, and CC1101.
Definition at line 292 of file Wireless.hh.
|
inlineinherited |
|
virtual |
|
virtual |
Set device in power down mode.
Reimplemented from Wireless::Driver.
|
inlinevirtualinherited |
Set device in power up mode.
Reimplemented in VWI, and NRF24L01P.
Definition at line 146 of file Wireless.hh.
void RFM69::recalibrate | ( | ) |
|
virtual |
Receive message and store into given buffer with given maximum length. The source network address is returned in the parameter src. Returns error code(-2) if no message is available and/or a timeout occured. Returns error code(-1) if the buffer size if to small for incoming message or if the receiver fifo has overflowed. Otherwise the actual number of received bytes is returned
[out] | src | source network address. |
[out] | port | device port (or message type). |
[in] | buf | buffer to store incoming message. |
[in] | len | maximum number of bytes to receive. |
[in] | ms | maximum time out period. |
Implements Wireless::Driver.
|
inlinevirtualinherited |
Return true(1) if there is room to send on the device otherwise false(0).
Definition at line 176 of file Wireless.hh.
|
virtual |
Send message in given null terminated io vector. Returns number of bytes sent. Returns error code(-1) if number of bytes is greater than PAYLOAD_MAX. Return error code(-2) if fails to set transmit mode and/or packet is available to receive.
[in] | dest | destination network address. |
[in] | port | device port (or message type). |
[in] | vec | null termianted io vector. |
Implements Wireless::Driver.
|
virtual |
Send message in given buffer, with given number of bytes. Returns number of bytes sent. Returns error code(-1) if number of bytes is greater than PAYLOAD_MAX. Return error code(-2) if fails to set transmit mode.
[in] | dest | destination network address. |
[in] | port | device port (or message type). |
[in] | buf | buffer to transmit. |
[in] | len | number of bytes in buffer. |
Reimplemented from Wireless::Driver.
int RFM69::temperature | ( | ) |
|
virtual |
Set device in wakeup on radio mode.
Reimplemented from Wireless::Driver.
|
staticinherited |
Broadcast device address.
Definition at line 58 of file Wireless.hh.
|
static |
|
protectedinherited |
Current network and device address.
Definition at line 299 of file Wireless.hh.
|
protectedinherited |
Message available. May be set by ISR.
Definition at line 300 of file Wireless.hh.
|
protectedinherited |
Current channel (device dependent.
Definition at line 298 of file Wireless.hh.
|
protectedinherited |
Latest message destination device address.
Definition at line 301 of file Wireless.hh.
|
static |