aboutsummaryrefslogtreecommitdiffstats
path: root/demos/applications/graph/main.c
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2012-11-20 18:37:49 +0100
committerJoel Bodenmann <joel@unormal.org>2012-11-20 18:37:49 +0100
commit43d45dca63e8e098e8a40481411d0c4ca46564c5 (patch)
treef395cf3409123d5d96f3950550c711fd4b140aff /demos/applications/graph/main.c
parent802e967a7abc8dd40ed35993e885db50f0f8c930 (diff)
downloaduGFX-43d45dca63e8e098e8a40481411d0c4ca46564c5.tar.gz
uGFX-43d45dca63e8e098e8a40481411d0c4ca46564c5.tar.bz2
uGFX-43d45dca63e8e098e8a40481411d0c4ca46564c5.zip
gtimer demo
Diffstat (limited to 'demos/applications/graph/main.c')
-rw-r--r--demos/applications/graph/main.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/demos/applications/graph/main.c b/demos/applications/graph/main.c
new file mode 100644
index 00000000..bd50cf60
--- /dev/null
+++ b/demos/applications/graph/main.c
@@ -0,0 +1,51 @@
+#include "ch.h"
+#include "hal.h"
+#include "gdisp.h"
+#include "graph.h"
+#include "math.h"
+
+int data[5][2] = {
+ { 0, 0 },
+ { 10, 10 },
+ { 20, 20 },
+ { 30, 30 },
+ { 40, 40 }
+};
+
+int main(void) {
+ halInit();
+ chSysInit();
+
+ gdispInit();
+ gdispSetOrientation(GDISP_ROTATE_90);
+ gdispClear(Black);
+
+ Graph G1 = {
+ gdispGetWidth()/2,
+ gdispGetHeight()/2,
+ -150,
+ 150,
+ -110,
+ 110,
+ 21,
+ 5,
+ TRUE,
+ TRUE,
+ White,
+ Grey,
+ };
+
+ graphDrawSystem(&G1);
+
+ uint16_t i;
+ for(i = 0; i < 2500; i++)
+ graphDrawDot(&G1, i-170, 80*sin(2*0.2*M_PI*i/180), 1, Blue);
+
+ for(i = 0; i < 2500; i++)
+ graphDrawDot(&G1, i/5-150, 95*sin(2*0.2*M_PI*i/180), 1, Green);
+
+ while(TRUE) {
+ chThdSleepMilliseconds(100);
+ }
+}
+