Code for autonomous rover for Sparkfun AVC. DataBus won 3rd in 2012 and the same code was used on Troubled Child, a 1986 Jeep Grand Wagoneer to win 1st in 2014.
Dependencies: mbed Watchdog SDFileSystem DigoleSerialDisp
print.h@13:14f56b76aa23, 2018-11-29 (annotated)
- Committer:
- shimniok
- Date:
- Thu Nov 29 16:52:09 2018 +0000
- Revision:
- 13:14f56b76aa23
Added print c module
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 13:14f56b76aa23 | 1 | /* |
shimniok | 13:14f56b76aa23 | 2 | * print.h |
shimniok | 13:14f56b76aa23 | 3 | * |
shimniok | 13:14f56b76aa23 | 4 | * Created on: Jan 6, 2014 |
shimniok | 13:14f56b76aa23 | 5 | * Author: mes |
shimniok | 13:14f56b76aa23 | 6 | */ |
shimniok | 13:14f56b76aa23 | 7 | |
shimniok | 13:14f56b76aa23 | 8 | #ifndef MYPRINT_H_ |
shimniok | 13:14f56b76aa23 | 9 | #define MYPRINT_H_ |
shimniok | 13:14f56b76aa23 | 10 | |
shimniok | 13:14f56b76aa23 | 11 | #include <stdio.h> |
shimniok | 13:14f56b76aa23 | 12 | #include <stdint.h> |
shimniok | 13:14f56b76aa23 | 13 | |
shimniok | 13:14f56b76aa23 | 14 | #ifdef __CPLUSPLUS |
shimniok | 13:14f56b76aa23 | 15 | extern "C" { |
shimniok | 13:14f56b76aa23 | 16 | #endif |
shimniok | 13:14f56b76aa23 | 17 | |
shimniok | 13:14f56b76aa23 | 18 | /** print an unsigned long number to FILE |
shimniok | 13:14f56b76aa23 | 19 | * |
shimniok | 13:14f56b76aa23 | 20 | * @param f is the FILE * to which the data will be sent |
shimniok | 13:14f56b76aa23 | 21 | * @param n is the number to print |
shimniok | 13:14f56b76aa23 | 22 | * @return the number of bytes printed |
shimniok | 13:14f56b76aa23 | 23 | */ |
shimniok | 13:14f56b76aa23 | 24 | extern "C" size_t printNumber(FILE *f, unsigned long n); |
shimniok | 13:14f56b76aa23 | 25 | |
shimniok | 13:14f56b76aa23 | 26 | /** print a signed long number to FILE |
shimniok | 13:14f56b76aa23 | 27 | * |
shimniok | 13:14f56b76aa23 | 28 | * @param f is the FILE * to which the data will be sent |
shimniok | 13:14f56b76aa23 | 29 | * @param n is the number to print |
shimniok | 13:14f56b76aa23 | 30 | * @return the number of bytes printed |
shimniok | 13:14f56b76aa23 | 31 | */ |
shimniok | 13:14f56b76aa23 | 32 | extern "C" size_t printInt(FILE *f, long n); |
shimniok | 13:14f56b76aa23 | 33 | |
shimniok | 13:14f56b76aa23 | 34 | /** print a double to FILE |
shimniok | 13:14f56b76aa23 | 35 | * |
shimniok | 13:14f56b76aa23 | 36 | * @param f is the FILE * to which the data will be sent |
shimniok | 13:14f56b76aa23 | 37 | * @param number is the number to print |
shimniok | 13:14f56b76aa23 | 38 | * @param digits is the number of digits to print after the decimal point |
shimniok | 13:14f56b76aa23 | 39 | * @return the number of bytes printed |
shimniok | 13:14f56b76aa23 | 40 | */ |
shimniok | 13:14f56b76aa23 | 41 | extern "C" size_t printFloat(FILE *f, double number, uint8_t digits); |
shimniok | 13:14f56b76aa23 | 42 | |
shimniok | 13:14f56b76aa23 | 43 | /** print an int as hex to FILE |
shimniok | 13:14f56b76aa23 | 44 | * |
shimniok | 13:14f56b76aa23 | 45 | * @param f is the FILE * to which the data will be sent |
shimniok | 13:14f56b76aa23 | 46 | * @param n is the number to print |
shimniok | 13:14f56b76aa23 | 47 | * @param digits is the number of hex digits to print |
shimniok | 13:14f56b76aa23 | 48 | * @return the number of bytes printed |
shimniok | 13:14f56b76aa23 | 49 | */ |
shimniok | 13:14f56b76aa23 | 50 | extern "C" size_t printHex(FILE *f, long n, uint8_t digits); |
shimniok | 13:14f56b76aa23 | 51 | |
shimniok | 13:14f56b76aa23 | 52 | #ifdef __CPLUSPLUS |
shimniok | 13:14f56b76aa23 | 53 | } |
shimniok | 13:14f56b76aa23 | 54 | #endif |
shimniok | 13:14f56b76aa23 | 55 | |
shimniok | 13:14f56b76aa23 | 56 | #endif /* MYPRINT_H_ */ |