Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Serial.c
00001 #include "System.h" 00002 00003 ByteQueue PCBackDoorTx,PCBackDoorRx; 00004 BYTE PCBackDoorTx_Queue_Storage[PC_BACKDOOR_TX_QUEUE_SIZE]; 00005 BYTE PCBackDoorRx_Queue_Storage[PC_BACKDOOR_RX_QUEUE_SIZE]; 00006 00007 Serial PCBackDoor(USBTX, USBRX); 00008 Ticker PCBackDoorTxQueueCheck; 00009 00010 //IRQ for when data is received 00011 void PCBackDoorRxIRQ(); 00012 void PCBackDoorMoveTxQueue(); 00013 00014 void InitPCBackDoor() 00015 { 00016 InitByteQueue(&PCBackDoorTx,PC_BACKDOOR_TX_QUEUE_SIZE,&PCBackDoorTx_Queue_Storage[0]); 00017 InitByteQueue(&PCBackDoorRx,PC_BACKDOOR_RX_QUEUE_SIZE,&PCBackDoorRx_Queue_Storage[0]); 00018 00019 PCBackDoor.baud(57600); 00020 PCBackDoor.format(8,Serial::None,1); 00021 00022 00023 //The Rx IRQ wil fill up my big software Rx Queue 00024 PCBackDoor.attach(&PCBackDoorRxIRQ); 00025 00026 //Periodicically check my outgoing Tx Queue (every 1 mS) 00027 PCBackDoorTxQueueCheck.attach_us(&PCBackDoorMoveTxQueue,500); 00028 } 00029 00030 void PCBackDoorMoveTxQueue() 00031 { 00032 BYTE Temp; 00033 00034 while(PCBackDoor.writeable()) 00035 { 00036 if(BytesInQueue(&PCBackDoorTx) == 0) 00037 { 00038 break; 00039 } 00040 else 00041 { 00042 ByteDequeue(&PCBackDoorTx,&Temp); 00043 PCBackDoor.putc(Temp); 00044 } 00045 } 00046 00047 } 00048 00049 void PCBackDoorRxIRQ() 00050 { 00051 while(PCBackDoor.readable()) 00052 { 00053 ByteEnqueue(&PCBackDoorRx,(BYTE)PCBackDoor.getc()); 00054 } 00055 }
Generated on Thu Jul 14 2022 09:05:34 by
1.7.2