49 # define outChar __esos_unsafe_PutUint8 60 # if (NUM_UART_MODS >= 1) 65 # if (NUM_UART_MODS >= 2) 70 # if (NUM_UART_MODS >= 3) 75 # if (NUM_UART_MODS >= 4) 93 # if (SERIAL_EOL_DEFAULT == SERIAL_EOL_CR_LF) 94 if (*psz_s ==
'\n')
outChar(0x0D);
96 # elif (SERIAL_EOL_DEFAULT == SERIAL_EOL_CR) 97 if (*psz_s ==
'\n')
outChar(0x0D);
99 # elif (SERIAL_EOL_DEFAULT == SERIAL_EOL_LF) 103 # error "Invalid SERIAL_EOL_DEFAULT." 112 static uint16_t inStringInternal(
char *psz_buff, uint16_t u16_maxCount,
uint8_t echoFlag) {
116 if (!u16_maxCount)
return 0;
118 for (u16_i = 0; u16_i < u16_maxCount; u16_i++) {
121 if (u8_c ==
'\n' ||u8_c ==
'\r' )
break;
140 uint16_t
inString(
char *psz_buff, int16_t u16_maxCount) {
141 return inStringInternal(psz_buff,u16_maxCount,0);
148 return inStringInternal(psz_buff,u16_maxCount,1);
152 void outUint8NoLeader(
uint8_t u8_x) {
154 u8_c = (u8_x>>4)& 0xf;
155 if (u8_c > 9)
outChar(
'A'+u8_c-10);
159 if (u8_c > 9)
outChar(
'A'+u8_c-10);
169 outUint8NoLeader(u8_x);
181 outUint8NoLeader(u8_c);
183 outUint8NoLeader(u8_c);
193 u8_c = (u32_x >> 24);
194 outUint8NoLeader(u8_c);
195 u8_c = (u32_x >> 16);
196 outUint8NoLeader(u8_c);
198 outUint8NoLeader(u8_c);
200 outUint8NoLeader(u8_c);
208 static const uint8_t u8_d[]= {50, 30, 20, 10, 5, 3, 2, 1 };
209 static const uint8_t u8_f[]= {5, 3, 2, 1, 5, 3, 2, 1 };
220 if (u8_destroy >= 200) {
224 if (u8_destroy >= 100) {
228 for (u8_i=0; u8_i<8; u8_i++) {
229 if (u8_destroy >= u8_d[u8_i]) {
230 psz_out[1+(u8_i/4)] += u8_f[u8_i];
231 u8_destroy -= u8_d[u8_i];
243 static const uint16_t u16_d[]= {50000, 30000, 20000, 10000, 5000, 3000, 2000, 1000, \
244 500, 300, 200, 100, 50, 30, 20, 10, 5, 3, 2, 1
246 static const uint8_t u8_f[]= {5, 3, 2, 1 };
249 uint16_t u16_destroy;
260 for (u8_i=0; u8_i<20; u8_i++) {
261 if (u16_destroy >= u16_d[u8_i]) {
262 psz_out[u8_i/4] += u8_f[u8_i % 4];
263 u16_destroy -= u16_d[u8_i];
278 switch (__C30_UART) {
279 # if (NUM_UART_MODS >= 1) 283 # if (NUM_UART_MODS >= 2) 287 # if (NUM_UART_MODS >= 3) 291 # if (NUM_UART_MODS >= 4) 317 switch (__C30_UART) {
318 # if (NUM_UART_MODS >= 1) 322 # if (NUM_UART_MODS >= 2) 324 return isCharReady2();
326 # if (NUM_UART_MODS >= 3) 328 return isCharReady3();
330 # if (NUM_UART_MODS >= 4) 332 return isCharReady4();
352 #if DEFAULT_UART == 1 354 #elif DEFAULT_UART == 2 355 configUART2(u32_baudRate);
356 #elif DEFAULT_UART == 3 357 configUART3(u32_baudRate);
358 #elif DEFAULT_UART == 4 359 configUART4(u32_baudRate);
361 # error "Invalid DEFAULT_UART." void outUint16Decimal(uint16_t u16_x)
void outUint32(uint32_t u32_x)
#define REPORT_ERROR(msg)
uint8_t isCharReady(void)
uint16_t inString(char *psz_buff, int16_t u16_maxCount)
void outUint8Decimal(uint8_t u8_x)
void outUint16(uint16_t u16_x)
void configDefaultUART(uint32_t u32_baudRate)
void outString(const char *psz_s)
void configUART1(uint32_t u32_baudRate)
void outChar1(uint8_t u8_c)
uint16_t inStringEcho(char *psz_buff, int16_t u16_maxCount)
void outChar(uint8_t u8_c)
A system-dependent macro to output one character.
unsigned char uint8_t
An abbreviation for an 8-bit unsigned integer.
void outUint8(uint8_t u8_x)
uint8_t isCharReady1(void)