standalone sx1276 demo program

Dependencies:   SX1276Lib mbed

Fork of SX1276_GPS by CaryCoders

main.h

Committer:
ftagius
Date:
2015-06-16
Revision:
29:0ea07cc7124b
Child:
31:2c813f321db7

File content as of revision 29:0ea07cc7124b:

/*
 / _____)             _              | |
( (____  _____ ____ _| |_ _____  ____| |__
 \____ \| ___ |    (_   _) ___ |/ ___)  _ \
 _____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
    ( C )2014 Semtech

Description: Contains the callbacks for the IRQs and any application related details

License: Revised BSD License, see LICENSE.TXT file include in the project

Maintainer: Miguel Luis and Gregory Cristian
*/
#ifndef __MAIN_H__
#define __MAIN_H__
#include "vt100.h"
#include "lcdadafruit.h"
#include "GPS.h"
/*
 * Callback functions prototypes
 */
/*!
 * @brief Function to be executed on Radio Tx Done event
 */
void OnTxDone( void );

/*!
 * @brief Function to be executed on Radio Rx Done event
 */
void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );

/*!
 * @brief Function executed on Radio Tx Timeout event
 */
void OnTxTimeout( void );

/*!
 * @brief Function executed on Radio Rx Timeout event
 */
void OnRxTimeout( void );

/*!
 * @brief Function executed on Radio Rx Error event
 */
void OnRxError( void );

/*!
 * @brief Function executed on Radio Fhss Change Channel event
 */
void OnFhssChangeChannel( uint8_t channelIndex );

/*!
 * @brief Function executed on CAD Done event
 */
void OnCadDone( void );

char* itoa(int val, int base);
unsigned int randomSeed(void);
void start_ping_pong(void);
void ping_pong(void);
void start_hello(void);
void hello(void);
void check_gps(void);
int get_kbd_str(char* buf, int size);
void console_chat();
void console();
void check_rx_chat();
void configRxTx();
void print_status();
void print_help();
void print_bandwidth();
void print_cr();
void print_power();

/*
 *  Global variables declarations
 */
extern Serial pc;
//extern char pcbuf[];

#define RX_TIMEOUT_VALUE                                5000000   // in us
#define TX_TIMEOUT_VALUE                                4000000   // in us
#define BUFFER_SIZE                                     256        // Define the payload size here
#define RADIO_INSTALLED                                 true

#if( defined ( TARGET_KL25Z ) || defined ( TARGET_LPC11U6X ) )
extern DigitalOut led;
#else
extern DigitalOut led;
#endif
 
typedef RadioState States_t;
extern LCDadafruit cLCD;
extern volatile States_t State;
extern SX1276MB1xAS Radio;
extern GPS gpsd;
extern uint8_t PingMsg[];
extern uint8_t PongMsg[];
extern uint8_t HelloMsg[];
extern uint16_t BufferSize;
extern uint8_t BufferTx[];
extern uint8_t BufferRx[];
extern vt100 ctrl;
extern float Frequency;
extern int TxPower;
extern int Bandwidth;
extern int SpreadingFactor;
extern int CodingRate;
extern int pkt_count;
extern int pkt_data[];
extern int max_pkts;
extern int per;
extern bool isMaster;
extern bool AlwaysMaster;
extern bool AlwaysSlave;
extern bool rxTimeout;
extern char pcbuf[];
extern bool ackRcvd;
extern bool gpsEnabled;
extern int txLen;
extern int16_t RssiValue;
extern int8_t SnrValue;
#define PCBUF_SIZE 64

typedef enum {
    APP_NONE = 0,
    APP_PING,
    APP_CHAT,
    APP_HELLO,
    APP_CONSOLE,
    APP_GPS
} app_e;

extern app_e app;

#endif // __MAIN_H__