Skip to content

Commit adbe2b6

Browse files
committed
upload from mac
1 parent 106ede5 commit adbe2b6

File tree

1,766 files changed

+291502
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,766 files changed

+291502
-0
lines changed

Install Bluez Script

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sudo apt-get install bluetooth bluez-tools
2+
sudo apt-get install build-essential autoconf glib2.0 libglib2.0-dev libdbus-1-dev libudev-dev libical-dev libreadline-dev
3+
sudo apt-get install rsync python-dbus python3-dbus python-dbusmock python3-dbusmock
4+
sudo pip3 install Sphinx
5+
sudo pip3 install sphinx_rtd_theme
6+
sudo pip3 install pycodestyle

Intelli-Home/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
# Copyright (c) 2014 Adafruit Industries
2+
# Author: Tony DiCola
3+
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
import re
22+
23+
import Adafruit_DHT.common as common
24+
import Adafruit_DHT.Beaglebone_Black_Driver as driver
25+
26+
27+
# Define mapping of pin names to GPIO base and number.
28+
# Adapted from Adafruit_BBIO code Beaglebone Black system reference.
29+
pin_to_gpio = {
30+
"P9_11": (0,30),
31+
"P9_12": (1,28),
32+
"P9_13": (0,31),
33+
"P9_14": (1,18),
34+
"P9_15": (1,16),
35+
"P9_16": (1,19),
36+
"P9_17": (0,5),
37+
"P9_18": (0,4),
38+
"P9_19": (0,13),
39+
"P9_20": (0,12),
40+
"P9_21": (0,3),
41+
"P9_22": (0,2),
42+
"P9_23": (1,17),
43+
"P9_24": (0,15),
44+
"P9_25": (3,21),
45+
"P9_26": (0,14),
46+
"P9_27": (3,19),
47+
"P9_28": (3,17),
48+
"P9_29": (3,15),
49+
"P9_30": (3,16),
50+
"P9_31": (3,14),
51+
"P9_41": (0,20),
52+
"P9_42": (0,7),
53+
"UART4_RXD": (0,30),
54+
"UART4_TXD": (0,31),
55+
"EHRPWM1A": (1,18),
56+
"EHRPWM1B": (1,19),
57+
"I2C1_SCL": (0,5),
58+
"I2C1_SDA": (0,4),
59+
"I2C2_SCL": (0,13),
60+
"I2C2_SDA": (0,12),
61+
"UART2_TXD": (0,3),
62+
"UART2_RXD": (0,2),
63+
"UART1_TXD": (0,15),
64+
"UART1_RXD": (0,14),
65+
"SPI1_CS0": (3,17),
66+
"SPI1_D0": (3,15),
67+
"SPI1_D1": (3,16),
68+
"SPI1_SCLK": (3,14),
69+
"CLKOUT2": (0,20),
70+
"30": (0,30),
71+
"60": (1,28),
72+
"31": (0,31),
73+
"50": (1,18),
74+
"48": (1,16),
75+
"51": (1,19),
76+
"5": (0,5),
77+
"4": (0,4),
78+
"13": (0,13),
79+
"12": (0,12),
80+
"3": (0,3),
81+
"2": (0,2),
82+
"49": (1,17),
83+
"15": (0,15),
84+
"117": (3,21),
85+
"14": (0,14),
86+
"115": (3,19),
87+
"113": (3,17),
88+
"111": (3,15),
89+
"112": (3,16),
90+
"110": (3,14),
91+
"20": (0,20),
92+
"7": (0,7),
93+
"P8_3": (1,6),
94+
"P8_4": (1,7),
95+
"P8_5": (1,2),
96+
"P8_6": (1,3),
97+
"P8_7": (2,2),
98+
"P8_8": (2,3),
99+
"P8_9": (2,5),
100+
"P8_10": (2,4),
101+
"P8_11": (1,13),
102+
"P8_12": (1,12),
103+
"P8_13": (0,23),
104+
"P8_14": (0,26),
105+
"P8_15": (1,15),
106+
"P8_16": (1,14),
107+
"P8_17": (0,27),
108+
"P8_18": (2,1),
109+
"P8_19": (0,22),
110+
"P8_20": (1,31),
111+
"P8_21": (1,30),
112+
"P8_22": (1,5),
113+
"P8_23": (1,4),
114+
"P8_24": (1,1),
115+
"P8_25": (1,0),
116+
"P8_26": (1,29),
117+
"P8_27": (2,22),
118+
"P8_28": (2,24),
119+
"P8_29": (2,23),
120+
"P8_30": (2,25),
121+
"P8_31": (0,10),
122+
"P8_32": (0,11),
123+
"P8_33": (0,9),
124+
"P8_34": (2,17),
125+
"P8_35": (0,8),
126+
"P8_36": (2,16),
127+
"P8_37": (2,14),
128+
"P8_38": (2,15),
129+
"P8_39": (2,12),
130+
"P8_40": (2,13),
131+
"P8_41": (2,10),
132+
"P8_42": (2,11),
133+
"P8_43": (2,8),
134+
"P8_44": (2,9),
135+
"P8_45": (2,6),
136+
"P8_46": (2,7),
137+
"TIMER4": (2,2),
138+
"TIMER7": (2,3),
139+
"TIMER5": (2,5),
140+
"TIMER6": (2,4),
141+
"EHRPWM2B": (0,23),
142+
"EHRPWM2A": (0,22),
143+
"UART5_CTSN": (0,10),
144+
"UART5_RTSN": (0,11),
145+
"UART4_RTSN": (0,9),
146+
"UART3_RTSN": (2,17),
147+
"UART4_CTSN": (0,8),
148+
"UART3_CTSN": (2,16),
149+
"UART5_TXD": (2,14),
150+
"UART5_RXD": (2,15),
151+
"38": (1,6),
152+
"39": (1,7),
153+
"34": (1,2),
154+
"35": (1,3),
155+
"66": (2,2),
156+
"67": (2,3),
157+
"69": (2,5),
158+
"68": (2,4),
159+
"45": (1,13),
160+
"44": (1,12),
161+
"23": (0,23),
162+
"26": (0,26),
163+
"47": (1,15),
164+
"46": (1,14),
165+
"27": (0,27),
166+
"65": (2,1),
167+
"22": (0,22),
168+
"63": (1,31),
169+
"62": (1,30),
170+
"37": (1,5),
171+
"36": (1,4),
172+
"33": (1,1),
173+
"32": (1,0),
174+
"61": (1,29),
175+
"86": (2,22),
176+
"88": (2,24),
177+
"87": (2,23),
178+
"89": (2,25),
179+
"10": (0,10),
180+
"11": (0,11),
181+
"9": (0,9),
182+
"81": (2,17),
183+
"8": (0,8),
184+
"80": (2,16),
185+
"78": (2,14),
186+
"79": (2,15),
187+
"76": (2,12),
188+
"77": (2,13),
189+
"74": (2,10),
190+
"75": (2,11),
191+
"72": (2,8),
192+
"73": (2,9),
193+
"70": (2,6),
194+
"71": (2,7)
195+
}
196+
197+
def read(sensor, pin):
198+
# Validate GPIO and map it to GPIO base and number.
199+
gpio = pin_to_gpio.get(str(pin).upper(), None)
200+
if gpio is None:
201+
# Couldn't find in mapping, check if pin looks like GPIO<base>_<number>
202+
match = re.match('GPIO([0123])_(\d+)', pin, re.IGNORECASE)
203+
if match is not None:
204+
gpio = (int(match.group(1)), int(match.group(2)))
205+
if gpio is None or gpio[0] < 0 or gpio[0] > 3 or gpio[1] < 0 or gpio[1] > 31:
206+
raise ValueError('Pin must be a valid GPIO identifier like P9_12 or GPIO1_28.')
207+
# Get a reading from C driver code.
208+
result, humidity, temp = driver.read(sensor, gpio[0], gpio[1])
209+
if result in common.TRANSIENT_ERRORS:
210+
# Signal no result could be obtained, but the caller can retry.
211+
return (None, None)
212+
elif result == common.DHT_ERROR_GPIO:
213+
raise RuntimeError('Error accessing GPIO. Make sure program is run as root with sudo!')
214+
elif result != common.DHT_SUCCESS:
215+
# Some kind of error occured.
216+
raise RuntimeError('Error calling DHT test driver read: {0}'.format(result))
217+
return (humidity, temp)
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) 2014 Adafruit Industries
2+
# Author: Tony DiCola
3+
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
import Adafruit_DHT.common as common
22+
import Adafruit_DHT.Raspberry_Pi_Driver as driver
23+
24+
def read(sensor, pin):
25+
# Validate pin is a valid GPIO.
26+
if pin is None or int(pin) < 0 or int(pin) > 31:
27+
raise ValueError('Pin must be a valid GPIO number 0 to 31.')
28+
# Get a reading from C driver code.
29+
result, humidity, temp = driver.read(sensor, int(pin))
30+
if result in common.TRANSIENT_ERRORS:
31+
# Signal no result could be obtained, but the caller can retry.
32+
return (None, None)
33+
elif result == common.DHT_ERROR_GPIO:
34+
raise RuntimeError('Error accessing GPIO. Make sure program is run as root with sudo!')
35+
elif result != common.DHT_SUCCESS:
36+
# Some kind of error occured.
37+
raise RuntimeError('Error calling DHT test driver read: {0}'.format(result))
38+
return (humidity, temp)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) 2014 Adafruit Industries
2+
# Author: Tony DiCola
3+
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
import Adafruit_DHT.common as common
22+
import Adafruit_DHT.Raspberry_Pi_2_Driver as driver
23+
24+
def read(sensor, pin):
25+
# Validate pin is a valid GPIO.
26+
if pin is None or int(pin) < 0 or int(pin) > 31:
27+
raise ValueError('Pin must be a valid GPIO number 0 to 31.')
28+
# Get a reading from C driver code.
29+
result, humidity, temp = driver.read(sensor, int(pin))
30+
if result in common.TRANSIENT_ERRORS:
31+
# Signal no result could be obtained, but the caller can retry.
32+
return (None, None)
33+
elif result == common.DHT_ERROR_GPIO:
34+
raise RuntimeError('Error accessing GPIO. Make sure program is run as root with sudo!')
35+
elif result != common.DHT_SUCCESS:
36+
# Some kind of error occured.
37+
raise RuntimeError('Error calling DHT test driver read: {0}'.format(result))
38+
return (humidity, temp)
1017 Bytes
Binary file not shown.

Intelli-Home/Adafruit_DHT/Test.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2014 Adafruit Industries
2+
# Author: Tony DiCola
3+
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
import Adafruit_DHT.common as common
22+
import Adafruit_DHT.Test_Driver as driver
23+
24+
def read(sensor, pin):
25+
# Get a reading from C driver code.
26+
result, humidity, temp = driver.read(sensor, pin)
27+
if result in common.TRANSIENT_ERRORS:
28+
# Signal no result could be obtained, but the caller can retry.
29+
return (None, None)
30+
elif result != common.DHT_SUCCESS:
31+
# Some kind of error occured.
32+
raise RuntimeError('Error calling DHT test driver read: {0}'.format(result))
33+
return (humidity, temp)

Intelli-Home/Adafruit_DHT/__init__.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2014 Adafruit Industries
2+
# Author: Tony DiCola
3+
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
from Adafruit_DHT.common import DHT11, DHT22, AM2302, read, read_retry
296 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)