Contains the main execution of the clock uses headers to import functions

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of TFT_Mikroelectronika_IL9341_sketchpad by Oxford CWM Team

Committer:
Owenmatthewmcgowan
Date:
Fri May 26 09:37:06 2017 +0000
Revision:
49:243b5e826228
Parent:
41:3f2e75e7fbeb
merge;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tunagonen 37:54285105ed80 1
tunagonen 39:4b70d28cb273 2 //early version of the analog clock draw function
mlin 38:3fe3bafbf0c7 3 void draw_hands ( int x0 , int y0 , int r , float minutes , int hours , int color)
tunagonen 37:54285105ed80 4 {
mlin 38:3fe3bafbf0c7 5 int x1,y1,x2,y2;
mlin 38:3fe3bafbf0c7 6 int rs = 0.6 * r ; // shorter moving hand
tunagonen 39:4b70d28cb273 7 int m = minutes ; // minutes
tunagonen 39:4b70d28cb273 8 int k = hours % 12; // hours
tunagonen 39:4b70d28cb273 9 double angle2 = k * M_PI / 6 ; // scaling
mlin 38:3fe3bafbf0c7 10 double angle = m * M_PI / 30 ;
mlin 41:3f2e75e7fbeb 11
mlin 40:05798eeadd02 12 x1 = r* sin(angle) + x0;//mins
mlin 40:05798eeadd02 13 y1 = r * -cos(angle) + y0;
mlin 40:05798eeadd02 14 x2 = rs * sin(angle2) + x0; //hours
mlin 40:05798eeadd02 15 y2 = rs * -cos(angle2) + y0;
tunagonen 37:54285105ed80 16 TFT.line(x0, y0, x2, y2, color);
tunagonen 37:54285105ed80 17 TFT.line(x0, y0, x1, y1, color);
mlin 41:3f2e75e7fbeb 18
tunagonen 37:54285105ed80 19 }
tunagonen 37:54285105ed80 20
tunagonen 37:54285105ed80 21
tunagonen 37:54285105ed80 22