-
-
Save AkosLukacs/d37aa8663943dbd976279fc4cfa7c785 to your computer and use it in GitHub Desktop.
wip...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/false | |
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers | |
# | |
# Copyright (C) 2015 Gordon Williams <gw@pur3.co.uk> | |
# | |
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
# | |
# ---------------------------------------------------------------------------------------- | |
# This file contains information for a specific board - the available pins, and where LEDs, | |
# Buttons, and other in-built peripherals are. It is used to build documentation as well | |
# as various source and header files for Espruino. | |
# ---------------------------------------------------------------------------------------- | |
# { free: 251, usage: 49, total: 300, history: 16, | |
# gc: 0, gctime: 3.32641601562, "stackEndAddress": 536884560, flash_start: 0, "flash_binary_end": 258044, | |
# "flash_code_start": 260096, flash_length: 262144 } | |
# { free: 283, usage: 20, total: 303, history: 0, | |
# gc: 0, gctime: 2.89916992187, "stackEndAddress": 536884592, flash_start: 0, "flash_binary_end": 249740, | |
# "flash_code_start": 260096, flash_length: 262144 } | |
## 8304 byte flash & 32 byte stackend dif! | |
import pinutils; | |
# placeholder | |
info = { | |
'name' : "Humi", | |
'link' : [ "" ], | |
'default_console' : "EV_SERIAL1", | |
'default_console_tx' : "D24", # pin 24 | |
'default_console_rx' : "D25", # pin 25 | |
'default_console_baudrate' : "9600", | |
'variables' : 300, | |
'binary_name' : 'espruino_%v_humi.hex', | |
'build' : { | |
'optimizeflags' : '-Os', | |
'libraries' : [ | |
'BLUETOOTH' | |
], | |
'makefile' : [ | |
'SAVE_ON_FLASH=1', | |
'DEFINES+=-DCONFIG_GPIO_AS_PINRESET', # Allow the reset pin to work | |
'DEFINES+=-DUSE_TAB_COMPLETE' # Removed -DUSE_DEBUGGER due to firmware size issues | |
#'INCLUDE += -I$(ROOT)/libs/humi', | |
#'WRAPPERSOURCES += libs/humi/jswrap_humi.c' | |
] | |
} | |
}; | |
chip = { | |
'part' : "NRF51822", | |
'family' : "NRF51", | |
'package' : "QFN48", | |
'ram' : 16, | |
'flash' : 256, | |
'speed' : 16, | |
'usart' : 1, | |
'spi' : 1, | |
'i2c' : 1, | |
'adc' : 0, | |
'dac' : 0, | |
# If using DFU bootloader, it sits at 0x3C000 - 0x40000 (0x40000 is end of flash) | |
# Might want to change 256 -> 240 in the code below | |
'saved_code' : { | |
'address' : ((256 - 2) * 1024), | |
'page_size' : 1024, | |
'pages' : 2, | |
'flash_available' : (256 - 108 - 2) # total flash pages - softdevice - saved code | |
} | |
}; | |
devices = { | |
# 'BTN1' : { 'pin' : 'D5', 'pinstate' : 'IN_PULLDOWN' }, # 'P0_17' - Pin negated in software | |
# 'BTN2' : { 'pin' : 'D11', 'pinstate' : 'IN_PULLDOWN' }, # 'P0_26' - Pin negated in software | |
}; | |
# left-right, or top-bottom order | |
board = { | |
}; | |
def get_pins(): | |
pins = [ | |
{ "name":"PD0", "sortingname":"D00", "port":"D", "num":"0", "functions":{ "ADC1_IN0":0 }, "csv":{} }, #AREF0 | |
{ "name":"PD1", "sortingname":"D01", "port":"D", "num":"1", "functions":{ "ADC1_IN2":0 }, "csv":{} }, | |
{ "name":"PD2", "sortingname":"D02", "port":"D", "num":"2", "functions":{ "ADC1_IN3":0 }, "csv":{} }, | |
{ "name":"PD3", "sortingname":"D03", "port":"D", "num":"3", "functions":{ "ADC1_IN4":0 }, "csv":{} }, | |
{ "name":"PD4", "sortingname":"D04", "port":"D", "num":"4", "functions":{ "ADC1_IN5":0 }, "csv":{} }, | |
{ "name":"PD5", "sortingname":"D05", "port":"D", "num":"5", "functions":{ "ADC1_IN6":0 }, "csv":{} }, | |
{ "name":"PD6", "sortingname":"D06", "port":"D", "num":"6", "functions":{ "ADC1_IN7":0 }, "csv":{} }, #AREF 1 | |
{ "name":"PD7", "sortingname":"D07", "port":"D", "num":"7", "functions":{}, "csv":{} }, | |
{ "name":"PD8", "sortingname":"D08", "port":"D", "num":"8", "functions":{}, "csv":{} }, | |
{ "name":"PD9", "sortingname":"D09", "port":"D", "num":"9", "functions":{"SPI1_MOSI":0}, "csv":{} }, | |
{ "name":"PD10", "sortingname":"D10", "port":"D", "num":"10", "functions":{"SPI1_SCK":0}, "csv":{} }, | |
{ "name":"PD11", "sortingname":"D11", "port":"D", "num":"11", "functions":{}, "csv":{} }, | |
{ "name":"PD12", "sortingname":"D12", "port":"D", "num":"12", "functions":{}, "csv":{} }, | |
{ "name":"PD13", "sortingname":"D13", "port":"D", "num":"13", "functions":{ }, "csv":{} }, | |
{ "name":"PD14", "sortingname":"D14", "port":"D", "num":"14", "functions":{"SPI1_MISO":0 }, "csv":{} }, | |
{ "name":"PD15", "sortingname":"D15", "port":"D", "num":"15", "functions":{}, "csv":{} }, | |
{ "name":"PD16", "sortingname":"D16", "port":"D", "num":"16", "functions":{}, "csv":{} }, | |
{ "name":"PD17", "sortingname":"D17", "port":"D", "num":"17", "functions":{}, "csv":{} }, | |
{ "name":"PD18", "sortingname":"D18", "port":"D", "num":"18", "functions":{}, "csv":{} }, | |
{ "name":"PD19", "sortingname":"D19", "port":"D", "num":"19", "functions":{}, "csv":{} }, | |
{ "name":"PD20", "sortingname":"D20", "port":"D", "num":"20", "functions":{}, "csv":{} }, | |
{ "name":"PD21", "sortingname":"D21", "port":"D", "num":"21", "functions":{}, "csv":{} }, | |
{ "name":"PD22", "sortingname":"D22", "port":"D", "num":"22", "functions":{}, "csv":{} }, | |
{ "name":"PD23", "sortingname":"D23", "port":"D", "num":"23", "functions":{}, "csv":{} }, | |
{ "name":"PD24", "sortingname":"D24", "port":"D", "num":"24", "functions":{}, "csv":{} }, # Console TX | |
{ "name":"PD25", "sortingname":"D25", "port":"D", "num":"25", "functions":{}, "csv":{} }, # Console RX # P0.26, 27 - 32kHz xtal | |
{ "name":"PD28", "sortingname":"D28", "port":"D", "num":"28", "functions":{}, "csv":{} }, | |
{ "name":"PD29", "sortingname":"D29", "port":"D", "num":"29", "functions":{}, "csv":{} }, | |
{ "name":"PD30", "sortingname":"D30", "port":"D", "num":"30", "functions":{}, "csv":{} } | |
]; | |
# Make buttons negated | |
# pinutils.findpin(pins, "PD5", True)["functions"]["NEGATED"]=0; | |
# pinutils.findpin(pins, "PD11", True)["functions"]["NEGATED"]=0; | |
# everything is non-5v tolerant | |
for pin in pins: | |
pin["functions"]["3.3"]=0; | |
return pins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment