====== RFM69HW Synchronous Library ====== This is a synchronous control and configuration library for the RFM69HW (currently only Arduino-compatible). **Code Repository** - [[https://github.com/philcrump/UKHASnet_RFM69_Synchronous|github.com/philcrump/UKHASnet_RFM69_Synchronous]] By synchronous, this means that the library will block on transmission, and requires polling to read whether a packet is waiting in the FIFO buffer, failure to check this regularly will cause the previously received packet to be discarded if another is received. ===== Constructor ===== **RFM69(float tempFudge)** * tempFudge is the calibration for the internal RFM Temperature sensor. This is only used if the temperature is polled and is not used in normal send/receive operations. ===== Initialisation ===== **boolean init()** This function sets up the Arduino SPI drivers, writes the stored RFM69 configuration into the Transceiver Configuration Registers, sets the default mode (RX), and clears the MCU buffer. Currently this function will always return true, even if the RFM module is not connected. A check is planned for the future to return false if the module fails to respond, so please test the result of this to ensure future compatibility. ===== Control ===== **void setMode(uint8_t newMode)** This function allows you to set the current operation mode of the RFM69HW Transceiver Module. **boolean checkRx()** This function will poll the RFM69HW status registers to check for the presence of a received packet in the FIFO. In the case that a received packet is ready, the packet will be read into the MCU buffer, the RSSI will be read into the internal variable, and the function will return true. Else the function will return false. **void recv(uint8_t* buf, uint8_t* len)** This function will copy the MCU buffer into the buffer passed by //buf// and store the length of the data in //len//. The MCU buffer will then be cleared. **void send(const uint8_t* data, uint8_t len, uint8_t power)** This function will switch the operating mode to Transmit, ramp the PA power up to the power in dBmW given by //power//, then send the data stored in //data// upto the length given in //len//. The function will block while the packet is transmitted and finally return the operating mode to its previous state. **void SetLnaMode(uint8_t lnaMode)** This function allows the setting of the LNA mode to either 'Standard Sensitivity' or 'High Sensitivity'. It is expected that the use of 'High Sensitivity' in high signal strength conditions could cause overloading of the receiver and loss of packet throughput. **float readTemp()** This function will set the RFM69HW into Standby Mode, initiate a Temperature Sampling process and block while the sampling is completed. The function will then return the converted temperature value in degrees Celsius, with the calibration offset tempFudge that was passed to the constructor. **int lastRssi()** This function returns the RSSI value in the MCU variable, and is useful for polling the RSSI of a received packet after the packet has been read from the FIFO by //recv()//. **int RFM69::sampleRssi()** This function initiates an RSSI Sampling process and will block while the process is completed. The RSSI value is stored in the MCU variable and then returned in integer dBmW. It is not know what would happen if this function was called in an Operating Mode other than Receive, so the function will return '0' in this case.