aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorJoel Bodenmann <joel.bodenmann@hevs.ch>2012-10-24 23:37:44 +0200
committerJoel Bodenmann <joel.bodenmann@hevs.ch>2012-10-24 23:37:44 +0200
commit7cebc4283193eca6167b3a7c02ef25340ef1adcd (patch)
tree6a5eb6eafb7397ddbb1bc346f94e98db29e22225 /demos
parent563d24096206c3e557d5d5433c612418afccfe6d (diff)
downloaduGFX-7cebc4283193eca6167b3a7c02ef25340ef1adcd.tar.gz
uGFX-7cebc4283193eca6167b3a7c02ef25340ef1adcd.tar.bz2
uGFX-7cebc4283193eca6167b3a7c02ef25340ef1adcd.zip
added graph demo
Diffstat (limited to 'demos')
-rw-r--r--demos/graph/main.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/demos/graph/main.c b/demos/graph/main.c
new file mode 100644
index 00000000..bd50cf60
--- /dev/null
+++ b/demos/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);
+ }
+}
+