Anish updated the code to work with L152. RTC seems to causing issue. Will have to disable LSE.

Dependencies:   mbed LoRaWAN-lib SX1276Lib

Committer:
uss1994
Date:
Fri Jul 19 16:03:32 2019 +0000
Revision:
37:24625e89879b
Parent:
19:6f88d1cabaca
measure after the relay triggers

Who changed what in which revision?

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