Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016, the SoD project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 import 'dart:dartino.ffi'; | |
| 6 | |
| 7 final ForeignFunction _toggleLED = ForeignLibrary.main.lookup('led_toggle'); | |
| 8 | |
| 9 class LED { | |
| 10 final int _id; | |
| 11 | |
| 12 const LED._internal(this._id); | |
|
lukechurch
2016/02/09 09:20:01
Consider an explanatory comment as to the pattern
herhut
2016/02/09 10:10:15
I think this is a very common pattern and we shoul
lukechurch
2016/02/09 10:13:53
I agree. We should describe it once, in the place
| |
| 13 | |
| 14 setState(bool value) { | |
|
Søren Gjesse
2016/02/09 09:16:01
Just make this a setter.
And please add a getter
herhut
2016/02/09 10:10:15
Done.
| |
| 15 _toggleLED.icall$2(_id, value ? 1 : 0); | |
| 16 } | |
| 17 } | |
| 18 | |
| 19 const LED0 = const LED._internal(0); | |
| 20 const LED1 = const LED._internal(1); | |
| 21 const LED2 = const LED._internal(2); | |
| 22 const LED3 = const LED._internal(3); | |
| OLD | NEW |