Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor
Fork of TFT_Mikroelectronika_IL9341_sketchpad by
drawhands.h@39:4b70d28cb273, 2017-05-26 (annotated)
- Committer:
- tunagonen
- Date:
- Fri May 26 08:28:27 2017 +0000
- Revision:
- 39:4b70d28cb273
- Parent:
- 38:3fe3bafbf0c7
- Child:
- 41:3f2e75e7fbeb
comments added;
Who changed what in which revision?
| User | Revision | Line number | New 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 ; |
| tunagonen | 39:4b70d28cb273 | 11 | x1 = rs * sin(angle) + x0; // trigonometric functions to get values |
| mlin | 38:3fe3bafbf0c7 | 12 | y1 = rs * cos(angle) + y0; |
| mlin | 38:3fe3bafbf0c7 | 13 | x2 = r * sin(angle2) + x0; |
| mlin | 38:3fe3bafbf0c7 | 14 | y2 = r * cos(angle2) + y0; |
| tunagonen | 39:4b70d28cb273 | 15 | TFT.line(x0, y0, x2, y2, color); //draw line |
| tunagonen | 39:4b70d28cb273 | 16 | TFT.line(x0, y0, x1, y1, color); //draw line |
| tunagonen | 37:54285105ed80 | 17 | } |
| tunagonen | 37:54285105ed80 | 18 | |
| tunagonen | 37:54285105ed80 | 19 | |
| tunagonen | 37:54285105ed80 | 20 |
