aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@seriouslyembedded.com>2015-11-28 23:41:24 +0100
committerJoel Bodenmann <joel@seriouslyembedded.com>2015-11-28 23:41:24 +0100
commit02e793e5db3ea240432d43c3f9ab098516df1173 (patch)
tree1fc2f98790ba5b7cf70c75b4dd2c062e31d42f6f
parent5a99092b794373966e444296c57991631e712c70 (diff)
downloaduGFX-02e793e5db3ea240432d43c3f9ab098516df1173.tar.gz
uGFX-02e793e5db3ea240432d43c3f9ab098516df1173.tar.bz2
uGFX-02e793e5db3ea240432d43c3f9ab098516df1173.zip
using GFX_PI internally to avoid issues with M_PI
-rw-r--r--demos/modules/gwin/graph/main.c4
-rw-r--r--src/gdisp/gdisp.c8
-rw-r--r--src/gmisc/gmisc.h6
-rw-r--r--src/gmisc/gmisc_matrix2d.c2
4 files changed, 10 insertions, 10 deletions
diff --git a/demos/modules/gwin/graph/main.c b/demos/modules/gwin/graph/main.c
index 7a496fae..4273b750 100644
--- a/demos/modules/gwin/graph/main.c
+++ b/demos/modules/gwin/graph/main.c
@@ -82,14 +82,14 @@ int main(void) {
gwinGraphDrawAxis(gh);
for(i = 0; i < gwinGetWidth(gh); i++)
- gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*fsin(2*i/5)); //sin(2*0.2*M_PI*i/180));
+ gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*fsin(2*i/5)); //sin(2*0.2*GFX_PI*i/180));
gwinGraphStartSet(gh);
GraphStyle1.point.color = Green;
gwinGraphSetStyle(gh, &GraphStyle1);
for(i = 0; i < gwinGetWidth(gh)*5; i++)
- gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*fsin(2*i/5)); //sin(2*0.2*M_PI*i/180));
+ gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*fsin(2*i/5)); //sin(2*0.2*GFX_PI*i/180));
gwinGraphStartSet(gh);
gwinGraphSetStyle(gh, &GraphStyle2);
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c
index 25fa2c4e..3c0bab9c 100644
--- a/src/gdisp/gdisp.c
+++ b/src/gdisp/gdisp.c
@@ -1725,8 +1725,8 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c
sedge = round(radius * ((sbit & 0x99) ? fsin(start) : fcos(start)));
eedge = round(radius * ((ebit & 0x99) ? fsin(end) : fcos(end)));
#else
- sedge = round(radius * ((sbit & 0x99) ? sin(start*M_PI/180) : cos(start*M_PI/180)));
- eedge = round(radius * ((ebit & 0x99) ? sin(end*M_PI/180) : cos(end*M_PI/180)));
+ sedge = round(radius * ((sbit & 0x99) ? sin(start*GFX_PI/180) : cos(start*GFX_PI/180)));
+ eedge = round(radius * ((ebit & 0x99) ? sin(end*GFX_PI/180) : cos(end*GFX_PI/180)));
#endif
if (sbit & 0xB4) sedge = -sedge;
if (ebit & 0xB4) eedge = -eedge;
@@ -1852,8 +1852,8 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c
sxb = FP2FIXED(radius*fcos(start)); sy = -round(radius*fsin(start));
exb = FP2FIXED(radius*fcos(end)); ey = -round(radius*fsin(end));
#else
- sxb = FP2FIXED(radius*cos(start*M_PI/180)); sy = -round(radius*sin(start*M_PI/180));
- exb = FP2FIXED(radius*cos(end*M_PI/180)); ey = -round(radius*sin(end*M_PI/180));
+ sxb = FP2FIXED(radius*cos(start*GFX_PI/180)); sy = -round(radius*sin(start*GFX_PI/180));
+ exb = FP2FIXED(radius*cos(end*GFX_PI/180)); ey = -round(radius*sin(end*GFX_PI/180));
#endif
sxd = sy ? sxb/sy : sxb;
exd = ey ? exb/ey : exb;
diff --git a/src/gmisc/gmisc.h b/src/gmisc/gmisc.h
index 7ce91442..aa845261 100644
--- a/src/gmisc/gmisc.h
+++ b/src/gmisc/gmisc.h
@@ -75,14 +75,14 @@ typedef int32_t fixed;
/**
* @brief The famous number pi
*/
-#ifndef PI
- #define PI 3.1415926535897932384626433832795028841971693993751
+#ifndef GFX_PI
+ #define GFX_PI 3.1415926535897932384626433832795028841971693993751
#endif
/**
* @brief pi as a fixed point
*/
-#define FIXED_PI FP2FIXED(PI)
+#define FIXED_PI FP2FIXED(GFX_PI)
/*===========================================================================*/
/* External declarations. */
diff --git a/src/gmisc/gmisc_matrix2d.c b/src/gmisc/gmisc_matrix2d.c
index 2cd162f2..352afbe7 100644
--- a/src/gmisc/gmisc_matrix2d.c
+++ b/src/gmisc/gmisc_matrix2d.c
@@ -75,7 +75,7 @@ void gmiscMatrixFloat2DApplyRotation(MatrixFloat2D *dst, const MatrixFloat2D *sr
s = fsin(angle);
c = fcos(angle);
#else
- c = angle*M_PI/180;
+ c = angle*GFX_PI/180;
s = sin(c);
c = cos(c);
#endif