Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(523)

Unified Diff: samples/raspberry_pi/basic/blinky.dart

Issue 1389573002: Refactor Raspberry Pi GPIO and add GPIO mock (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Fixed come commetns Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: samples/raspberry_pi/basic/blinky.dart
diff --git a/samples/raspberry_pi/basic/blinky.dart b/samples/raspberry_pi/basic/blinky.dart
index fb688a95ab4861678a74e67f9a633e8a7af27d36..a7cf028626fcf66a3beca563946a4e47ecd80575 100644
--- a/samples/raspberry_pi/basic/blinky.dart
+++ b/samples/raspberry_pi/basic/blinky.dart
@@ -6,14 +6,18 @@
// Raspberry Pi 2 activity LED.
import 'package:gpio/gpio.dart';
+import 'package:raspberry_pi/raspberry_pi.dart';
import 'package:os/os.dart';
main() {
// Constant for the Raspberry Pi 2 onboard green LED.
const int led = 47;
- // Initialize gpio and configure the pin.
- PiMemoryMappedGPIO gpio = new PiMemoryMappedGPIO();
+ // Initialize Raspberry Pi and configure the activity LED to be GPIO
+ // controlled.
+ RaspberryPi pi = new RaspberryPi();
+ pi.leds.activityLED.setMode(OnboardLEDMode.gpio);
+ GPIO gpio = pi.memoryMappedGPIO;
gpio.setMode(led, Mode.output);
// Turn LED on and off in a continuous loop.

Powered by Google App Engine
This is Rietveld 408576698