Skip to content

Commit 3f55058

Browse files
authored
Merge pull request #29 from robotics-masters/wallarug/robohatmm1
Adding Robo HAT MM1 Board Definitions
2 parents 1d12cfc + d18c2ec commit 3f55058

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

adafruit_seesaw/robohat.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2019 wallarug for Robotics Masters
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
# pylint: disable=missing-docstring,invalid-name,too-many-public-methods,too-few-public-methods
23+
24+
from micropython import const
25+
26+
__version__ = "0.0.0-auto.0"
27+
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_seesaw.git"
28+
29+
# Robo HAT MM1 Board: https://www.crowdsupply.com/robotics-masters/robo-hat-mm1
30+
31+
# The ordering here reflects the seesaw firmware (mm1_hat) pinmap for Robo HAT MM1,
32+
# not logical ordering of the HAT terminals.
33+
34+
_MM1_D0 = const(55) # (RX to RPI_TX)
35+
_MM1_D1 = const(54) # (TX to RPI_RX)
36+
_MM1_D2 = const(34) # ADC (GPS_TX)
37+
_MM1_D3 = const(35) # ADC (GPS_RX)
38+
_MM1_D4 = const(0) # (GPS_SDA)
39+
_MM1_D5 = const(1) # (GPS_SCL)
40+
_MM1_D6 = const(28) # (POWER_ENABLE)
41+
_MM1_D7 = const(2) # (BATTERY)
42+
_MM1_D8 = const(20) # (NEOPIXEL)
43+
_MM1_D9 = const(43) # PWM (SPI_SCK)
44+
_MM1_D10 = const(41) # PWM (SPI_SS)
45+
_MM1_D11 = const(42) # PWM (SPI_MOSI)
46+
_MM1_D12 = const(40) # PWM (SPI_MISO)
47+
_MM1_D13 = const(21) # LED
48+
_MM1_D14 = const(3) # (POWER_OFF)
49+
50+
_MM1_SERVO8 = const(8)
51+
_MM1_SERVO7 = const(9)
52+
_MM1_SERVO6 = const(10)
53+
_MM1_SERVO5 = const(11)
54+
_MM1_SERVO4 = const(19)
55+
_MM1_SERVO3 = const(18)
56+
_MM1_SERVO2 = const(17)
57+
_MM1_SERVO1 = const(16)
58+
59+
_MM1_RCH1 = const(7)
60+
_MM1_RCH2 = const(6)
61+
_MM1_RCH3 = const(5)
62+
_MM1_RCH4 = const(4)
63+
64+
65+
# seesaw firmware has indexed lists of pins by function.
66+
# These "pin" numbers map to real PAxx, PBxx pins on the board implementing seesaaw
67+
# They may or may not match.
68+
# See seesaw/include/SeesawConfig.h and seesaw/boards/robohatmm1/board_config.h for the pin choices.
69+
70+
# You must look at both files and combine the defaults in SeesawConfig.h with the
71+
# overrides in robohatmm1/board_config.h.
72+
# PA<nn> pins are nn
73+
# PB<nn> pins are 32+nn
74+
75+
class MM1_Pinmap:
76+
# seesaw firmware (mm1_hat) analog pin map:
77+
# analog[0]:47 analog[1]:48 analog[2]: analog[3]:
78+
# analog[4]: analog[5]: analog[6]: analog[7]:
79+
#
80+
analog_pins = (_MM1_D3, _MM1_D2)
81+
82+
pwm_width = 16
83+
84+
# seesaw firmware (mm1_hat) pwm pin map:
85+
# pwm[0]:16 pwm[1]:17 pwm[2]:18 pwm[3]:19 pwm[4]:11 pwm[5]:10
86+
# pwm[6]:9 pwm[7]:8 pwm[8]:40 pwm[9]:41 pwm[10]:42 pwm[11]:43
87+
#
88+
pwm_pins = (_MM1_SERVO1, _MM1_SERVO2, _MM1_SERVO3, _MM1_SERVO4,
89+
_MM1_SERVO5, _MM1_SERVO6, _MM1_SERVO7, _MM1_SERVO8,
90+
_MM1_D12, _MM1_D10, _MM1_D11, _MM1_D9)
91+
92+
# seesaw firmware touch pin map:
93+
# touch[0]: 7 touch[1]: 6 touch[2]: 5 touch[3]: 4
94+
touch_pins = (_MM1_RCH1, _MM1_RCH2, _MM1_RCH3, _MM1_RCH4)

adafruit_seesaw/seesaw.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121

122122
#TODO: update when we get real PID
123123
_CRICKIT_PID = const(9999)
124+
_ROBOHATMM1_PID = const(9998)
124125

125126
class Seesaw:
126127
"""Driver for Seesaw i2c generic conversion trip
@@ -156,6 +157,9 @@ def sw_reset(self):
156157
if pid == _CRICKIT_PID:
157158
from adafruit_seesaw.crickit import Crickit_Pinmap
158159
self.pin_mapping = Crickit_Pinmap
160+
elif pid == _ROBOHATMM1_PID:
161+
from adafruit_seesaw.robohat import MM1_Pinmap
162+
self.pin_mapping = MM1_Pinmap
159163
else:
160164
from adafruit_seesaw.samd09 import SAMD09_Pinmap
161165
self.pin_mapping = SAMD09_Pinmap

0 commit comments

Comments
 (0)