mirror of
https://github.com/pvvx/rtl00TstMinAmebaV35a.git
synced 2025-07-31 20:31:06 +00:00
first commit
This commit is contained in:
commit
c399bf5be0
806 changed files with 421674 additions and 0 deletions
66
component/common/mbed/api/error.h
Normal file
66
component/common/mbed/api/error.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_ERROR_H
|
||||
#define MBED_ERROR_H
|
||||
|
||||
/** To generate a fatal compile-time error, you can use the pre-processor #error directive.
|
||||
*
|
||||
* @code
|
||||
* #error "That shouldn't have happened!"
|
||||
* @endcode
|
||||
*
|
||||
* If the compiler evaluates this line, it will report the error and stop the compile.
|
||||
*
|
||||
* For example, you could use this to check some user-defined compile-time variables:
|
||||
*
|
||||
* @code
|
||||
* #define NUM_PORTS 7
|
||||
* #if (NUM_PORTS > 4)
|
||||
* #error "NUM_PORTS must be less than 4"
|
||||
* #endif
|
||||
* @endcode
|
||||
*
|
||||
* Reporting Run-Time Errors:
|
||||
* To generate a fatal run-time error, you can use the mbed error() function.
|
||||
*
|
||||
* @code
|
||||
* error("That shouldn't have happened!");
|
||||
* @endcode
|
||||
*
|
||||
* If the mbed running the program executes this function, it will print the
|
||||
* message via the USB serial port, and then die with the blue lights of death!
|
||||
*
|
||||
* The message can use printf-style formatting, so you can report variables in the
|
||||
* message too. For example, you could use this to check a run-time condition:
|
||||
*
|
||||
* @code
|
||||
* if(x >= 5) {
|
||||
* error("expected x to be less than 5, but got %d", x);
|
||||
* }
|
||||
* #endcode
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void error(const char* format, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
50
component/common/mbed/api/mbed_assert.h
Normal file
50
component/common/mbed/api/mbed_assert.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_ASSERT_H
|
||||
#define MBED_ASSERT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Internal mbed assert function which is invoked when MBED_ASSERT macro failes.
|
||||
* This function is active only if NDEBUG is not defined prior to including this
|
||||
* assert header file.
|
||||
* In case of MBED_ASSERT failing condition, the assertation message is printed
|
||||
* to stderr and mbed_die() is called.
|
||||
* @param expr Expresion to be checked.
|
||||
* @param file File where assertation failed.
|
||||
* @param line Failing assertation line number.
|
||||
*/
|
||||
void mbed_assert_internal(const char *expr, const char *file, int line);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define MBED_ASSERT(expr) ((void)0)
|
||||
|
||||
#else
|
||||
#define MBED_ASSERT(expr) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
mbed_assert_internal(#expr, __FILE__, __LINE__); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
74
component/common/mbed/api/rtc_time.h
Normal file
74
component/common/mbed/api/rtc_time.h
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Implementation of the C time.h functions
|
||||
*
|
||||
* Provides mechanisms to set and read the current time, based
|
||||
* on the microcontroller Real-Time Clock (RTC), plus some
|
||||
* standard C manipulation and formating functions.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* #include "mbed.h"
|
||||
*
|
||||
* int main() {
|
||||
* set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
|
||||
*
|
||||
* while(1) {
|
||||
* time_t seconds = time(NULL);
|
||||
*
|
||||
* printf("Time as seconds since January 1, 1970 = %d\n", seconds);
|
||||
*
|
||||
* printf("Time as a basic string = %s", ctime(&seconds));
|
||||
*
|
||||
* char buffer[32];
|
||||
* strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
|
||||
* printf("Time as a custom formatted string = %s", buffer);
|
||||
*
|
||||
* wait(1);
|
||||
* }
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
/** Set the current time
|
||||
*
|
||||
* Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
|
||||
* to the time represented by the number of seconds since January 1, 1970
|
||||
* (the UNIX timestamp).
|
||||
*
|
||||
* @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* #include "mbed.h"
|
||||
*
|
||||
* int main() {
|
||||
* set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
void set_time(time_t t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
66
component/common/mbed/api/wait_api.h
Normal file
66
component/common/mbed/api/wait_api.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_WAIT_API_H
|
||||
#define MBED_WAIT_API_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Generic wait functions.
|
||||
*
|
||||
* These provide simple NOP type wait capabilities.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* #include "mbed.h"
|
||||
*
|
||||
* DigitalOut heartbeat(LED1);
|
||||
*
|
||||
* int main() {
|
||||
* while (1) {
|
||||
* heartbeat = 1;
|
||||
* wait(0.5);
|
||||
* heartbeat = 0;
|
||||
* wait(0.5);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
/** Waits for a number of seconds, with microsecond resolution (within
|
||||
* the accuracy of single precision floating point).
|
||||
*
|
||||
* @param s number of seconds to wait
|
||||
*/
|
||||
void wait(float s);
|
||||
|
||||
/** Waits a number of milliseconds.
|
||||
*
|
||||
* @param ms the whole number of milliseconds to wait
|
||||
*/
|
||||
void wait_ms(int ms);
|
||||
|
||||
/** Waits a number of microseconds.
|
||||
*
|
||||
* @param us the whole number of microseconds to wait
|
||||
*/
|
||||
void wait_us(int us);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue