Lab 1 Program C

Dependents:   Lab1C

Fork of mbed by -deleted-

Committer:
simon.ford@mbed.co.uk
Date:
Thu Jan 22 18:32:40 2009 +0000
Revision:
5:62573be585e9
Parent:
4:5d1359a283bc
* Added initial RPC release
* Added RTC and helper functions
* Added read_u16()/write_u16() to AnalogIn/Out
* Ticker/Timeout timing fixed!
* mbedinfo() helper added
* error() and printf() added to replace DEBUG() and ERROR()
* DigitalIn supports methods on rise/fall
* SPI and Serial support NC
* LED1-4 also map to 1-4
* Timer object reset fixed
* SPI uses single mode
* SPI3 added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon.ford@mbed.co.uk 0:82220227f4fa 1 /* mbed Microcontroller Library - Debug
simon.ford@mbed.co.uk 0:82220227f4fa 2 * Copyright (c) 2007-2008, sford
simon.ford@mbed.co.uk 0:82220227f4fa 3 */
simon.ford@mbed.co.uk 0:82220227f4fa 4
simon.ford@mbed.co.uk 0:82220227f4fa 5 #ifndef MBED_DEBUG_H
simon.ford@mbed.co.uk 0:82220227f4fa 6 #define MBED_DEBUG_H
simon.ford@mbed.co.uk 0:82220227f4fa 7
simon.ford@mbed.co.uk 5:62573be585e9 8 #include <cstdio>
simon.ford@mbed.co.uk 5:62573be585e9 9 #include <cstdlib>
simon.ford@mbed.co.uk 5:62573be585e9 10 #define __ASSERT_MSG
simon.ford@mbed.co.uk 5:62573be585e9 11 #include <assert.h>
simon.ford@mbed.co.uk 5:62573be585e9 12
simon.ford@mbed.co.uk 0:82220227f4fa 13 namespace mbed {
simon.ford@mbed.co.uk 0:82220227f4fa 14
simon.ford@mbed.co.uk 0:82220227f4fa 15 /* Section: debug
simon.ford@mbed.co.uk 0:82220227f4fa 16 * Error reporting and debugging functions
simon.ford@mbed.co.uk 0:82220227f4fa 17 */
simon.ford@mbed.co.uk 0:82220227f4fa 18
simon.ford@mbed.co.uk 5:62573be585e9 19 void mbedinfo(std::FILE *fp = stdout);
simon.ford@mbed.co.uk 5:62573be585e9 20
simon.ford@mbed.co.uk 5:62573be585e9 21 #define error(...) (std::fprintf(stderr, __VA_ARGS__), std::abort())
simon.ford@mbed.co.uk 5:62573be585e9 22
simon.ford@mbed.co.uk 0:82220227f4fa 23 // As seen by user, for documentation purposes only
simon.ford@mbed.co.uk 0:82220227f4fa 24 #if 0
simon.ford@mbed.co.uk 5:62573be585e9 25 /* Function: error
simon.ford@mbed.co.uk 0:82220227f4fa 26 * Report a fatal runtime error. Attempts to report the specified error message through the
simon.ford@mbed.co.uk 0:82220227f4fa 27 * USB serial port, then dies with a fatal runtime error (siren lights)
simon.ford@mbed.co.uk 0:82220227f4fa 28 *
simon.ford@mbed.co.uk 0:82220227f4fa 29 * Variables:
simon.ford@mbed.co.uk 0:82220227f4fa 30 * format - printf-style format string, followed by associated variables
simon.ford@mbed.co.uk 0:82220227f4fa 31 */
simon.ford@mbed.co.uk 5:62573be585e9 32 void error(const char* format, ...);
simon.ford@mbed.co.uk 0:82220227f4fa 33 #endif
simon.ford@mbed.co.uk 0:82220227f4fa 34
simon.ford@mbed.co.uk 5:62573be585e9 35 void ERROR(const char* format, ...);// __attribute__((deprecated));
simon.ford@mbed.co.uk 5:62573be585e9 36 void ASSERT(int condition, const char* format = 0, ...);// __attribute__((deprecated));
simon.ford@mbed.co.uk 5:62573be585e9 37 void DEBUG(const char* format, ...);// __attribute__((deprecated));
simon.ford@mbed.co.uk 0:82220227f4fa 38
simon.ford@mbed.co.uk 0:82220227f4fa 39 /* Function: DEBUG_LED1
simon.ford@mbed.co.uk 0:82220227f4fa 40 * Set the state of LED1
simon.ford@mbed.co.uk 0:82220227f4fa 41 */
simon.ford@mbed.co.uk 0:82220227f4fa 42 void DEBUG_LED1(int v);
simon.ford@mbed.co.uk 0:82220227f4fa 43
simon.ford@mbed.co.uk 0:82220227f4fa 44 /* Function: DEBUG_LED2
simon.ford@mbed.co.uk 0:82220227f4fa 45 * Set the state of LED2
simon.ford@mbed.co.uk 0:82220227f4fa 46 */
simon.ford@mbed.co.uk 0:82220227f4fa 47 void DEBUG_LED2(int v);
simon.ford@mbed.co.uk 0:82220227f4fa 48
simon.ford@mbed.co.uk 0:82220227f4fa 49 /* Function: DEBUG_LED3
simon.ford@mbed.co.uk 0:82220227f4fa 50 * Set the state of LED3
simon.ford@mbed.co.uk 0:82220227f4fa 51 */
simon.ford@mbed.co.uk 0:82220227f4fa 52 void DEBUG_LED3(int v);
simon.ford@mbed.co.uk 0:82220227f4fa 53
simon.ford@mbed.co.uk 0:82220227f4fa 54 /* Function: DEBUG_LED4
simon.ford@mbed.co.uk 0:82220227f4fa 55 * Set the state of LED4
simon.ford@mbed.co.uk 0:82220227f4fa 56 */
simon.ford@mbed.co.uk 0:82220227f4fa 57 void DEBUG_LED4(int v);
simon.ford@mbed.co.uk 0:82220227f4fa 58
simon.ford@mbed.co.uk 0:82220227f4fa 59 } // namepsace mbed
simon.ford@mbed.co.uk 0:82220227f4fa 60
simon.ford@mbed.co.uk 1:6b7f447ca868 61 #endif
simon.ford@mbed.co.uk 1:6b7f447ca868 62