1
|
|
|
# Copyright 2019 Virantha N. Ekanayake |
2
|
|
|
# |
3
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
4
|
|
|
# you may not use this file except in compliance with the License. |
5
|
|
|
# You may obtain a copy of the License at |
6
|
|
|
# |
7
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
8
|
|
|
# |
9
|
|
|
# Unless required by applicable law or agreed to in writing, software |
10
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
11
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12
|
|
|
# See the License for the specific language governing permissions and |
13
|
|
|
# limitations under the License. |
14
|
|
|
|
15
|
|
|
"""Useful constants for BrickNil |
16
|
|
|
""" |
17
|
|
|
from enum import Enum |
18
|
|
|
import platform |
19
|
|
|
|
20
|
|
|
if platform.system() == "Darwin": |
21
|
|
|
USE_BLEAK = False |
22
|
|
|
else: |
23
|
|
|
USE_BLEAK = True |
24
|
|
|
|
25
|
|
|
class Color(Enum): |
26
|
|
|
"""11 colors""" |
27
|
|
|
black = 0 |
28
|
|
|
pink = 1 |
29
|
|
|
purple = 2 |
30
|
|
|
blue = 3 |
31
|
|
|
light_blue = 4 |
32
|
|
|
cyan = 5 |
33
|
|
|
green = 6 |
34
|
|
|
yellow = 7 |
35
|
|
|
orange = 8 |
36
|
|
|
red = 9 |
37
|
|
|
white = 10 |
38
|
|
|
none = 255 |
39
|
|
|
|
40
|
|
|
DEVICES = { 0x0001: 'Motor', |
41
|
|
|
0x0002: 'System Train Motor', |
42
|
|
|
0x0005: 'Button', |
43
|
|
|
0x0008: 'Light', |
44
|
|
|
0x0014: 'Voltage', |
45
|
|
|
0x0015: 'Current', |
46
|
|
|
0x0016: 'Piezo Tone (Sound)', |
47
|
|
|
0x0017: 'RGB Light', |
48
|
|
|
0x0022: 'External Tilt Sensor', |
49
|
|
|
0x0023: 'Motion Sensor', |
50
|
|
|
0x0025: 'Vision Sensor', |
51
|
|
|
0x0026: 'External Motor with Tacho', |
52
|
|
|
0x0027: 'Internal Motor with Tacho', |
53
|
|
|
0x0028: 'Internal Tilt', |
54
|
|
|
0x0029: 'Duplo Train Motor', |
55
|
|
|
0x002A: 'Duplo Train Speaker', |
56
|
|
|
0x002B: 'Duplo Train Color', |
57
|
|
|
0x002C: 'Duplo Train Speedometer', |
58
|
|
|
0x002E: 'Technic Control+ Large Motor', |
59
|
|
|
0x002F: 'Technic Control+ XL Motor', |
60
|
|
|
0x0036: 'Powered Up Hub IMU Gesture', |
61
|
|
|
0x0037: 'Remote Button', |
62
|
|
|
0x0038: 'Remote Signal Level', |
63
|
|
|
0x0039: 'Powered Up Hub IMU Accelerometer', |
64
|
|
|
0x003A: 'Powered Up Hub IMU Gyro', |
65
|
|
|
0x003B: 'Powered Up Hub IMU Position', |
66
|
|
|
0x003C: 'Powered Up Hub IMU Temperature', |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
|