OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Access to Raspberry Pi 2 specific hardware features such as onboard LEDs. | 5 /// Access to Raspberry Pi 2 specific hardware features such as onboard LEDs. |
6 /// Also provides an API to the Sense HAT shield. | 6 /// Also provides an API to the Sense HAT shield. |
7 /// | 7 /// |
8 /// The class [RaspberryPi] provide access to the Raspberry Pi features. | 8 /// The class [RaspberryPi] provide access to the Raspberry Pi features. |
9 /// | 9 /// |
10 /// Usage | 10 /// Usage |
(...skipping 11 matching lines...) Expand all Loading... |
22 /// pi.leds.activityLED.on(); | 22 /// pi.leds.activityLED.on(); |
23 /// } | 23 /// } |
24 /// ``` | 24 /// ``` |
25 /// | 25 /// |
26 /// Reporting issues | 26 /// Reporting issues |
27 /// ---------------- | 27 /// ---------------- |
28 /// Please file an issue [in the issue | 28 /// Please file an issue [in the issue |
29 /// tracker](https://github.com/dartino/sdk/issues/new?title=Add%20title&labels=
Area-Package&body=%3Cissue%20description%3E%0A%3Crepro%20steps%3E%0A%3Cexpected%
20outcome%3E%0A%3Cactual%20outcome%3E). | 29 /// tracker](https://github.com/dartino/sdk/issues/new?title=Add%20title&labels=
Area-Package&body=%3Cissue%20description%3E%0A%3Crepro%20steps%3E%0A%3Cexpected%
20outcome%3E%0A%3Cactual%20outcome%3E). |
30 library raspberry_pi; | 30 library raspberry_pi; |
31 | 31 |
32 import 'dart:fletch.ffi'; | 32 import 'dart:dartino.ffi'; |
33 import 'dart:typed_data'; | 33 import 'dart:typed_data'; |
34 | 34 |
35 import 'package:file/file.dart'; | 35 import 'package:file/file.dart'; |
36 import 'package:gpio/gpio.dart' as gpio; | 36 import 'package:gpio/gpio.dart' as gpio; |
37 | 37 |
38 // Foreign functions used. | 38 // Foreign functions used. |
39 final ForeignFunction _open = ForeignLibrary.main.lookup('open'); | 39 final ForeignFunction _open = ForeignLibrary.main.lookup('open'); |
40 final ForeignFunction _mmap = ForeignLibrary.main.lookup('mmap'); | 40 final ForeignFunction _mmap = ForeignLibrary.main.lookup('mmap'); |
41 | 41 |
42 /// Possible modes of the on-board LEDs | 42 /// Possible modes of the on-board LEDs |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 void setMode(OnboardLEDMode mode) { | 396 void setMode(OnboardLEDMode mode) { |
397 _leds._setMode(_led, mode); | 397 _leds._setMode(_led, mode); |
398 } | 398 } |
399 | 399 |
400 /// Turn on the LED. | 400 /// Turn on the LED. |
401 void on() => _leds._setBrightness(_led, true); | 401 void on() => _leds._setBrightness(_led, true); |
402 | 402 |
403 /// Turn off the LED. | 403 /// Turn off the LED. |
404 void off() => _leds._setBrightness(_led, false); | 404 void off() => _leds._setBrightness(_led, false); |
405 } | 405 } |
OLD | NEW |