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 /// GPIO support providing access to controlling GPIO pins. | 5 /// GPIO support providing access to controlling GPIO pins. |
6 /// | 6 /// |
7 /// Currently this has only been tested with a Raspberry Pi 2. | 7 /// Currently this has only been tested with a Raspberry Pi 2. |
8 /// | 8 /// |
9 /// Access types | 9 /// Access types |
10 /// ------------ | 10 /// ------------ |
(...skipping 29 matching lines...) Expand all Loading... |
40 /// ``` | 40 /// ``` |
41 /// | 41 /// |
42 /// See ```/samples/raspberry_pi/``` for additional details. | 42 /// See ```/samples/raspberry_pi/``` for additional details. |
43 /// | 43 /// |
44 /// Reporting issues | 44 /// Reporting issues |
45 /// ---------------- | 45 /// ---------------- |
46 /// Please file an issue [in the issue | 46 /// Please file an issue [in the issue |
47 /// 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). | 47 /// 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). |
48 library gpio; | 48 library gpio; |
49 | 49 |
50 import 'dart:fletch.ffi'; | 50 import 'dart:dartino.ffi'; |
51 import 'dart:typed_data'; | 51 import 'dart:typed_data'; |
52 | 52 |
53 import 'package:file/file.dart'; | 53 import 'package:file/file.dart'; |
54 | 54 |
55 // Foreign functions used. | 55 // Foreign functions used. |
56 final ForeignFunction _lseek = ForeignLibrary.main.lookup('lseek'); | 56 final ForeignFunction _lseek = ForeignLibrary.main.lookup('lseek'); |
57 final ForeignFunction _poll = ForeignLibrary.main.lookup('poll'); | 57 final ForeignFunction _poll = ForeignLibrary.main.lookup('poll'); |
58 | 58 |
59 /// GPIO modes. | 59 /// GPIO modes. |
60 enum Mode { | 60 enum Mode { |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 /// Exception message. | 386 /// Exception message. |
387 final String message; | 387 final String message; |
388 /// OS error number if any. | 388 /// OS error number if any. |
389 final int errno; | 389 final int errno; |
390 const GPIOException(this.message, [this.errno]); | 390 const GPIOException(this.message, [this.errno]); |
391 String toString() { | 391 String toString() { |
392 if (errno == null) return message; | 392 if (errno == null) return message; |
393 return '$message (error ${errno})'; | 393 return '$message (error ${errno})'; |
394 } | 394 } |
395 } | 395 } |
OLD | NEW |