A mbed library for the RN2483. Heavily based on the Sodaq_RN2483 library for Arduino (https://github.com/SodaqMoja/Sodaq_RN2483). This is currently under-going initial testing, but seems to work! Tested on a NRF51 and FRDM K64F.
Dependents: rn2483-TestProgram
Diff: RN2483.h
- Revision:
- 2:336a025b82b5
- Parent:
- 1:cf9b0c21907a
- Child:
- 3:ee222a99783c
--- a/RN2483.h Sat Nov 19 23:30:34 2016 +0000 +++ b/RN2483.h Sun Nov 20 14:37:54 2016 +0000 @@ -49,6 +49,7 @@ NetworkFatalError = 6, NotConnected = 7, NoAcknowledgment = 8, + Silent = 9, }; // Provides a simple, abstracted interface to Microchip's RN2483 LoRaWAN module. @@ -72,11 +73,11 @@ }; /** - * @brief Connect to network using Over The Air activation. + * @brief Initialise settings and connect to network using Over The Air activation. * @param devEUI provided by LoRaWAN Network server registration. * @param appEUI provided by LoRaWAN Network server registration. * @param appKey provided by LoRaWAN Network server registration. - * @return Network confirmation if sucessfully connected. + * @return Returns true if network confirmation and able to save settings. */ bool initOTA(const uint8_t devEUI[8], const uint8_t appEUI[8], const uint8_t appKey[16], bool adr = true); @@ -85,11 +86,23 @@ * @param devADDR provided by LoRaWAN Network server registration. * @param appSKey provided by LoRaWAN Network server registration. * @param nwkSKey provided by LoRaWAN Network server registration. - * @return Returns true if the parameters was valid. + * @return Returns true if the parameters were valid and able to save settings. */ bool initABP(const uint8_t devAddr[4], const uint8_t appSKey[16], const uint8_t nwkSKey[16], bool adr = true); /** + * @brief Attempts to connect to the network using Over The Air Activation. + * @return Returns true if able to join network. + */ + bool joinOTTA(); + + /** + * @brief Attempts to connect to the network using Activation By Personalization. + * @return Returns true if able to join network. + */ + bool joinABP(); + + /** * @brief Sends the given payload without acknowledgement. * @param Port to use for transmission. * @param Payload buffer @@ -123,6 +136,12 @@ * @return Returns the number of bytes written or 0 in case of error.. */ uint8_t getHWEUI(uint8_t* buffer, uint8_t size); + + /** + * @brief Informs the RN2483 to do an ADC conversion on the VDD. + * @return Returns mV as a decimal from 0 to 3600. + */ + uint8_t getVDD(); /** * @brief Enables all the channels that belong to the given Frequency Sub-Band (FSB)