-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintfOverride.c
More file actions
43 lines (34 loc) · 820 Bytes
/
printfOverride.c
File metadata and controls
43 lines (34 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* printfOverride.c
*
* Created on: May 27, 2015
* Author: Gerard Sequeira, 43oh
*
* With input from:
* http://processors.wiki.ti.com/index.php/
* Printf_support_for_MSP430_CCSTUDIO_compiler
*/
/* DriverLib Includes */
#include "driverlib.h"
/* Standard Includes */
#include <stdio.h>
#include <string.h>
int fputc(int _c, register FILE *_fp);
int fputs(const char *_ptr, register FILE *_fp);
int fputc(int _c, register FILE *_fp)
{
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = (unsigned char) _c;
return((unsigned char)_c);
}
int fputs(const char *_ptr, register FILE *_fp)
{
unsigned int i, len;
len = strlen(_ptr);
for(i=0 ; i<len ; i++)
{
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = (unsigned char) _ptr[i];
}
return len;
}