Skip to content

Commit 483d3cf

Browse files
committed
DM: rename to CRICKIT
1 parent 5d77362 commit 483d3cf

2 files changed

Lines changed: 73 additions & 73 deletions

File tree

adafruit_seesaw.py

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -117,47 +117,47 @@
117117
_ADC_INPUT_2_PIN = const(0x04)
118118
_ADC_INPUT_3_PIN = const(0x05)
119119

120-
_ADC_INPUT_0_PIN_CRCKIT = const(2)
121-
_ADC_INPUT_1_PIN_CRCKIT = const(3)
122-
_ADC_INPUT_2_PIN_CRCKIT = const(40)
123-
_ADC_INPUT_3_PIN_CRCKIT = const(41)
124-
_ADC_INPUT_4_PIN_CRCKIT = const(11)
125-
_ADC_INPUT_5_PIN_CRCKIT = const(10)
126-
_ADC_INPUT_6_PIN_CRCKIT = const(9)
127-
_ADC_INPUT_7_PIN_CRCKIT = const(8)
120+
_ADC_INPUT_0_PIN_CRICKIT = const(2)
121+
_ADC_INPUT_1_PIN_CRICKIT = const(3)
122+
_ADC_INPUT_2_PIN_CRICKIT = const(40)
123+
_ADC_INPUT_3_PIN_CRICKIT = const(41)
124+
_ADC_INPUT_4_PIN_CRICKIT = const(11)
125+
_ADC_INPUT_5_PIN_CRICKIT = const(10)
126+
_ADC_INPUT_6_PIN_CRICKIT = const(9)
127+
_ADC_INPUT_7_PIN_CRICKIT = const(8)
128128

129129
_PWM_0_PIN = const(0x04)
130130
_PWM_1_PIN = const(0x05)
131131
_PWM_2_PIN = const(0x06)
132132
_PWM_3_PIN = const(0x07)
133133

134-
_CRCKIT_S4 = const(14)
135-
_CRCKIT_S3 = const(15)
136-
_CRCKIT_S2 = const(16)
137-
_CRCKIT_S1 = const(17)
138-
139-
_CRCKIT_M1_A1 = const(18)
140-
_CRCKIT_M1_A2 = const(19)
141-
_CRCKIT_M1_B1 = const(22)
142-
_CRCKIT_M1_B2 = const(23)
143-
_CRCKIT_DRIVE1 = const(42)
144-
_CRCKIT_DRIVE2 = const(43)
145-
_CRCKIT_DRIVE3 = const(12)
146-
_CRCKIT_DRIVE4 = const(13)
147-
148-
_CRCKIT_CT1 = const(0)
149-
_CRCKIT_CT2 = const(1)
150-
_CRCKIT_CT3 = const(2)
151-
_CRCKIT_CT4 = const(3)
134+
_CRICKIT_S4 = const(14)
135+
_CRICKIT_S3 = const(15)
136+
_CRICKIT_S2 = const(16)
137+
_CRICKIT_S1 = const(17)
138+
139+
_CRICKIT_M1_A1 = const(18)
140+
_CRICKIT_M1_A2 = const(19)
141+
_CRICKIT_M1_B1 = const(22)
142+
_CRICKIT_M1_B2 = const(23)
143+
_CRICKIT_DRIVE1 = const(42)
144+
_CRICKIT_DRIVE2 = const(43)
145+
_CRICKIT_DRIVE3 = const(12)
146+
_CRICKIT_DRIVE4 = const(13)
147+
148+
_CRICKIT_CT1 = const(0)
149+
_CRICKIT_CT2 = const(1)
150+
_CRICKIT_CT3 = const(2)
151+
_CRICKIT_CT4 = const(3)
152152

153153
_HW_ID_CODE = const(0x55)
154154
_EEPROM_I2C_ADDR = const(0x3F)
155155

156156
SEESAW_SAMD09 = const(0x00)
157-
SEESAW_CRCKIT = const(0x01)
157+
SEESAW_CRICKIT = const(0x01)
158158

159159
#TODO: update when we get real PID
160-
_CRCKIT_PID = const(9999)
160+
_CRICKIT_PID = const(9999)
161161

162162
class DigitalIO:
163163
def __init__(self, seesaw, pin):
@@ -368,8 +368,8 @@ def sw_reset(self):
368368
.format(chip_id, _HW_ID_CODE))
369369

370370
pid = self.get_version() >> 16
371-
if pid == _CRCKIT_PID:
372-
self.variant = SEESAW_CRCKIT
371+
if pid == _CRICKIT_PID:
372+
self.variant = SEESAW_CRICKIT
373373
else:
374374
self.variant = SEESAW_SAMD09
375375

@@ -436,11 +436,11 @@ def get_analog_in(self, pin):
436436

437437
def analog_read(self, pin):
438438
buf = bytearray(2)
439-
if self.variant == SEESAW_CRCKIT:
440-
pin_mapping = [_ADC_INPUT_0_PIN_CRCKIT, _ADC_INPUT_1_PIN_CRCKIT,
441-
_ADC_INPUT_2_PIN_CRCKIT, _ADC_INPUT_3_PIN_CRCKIT,
442-
_ADC_INPUT_4_PIN_CRCKIT, _ADC_INPUT_5_PIN_CRCKIT,
443-
_ADC_INPUT_6_PIN_CRCKIT, _ADC_INPUT_7_PIN_CRCKIT]
439+
if self.variant == SEESAW_CRICKIT:
440+
pin_mapping = [_ADC_INPUT_0_PIN_CRICKIT, _ADC_INPUT_1_PIN_CRICKIT,
441+
_ADC_INPUT_2_PIN_CRICKIT, _ADC_INPUT_3_PIN_CRICKIT,
442+
_ADC_INPUT_4_PIN_CRICKIT, _ADC_INPUT_5_PIN_CRICKIT,
443+
_ADC_INPUT_6_PIN_CRICKIT, _ADC_INPUT_7_PIN_CRICKIT]
444444
else:
445445
pin_mapping = [_ADC_INPUT_0_PIN, _ADC_INPUT_1_PIN,
446446
_ADC_INPUT_2_PIN, _ADC_INPUT_3_PIN]
@@ -456,7 +456,7 @@ def analog_read(self, pin):
456456
def touch_read(self, pin):
457457
buf = bytearray(2)
458458

459-
pin_mapping = [_CRCKIT_CT1, _CRCKIT_CT2, _CRCKIT_CT3, _CRCKIT_CT4]
459+
pin_mapping = [_CRICKIT_CT1, _CRICKIT_CT2, _CRICKIT_CT3, _CRICKIT_CT4]
460460

461461
if pin not in pin_mapping:
462462
raise ValueError("Invalid touch pin")
@@ -510,11 +510,11 @@ def get_pwm(self, pin):
510510
return PWMChannel(self, pin)
511511

512512
def analog_write(self, pin, value):
513-
if self.variant == SEESAW_CRCKIT:
514-
pin_mapping = [_CRCKIT_S4, _CRCKIT_S3, _CRCKIT_S2, _CRCKIT_S1,
515-
_CRCKIT_M1_A1, _CRCKIT_M1_A2, _CRCKIT_M1_B1,
516-
_CRCKIT_M1_B2, _CRCKIT_DRIVE1, _CRCKIT_DRIVE2,
517-
_CRCKIT_DRIVE3, _CRCKIT_DRIVE4]
513+
if self.variant == SEESAW_CRICKIT:
514+
pin_mapping = [_CRICKIT_S4, _CRICKIT_S3, _CRICKIT_S2, _CRICKIT_S1,
515+
_CRICKIT_M1_A1, _CRICKIT_M1_A2, _CRICKIT_M1_B1,
516+
_CRICKIT_M1_B2, _CRICKIT_DRIVE1, _CRICKIT_DRIVE2,
517+
_CRICKIT_DRIVE3, _CRICKIT_DRIVE4]
518518
if pin in pin_mapping:
519519
cmd = bytearray([pin_mapping.index(pin), (value >> 8), value])
520520
self.write(_TIMER_BASE, _TIMER_PWM, cmd)
@@ -525,11 +525,11 @@ def analog_write(self, pin, value):
525525
self.write(_TIMER_BASE, _TIMER_PWM, cmd)
526526

527527
def set_pwm_freq(self, pin, freq):
528-
if self.variant == SEESAW_CRCKIT:
529-
pin_mapping = [_CRCKIT_S4, _CRCKIT_S3, _CRCKIT_S2, _CRCKIT_S1,
530-
_CRCKIT_M1_A1, _CRCKIT_M1_A2, _CRCKIT_M1_B1,
531-
_CRCKIT_M1_B2, _CRCKIT_DRIVE1, _CRCKIT_DRIVE2,
532-
_CRCKIT_DRIVE3, _CRCKIT_DRIVE4]
528+
if self.variant == SEESAW_CRICKIT:
529+
pin_mapping = [_CRICKIT_S4, _CRICKIT_S3, _CRICKIT_S2, _CRICKIT_S1,
530+
_CRICKIT_M1_A1, _CRICKIT_M1_A2, _CRICKIT_M1_B1,
531+
_CRICKIT_M1_B2, _CRICKIT_DRIVE1, _CRICKIT_DRIVE2,
532+
_CRICKIT_DRIVE3, _CRICKIT_DRIVE4]
533533
else:
534534
pin_mapping = [_PWM_0_PIN, _PWM_1_PIN, _PWM_2_PIN, _PWM_3_PIN]
535535

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@
2727

2828
servos = [S1, S2, S3, S4]
2929

30-
CRCKIT_NUM_ADC = 8
31-
CRCKit_adc = [2, 3, 40, 41, 11, 10, 9, 8]
30+
CRICKIT_NUM_ADC = 8
31+
CRICKIT_adc = [2, 3, 40, 41, 11, 10, 9, 8]
3232

33-
CRCKIT_NUM_DRIVE = 4
34-
CRCKit_drive = [42, 43, 12, 13]
33+
CRICKIT_NUM_DRIVE = 4
34+
CRICKIT_drive = [42, 43, 12, 13]
3535

3636
CAPTOUCH_THRESH = 500
3737

38-
_CRCKIT_M1_A1 = 18
39-
_CRCKIT_M1_A2 = 19
40-
_CRCKIT_M1_B1 = 22
41-
_CRCKIT_M1_B2 = 23
38+
_CRICKIT_M1_A1 = 18
39+
_CRICKIT_M1_A2 = 19
40+
_CRICKIT_M1_B1 = 22
41+
_CRICKIT_M1_B2 = 23
4242

4343
cap_state = [False, False, False, False]
4444
cap_justtouched = [False, False, False, False]
@@ -64,7 +64,7 @@
6464
print("-------------------- analog -----------------------")
6565
str_out = ""
6666
for i in range(8):
67-
val = ss.analog_read(CRCKit_adc[i]) * 3.3/1024
67+
val = ss.analog_read(CRICKIT_adc[i]) * 3.3/1024
6868
str_out = str_out + str(round(val, 2)) + "\t"
6969

7070
print(str_out + "\n")
@@ -138,45 +138,45 @@
138138

139139
if counter % 64 == 0:
140140
print("DRIVE" + str(drivenum) + " ON")
141-
ss.analog_write(CRCKit_drive[drivenum], 65535)
141+
ss.analog_write(CRICKIT_drive[drivenum], 65535)
142142

143143
else:
144144
print("DRIVE" + str(drivenum) + " OFF")
145-
ss.analog_write(CRCKit_drive[drivenum], 0)
145+
ss.analog_write(CRICKIT_drive[drivenum], 0)
146146

147147
if test_motors:
148148
if counter < 128:
149149
if motor1_dir:
150-
ss.analog_write(_CRCKIT_M1_A1, 0)
151-
ss.analog_write(_CRCKIT_M1_A2, counter * 512)
150+
ss.analog_write(_CRICKIT_M1_A1, 0)
151+
ss.analog_write(_CRICKIT_M1_A2, counter * 512)
152152
else:
153-
ss.analog_write(_CRCKIT_M1_A2, 0)
154-
ss.analog_write(_CRCKIT_M1_A1, counter * 512)
153+
ss.analog_write(_CRICKIT_M1_A2, 0)
154+
ss.analog_write(_CRICKIT_M1_A1, counter * 512)
155155
else:
156156
if motor1_dir:
157-
ss.analog_write(_CRCKIT_M1_A1, 0)
158-
ss.analog_write(_CRCKIT_M1_A2, (255-counter) * 512)
157+
ss.analog_write(_CRICKIT_M1_A1, 0)
158+
ss.analog_write(_CRICKIT_M1_A2, (255-counter) * 512)
159159
else:
160-
ss.analog_write(_CRCKIT_M1_A2, 0)
161-
ss.analog_write(_CRCKIT_M1_A1, (255-counter) * 512)
160+
ss.analog_write(_CRICKIT_M1_A2, 0)
161+
ss.analog_write(_CRICKIT_M1_A1, (255-counter) * 512)
162162
if counter == 255:
163163
print("-------------------- motor 1 -----------------------")
164164
motor1_dir = not motor1_dir
165165

166166
if counter < 128:
167167
if motor2_dir:
168-
ss.analog_write(_CRCKIT_M1_B1, 0)
169-
ss.analog_write(_CRCKIT_M1_B2, counter * 512)
168+
ss.analog_write(_CRICKIT_M1_B1, 0)
169+
ss.analog_write(_CRICKIT_M1_B2, counter * 512)
170170
else:
171-
ss.analog_write(_CRCKIT_M1_B2, 0)
172-
ss.analog_write(_CRCKIT_M1_B1, counter * 512)
171+
ss.analog_write(_CRICKIT_M1_B2, 0)
172+
ss.analog_write(_CRICKIT_M1_B1, counter * 512)
173173
else:
174174
if motor2_dir:
175-
ss.analog_write(_CRCKIT_M1_B1, 0)
176-
ss.analog_write(_CRCKIT_M1_B2, (255-counter) * 512)
175+
ss.analog_write(_CRICKIT_M1_B1, 0)
176+
ss.analog_write(_CRICKIT_M1_B2, (255-counter) * 512)
177177
else:
178-
ss.analog_write(_CRCKIT_M1_B2, 0)
179-
ss.analog_write(_CRCKIT_M1_B1, (255-counter) * 512)
178+
ss.analog_write(_CRICKIT_M1_B2, 0)
179+
ss.analog_write(_CRICKIT_M1_B1, (255-counter) * 512)
180180
if counter == 255:
181181
print("-------------------- motor 2 -----------------------")
182182
motor2_dir = not motor2_dir

0 commit comments

Comments
 (0)