2012-12-06 08:45:54 +00:00
|
|
|
#include "ch.h"
|
|
|
|
#include "hal.h"
|
|
|
|
#include "gfx.h"
|
|
|
|
#include "math.h"
|
|
|
|
|
|
|
|
int data[5][2] = {
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 10, 10 },
|
|
|
|
{ 20, 20 },
|
|
|
|
{ 30, 30 },
|
|
|
|
{ 40, 40 }
|
|
|
|
};
|
|
|
|
|
|
|
|
GGraphObject g;
|
|
|
|
|
2012-12-06 12:24:28 +00:00
|
|
|
GGraphStyle GraphStyle1 = {
|
|
|
|
{ GGRAPH_POINT_DOT, 0, Blue }, // point
|
|
|
|
{ GGRAPH_LINE_NONE, 2, Gray }, // line
|
|
|
|
{ GGRAPH_LINE_SOLID, 0, White }, // x axis
|
|
|
|
{ GGRAPH_LINE_SOLID, 0, White }, // y axis
|
|
|
|
{ GGRAPH_LINE_NONE, 0, White, 0 }, // x grid
|
|
|
|
{ GGRAPH_LINE_NONE, 0, White, 0 }, // y grid
|
|
|
|
GWIN_GRAPH_STYLE_XAXIS_ARROWS|GWIN_GRAPH_STYLE_YAXIS_ARROWS // flags
|
|
|
|
};
|
|
|
|
|
2012-12-06 08:45:54 +00:00
|
|
|
GGraphStyle GraphStyle2 = {
|
|
|
|
{ GGRAPH_POINT_DOT, 0, Green }, // point
|
2012-12-06 12:24:28 +00:00
|
|
|
{ GGRAPH_LINE_NONE, 2, Gray }, // line
|
2012-12-06 08:45:54 +00:00
|
|
|
{ GGRAPH_LINE_SOLID, 0, White }, // x axis
|
|
|
|
{ GGRAPH_LINE_SOLID, 0, White }, // y axis
|
|
|
|
{ GGRAPH_LINE_NONE, 0, White, 0 }, // x grid
|
|
|
|
{ GGRAPH_LINE_NONE, 0, White, 0 }, // y grid
|
|
|
|
GWIN_GRAPH_STYLE_XAXIS_ARROWS|GWIN_GRAPH_STYLE_YAXIS_ARROWS // flags
|
|
|
|
};
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
GHandle gh;
|
|
|
|
uint16_t i;
|
|
|
|
|
|
|
|
halInit();
|
|
|
|
chSysInit();
|
|
|
|
|
|
|
|
gdispInit();
|
|
|
|
gdispClear(Black);
|
|
|
|
|
2012-12-06 12:24:28 +00:00
|
|
|
gh = gwinCreateGraph(&g, 0, 0, gdispGetWidth(), gdispGetHeight());
|
2012-12-06 08:45:54 +00:00
|
|
|
|
2012-12-06 12:24:28 +00:00
|
|
|
gwinGraphSetOrigin(gh, gwinGetWidth(gh)/2, gwinGetHeight(gh)/2);
|
|
|
|
gwinGraphSetStyle(gh, &GraphStyle1);
|
2012-12-06 08:45:54 +00:00
|
|
|
gwinGraphDrawAxis(gh);
|
|
|
|
|
2012-12-06 12:24:28 +00:00
|
|
|
for(i = 0; i < gwinGetWidth(gh); i++)
|
|
|
|
gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*sin(2*0.2*M_PI*i/180));
|
2012-12-06 08:45:54 +00:00
|
|
|
|
|
|
|
gwinGraphStartSet(gh);
|
|
|
|
gwinGraphSetStyle(gh, &GraphStyle2);
|
|
|
|
|
2012-12-06 12:24:28 +00:00
|
|
|
for(i = 0; i < gwinGetWidth(gh)*5; i++)
|
|
|
|
gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*sin(2*0.2*M_PI*i/180));
|
2012-12-06 08:45:54 +00:00
|
|
|
|
|
|
|
while(TRUE) {
|
|
|
|
chThdSleepMilliseconds(100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|