Elmo Terminal provides functionality to test Lora radio and access SX1272 chip registers delivered with Elmo board. This firmware allows the user to control the LoRa radio parameters (eg. frequency, bandwidth, spreading factor etc.) by entering console commands via serial terminal. Application also contains "Ping-Pong" and data transmission functionalities.

Dependencies:   SX1272lib mbed

Fork of Elmo-Terminal by Michal Leksinski

Committer:
WGorniak
Date:
Thu Oct 22 08:03:32 2015 +0000
Revision:
12:26045241f50f
Parent:
4:2767f13b0a75
updated sx lib

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WGorniak 2:8d8295a51f68 1 #ifndef LIBRARIES_TESTS_RADIO_TERMINAL_RADIOCONTEX_H_
WGorniak 2:8d8295a51f68 2 #define LIBRARIES_TESTS_RADIO_TERMINAL_RADIOCONTEX_H_
WGorniak 2:8d8295a51f68 3
WGorniak 2:8d8295a51f68 4 #include "sx1272-hal.h"
WGorniak 2:8d8295a51f68 5 #include <string>
WGorniak 2:8d8295a51f68 6
WGorniak 2:8d8295a51f68 7 class Settings;
WGorniak 2:8d8295a51f68 8
WGorniak 2:8d8295a51f68 9 class RadioContex
WGorniak 2:8d8295a51f68 10 {
WGorniak 2:8d8295a51f68 11 private:
WGorniak 2:8d8295a51f68 12 static const char* rx_error_msg;
WGorniak 2:8d8295a51f68 13 static const char* rx_timeout_msg;
WGorniak 2:8d8295a51f68 14 int sendCntr;
WGorniak 2:8d8295a51f68 15 public:
WGorniak 2:8d8295a51f68 16
WGorniak 2:8d8295a51f68 17 enum
WGorniak 2:8d8295a51f68 18 {
WGorniak 2:8d8295a51f68 19 BUFFER_SIZE = 32 // Define the payload size here
WGorniak 2:8d8295a51f68 20 };
WGorniak 2:8d8295a51f68 21
WGorniak 2:8d8295a51f68 22 RadioContex (Settings* settings);
WGorniak 2:8d8295a51f68 23 ~RadioContex ();
WGorniak 2:8d8295a51f68 24
WGorniak 2:8d8295a51f68 25 Radio& radio();
WGorniak 2:8d8295a51f68 26
WGorniak 2:8d8295a51f68 27
WGorniak 2:8d8295a51f68 28 public:
WGorniak 4:2767f13b0a75 29 SX1272BRD* radio_;
WGorniak 2:8d8295a51f68 30
WGorniak 2:8d8295a51f68 31 static RadioContex* thi;
WGorniak 2:8d8295a51f68 32
WGorniak 2:8d8295a51f68 33
WGorniak 2:8d8295a51f68 34 typedef RadioState States_t;
WGorniak 2:8d8295a51f68 35 volatile States_t State;
WGorniak 2:8d8295a51f68 36
WGorniak 2:8d8295a51f68 37
WGorniak 2:8d8295a51f68 38
WGorniak 2:8d8295a51f68 39 uint8_t Buffer[BUFFER_SIZE];
WGorniak 2:8d8295a51f68 40
WGorniak 2:8d8295a51f68 41 int16_t RssiValue;
WGorniak 2:8d8295a51f68 42 int8_t SnrValue;
WGorniak 2:8d8295a51f68 43 uint16_t BufferSize;
WGorniak 2:8d8295a51f68 44
WGorniak 2:8d8295a51f68 45
WGorniak 2:8d8295a51f68 46 States_t getState() const;
WGorniak 2:8d8295a51f68 47 bool setState(States_t);
WGorniak 2:8d8295a51f68 48
WGorniak 2:8d8295a51f68 49
WGorniak 2:8d8295a51f68 50
WGorniak 2:8d8295a51f68 51 bool Send(std::string arg);
WGorniak 2:8d8295a51f68 52 bool initReceive();
WGorniak 2:8d8295a51f68 53 bool pool_rx();
WGorniak 2:8d8295a51f68 54
WGorniak 2:8d8295a51f68 55
WGorniak 2:8d8295a51f68 56
WGorniak 2:8d8295a51f68 57 static void StaticOnTxDone( void );
WGorniak 2:8d8295a51f68 58 static void StaticOnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr);
WGorniak 2:8d8295a51f68 59 static void StaticOnTxTimeout( void );
WGorniak 2:8d8295a51f68 60 static void StaticOnRxTimeout( void );
WGorniak 2:8d8295a51f68 61 static void StaticOnRxError( void );
WGorniak 2:8d8295a51f68 62
WGorniak 2:8d8295a51f68 63
WGorniak 2:8d8295a51f68 64 void OnTxDone( void );
WGorniak 2:8d8295a51f68 65 void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr);
WGorniak 2:8d8295a51f68 66 void OnTxTimeout( void );
WGorniak 2:8d8295a51f68 67 void OnRxTimeout( void );
WGorniak 2:8d8295a51f68 68 void OnRxError( void );
WGorniak 2:8d8295a51f68 69 };
WGorniak 2:8d8295a51f68 70
WGorniak 2:8d8295a51f68 71 #endif /* LIBRARIES_TESTS_RADIO_TERMINAL_RADIOCONTEX_H_ */