Soldered SD Card Arduino Library 1.0.0
Easily read and write files to and form the SD card breakout! A fork of the original SDFat library by Bill Greiman.
Loading...
Searching...
No Matches
SysCall.h
Go to the documentation of this file.
1
29#ifndef SysCall_h
30#define SysCall_h
31#include "../SdFatConfig.h"
32#include <stddef.h>
33#include <stdint.h>
34#if __cplusplus < 201103
35#warning nullptr defined
37#define nullptr NULL
38#endif // __cplusplus < 201103
39//------------------------------------------------------------------------------
41typedef uint16_t SdMillis_t;
42//------------------------------------------------------------------------------
48{
49 public:
51 static SdMillis_t curTimeMS();
53 static void halt()
54 {
55 while (1)
56 {
57 yield();
58 }
59 }
61 static void yield();
62};
63#if ENABLE_ARDUINO_FEATURES
64#if defined(ARDUINO)
66typedef Print print_t;
68typedef Stream stream_t;
69#else // defined(ARDUINO)
70#error "Unknown system"
71#endif // defined(ARDUINO)
72//------------------------------------------------------------------------------
73#ifndef F
75#define F(str) (str)
76#endif // F
77//------------------------------------------------------------------------------
80{
81 return millis();
82}
83//------------------------------------------------------------------------------
84#if defined(PLATFORM_ID) // Only defined if a Particle device
85inline void SysCall::yield()
86{
87 // Recommended to only call Particle.process() if system threading is disabled
88 if (system_thread_get_state(NULL) == spark::feature::DISABLED)
89 {
90 Particle.process();
91 }
92}
93#elif defined(ARDUINO)
94inline void SysCall::yield()
95{
96 // Use the external Arduino yield() function.
97 ::yield();
98}
99#else // defined(PLATFORM_ID)
100inline void SysCall::yield()
101{
102}
103#endif // defined(PLATFORM_ID)
104//------------------------------------------------------------------------------
105#else // ENABLE_ARDUINO_FEATURES
106#error Print not defined
107#include "PrintBasic.h"
109typedef PrintBasic print_t;
111typedef PrintBasic stream_t;
112inline void SysCall::yield()
113{
114}
115#endif // ENABLE_ARDUINO_FEATURES
116#endif // SysCall_h
uint16_t SdMillis_t
Definition SysCall.h:41
Print print_t
Definition SysCall.h:66
Stream stream_t
Definition SysCall.h:68
SysCall - Class to wrap system calls.
Definition SysCall.h:48
static void yield()
Definition SysCall.h:85
static void halt()
Definition SysCall.h:53
static SdMillis_t curTimeMS()
Definition SysCall.h:79