| OLD | NEW |
| 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 import 'dart:dartino'; | 5 import 'dart:dartino'; |
| 6 | 6 |
| 7 import 'package:stm32/lcd.dart'; | 7 import 'package:stm32/lcd.dart'; |
| 8 import 'package:stm32/stm32f746g_disco.dart'; | 8 import 'package:stm32/stm32f746g_disco.dart'; |
| 9 import 'package:stm32/ts.dart'; | 9 import 'package:stm32/ts.dart'; |
| 10 | 10 |
| 11 main() { | 11 main() { |
| 12 var disco = new STM32F746GDiscovery(); | 12 var disco = new STM32F746GDiscovery(); |
| 13 var frameBuffer = disco.frameBuffer; | 13 var frameBuffer = disco.frameBuffer; |
| 14 var touchScreen = disco.touchScreen; | 14 var touchScreen = disco.touchScreen; |
| 15 | 15 |
| 16 frameBuffer.backgroundColor = Color.white; | 16 frameBuffer.backgroundColor = Color.white; |
| 17 frameBuffer.clear(Color.white); | 17 frameBuffer.clear(); |
| 18 int x = 25; | 18 int x = 25; |
| 19 int y = 25; | 19 int y = 25; |
| 20 frameBuffer.drawLine(x, y - 5, x, y + 5, Color.blue); | 20 frameBuffer.drawLine(x, y - 5, x, y + 5, Color.blue); |
| 21 frameBuffer.drawLine(x - 5, y, x + 5, y, Color.blue); | 21 frameBuffer.drawLine(x - 5, y, x + 5, y, Color.blue); |
| 22 frameBuffer.writeText(x + 3, y + 3, "$x, $y"); | 22 frameBuffer.writeText(x + 3, y + 3, "$x, $y"); |
| 23 x = frameBuffer.width - 25; | 23 x = frameBuffer.width - 25; |
| 24 frameBuffer.drawLine(x, y - 5, x, y + 5, Color.blue); | 24 frameBuffer.drawLine(x, y - 5, x, y + 5, Color.blue); |
| 25 frameBuffer.drawLine(x - 5, y, x + 5, y, Color.blue); | 25 frameBuffer.drawLine(x - 5, y, x + 5, y, Color.blue); |
| 26 frameBuffer.writeText(x - 50, y + 3, "$x, $y"); | 26 frameBuffer.writeText(x - 50, y + 3, "$x, $y"); |
| 27 | 27 |
| 28 while (true) { | 28 while (true) { |
| 29 TouchState t = touchScreen.state; | 29 TouchState t = touchScreen.state; |
| 30 var msg = new StringBuffer('touch: ${t.count}'); | 30 var msg = new StringBuffer('touch: ${t.count}'); |
| 31 for (int index = 0; index < t.count; ++index) { | 31 for (int index = 0; index < t.count; ++index) { |
| 32 msg.write(' - ${t.x[index]}, ${t.y[index]}'); | 32 msg.write(' - ${t.x[index]}, ${t.y[index]}'); |
| 33 } | 33 } |
| 34 print(msg); | 34 print(msg); |
| 35 sleep(500); | 35 sleep(500); |
| 36 } | 36 } |
| 37 } | 37 } |
| OLD | NEW |