These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!
EMAC/uIP/common/Serial.c@0:bf7b9fba3924, 2011-03-20 (annotated)
- Committer:
- frank26080115
- Date:
- Sun Mar 20 05:38:56 2011 +0000
- Revision:
- 0:bf7b9fba3924
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frank26080115 | 0:bf7b9fba3924 | 1 | /******************************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 2 | /* SERIAL.C: Low Level Serial Routines */ |
frank26080115 | 0:bf7b9fba3924 | 3 | /******************************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 4 | /* This file is part of the uVision/ARM development tools. */ |
frank26080115 | 0:bf7b9fba3924 | 5 | /* Copyright (c) 2005-2007 Keil Software. All rights reserved. */ |
frank26080115 | 0:bf7b9fba3924 | 6 | /* This software may only be used under the terms of a valid, current, */ |
frank26080115 | 0:bf7b9fba3924 | 7 | /* end user licence from KEIL for a compatible version of KEIL software */ |
frank26080115 | 0:bf7b9fba3924 | 8 | /* development tools. Nothing else gives you the right to use this software. */ |
frank26080115 | 0:bf7b9fba3924 | 9 | /******************************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 10 | |
frank26080115 | 0:bf7b9fba3924 | 11 | #include "debug_frmwrk.h" |
frank26080115 | 0:bf7b9fba3924 | 12 | |
frank26080115 | 0:bf7b9fba3924 | 13 | #define CR 0x0D |
frank26080115 | 0:bf7b9fba3924 | 14 | |
frank26080115 | 0:bf7b9fba3924 | 15 | |
frank26080115 | 0:bf7b9fba3924 | 16 | void init_serial (void) { /* Initialize Serial Interface */ |
frank26080115 | 0:bf7b9fba3924 | 17 | debug_frmwrk_init(); |
frank26080115 | 0:bf7b9fba3924 | 18 | } |
frank26080115 | 0:bf7b9fba3924 | 19 | |
frank26080115 | 0:bf7b9fba3924 | 20 | |
frank26080115 | 0:bf7b9fba3924 | 21 | /* Implementation of putchar (also used by printf function to output data) */ |
frank26080115 | 0:bf7b9fba3924 | 22 | int sendchar (int ch) { /* Write character to Serial Port */ |
frank26080115 | 0:bf7b9fba3924 | 23 | #if 1 |
frank26080115 | 0:bf7b9fba3924 | 24 | if (ch == '\n') { |
frank26080115 | 0:bf7b9fba3924 | 25 | _DBC(CR); /* output CR */ |
frank26080115 | 0:bf7b9fba3924 | 26 | } |
frank26080115 | 0:bf7b9fba3924 | 27 | #endif |
frank26080115 | 0:bf7b9fba3924 | 28 | _DBC(ch); |
frank26080115 | 0:bf7b9fba3924 | 29 | return (ch); |
frank26080115 | 0:bf7b9fba3924 | 30 | } |
frank26080115 | 0:bf7b9fba3924 | 31 | |
frank26080115 | 0:bf7b9fba3924 | 32 | |
frank26080115 | 0:bf7b9fba3924 | 33 | int getkey (void) { /* Read character from Serial Port */ |
frank26080115 | 0:bf7b9fba3924 | 34 | return (_DG); |
frank26080115 | 0:bf7b9fba3924 | 35 | } |
frank26080115 | 0:bf7b9fba3924 | 36 | |
frank26080115 | 0:bf7b9fba3924 | 37 | unsigned char getchar(void) |
frank26080115 | 0:bf7b9fba3924 | 38 | { |
frank26080115 | 0:bf7b9fba3924 | 39 | return getkey(); |
frank26080115 | 0:bf7b9fba3924 | 40 | } |