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
drawhands.h.orig@49:243b5e826228, 2017-05-26 (annotated)
- Committer:
- Owenmatthewmcgowan
- Date:
- Fri May 26 09:37:06 2017 +0000
- Revision:
- 49:243b5e826228
- Parent:
- 41:3f2e75e7fbeb
merge;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mlin | 41:3f2e75e7fbeb | 1 | |
mlin | 41:3f2e75e7fbeb | 2 | void draw_hands ( int x0 , int y0 , int r , float minutes , int hours , int color) |
mlin | 41:3f2e75e7fbeb | 3 | { |
mlin | 41:3f2e75e7fbeb | 4 | int x1,y1,x2,y2; |
mlin | 41:3f2e75e7fbeb | 5 | int rs = 0.6 * r ; // shorter moving hand |
mlin | 41:3f2e75e7fbeb | 6 | int m = minutes ; |
mlin | 41:3f2e75e7fbeb | 7 | int k = hours % 12; |
mlin | 41:3f2e75e7fbeb | 8 | double angle2 = k * M_PI / 6 ; |
mlin | 41:3f2e75e7fbeb | 9 | double angle = m * M_PI / 30 ; |
mlin | 41:3f2e75e7fbeb | 10 | x1 = r* sin(angle) + x0;//mins |
mlin | 41:3f2e75e7fbeb | 11 | y1 = r * -cos(angle) + y0; |
mlin | 41:3f2e75e7fbeb | 12 | x2 = rs * sin(angle2) + x0; //hours |
mlin | 41:3f2e75e7fbeb | 13 | y2 = rs * -cos(angle2) + y0; |
mlin | 41:3f2e75e7fbeb | 14 | TFT.line(x0, y0, x2, y2, color); |
mlin | 41:3f2e75e7fbeb | 15 | TFT.line(x0, y0, x1, y1, color); |
mlin | 41:3f2e75e7fbeb | 16 | } |
mlin | 41:3f2e75e7fbeb | 17 | |
mlin | 41:3f2e75e7fbeb | 18 | |
mlin | 41:3f2e75e7fbeb | 19 |