Skip to content

Commit

Permalink
Merge pull request #10 from BlueAndi/bugfix/_USE_MATH_DEFINES
Browse files Browse the repository at this point in the history
"_use math defines" bugfix
  • Loading branch information
gabryelreyes authored Nov 8, 2024
2 parents 623bc70 + e9ab792 commit f9bfe66
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff 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 number Diff line number Diff 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 number Diff line number Diff 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 number Diff line number Diff 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

0 comments on commit f9bfe66

Please sign in to comment.