PIC24 Support Libraries
pic24_serial.h
Go to the documentation of this file.
1 /*
2  * "Copyright (c) 2008 Robert B. Reese, Bryan A. Jones, J. W. Bruce ("AUTHORS")"
3  * All rights reserved.
4  * (R. Reese, reese_AT_ece.msstate.edu, Mississippi State University)
5  * (B. A. Jones, bjones_AT_ece.msstate.edu, Mississippi State University)
6  * (J. W. Bruce, jwbruce_AT_ece.msstate.edu, Mississippi State University)
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation for any purpose, without fee, and without written agreement is
10  * hereby granted, provided that the above copyright notice, the following
11  * two paragraphs and the authors appear in all copies of this software.
12  *
13  * IN NO EVENT SHALL THE "AUTHORS" BE LIABLE TO ANY PARTY FOR
14  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
15  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHORS"
16  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17  *
18  * THE "AUTHORS" SPECIFICALLY DISCLAIMS ANY WARRANTIES,
19  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21  * ON AN "AS IS" BASIS, AND THE "AUTHORS" HAS NO OBLIGATION TO
22  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
23  *
24  * Please maintain this header in its entirety when copying/modifying
25  * these files.
26  *
27  *
28  */
29 
30 
31 // Documentation for this file. If the \file tag isn't present,
32 // this file won't be documented.
33 /** \file
34  * This file defines routines to send and receive data
35  * over the serial port. All hardware-specific routines
36  * are contained elsewhere.
37  * These are lightweight character I/O functions and are
38  * intended for use when \em printf overhead is too costly.
39  */
40 
41 #pragma once
42 
43 #include <stdint.h>
44 #include "pic24_chip.h"
45 #include "pic24_libconfig.h"
46 
47 
48 
49 // Consistency check
50 #if (DEFAULT_UART > NUM_UART_MODS) || (DEFAULT_UART < 1)
51 # error "Invalid choice of DEFAULT_UART."
52 #endif
53 
54 
55 
56 uint8_t inChar(void); //blocking single character input
57 void outString(const char* psz_s);
58 uint16_t inString(char *psz_buff, int16_t u16_maxCount);
59 uint16_t inStringEcho(char *psz_buff, int16_t u16_maxCount);
60 void outChar(uint8_t u8_c);
61 void outUint8NoLeader(uint8_t u8_x);
62 void outUint8(uint8_t u8_x);
63 void outUint16(uint16_t u16_x);
64 void outUint32(uint32_t u32_x);
65 void outUint8Decimal(uint8_t u8_x);
66 void outUint16Decimal(uint16_t u16_x);
67 uint8_t isCharReady(void); //determine if character is available to be read
68 
69 uint8_t inCharEcho(void);
70 void configDefaultUART(uint32_t u32_baudRate);
uint16_t inStringEcho(char *psz_buff, int16_t u16_maxCount)
Definition: pic24_serial.c:147
void outUint16Decimal(uint16_t u16_x)
Definition: pic24_serial.c:242
void outUint8Decimal(uint8_t u8_x)
Definition: pic24_serial.c:207
uint8_t isCharReady(void)
Definition: pic24_serial.c:316
void outUint8(uint8_t u8_x)
Definition: pic24_serial.c:167
void outUint32(uint32_t u32_x)
Definition: pic24_serial.c:190
uint8_t inChar(void)
Definition: pic24_serial.c:277
void outChar(uint8_t u8_c)
A system-dependent macro to output one character.
Definition: pic24_serial.c:58
void outUint16(uint16_t u16_x)
Definition: pic24_serial.c:176
void outString(const char *psz_s)
Definition: pic24_serial.c:90
void configDefaultUART(uint32_t u32_baudRate)
Definition: pic24_serial.c:347
uint16_t inString(char *psz_buff, int16_t u16_maxCount)
Definition: pic24_serial.c:140
unsigned char uint8_t
An abbreviation for an 8-bit unsigned integer.
Definition: dataXferImpl.h:194
uint8_t inCharEcho(void)
Definition: pic24_serial.c:305