Chromium Code Reviews| Index: dart/pkg/lk/lib/leds.dart |
| diff --git a/dart/pkg/lk/lib/leds.dart b/dart/pkg/lk/lib/leds.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cb605a56151f762fe840eb250cc3f7c1c6fa538a |
| --- /dev/null |
| +++ b/dart/pkg/lk/lib/leds.dart |
| @@ -0,0 +1,22 @@ |
| +// Copyright (c) 2016, the SoD project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE.md file. |
| + |
| +import 'dart:dartino.ffi'; |
| + |
| +final ForeignFunction _toggleLED = ForeignLibrary.main.lookup('led_toggle'); |
| + |
| +class LED { |
| + final int _id; |
| + |
| + 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
|
| + |
| + 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.
|
| + _toggleLED.icall$2(_id, value ? 1 : 0); |
| + } |
| +} |
| + |
| +const LED0 = const LED._internal(0); |
| +const LED1 = const LED._internal(1); |
| +const LED2 = const LED._internal(2); |
| +const LED3 = const LED._internal(3); |