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:
mluis
Date:
Thu Mar 17 09:32:46 2016 +0000
Revision:
0:cb80564f40e1
Child:
4:fc21b1bd6b15
Project creation based on LoRaWAN-demo-76

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