Skip to content

Commit 1049974

Browse files
committed
merge in work on new device
1 parent e0a7629 commit 1049974

19 files changed

Lines changed: 710 additions & 132 deletions

File tree

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
Bangle.js: StorageFile now uses 10x bigger chunks which reduces stress on Storage.list()
2222
Storage.list now allows you to specifically request StorageFile, only ever reports first StorageFile chunk
2323
Graphics: Allow colors to be specified as '#rgb' strings
24+
Graphics: Antialiased lines now read the background color so overlap nicely
25+
Graphics: Add fillPolyAA and use antialiased vector fonts (on platforms where AA is enabled)
2426
Puck.js: Fix regression where IR LED was left on after transmission (fix #1969)
27+
Graphics: Fix overdraw when drawing ellipses/circles
28+
NRF52840: Use SPI3 by default as it's more capable/faster than SPI0
2529

2630
2v08 : nRF52: Added option to build in I2C slave support
2731
Fix Tensorflow aiGesture regression from 2v07 (re-add opcodes) (fix #1936)

boards/BANGLEJS.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
'pin_scl' : 'D14'
124124
},
125125
'MAG' : { # Magnetometer/compass
126-
'device' : 'unknown',
126+
'device' : 'GMC303',
127127
'addr' : 0x0C,
128128
'pin_sda' : 'D15',
129129
'pin_scl' : 'D14'

boards/DICKENS.py

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
#!/bin/false
2+
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
3+
#
4+
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
5+
#
6+
# This Source Code Form is subject to the terms of the Mozilla Public
7+
# License, v. 2.0. If a copy of the MPL was not distributed with this
8+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
9+
#
10+
# ----------------------------------------------------------------------------------------
11+
# This file contains information for a specific board - the available pins, and where LEDs,
12+
# Buttons, and other in-built peripherals are. It is used to build documentation as well
13+
# as various source and header files for Espruino.
14+
# ----------------------------------------------------------------------------------------
15+
16+
import pinutils;
17+
18+
# NOTES FROM REVERSE ENGINEERING
19+
#====================================
20+
# Flash init:
21+
# w(0x6), while (r(5)&1);
22+
23+
# D2 and D8 and used together. Both outputs
24+
# D8 set/cleared then 10ms delay
25+
26+
# D2 set then I2C device 0x70[0x38] contacted
27+
28+
# D0/D1 will be 32kHz crystal
29+
30+
# Button flex header
31+
# o GND D28(btn)
32+
# VCC D46(btn)
33+
# D3 D9
34+
# D29(btn) D10
35+
# D42(btn) GND
36+
37+
# unfitted big flash-ish chip
38+
# o D14 NC?
39+
# D15 D17
40+
# D2 D19
41+
# GND D18
42+
#
43+
44+
# unfitted header (assuming same dir as Button flex header)
45+
# VCC D10
46+
# VCC D9
47+
# FET GND
48+
# GND D31
49+
# ? D30
50+
# ... there's an unpopulated footprint - likely a FET (not checked to see what IO this is connected to)
51+
52+
# Unknown pins:
53+
# D8,D16,D17,D26,D32,D34,D35,D36,
54+
# D37,D38,D39,D41,D44,D45,D47
55+
56+
#====================================
57+
58+
info = {
59+
'name' : "DICKENS",
60+
'link' : [ "" ],
61+
'espruino_page_link' : '',
62+
'variables' : 2500, # How many variables are allocated for Espruino to use. RAM will be overflowed if this number is too high and code won't compile.
63+
# 'bootloader' : 1,
64+
'binary_name' : 'espruino_%v_dickens.hex',
65+
'build' : {
66+
'optimizeflags' : '-Os',
67+
'libraries' : [
68+
'BLUETOOTH',
69+
'TERMINAL',
70+
'GRAPHICS',
71+
'LCD_SPI'
72+
],
73+
'makefile' : [
74+
# 'DEFINES += -DNRF_LOG_ENABLED=1 -DNRF_LOG_FILTERS_ENABLED=0',
75+
'DEFINES += -DCONFIG_NFCT_PINS_AS_GPIOS', # Allow the reset pin to work
76+
'DEFINES += -DNRF_BL_DFU_ENTER_METHOD_BUTTON=1 -DNRF_BL_DFU_ENTER_METHOD_BUTTON_PIN=29',
77+
'DEFINES += -DBUTTONPRESS_TO_REBOOT_BOOTLOADER',
78+
'BOOTLOADER_SETTINGS_FAMILY = NRF52840',
79+
'DFU_PRIVATE_KEY=targets/nrf5x_dfu/dfu_private_key.pem',
80+
'DFU_SETTINGS=--application-version 0xff --hw-version 52 --sd-req 0xA9', # SD 6.0.0
81+
82+
'DEFINES+=-DBLUETOOTH_NAME_PREFIX=\'"Bangle.js"\'',
83+
'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_banglejs_getBattery',
84+
'DEFINES+=-DDUMP_IGNORE_VARIABLES=\'"g\\0"\'',
85+
'DEFINES+=-DUSE_FONT_6X8 -DGRAPHICS_PALETTED_IMAGES -DESPR_GRAPHICS_12BIT -DGRAPHICS_ANTIALIAS',
86+
'DEFINES+=-DNO_DUMP_HARDWARE_INITIALISATION', # don't dump hardware init - not used and saves 1k of flash
87+
'INCLUDE += -I$(ROOT)/libs/banglejs -I$(ROOT)/libs/misc',
88+
'WRAPPERSOURCES += libs/banglejs/jswrap_bangle.c',
89+
'JSMODULESOURCES += libs/js/banglejs/locale.min.js',
90+
'DEFINES += -DBANGLEJS',
91+
92+
'NRF_SDK15=1'
93+
]
94+
}
95+
};
96+
97+
98+
chip = {
99+
'part' : "NRF52840",
100+
'family' : "NRF52",
101+
'package' : "QFN48",
102+
'ram' : 256,
103+
'flash' : 1024,
104+
'speed' : 64,
105+
'usart' : 2,
106+
'spi' : 1,
107+
'i2c' : 1,
108+
'adc' : 1,
109+
'dac' : 0,
110+
'saved_code' : {
111+
# 'address' : ((246 - 10) * 4096), # Bootloader takes pages 248-255, FS takes 246-247
112+
# 'page_size' : 4096,
113+
# 'pages' : 10,
114+
# 'flash_available' : 1024 - ((31 + 8 + 2 + 10)*4) # Softdevice uses 31 pages of flash, bootloader 8, FS 2, code 10. Each page is 4 kb.
115+
'address' : 0x60000000, # put this in external spiflash (see below)
116+
'page_size' : 4096,
117+
'pages' : 1024, # Entire 4MB of external flash
118+
'flash_available' : 1024 - ((31 + 8 + 2)*4) # Softdevice uses 31 pages of flash, bootloader 8, FS 2. Each page is 4 kb.
119+
},
120+
};
121+
122+
devices = {
123+
'BTN1' : { 'pin' : 'D29', 'pinstate' : 'IN_PULLDOWN' }, # TR STATUS Pin negated in software
124+
'BTN2' : { 'pin' : 'D46', 'pinstate' : 'IN_PULLDOWN' }, # BL ATMOS Pin negated in software
125+
'BTN3' : { 'pin' : 'D42', 'pinstate' : 'IN_PULLDOWN' }, # BR Pin negated in software
126+
'BTN4' : { 'pin' : 'D28', 'pinstate' : 'IN_PULLDOWN' }, # TL Pin negated in software
127+
128+
'VIBRATE' : { 'pin' : 'D6' }, # Pin negated in software
129+
'LCD' : {
130+
'width' : 240, 'height' : 240, 'bpp' : 16, # 16 normal, 12 bit is possible
131+
'controller' : 'gc9a01',
132+
'pin_dc' : 'D7',
133+
'pin_cs' : 'D11',
134+
'pin_rst' : 'D40',
135+
'pin_sck' : 'D12',
136+
'pin_mosi' : 'D5',
137+
'pin_miso' : 'D27',
138+
'pin_en' : 'D43',
139+
'pin_bl' : 'D33', # TESTED!
140+
'bitrate' : 32000000
141+
},
142+
'BAT' : {
143+
'pin_charging' : 'D13',
144+
'pin_voltage' : 'D4'
145+
},
146+
'MAG' : { # Magnetometer/compass
147+
'device' : 'GMC303',
148+
'addr' : 0x0C,
149+
'pin_sda' : 'D9',
150+
'pin_scl' : 'D10'
151+
},
152+
'ACCEL' : {
153+
'device' : 'KXTJ3_1057', 'addr' : 0x0e,
154+
'pin_sda' : 'D9',
155+
'pin_scl' : 'D10',
156+
# 'pin_int' : '' # unknown
157+
},
158+
'PRESSURE' : {
159+
'device' : 'SPL06_007', 'addr' : 0x76,
160+
'pin_sda' : 'D9',
161+
'pin_scl' : 'D10',
162+
},
163+
# KX126-1063
164+
'SPIFLASH' : {
165+
'pin_cs' : 'D20',
166+
'pin_sck' : 'D25',
167+
'pin_mosi' : 'D22', # D0
168+
'pin_miso' : 'D23', # D1
169+
'pin_wp' : 'D21', # D2
170+
'pin_rst' : 'D24', # D3
171+
'size' : 4096*1024,
172+
'memmap_base' : 0x60000000 # map into the address space (in software)
173+
}
174+
};
175+
176+
# left-right, or top-bottom order
177+
board = {
178+
};
179+
board["_css"] = """
180+
""";
181+
182+
def get_pins():
183+
pins = pinutils.generate_pins(0,47) # 48 General Purpose I/O Pins.
184+
pinutils.findpin(pins, "PD0", True)["functions"]["XL1"]=0;
185+
pinutils.findpin(pins, "PD1", True)["functions"]["XL2"]=0;
186+
pinutils.findpin(pins, "PD2", True)["functions"]["ADC1_IN0"]=0;
187+
pinutils.findpin(pins, "PD3", True)["functions"]["ADC1_IN1"]=0;
188+
pinutils.findpin(pins, "PD4", True)["functions"]["ADC1_IN2"]=0;
189+
pinutils.findpin(pins, "PD5", True)["functions"]["ADC1_IN3"]=0;
190+
pinutils.findpin(pins, "PD28", True)["functions"]["ADC1_IN4"]=0;
191+
pinutils.findpin(pins, "PD29", True)["functions"]["ADC1_IN5"]=0;
192+
pinutils.findpin(pins, "PD30", True)["functions"]["ADC1_IN6"]=0;
193+
pinutils.findpin(pins, "PD31", True)["functions"]["ADC1_IN7"]=0;
194+
# Make buttons and LEDs negated
195+
pinutils.findpin(pins, "PD29", True)["functions"]["NEGATED"]=0; # ok
196+
pinutils.findpin(pins, "PD46", True)["functions"]["NEGATED"]=0; # ok
197+
pinutils.findpin(pins, "PD42", True)["functions"]["NEGATED"]=0; # ok
198+
pinutils.findpin(pins, "PD28", True)["functions"]["NEGATED"]=0; # ok
199+
200+
201+
# everything is non-5v tlerant
202+
for pin in pins:
203+
pin["functions"]["3.3"]=0;
204+
#The boot/reset button will function as a reset button in normal operation. Pin reset on PD21 needs to be enabled on the nRF52832 device for this to work.
205+
return pins

0 commit comments

Comments
 (0)