reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
lf_arduino_support.h
Go to the documentation of this file.
1/* Arduino Platform API support for the C target of Lingua Franca. */
2
3
27/* Arduino Platform API support for the C target of Lingua Franca.
28 *
29 * @author{Anirudh Rengarajan <arengarajan@berkeley.edu>}
30 */
31
32#ifndef LF_ARDUINO_SUPPORT_H
33#define LF_ARDUINO_SUPPORT_H
34
35#include <stdint.h> // For fixed-width integral types
36#include <time.h> // For CLOCK_MONOTONIC
37#include <stdbool.h>
38
39#define AVR 0
40#define megaAVR 1
41#define SAMD 2
42#define SAM 3
43#define MBED 4
44
45#ifndef BOARD
46#if defined(ARDUINO_AVR_ADK)
47#define BOARD AVR
48#elif defined(ARDUINO_AVR_BT) // Bluetooth
49#define BOARD AVR
50#elif defined(ARDUINO_AVR_DUEMILANOVE)
51#define BOARD AVR
52#elif defined(ARDUINO_AVR_ESPLORA)
53#define BOARD AVR
54#elif defined(ARDUINO_AVR_ETHERNET)
55#define BOARD AVR
56#elif defined(ARDUINO_AVR_FIO)
57#define BOARD AVR
58#elif defined(ARDUINO_AVR_GEMMA)
59#define BOARD AVR
60#elif defined(ARDUINO_AVR_LEONARDO)
61#define BOARD AVR
62#elif defined(ARDUINO_AVR_LILYPAD)
63#define BOARD AVR
64#elif defined(ARDUINO_AVR_LILYPAD_USB)
65#define BOARD AVR
66#elif defined(ARDUINO_AVR_MEGA)
67#define BOARD AVR
68#elif defined(ARDUINO_AVR_MEGA2560)
69#define BOARD AVR
70#elif defined(ARDUINO_AVR_MICRO)
71#define BOARD AVR
72#elif defined(ARDUINO_AVR_MINI)
73#define BOARD AVR
74#elif defined(ARDUINO_AVR_NANO)
75#define BOARD AVR
76#elif defined(ARDUINO_AVR_NG)
77#define BOARD AVR
78#elif defined(ARDUINO_AVR_PRO)
79#define BOARD AVR
80#elif defined(ARDUINO_AVR_ROBOT_CONTROL)
81#define BOARD AVR
82#elif defined(ARDUINO_AVR_ROBOT_MOTOR)
83#define BOARD AVR
84#elif defined(ARDUINO_AVR_UNO) || defined(__AVR_ATmega4809__)
85#define BOARD AVR
86#elif defined(ARDUINO_AVR_YUN)
87#define BOARD AVR
88
89// These boards must be installed separately:
90#elif defined(ARDUINO_SAM_DUE)
91#define BOARD SAM
92#elif defined(ARDUINO_SAMD_ZERO)
93#define BOARD SAMD
94#elif defined(ARDUINO_ARC32_TOOLS)
95#define BOARD SAM
96#elif defined(ARDUINO_ARDUINO_NANO33BLE)
97#define BOARD MBED
98#endif
99#endif
100
101#define __STDC_FORMAT_MACROS
102#include <inttypes.h>
103
104#ifndef __timespec_defined
105#define __timespec_defined
106#ifndef _SYS__TIMESPEC_H_
107#define _SYS__TIMESPEC_H_
108struct timespec {
109 long long tv_sec; /* seconds */
110 long tv_nsec; /* and nanoseconds */
111};
112#endif
113#endif
114
115#if !defined(LF_SINGLE_THREADED)
116#warning "Threaded support on Arduino is still experimental"
117
118typedef void* lf_mutex_t;
119typedef void* lf_cond_t;
120typedef void* lf_thread_t;
121
122#endif // !LF_SNIGLE_THREADED
123
124#define PRINTF_TIME "%" PRIu32
125#define PRINTF_MICROSTEP "%" PRIu32
126#define PRINTF_TAG "(" PRINTF_TIME ", " PRINTF_MICROSTEP ")"
127
128#define LLONG_MAX __LONG_LONG_MAX__
129#define LLONG_MIN (-LLONG_MAX - 1LL)
130#define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
131
132// Arduinos are embedded platforms with no command line interface
133#define NO_CLI
134
135#endif // LF_ARDUINO_SUPPORT_H
void * lf_cond_t
Definition lf_arduino_support.h:119
void * lf_thread_t
Definition lf_arduino_support.h:120
void * lf_mutex_t
Definition lf_arduino_support.h:118
Definition lf_arduino_support.h:108
long long tv_sec
Definition lf_arduino_support.h:109
long tv_nsec
Definition lf_arduino_support.h:110