Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,12 @@ This library provides for this use case some Arduino interfaces, but not all yet
lib_deps =
BlueAndi/ArduinoNative @ ~0.1.0
```
2. Call the ```Arduino::setup()``` once and the ```Arduino::loop()``` in a infinite loop in your main entry point function.
2. Add this build flags to your _platformio.ini_ in your environment:
```
build_flags =
-D _USE_MATH_DEFINES
```
3. Call the ```Arduino::setup()``` once and the ```Arduino::loop()``` in a infinite loop in your main entry point function.

## Example
See [minimal example](./examples/example/).
Expand Down
1 change: 1 addition & 0 deletions examples/example/platformio.ini
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,6 +16,7 @@
platform = native @ ~1.2.1
build_flags =
-std=c++11
-D _USE_MATH_DEFINES
lib_deps =
MainNative
BlueAndi/ArduinoNative @ ~0.1.1
2 changes: 1 addition & 1 deletion library.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "ArduinoNative",
"version": "0.2.0",
"version": "0.2.1",
"description": "Arduino for the native environment. It doesn't support every interface, just some of them!",
"authors": [{
"name": "Andreas Merkle",
Expand Down
10 changes: 9 additions & 1 deletion src/Arduino.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,9 @@
* Compile Switches
*****************************************************************************/

#define _USE_MATH_DEFINES
#ifndef _USE_MATH_DEFINES
#error Please define _USE_MATH_DEFINES in your build flags.
#endif /* _USE_MATH_DEFINES */

/******************************************************************************
* Includes
Expand All@@ -53,6 +55,9 @@
* Macros
*****************************************************************************/

/**
* Constrain the given value to min. and max.
*/
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))

#ifndef PSTR
Expand All@@ -63,6 +68,9 @@
#define PROGMEM
#endif

/**
* The constant PI.
*/
#define PI M_PI

/******************************************************************************
Expand Down