for India band 30dBm LoRa Module, DSPLoRa based on code from Semtech and as modified by Sachin Pukale/ TCL/

Dependencies:   mbed Chainable_RGB_LED DigitDisplay LoRaWAN-lib SX1276Lib

Fork of DSP_LoRaWAN by Akshay Mishra

Committer:
akshaymishra
Date:
Thu Jan 05 03:47:15 2017 +0000
Revision:
7:5c0e1dfdf0c6
Parent:
4:fc21b1bd6b15
Address update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mluis 0:cb80564f40e1 1 /*
mluis 0:cb80564f40e1 2 / _____) _ | |
mluis 0:cb80564f40e1 3 ( (____ _____ ____ _| |_ _____ ____| |__
mluis 0:cb80564f40e1 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
mluis 0:cb80564f40e1 5 _____) ) ____| | | || |_| ____( (___| | | |
mluis 0:cb80564f40e1 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
mluis 0:cb80564f40e1 7 (C)2015 Semtech
mluis 0:cb80564f40e1 8
mluis 0:cb80564f40e1 9 Description: VT100 serial display management
mluis 0:cb80564f40e1 10
mluis 0:cb80564f40e1 11 License: Revised BSD License, see LICENSE.TXT file include in the project
mluis 0:cb80564f40e1 12
mluis 0:cb80564f40e1 13 Maintainer: Miguel Luis and Gregory Cristian
mluis 0:cb80564f40e1 14 */
mluis 0:cb80564f40e1 15 #include "board.h"
mluis 0:cb80564f40e1 16 #include "vt100.h"
mluis 0:cb80564f40e1 17 #include "SerialDisplay.h"
mluis 0:cb80564f40e1 18
akshaymishra 4:fc21b1bd6b15 19 //VT100 vt( USBTX, USBRX );
akshaymishra 4:fc21b1bd6b15 20 VT100 vt( SERIAL_TX, SERIAL_RX );
mluis 0:cb80564f40e1 21
mluis 0:cb80564f40e1 22 void SerialPrintCheckBox( bool activated, uint8_t color )
mluis 0:cb80564f40e1 23 {
mluis 0:cb80564f40e1 24 if( activated == true )
mluis 0:cb80564f40e1 25 {
mluis 0:cb80564f40e1 26 vt.SetAttribute( VT100::ATTR_OFF, color, color );
mluis 0:cb80564f40e1 27 }
mluis 0:cb80564f40e1 28 else
mluis 0:cb80564f40e1 29 {
mluis 0:cb80564f40e1 30 vt.SetAttribute( VT100::ATTR_OFF );
mluis 0:cb80564f40e1 31 }
mluis 0:cb80564f40e1 32 vt.printf( " " );
mluis 0:cb80564f40e1 33 vt.SetAttribute( VT100::ATTR_OFF );
mluis 0:cb80564f40e1 34 }
mluis 0:cb80564f40e1 35
mluis 0:cb80564f40e1 36 void SerialDisplayUpdateActivationMode( bool otaa )
mluis 0:cb80564f40e1 37 {
mluis 0:cb80564f40e1 38 vt.SetCursorPos( 4, 17 );
mluis 0:cb80564f40e1 39 SerialPrintCheckBox( otaa, VT100::WHITE );
mluis 0:cb80564f40e1 40 vt.SetCursorPos( 9, 17 );
mluis 0:cb80564f40e1 41 SerialPrintCheckBox( !otaa, VT100::WHITE );
mluis 0:cb80564f40e1 42 }
mluis 0:cb80564f40e1 43
mluis 0:cb80564f40e1 44 void SerialDisplayUpdateEui( uint8_t line, uint8_t *eui )
mluis 0:cb80564f40e1 45 {
mluis 0:cb80564f40e1 46 vt.SetCursorPos( line, 27 );
mluis 0:cb80564f40e1 47 for( uint8_t i = 0; i < 8; i++ )
mluis 0:cb80564f40e1 48 {
mluis 0:cb80564f40e1 49 vt.printf( "%02X ", eui[i] );
mluis 0:cb80564f40e1 50 }
mluis 0:cb80564f40e1 51 vt.SetCursorPos( line, 50 );
mluis 0:cb80564f40e1 52 vt.printf( "]" );
mluis 0:cb80564f40e1 53 }
mluis 0:cb80564f40e1 54
mluis 0:cb80564f40e1 55 void SerialDisplayUpdateKey( uint8_t line, uint8_t *key )
mluis 0:cb80564f40e1 56 {
mluis 0:cb80564f40e1 57 vt.SetCursorPos( line, 27 );
mluis 0:cb80564f40e1 58 for( uint8_t i = 0; i < 16; i++ )
mluis 0:cb80564f40e1 59 {
mluis 0:cb80564f40e1 60 vt.printf( "%02X ", key[i] );
mluis 0:cb80564f40e1 61 }
mluis 0:cb80564f40e1 62 vt.SetCursorPos( line, 74 );
mluis 0:cb80564f40e1 63 vt.printf( "]" );
mluis 0:cb80564f40e1 64 }
mluis 0:cb80564f40e1 65
mluis 0:cb80564f40e1 66 void SerialDisplayUpdateNwkId( uint8_t id )
mluis 0:cb80564f40e1 67 {
mluis 0:cb80564f40e1 68 vt.SetCursorPos( 10, 27 );
mluis 0:cb80564f40e1 69 vt.printf( "%03d", id );
mluis 0:cb80564f40e1 70 }
mluis 0:cb80564f40e1 71
mluis 0:cb80564f40e1 72 void SerialDisplayUpdateDevAddr( uint32_t addr )
mluis 0:cb80564f40e1 73 {
mluis 0:cb80564f40e1 74 vt.SetCursorPos( 11, 27 );
mluis 0:cb80564f40e1 75 vt.printf( "%02X %02X %02X %02X", ( addr >> 24 ) & 0xFF, ( addr >> 16 ) & 0xFF, ( addr >> 8 ) & 0xFF, addr & 0xFF );
mluis 0:cb80564f40e1 76 }
mluis 0:cb80564f40e1 77
mluis 0:cb80564f40e1 78 void SerialDisplayUpdateFrameType( bool confirmed )
mluis 0:cb80564f40e1 79 {
mluis 0:cb80564f40e1 80 vt.SetCursorPos( 15, 17 );
mluis 0:cb80564f40e1 81 SerialPrintCheckBox( confirmed, VT100::WHITE );
mluis 0:cb80564f40e1 82 vt.SetCursorPos( 15, 32 );
mluis 0:cb80564f40e1 83 SerialPrintCheckBox( !confirmed, VT100::WHITE );
mluis 0:cb80564f40e1 84 }
mluis 0:cb80564f40e1 85
mluis 0:cb80564f40e1 86 void SerialDisplayUpdateAdr( bool adr )
mluis 0:cb80564f40e1 87 {
mluis 0:cb80564f40e1 88 vt.SetCursorPos( 16, 27 );
mluis 0:cb80564f40e1 89 if( adr == true )
mluis 0:cb80564f40e1 90 {
mluis 0:cb80564f40e1 91 vt.printf( " ON" );
mluis 0:cb80564f40e1 92 }
mluis 0:cb80564f40e1 93 else
mluis 0:cb80564f40e1 94 {
mluis 0:cb80564f40e1 95 vt.printf( "OFF" );
mluis 0:cb80564f40e1 96 }
mluis 0:cb80564f40e1 97 }
mluis 0:cb80564f40e1 98
mluis 0:cb80564f40e1 99 void SerialDisplayUpdateDutyCycle( bool dutyCycle )
mluis 0:cb80564f40e1 100 {
mluis 0:cb80564f40e1 101 vt.SetCursorPos( 17, 27 );
mluis 0:cb80564f40e1 102 if( dutyCycle == true )
mluis 0:cb80564f40e1 103 {
mluis 0:cb80564f40e1 104 vt.printf( " ON" );
mluis 0:cb80564f40e1 105 }
mluis 0:cb80564f40e1 106 else
mluis 0:cb80564f40e1 107 {
mluis 0:cb80564f40e1 108 vt.printf( "OFF" );
mluis 0:cb80564f40e1 109 }
mluis 0:cb80564f40e1 110 }
mluis 0:cb80564f40e1 111
mluis 0:cb80564f40e1 112 void SerialDisplayUpdatePublicNetwork( bool network )
mluis 0:cb80564f40e1 113 {
mluis 0:cb80564f40e1 114 vt.SetCursorPos( 19, 17 );
mluis 0:cb80564f40e1 115 SerialPrintCheckBox( network, VT100::WHITE );
mluis 0:cb80564f40e1 116 vt.SetCursorPos( 19, 30 );
mluis 0:cb80564f40e1 117 SerialPrintCheckBox( !network, VT100::WHITE );
mluis 0:cb80564f40e1 118 }
mluis 0:cb80564f40e1 119
mluis 0:cb80564f40e1 120 void SerialDisplayUpdateNetworkIsJoined( bool state )
mluis 0:cb80564f40e1 121 {
mluis 0:cb80564f40e1 122 vt.SetCursorPos( 20, 17 );
mluis 0:cb80564f40e1 123 SerialPrintCheckBox( !state, VT100::RED );
mluis 0:cb80564f40e1 124 vt.SetCursorPos( 20, 30 );
mluis 0:cb80564f40e1 125 SerialPrintCheckBox( state, VT100::GREEN );
mluis 0:cb80564f40e1 126 }
mluis 0:cb80564f40e1 127
mluis 0:cb80564f40e1 128 void SerialDisplayUpdateLedState( uint8_t id, uint8_t state )
mluis 0:cb80564f40e1 129 {
mluis 0:cb80564f40e1 130 switch( id )
mluis 0:cb80564f40e1 131 {
mluis 0:cb80564f40e1 132 case 1:
mluis 0:cb80564f40e1 133 vt.SetCursorPos( 22, 17 );
mluis 0:cb80564f40e1 134 SerialPrintCheckBox( state, VT100::RED );
mluis 0:cb80564f40e1 135 break;
mluis 0:cb80564f40e1 136 case 2:
mluis 0:cb80564f40e1 137 vt.SetCursorPos( 22, 31 );
mluis 0:cb80564f40e1 138 SerialPrintCheckBox( state, VT100::GREEN );
mluis 0:cb80564f40e1 139 break;
mluis 0:cb80564f40e1 140 case 3:
mluis 0:cb80564f40e1 141 vt.SetCursorPos( 22, 45 );
mluis 0:cb80564f40e1 142 SerialPrintCheckBox( state, VT100::BLUE );
mluis 0:cb80564f40e1 143 break;
mluis 0:cb80564f40e1 144 }
mluis 0:cb80564f40e1 145 }
mluis 0:cb80564f40e1 146
mluis 0:cb80564f40e1 147 void SerialDisplayUpdateData( uint8_t line, uint8_t *buffer, uint8_t size )
mluis 0:cb80564f40e1 148 {
mluis 0:cb80564f40e1 149 if( size != 0 )
mluis 0:cb80564f40e1 150 {
mluis 0:cb80564f40e1 151 vt.SetCursorPos( line, 27 );
mluis 0:cb80564f40e1 152 for( uint8_t i = 0; i < size; i++ )
mluis 0:cb80564f40e1 153 {
mluis 0:cb80564f40e1 154 vt.printf( "%02X ", buffer[i] );
mluis 0:cb80564f40e1 155 if( ( ( i + 1 ) % 16 ) == 0 )
mluis 0:cb80564f40e1 156 {
mluis 0:cb80564f40e1 157 line++;
mluis 0:cb80564f40e1 158 vt.SetCursorPos( line, 27 );
mluis 0:cb80564f40e1 159 }
mluis 0:cb80564f40e1 160 }
mluis 0:cb80564f40e1 161 for( uint8_t i = size; i < 64; i++ )
mluis 0:cb80564f40e1 162 {
mluis 0:cb80564f40e1 163 vt.printf( "__ " );
mluis 0:cb80564f40e1 164 if( ( ( i + 1 ) % 16 ) == 0 )
mluis 0:cb80564f40e1 165 {
mluis 0:cb80564f40e1 166 line++;
mluis 0:cb80564f40e1 167 vt.SetCursorPos( line, 27 );
mluis 0:cb80564f40e1 168 }
mluis 0:cb80564f40e1 169 }
mluis 0:cb80564f40e1 170 vt.SetCursorPos( line - 1, 74 );
mluis 0:cb80564f40e1 171 vt.printf( "]" );
mluis 0:cb80564f40e1 172 }
mluis 0:cb80564f40e1 173 else
mluis 0:cb80564f40e1 174 {
mluis 0:cb80564f40e1 175 vt.SetCursorPos( line, 27 );
mluis 0:cb80564f40e1 176 for( uint8_t i = 0; i < 64; i++ )
mluis 0:cb80564f40e1 177 {
mluis 0:cb80564f40e1 178 vt.printf( "__ " );
mluis 0:cb80564f40e1 179 if( ( ( i + 1 ) % 16 ) == 0 )
mluis 0:cb80564f40e1 180 {
mluis 0:cb80564f40e1 181 line++;
mluis 0:cb80564f40e1 182 vt.SetCursorPos( line, 27 );
mluis 0:cb80564f40e1 183 }
mluis 0:cb80564f40e1 184 }
mluis 0:cb80564f40e1 185 vt.SetCursorPos( line - 1, 74 );
mluis 0:cb80564f40e1 186 vt.printf( "]" );
mluis 0:cb80564f40e1 187 }
mluis 0:cb80564f40e1 188 }
mluis 0:cb80564f40e1 189
mluis 0:cb80564f40e1 190 void SerialDisplayUpdateUplinkAcked( bool state )
mluis 0:cb80564f40e1 191 {
mluis 0:cb80564f40e1 192 vt.SetCursorPos( 24, 36 );
mluis 0:cb80564f40e1 193 SerialPrintCheckBox( state, VT100::GREEN );
mluis 0:cb80564f40e1 194 }
mluis 0:cb80564f40e1 195
mluis 0:cb80564f40e1 196 void SerialDisplayUpdateUplink( bool acked, uint8_t datarate, uint16_t counter, uint8_t port, uint8_t *buffer, uint8_t bufferSize )
mluis 0:cb80564f40e1 197 {
mluis 0:cb80564f40e1 198 // Acked
mluis 0:cb80564f40e1 199 SerialDisplayUpdateUplinkAcked( acked );
mluis 0:cb80564f40e1 200 // Datarate
mluis 0:cb80564f40e1 201 vt.SetCursorPos( 25, 33 );
mluis 0:cb80564f40e1 202 vt.printf( "DR%d", datarate );
mluis 0:cb80564f40e1 203 // Counter
mluis 0:cb80564f40e1 204 vt.SetCursorPos( 26, 27 );
mluis 0:cb80564f40e1 205 vt.printf( "%10d", counter );
mluis 0:cb80564f40e1 206 // Port
mluis 0:cb80564f40e1 207 vt.SetCursorPos( 27, 34 );
mluis 0:cb80564f40e1 208 vt.printf( "%3d", port );
mluis 0:cb80564f40e1 209 // Data
mluis 0:cb80564f40e1 210 SerialDisplayUpdateData( 28, buffer, bufferSize );
mluis 0:cb80564f40e1 211 // Help message
mluis 0:cb80564f40e1 212 vt.SetCursorPos( 42, 1 );
mluis 0:cb80564f40e1 213 vt.printf( "To refresh screen please hit 'r' key." );
mluis 0:cb80564f40e1 214 }
mluis 0:cb80564f40e1 215
mluis 0:cb80564f40e1 216 void SerialDisplayUpdateDonwlinkRxData( bool state )
mluis 0:cb80564f40e1 217 {
mluis 0:cb80564f40e1 218 vt.SetCursorPos( 34, 4 );
mluis 0:cb80564f40e1 219 SerialPrintCheckBox( state, VT100::GREEN );
mluis 0:cb80564f40e1 220 }
mluis 0:cb80564f40e1 221
mluis 0:cb80564f40e1 222 void SerialDisplayUpdateDownlink( bool rxData, int16_t rssi, int8_t snr, uint16_t counter, uint8_t port, uint8_t *buffer, uint8_t bufferSize )
mluis 0:cb80564f40e1 223 {
mluis 0:cb80564f40e1 224 // Rx data
mluis 0:cb80564f40e1 225 SerialDisplayUpdateDonwlinkRxData( rxData );
mluis 0:cb80564f40e1 226 // RSSI
mluis 0:cb80564f40e1 227 vt.SetCursorPos( 33, 32 );
mluis 0:cb80564f40e1 228 vt.printf( "%5d", rssi );
mluis 0:cb80564f40e1 229 // SNR
mluis 0:cb80564f40e1 230 vt.SetCursorPos( 34, 32 );
mluis 0:cb80564f40e1 231 vt.printf( "%5d", snr );
mluis 0:cb80564f40e1 232 // Counter
mluis 0:cb80564f40e1 233 vt.SetCursorPos( 35, 27 );
mluis 0:cb80564f40e1 234 vt.printf( "%10d", counter );
mluis 0:cb80564f40e1 235 if( rxData == true )
mluis 0:cb80564f40e1 236 {
mluis 0:cb80564f40e1 237 // Port
mluis 0:cb80564f40e1 238 vt.SetCursorPos( 36, 34 );
mluis 0:cb80564f40e1 239 vt.printf( "%3d", port );
mluis 0:cb80564f40e1 240 // Data
mluis 0:cb80564f40e1 241 SerialDisplayUpdateData( 37, buffer, bufferSize );
mluis 0:cb80564f40e1 242 }
mluis 0:cb80564f40e1 243 else
mluis 0:cb80564f40e1 244 {
mluis 0:cb80564f40e1 245 // Port
mluis 0:cb80564f40e1 246 vt.SetCursorPos( 36, 34 );
mluis 0:cb80564f40e1 247 vt.printf( " " );
mluis 0:cb80564f40e1 248 // Data
mluis 0:cb80564f40e1 249 SerialDisplayUpdateData( 37, NULL, 0 );
mluis 0:cb80564f40e1 250 }
mluis 0:cb80564f40e1 251 }
mluis 0:cb80564f40e1 252
mluis 0:cb80564f40e1 253 void SerialDisplayDrawFirstLine( void )
mluis 0:cb80564f40e1 254 {
mluis 0:cb80564f40e1 255 vt.PutBoxDrawingChar( 'l' );
mluis 0:cb80564f40e1 256 for( int8_t i = 0; i <= 77; i++ )
mluis 0:cb80564f40e1 257 {
mluis 0:cb80564f40e1 258 vt.PutBoxDrawingChar( 'q' );
mluis 0:cb80564f40e1 259 }
mluis 0:cb80564f40e1 260 vt.PutBoxDrawingChar( 'k' );
mluis 0:cb80564f40e1 261 vt.printf( "\r\n" );
mluis 0:cb80564f40e1 262 }
mluis 0:cb80564f40e1 263
mluis 0:cb80564f40e1 264 void SerialDisplayDrawTitle( const char* title )
mluis 0:cb80564f40e1 265 {
mluis 0:cb80564f40e1 266 vt.PutBoxDrawingChar( 'x' );
mluis 0:cb80564f40e1 267 vt.printf( "%s", title );
mluis 0:cb80564f40e1 268 vt.PutBoxDrawingChar( 'x' );
mluis 0:cb80564f40e1 269 vt.printf( "\r\n" );
mluis 0:cb80564f40e1 270 }
mluis 0:cb80564f40e1 271 void SerialDisplayDrawTopSeparator( void )
mluis 0:cb80564f40e1 272 {
mluis 0:cb80564f40e1 273 vt.PutBoxDrawingChar( 't' );
mluis 0:cb80564f40e1 274 for( int8_t i = 0; i <= 11; i++ )
mluis 0:cb80564f40e1 275 {
mluis 0:cb80564f40e1 276 vt.PutBoxDrawingChar( 'q' );
mluis 0:cb80564f40e1 277 }
mluis 0:cb80564f40e1 278 vt.PutBoxDrawingChar( 'w' );
mluis 0:cb80564f40e1 279 for( int8_t i = 0; i <= 64; i++ )
mluis 0:cb80564f40e1 280 {
mluis 0:cb80564f40e1 281 vt.PutBoxDrawingChar( 'q' );
mluis 0:cb80564f40e1 282 }
mluis 0:cb80564f40e1 283 vt.PutBoxDrawingChar( 'u' );
mluis 0:cb80564f40e1 284 vt.printf( "\r\n" );
mluis 0:cb80564f40e1 285 }
mluis 0:cb80564f40e1 286
mluis 0:cb80564f40e1 287 void SerialDisplayDrawColSeparator( void )
mluis 0:cb80564f40e1 288 {
mluis 0:cb80564f40e1 289 vt.PutBoxDrawingChar( 'x' );
mluis 0:cb80564f40e1 290 for( int8_t i = 0; i <= 11; i++ )
mluis 0:cb80564f40e1 291 {
mluis 0:cb80564f40e1 292 vt.PutBoxDrawingChar( ' ' );
mluis 0:cb80564f40e1 293 }
mluis 0:cb80564f40e1 294 vt.PutBoxDrawingChar( 't' );
mluis 0:cb80564f40e1 295 for( int8_t i = 0; i <= 64; i++ )
mluis 0:cb80564f40e1 296 {
mluis 0:cb80564f40e1 297 vt.PutBoxDrawingChar( 'q' );
mluis 0:cb80564f40e1 298 }
mluis 0:cb80564f40e1 299 vt.PutBoxDrawingChar( 'u' );
mluis 0:cb80564f40e1 300 vt.printf( "\r\n" );
mluis 0:cb80564f40e1 301 }
mluis 0:cb80564f40e1 302
mluis 0:cb80564f40e1 303 void SerialDisplayDrawSeparator( void )
mluis 0:cb80564f40e1 304 {
mluis 0:cb80564f40e1 305 vt.PutBoxDrawingChar( 't' );
mluis 0:cb80564f40e1 306 for( int8_t i = 0; i <= 11; i++ )
mluis 0:cb80564f40e1 307 {
mluis 0:cb80564f40e1 308 vt.PutBoxDrawingChar( 'q' );
mluis 0:cb80564f40e1 309 }
mluis 0:cb80564f40e1 310 vt.PutBoxDrawingChar( 'n' );
mluis 0:cb80564f40e1 311 for( int8_t i = 0; i <= 64; i++ )
mluis 0:cb80564f40e1 312 {
mluis 0:cb80564f40e1 313 vt.PutBoxDrawingChar( 'q' );
mluis 0:cb80564f40e1 314 }
mluis 0:cb80564f40e1 315 vt.PutBoxDrawingChar( 'u' );
mluis 0:cb80564f40e1 316 vt.printf( "\r\n" );
mluis 0:cb80564f40e1 317 }
mluis 0:cb80564f40e1 318
mluis 0:cb80564f40e1 319 void SerialDisplayDrawLine( const char* firstCol, const char* secondCol )
mluis 0:cb80564f40e1 320 {
mluis 0:cb80564f40e1 321 vt.PutBoxDrawingChar( 'x' );
mluis 0:cb80564f40e1 322 vt.printf( "%s", firstCol );
mluis 0:cb80564f40e1 323 vt.PutBoxDrawingChar( 'x' );
mluis 0:cb80564f40e1 324 vt.printf( "%s", secondCol );
mluis 0:cb80564f40e1 325 vt.PutBoxDrawingChar( 'x' );
mluis 0:cb80564f40e1 326 vt.printf( "\r\n" );
mluis 0:cb80564f40e1 327 }
mluis 0:cb80564f40e1 328
mluis 0:cb80564f40e1 329 void SerialDisplayDrawBottomLine( void )
mluis 0:cb80564f40e1 330 {
mluis 0:cb80564f40e1 331 vt.PutBoxDrawingChar( 'm' );
mluis 0:cb80564f40e1 332 for( int8_t i = 0; i <= 11; i++ )
mluis 0:cb80564f40e1 333 {
mluis 0:cb80564f40e1 334 vt.PutBoxDrawingChar( 'q' );
mluis 0:cb80564f40e1 335 }
mluis 0:cb80564f40e1 336 vt.PutBoxDrawingChar( 'v' );
mluis 0:cb80564f40e1 337 for( int8_t i = 0; i <= 64; i++ )
mluis 0:cb80564f40e1 338 {
mluis 0:cb80564f40e1 339 vt.PutBoxDrawingChar( 'q' );
mluis 0:cb80564f40e1 340 }
mluis 0:cb80564f40e1 341 vt.PutBoxDrawingChar( 'j' );
mluis 0:cb80564f40e1 342 vt.printf( "\r\n" );
mluis 0:cb80564f40e1 343 }
mluis 0:cb80564f40e1 344
mluis 0:cb80564f40e1 345 void SerialDisplayInit( void )
mluis 0:cb80564f40e1 346 {
mluis 0:cb80564f40e1 347 vt.ClearScreen( 2 );
mluis 0:cb80564f40e1 348 vt.SetCursorMode( false );
mluis 0:cb80564f40e1 349 vt.SetCursorPos( 0, 0 );
mluis 0:cb80564f40e1 350
mluis 0:cb80564f40e1 351 // "+-----------------------------------------------------------------------------+" );
mluis 0:cb80564f40e1 352 SerialDisplayDrawFirstLine( );
mluis 0:cb80564f40e1 353 // "¦ LoRaWAN Demonstration Application ¦" );
mluis 0:cb80564f40e1 354 SerialDisplayDrawTitle( " LoRaWAN Demonstration Application " );
mluis 0:cb80564f40e1 355 // "+------------+----------------------------------------------------------------¦" );
mluis 0:cb80564f40e1 356 SerialDisplayDrawTopSeparator( );
mluis 0:cb80564f40e1 357 // "¦ Activation ¦ [ ]Over The Air ¦" );
mluis 0:cb80564f40e1 358 SerialDisplayDrawLine( " Activation ", " [ ]Over The Air " );
mluis 0:cb80564f40e1 359 // "¦ ¦ DevEui [__ __ __ __ __ __ __ __] ¦" );
mluis 0:cb80564f40e1 360 SerialDisplayDrawLine( " ", " DevEui [__ __ __ __ __ __ __ __] " );
mluis 0:cb80564f40e1 361 // "¦ ¦ AppEui [__ __ __ __ __ __ __ __] ¦" );
mluis 0:cb80564f40e1 362 SerialDisplayDrawLine( " ", " AppEui [__ __ __ __ __ __ __ __] " );
mluis 0:cb80564f40e1 363 // "¦ ¦ AppKey [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __] ¦" );
mluis 0:cb80564f40e1 364 SerialDisplayDrawLine( " ", " AppKey [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __] " );
mluis 0:cb80564f40e1 365 // "¦ +----------------------------------------------------------------¦" );
mluis 0:cb80564f40e1 366 SerialDisplayDrawColSeparator( );
mluis 0:cb80564f40e1 367 // "¦ ¦ [x]Personalisation ¦" );
mluis 0:cb80564f40e1 368 SerialDisplayDrawLine( " ", " [ ]Personalisation " );
mluis 0:cb80564f40e1 369 // "¦ ¦ NwkId [___] ¦" );
mluis 0:cb80564f40e1 370 SerialDisplayDrawLine( " ", " NwkId [___] " );
mluis 0:cb80564f40e1 371 // "¦ ¦ DevAddr [__ __ __ __] ¦" );
mluis 0:cb80564f40e1 372 SerialDisplayDrawLine( " ", " DevAddr [__ __ __ __] " );
mluis 0:cb80564f40e1 373 // "¦ ¦ NwkSKey [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __] ¦" );
mluis 0:cb80564f40e1 374 SerialDisplayDrawLine( " ", " NwkSKey [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __] " );
mluis 0:cb80564f40e1 375 // "¦ ¦ AppSKey [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __] ¦" );
mluis 0:cb80564f40e1 376 SerialDisplayDrawLine( " ", " AppSKey [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __] " );
mluis 0:cb80564f40e1 377 // "+------------+----------------------------------------------------------------¦" );
mluis 0:cb80564f40e1 378 SerialDisplayDrawSeparator( );
mluis 0:cb80564f40e1 379 // "¦ MAC params ¦ [ ]Confirmed / [ ]Unconfirmed ¦" );
mluis 0:cb80564f40e1 380 SerialDisplayDrawLine( " MAC params ", " [ ]Confirmed / [ ]Unconfirmed " );
mluis 0:cb80564f40e1 381 // "¦ ¦ ADR [ ] ¦" );
mluis 0:cb80564f40e1 382 SerialDisplayDrawLine( " ", " ADR [ ] " );
mluis 0:cb80564f40e1 383 // "¦ ¦ Duty cycle[ ] ¦" );
mluis 0:cb80564f40e1 384 SerialDisplayDrawLine( " ", " Duty cycle[ ] " );
mluis 0:cb80564f40e1 385 // "+------------+----------------------------------------------------------------¦" );
mluis 0:cb80564f40e1 386 SerialDisplayDrawSeparator( );
mluis 0:cb80564f40e1 387 // "¦ Network ¦ [ ]Public / [ ]Private ¦" );
mluis 0:cb80564f40e1 388 SerialDisplayDrawLine( " Network ", " [ ]Public / [ ]Private " );
mluis 0:cb80564f40e1 389 // "¦ ¦ [ ]Joining / [ ]Joined ¦" );
mluis 0:cb80564f40e1 390 SerialDisplayDrawLine( " ", " [ ]Joining / [ ]Joined " );
mluis 0:cb80564f40e1 391 // "+------------+----------------------------------------------------------------¦" );
mluis 0:cb80564f40e1 392 SerialDisplayDrawSeparator( );
mluis 0:cb80564f40e1 393 // "¦ LED status ¦ [ ]LED1(Tx) / [ ]LED2(Rx) / [ ]LED3(App) ¦" );
mluis 0:cb80564f40e1 394 SerialDisplayDrawLine( " LED status ", " [ ]LED1(Tx) / [ ]LED2(Rx) / [ ]LED3(App) " );
mluis 0:cb80564f40e1 395 // "+------------+----------------------------------------------------------------¦" );
mluis 0:cb80564f40e1 396 SerialDisplayDrawSeparator( );
mluis 0:cb80564f40e1 397 // "¦ Uplink ¦ Acked [ ] ¦" );
mluis 0:cb80564f40e1 398 SerialDisplayDrawLine( " Uplink ", " Acked [ ] " );
mluis 0:cb80564f40e1 399 // "¦ ¦ Datarate [ ] ¦" );
mluis 0:cb80564f40e1 400 SerialDisplayDrawLine( " ", " Datarate [ ] " );
mluis 0:cb80564f40e1 401 // "¦ ¦ Counter [ ] ¦" );
mluis 0:cb80564f40e1 402 SerialDisplayDrawLine( " ", " Counter [ ] " );
mluis 0:cb80564f40e1 403 // "¦ ¦ Port [ ] ¦" );
mluis 0:cb80564f40e1 404 SerialDisplayDrawLine( " ", " Port [ ] " );
mluis 0:cb80564f40e1 405 // "¦ ¦ Data [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ ¦" );
mluis 0:cb80564f40e1 406 SerialDisplayDrawLine( " ", " Data [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ " );
mluis 0:cb80564f40e1 407 // "¦ ¦ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ ¦" );
mluis 0:cb80564f40e1 408 SerialDisplayDrawLine( " ", " __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ " );
mluis 0:cb80564f40e1 409 // "¦ ¦ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ ¦" );
mluis 0:cb80564f40e1 410 SerialDisplayDrawLine( " ", " __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ " );
mluis 0:cb80564f40e1 411 // "¦ ¦ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ ¦" );
mluis 0:cb80564f40e1 412 SerialDisplayDrawLine( " ", " __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ " );
mluis 0:cb80564f40e1 413 // "+------------+----------------------------------------------------------------¦" );
mluis 0:cb80564f40e1 414 SerialDisplayDrawSeparator( );
mluis 0:cb80564f40e1 415 // "¦ Downlink ¦ RSSI [ ] dBm ¦" );
mluis 0:cb80564f40e1 416 SerialDisplayDrawLine( " Downlink ", " RSSI [ ] dBm " );
mluis 0:cb80564f40e1 417 // "¦ [ ]Data ¦ SNR [ ] dB ¦" );
mluis 0:cb80564f40e1 418 SerialDisplayDrawLine( " [ ]Data ", " SNR [ ] dB " );
mluis 0:cb80564f40e1 419 // "¦ ¦ Counter [ ] ¦" );
mluis 0:cb80564f40e1 420 // "¦ ¦ Counter [ ] ¦" );
mluis 0:cb80564f40e1 421 SerialDisplayDrawLine( " ", " Counter [ ] " );
mluis 0:cb80564f40e1 422 // "¦ ¦ Port [ ] ¦" );
mluis 0:cb80564f40e1 423 SerialDisplayDrawLine( " ", " Port [ ] " );
mluis 0:cb80564f40e1 424 // "¦ ¦ Data [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ ¦" );
mluis 0:cb80564f40e1 425 SerialDisplayDrawLine( " ", " Data [__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ " );
mluis 0:cb80564f40e1 426 // "¦ ¦ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ ¦" );
mluis 0:cb80564f40e1 427 SerialDisplayDrawLine( " ", " __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ " );
mluis 0:cb80564f40e1 428 // "¦ ¦ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ ¦" );
mluis 0:cb80564f40e1 429 SerialDisplayDrawLine( " ", " __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ " );
mluis 0:cb80564f40e1 430 // "¦ ¦ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ ¦" );
mluis 0:cb80564f40e1 431 SerialDisplayDrawLine( " ", " __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ " );
mluis 0:cb80564f40e1 432 // "+------------+----------------------------------------------------------------+" );
mluis 0:cb80564f40e1 433 SerialDisplayDrawBottomLine( );
mluis 0:cb80564f40e1 434 vt.printf( "To refresh screen please hit 'r' key.\r\n" );
mluis 0:cb80564f40e1 435 }
mluis 0:cb80564f40e1 436
mluis 0:cb80564f40e1 437 bool SerialDisplayReadable( void )
mluis 0:cb80564f40e1 438 {
mluis 0:cb80564f40e1 439 return vt.Readable( );
mluis 0:cb80564f40e1 440 }
mluis 0:cb80564f40e1 441
mluis 0:cb80564f40e1 442 uint8_t SerialDisplayGetChar( void )
mluis 0:cb80564f40e1 443 {
mluis 0:cb80564f40e1 444 return vt.GetChar( );
mluis 0:cb80564f40e1 445 }