initial commit

master
Tomek 2013-11-06 16:35:28 +01:00
commit e4afbb8046
1099 changed files with 397233 additions and 0 deletions

View File

@ -0,0 +1,15 @@
break jsAssertFail
break jsErrorAt
break jsError
define trace
print jsvTrace(jsvGetRef(jsiGetParser()->root), 0)
end
define whereami
print jsiConsolePrintTokenLineMarker(execInfo.lex, execInfo.lex->tokenStart)
end
define typeof
if ($arg0)->flags&JSV_NAME
print JSV_NAME
end
print (JsVarFlags)(($arg0)->flags&(JSV_VARTYPEMASK))
end

12
Espruino/Espruino/.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
*~
*.o
*.elf
*.hex
*.lst
*.srec
*.bin
*.pyc
gen/*
boards/*.html
zipcontents
tmp

View File

@ -0,0 +1,25 @@
language: c
before_install:
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
- sudo apt-get update
- sudo apt-get install libsdl1.2-dev
- sudo apt-get install gcc-arm-none-eabi
before_script:
- arm-none-eabi-gcc --version
compiler:
- gcc
env:
global:
- RELEASE=1
matrix:
- ESPRUINO_1V0=1
- ESPRUINO_1V1=1
- OLIMEX=1
- HYSTM32_24=1
- HYSTM32_28=1
- HYSTM32_32=1
- STM32VLDISCOVERY=1
- STM32F3DISCOVERY=1
- STM32F4DISCOVERY=1
- LINUX_BUILD=1
script: make

View File

@ -0,0 +1,46 @@
Contributing
===========
Thanks for thinking about contributing to Espruino! Anything you can add is hugely appreciated, but please can you follow a few simple rules:
* Keep the same coding style (See **Coding Style** below)
* Ensure that you are not contributing someone else's code, and that you are willing to add your code under Espruino's MPL Licence
* Make sure that what you do doesn't break the Espruino board or the other boards we build for. We can't check all the boards for every commit, so if you break something you'll annoy a whole bunch of people.
* Be aware that Espruino is designed for Microcontrollers - with very low amounts of flash and memory. Both are at a premium so don't statically allocate variables or do other stuff that will use up memory.
* Avoid randomly adding newlines, spaces, refactoring everything or renaming things to your own personal style (some things really could do with renaming, but please check first or we may reject your pull request)
* Don't add a whole bunch of indirection/abstraction for the sake of it - it'll probably just use of more of our precious memory.
* If you add a new API, try and make it familiar to Arduino/JavaScript users.
Target Areas
-----------
We'll keep the outstanding issues in GitHub's issue list, but general stuff that would really help us is:
* Tests. If something doesn't work, please make a test for it. Even if you don't fix it it'll help others greatly. Bonus points if it's in a pull request :)
* Documentation. Improving the documentation (either the EspruinoDocs project, or the auto-generated reference) would be fantastic.
* Duplication. If the same code is used for multiple platforms, try and make sure it's shared, not duplicated.
* Remove hard-coded stuff. Various things like the SPI filesystem are still hard-coded with ifdefs for each board - we want all that stuff to be generated from build_platform_info.py
* Speed. There are a few areas this could be improved - but please benchmark what you're doing both before and afterwards on the Espruino board to check that what you've done helps
* Memory Usage. Both RAM and Flash are at a premium. Ways of reducing this (including stack usage) and making usage more efficient are really appreciated.
* JavaScript compliance (without affecting speed or memory usage too much).
Contributing
-----------
* Please RUN THE TESTS to check that there are no regressions
* Issue us a pull request to [www.github.com/espruino] via GitHub
* Please keep each request small (just include one fix per request)
Coding Style
-----------
The rough coding style is as follows, but you should get a good idea from the code. If we've missed anything obvious please let us know!
* 2 Spaces for indents
* Open curly braces on the same line
* No Tabs used
* Use bool for booleans - not int
* ```//``` comments for single lines, ```/* ... */``` for multiple lines
* Half-hearted Doxygen compatibility: use ```///<``` for function declaration documentation (if on same line), and ```/** ... */``` if doing it right before a function
* Use new lines sparingly (only where it really makes sense)

441
Espruino/Espruino/ChangeLog Normal file
View File

@ -0,0 +1,441 @@
1v42 : [ebirger] allowing 'new' with no brackets
Allow built-in functions with variable numbers of arguments (fix #83)
Implement 'String' constructor in the normal way (fix #110)
Fix regression with parsing constructors while not executing
Allow multiple arguments to print and console.log (fix #92)
Make 'arguments' array available in functions (fix #100)
Fix an assert fail, and handle some potential memory leaks
Don't show __proto__ and constructor with for..in, keys(), or JSON.stringify
Make 'trace()' output more readable debug data for complex structures
1v41 : Fix Olimexino compile (https://github.com/espruino/Espruino/issues/6)
[ebirger] Member constructors (eg. new a.b() )
[ebirger] Ensuring integers with radix specifiers can still be parsed if a radix is specified
Fix for tests/test_json_arraybuffer_001.js - iteration of arraybuffers of length==1
Add Object.keys(...)
More arraybuffer iteration fixes
On linux, use built-in stringToFloat to aid debugging. Handle exponentials, fix #31
'make serialflash' is now works correctly for Espruino Boards with bootloader
setWatch(..A0);setWatch(..A0);clearWatch(1) does not now kill the other watch, fix #25
One-based setTimeout/setWatch, fix #3
Added Function.call and Function.apply, fix #54
'http' and 'fs' are now libraries that need to be 'require'd, fix #8
Updated pin info for STM32F103xC/D/E chips, fix #84
Fixed linker script for STM32F4 (discovery board now works)
Object prototypes are now Objects, fix #101
Board docs now specify '3.3v' only pins fix #104
Add Array.forEach
Fix searching down >1 prototype to find functions (one more issue posted in #99)
Fix "12345"/5 type issues (fix #90)
'Consting' some string functions
Fixing arrays with string indices that are actually numbers \o/ (fix #19)
Released onto website
1v40 : Ensure that LCD.prototype.setPixel = function actually works
Refactor LCD driver code to allow lcdInit (and start of making it non-platform-specific)
Built 'LCD' support into linux/raspi/carambola
Add initial SPI.send(ArrayBuffer) support - even if NO VALUES RETURNED
Start of built-in Nokia 5110 LCD support
Remove GPIO clock removal on sleep for now (it kills setWatch)
Fix (sub)ArrayBuffer problems (test100.js)
Added setDeepSleep - still beta put power consumption drops to 1mA
Fix broken name for httpCRq.write
Changed LCD to Graphics - added ability to render to ArrayBuffer
Fix 8 char built-in class names
Adding preliminary Sony SmartWatch support
Adding preliminary support for completely bare 36 pin chip
Fixing pin defs for Espruino board rev 1v1
Added proper SDL/ArrayBuffer and JS Callback graphics support
Added "ifdef" ability in build_jswrapper
Take JSVAR_CACHE_SIZE out of jsutils and put it in the board config file
Added JSV_PARENTINFO which will allow us to do things like setTimeout(foo.bar,10)
Fixed arrays in non-executes streams - 'if (0) print([1,2,3]);'
Added 'require' function loading modules from node_modules on SD card
Added module cache to stop modules being re-loaded
Renamed internal vars to start with '>' - much easier to distinguish for 'dump'/etc
Only use parentInfo on functions
Load all tests in test dir - don't do them by number
Added 'zigzag' ordering for ArrayBuffer Graphics
Added 'vertical_byte' ordering for ArrayBuffer Graphics
toJSON now ignores 'hidden' object elements
Special-case jsvArrayBufferIteratorSetIntegerValue
Make SPI output an ArrayBuffer
Use best out of 3 for DelayMicroseconds calibration - something seems flaky right after bootup
Lines now drawn from p1 to p2 inclusive
Events now use jshPushIOWatchEvent (should cut down on code) also fixed bug with watching pin #11
Now remember if pinMode was set or not
Transform ```code``` in JSON into a code tag in the documentation
Graphics now supports FSMC for HY boards again
Drawing vector fonts is now roughly the right size and position (still not 100%)
Remove registration code
Adding MPL licence
Remove Arduino bit manipulation functions - nobody seems to use them anyway
# of flash pages/etc now comes from board info
[ebirger] Supply the correct arguments to Array.map
[ebirger] Method calls and membership evaluation should be done on all factors (ee. [1,2,3].foo())
[ebirger] When running multiple tests, only set up terminal once or it breaks the terminal window on exit
Added STM32-style USB CDC bootloader for Espruino Boards
Added scripts/create_espruino_image.sh to package up bootloader and espruino into one binary
SHIPPED on Impatient developer boards
1v39 : Added Bitwise NOT operator
Added Raspberry Pi version to ZIP (with HTTP support)
Fixed load/save on Linux Devices
Added pinMode function (to allow pull-ups/pull-downs to be turned on)
SPI.send4bit/send8bit will now not mess up the final element
changeInterval now clears up stored up callbacks (eg, setInterval(.., 0.01)...wait...changeInterval(...,20)
Ctrl-C no longer prints anything, which avoids lockups
No longer print "Execution Interrupted" if nothing was interrupted!
Added >>>= >>= and <<=
When entering text interactively, ensure that there are no trailing spaces
1v38 : Tweaks for Arduino IDE compile
Removed '(char #)' from stack trace, as a bit pointless now
Added better reporting of execution location when Ctrl-C pressed
Urgent fix for non-working Olimexino since 1v33
Fix string comparison when strings contain "\0"
Added LED1/2/OSC/SD/etc to Olimexino Board docs
1v37 : Urgent fix - power saving code made it difficult to re-flash Espruino (now only apply this to Espruino Board)
1v36 : Fix documentation for Array.pop()
Added some much better board documentation
Fixed DAC output on F3
Fixed DAC output on devices where PWM is also available and the alternate function is less than the DAC's
1v35 : Attempt to reduce power consumption when sleeping by turning off GPIO, and setting GPIOs to AIN on reset
Fix F3 issue where ADC/DAC weren't picked up properly
Tidy up register text and add KickStarter mention
var a = {}; a[LED1]=0; - not converted to String
JSON (and hence dump()) now dumps ArrayBuffer correctly
1v34 : Faster jshFromDeviceString
Preliminary support for flow control on Serial receive
Speed improvements by removing jsvGetRef from jsvUnLock
fast 4 byte pre-check in jsvFindChildFromString
Skip lock/unlock in FindChildFromString to help increase speed
When we unplug USB, only go to the default console device IF that is the device we're currently on
Support for custom Espruino board
Added ArrayBufferView.interpolate
16 bit SPI send for send4bit/sevrnd8bit (better reliability on low-end chips)
Fix JSON dump of typed array
Added Math.clip(x, min, max)
When saving on flash, don't do jslTokenAsString properly
B3/B4 move from alternate fn
Fix incorrect reporting of analog pins
Fix I2C.readFrom on STM32F1/4
Make 1/2 == 0.5 (was being sensible before, but now follow JS spec)
Ctrl-C while in timer fn clears timers (but not outside it)
Fixed broken clearInterval from within setInterval
Hopefully fixed issue on SSD1289 LCD controller
Trigger wheel handler to use interrupts
2D arraybuffer interpolation
Added Math.wrap, fixed a lot of trigger issues
Fixed SysTick priority/preempt problems
Slowed the SysTick timer back down for everything
Fix Int8Array signedness on F4 boards
Refactored source code tree
1v33 : fix character encoding issue of "\16"+"1" != "\161"
Refactoring of ArrayBuffer into iterator, and addition of a general purpose iterator
Fancier assert for debugging
jsvArrayJoin to use new iterator
for (i in ...) to use new iterator
I2C and SPI use new iterator
Serial.write() - to allow single ints to easily be written
changeInterval assert fail when given a function by accident
added peek8/poke8/peek16/poke16
memory() now takes account of command history size
memory() on ARM reports the end address of the stack - so it can be used as a scratchpad with peek and poke
Try and reduce code size by not inlining several functions
No refs for StringExts - so we get one more byte per JsVar (~5%) more storage efficiency
Move from jsvIsBuiltInFunction to computer-generated jswIsBuiltInFunction
When creating Objects, check for built-in function BEFORE creating an Object class for it
Built process now checks that flash usage is under the allowed value
Added short compare to jswHandleFunctionCall to reduce code size
Added 3 byte compare (4 byte read and AND off top byte) - faster, less code
Auto-generate jsvGetBasicObjectName from docs
No longer using refs for storing whether free or not - use flags with JSV_UNUSED and get one extra var with 8 bit refs
Switch to using STRING_0...STRING_MAX in flags, rather than specific bits in JsVarFlags - allows more that 15 chars to be used per JsVar
Make ArrayBuffers actually be ArrayBufferViews - saves on extra string-handling code at expense of one var
Make sure Uint8Array,etc inherits from ArrayBufferView
Fix issue where a '\0' coming in from serial was not put in e.data properly
Don't inline some functions when we're trying to save on flash
Re-use sin for cos, pow for sqrt to reduce code size
1v32 : Fixed embarassing issue with 0.999=="0.A"
Added and checked Pin.writeAtTime on STM32
Now don't allocate events array - just allocate directly, which saves memory and is faster (although slighty out of order)
Docs: now Alphabetically sorted, and class instances not listed by accident
Fix issue where Ctrl-C on ANY Serial port caused execution to be interrupted
Updated busy indicator to cope with recent change to not allocate events in an array
Fixed I2C on HY 2.4 board - I2C needed hard reset
Added basic ArrayBuffers/TypedArray support
Fix memory leak when error created with [] on a non-array/object
Improved hyperlinking in documentation
Fix I2C receive bug on F4
Increased VL board's input buffer size
1v31 : Fix PWM output on TIMER1/8 pins of the STM32F4
Fix PWM output for negated timers
memory() now runs a GC pass
Fixed multiple occurrence of functions in reference
1v30 : STM32F1: fixed AF issue meant peripherals would never return from AF mode
STM32F1: When given an invalid pin, now reports if pins are 'af' or not
Updated SPI.setup docs to mention that you can't mix AF and non-AF
If one SPI pin is specified but others aren't, only that pin will be set up
Added Olimexino hack so SPI1.setup works as expected
Allow using [] on a function
Fix precedence issue, so var a = function() { return 1; }(); works
Update SPI documentation
for (i in f) can now iterate over functions
Optional argument to trace() for object to start tracing from
Small steps towards ArrayBuffers
Added smart edit that checks for internal functions, and uses Function.replaceWith
Added Function.replaceWith to replace the internals of a function while keeping the scope
1v29 : Some hacky sysfs-based IO for running on Linux
HTTP Callbacks are now stored as names so they can be changed on the fly (Linux only)
Successful compile for Carambola
Filesystem support on Linux
Switch to variable size ref counter (marginally more efficient on very small devices, safe on Linux)
Linux now has unlimited memory available
Added linux/sysfs 'setWatch' (non-irq driven, so very noddy)
Checked jswrapper check from using multi-char constants to a #define
Improve pin suggestions for SPI/I2C/USART
Auto-initialise USART with default values when setConsole is used
Support for new Graphics LCD types
3.2" VCT6 board support
1v28 : Faster LCD fillrect for HY 2.8
Fix for multi-byte SPI writes on HY board at 1Mhz (touchscreen control bug)
Fix issue with delayMicrosecond calibration on HY (and hence OneWire)
Fixed digitalPulse on STM32VLDISCOVERY
1v27 : Fixed problem with OneWire constructor execution
Added |=, &= and ^=
Added Array.splice()
Faster, more ROM-efficient built-in symbol table
Fix for potential issue when using field accessor on an undefined var
1v26 : I2C Support on STM32F1 and STM32F4 boards too
Emergency cut in variables for Olimexino with bootloader (as flash usage has got too high for save to flash!)
1v25 : http.writeHead to accept an empty header
Fixed issue finding methods on built in classes (0 termination)
make sure http server with no data still sends headers...
Start of MINI-HY-2.8" support (all ok, but no SD card yet)
Reduce RAM usage by consting some arrays that are not modified
Vector fonts now use polys - 8kb less ROM, and faster rendering
Start of LCD 'driver' code
Standard way of handling events, Object.on/emit/removeAllListeners - like Node.js's EventEmitter
Self-calibrating Microsecond delay (for intermal OneWire/etc)
OneWire class
Correct handling of built-in class constructors
Fix error when parsing a zero-argument function that has been given arguments
I2C support - currently ONLY tested on STM32F3 board
1v24 : SDIO-based fat driver on the HY STM32 board
Added DAC to the HY boards (103xE-based)
Re-named the fileSystem functions to make them more compatible with node.js (readFile/writeFile/etc)
Added fs.appendFile
Removed HTTP from the reference until it is included in some boards
1v23 : Fix 'ERROR: INTERNAL: stmADCChannel' on STM32VLDISCOVERY/F1 boards when accessing PA0
Reference now mentions which Espruino version it is for
1v22 : Important fix - Events got executed in the wrong order if they got queued up
1v21 : Ensure SPI clock does not stop between bytes
Added SPI.send4bit and SPI.send8bit
Made sure the VL board's code fits into available flash
Smart += that can append to a string rather than cloning it
dump() prints functions properly, rather than 'var f = function() {}'
Pageup/down move the cursor to the beginning/end of input
LCD draw/fill with negative x and y
1v20 : Add console.log
Fix automatic usleep for Linux
Added node.js-style HTTP server for Linux version
Fixed null-pointer issue when accessing something that doesn't exist on an object
Added node.js-style HTTP client for Linux version
Start of bit bashing functionality
for (i in "ABCD") console.log(i) -> 0,1,2,3
String array access (but not for writing - doesn't work in JS anyway)
String String.fromCharCode / charCodeAt
Added SPI baud rate setting
Vector font chars 'a' and '4' now work ok
Fix numeric exception when rendering a poly that has some identical points
Better digitalPulse (uses timer + interrupts)
analogWrite can now take an object with a 'frequency' argument for PWM
1v19 : Fixed issue where var M=Math;M.random() failed
Fixed issue with var U=USB;U.print("Hello");
Remove loop iteration limit
Fix memory leak when a syntax error is in for '(i in arr)'
Save state of pin on setWatch interrupt (e.state)
Change setWatch to allow only on rise or fall as an option
clearWatch() clears all watches
1v18 : DAC support on F3/F4
Serial.setup() can also take a second parameter of an object {tx,rx}
Better support for dump() with echo/setBusyIndicator/etc
Better dumping of prototypes on built-in vars
Don't add chars<32 (Except tab) to the input line
SPI1/2/3/4.setup() to take an object {baud,sck,miso,mosi}
Better hardware initialisation code (not UARTS auto-init if they are used)
Fix issues with prototypes
Peek/poke instructions
Start of I2C support (not usable yet)
Added Math. ceil/floor/exp/log
1v17 : Support for running alongside the Maple bootloader
Fix parsing of numbers beginning with 0 when forceRadix!=8
Fixed USART1 on Maple/Olimexino devices
1v16 : Inlining of jsvLock/UnLock in jsvar.h to improve speed
Move non-hardware-dependent stuff into jsdevices
Move jshardware.c into targets/stm32/jshardware.c, create 'targets/linux' and use a single makefile
For + While loops work without reallocating lex
Fix AddNativeFunction when function already exists (and tests + saved state)
Change jsvFindChildFromX to use JsVar* from JsVarRef - saves a lot of lock/unlock
Handle new Foo() as per spec (return value + init of this+prototype) - still does not cope with non-object prototype
Beginning of SD card support (works on Olimexino, but not very flexible)
Fix for parse/eval when given non-strings
Strings can now contain '\0'
Jumptable-friendly reserved word check
Jumptable-friendly builtin functions (massive refactor)
SPI support
HY board support, and graphics LCD
Added fillPoly, and Vector fonts
Added Registration code
Fixed some undefined function/array warnings
Much better HTML function documentation
Fixed edit() function
STM32F3 support, and now peripheral stuff is done with a script
explain what pins are available if a pin is not capable of requested fn
power on ADCs only when needed
LCD fillPoly speed improvements, + drawLine
Add datatype for Pin, so pins written to console by pin name rather than integer value.
Added Pin.set/Pin.reset
Change warning about 'undefined.' into an error (foo.reset() had unexpected consequences!)
Fix parsing of '1.0/-3'!
Add typeof and instanceof operators
Ensure that Serial1/SPI1/etc are objects of type 'Serial'/'SPI' - so prototypes can be added
1v15 : Escaping JSON strings
Fix parsing of octal numbers in strings (so don't have to be 3 chars long)
Drastically improved stack usage using small stub functions (at expense of a bit of speed)
dump() also dumps out prototypes for functions
1v14 : Fix complaint about pins during setBusyIndicator()
Increase available memory on OLIMEXINO
Added function memory() to return memory usage
setWatch now links to function names (rather than just functions)
dump() also handles Serial.onData(...)
Fix issue with JSON printing functions with arguments to console
prefix builtin variables with '_'
fix ArrayIndexOf when array contains undefineds
move all devices into one git repository
USB on F4
call onInit function/string if it exists when Espruino powers on
Compile F4 with -O2 - as we have the program memory for it
Serial3/4/5/6 on F4
Serial3 on Olimexino
Make Serial.onData() clear onData handler
1v13 : Operations like + on Object/Array convert them to strings rather than error
var now doesn't error if there is no semi-colon
Allow new line or line delete in multi-line editing
add edit(functionName) - which copies function definition into inputline so it can be updated
When printing lines, delete current inputline and then put it back in idle loop (only if echo=1)
Support *,/ etc on numpad
1v12 : Issue when printing lots of data and then disconnect USB
Hide USB/Serial in Dump()
add Array.map(fn(x), thisArg)
For newline, count [] and () (as well as {}) - also knows about comments/strings/etc
Fix assert fail is setTimeout with non-function
If space at end of input line, enter still executes
Removed some hard-coded arrays in favour of JsVar strings
Fix confusion with jsvIsName/jsvIsString
Handle numpad end key
Add code to check stack and stop stack overflow if too much recursion
Ensure that setTimeout/setWatch store the link to a function, not the function
Fix nasty ref loop in ref loop GC issue
Add dotty output
Fix memory leak when error in jspParseSingleFunction
Now run Garbage collection if we're idle, and we know we have a few ms spare
Added setSleepIndicator
Fix line/col indicator in errors/warnings
Fix JSON parsing and printing when 'undefined' encountered
Rewritten object handling code to be way more standard JavaScript compliant
Array initialisation with 'new Array()', also for Strings
Added a few more built in functions
Nice error reporting with line + pointer
fixed Math.random
Binary style ops on doubles now work - they are just converted to ints
Added boolean datatype
1v11 : Add Math functions
Add command history (and dynamic history free if low memory)
Fix broken jsvArrayPop
Add tests for and fix Array.indexOf
In-line editing for commands
Fix bug in basicVarEquals for big strings
More fixes for low memory conditions
Multi-line edit for commands (but no newline or line delete yet)
Handle Home, End + reverse delete keys
Fix nested for loops not handling interrupts correctly
Fix AppendString issue when given start value greater than string
Add 'changeInterval' to allow things created with setInterval to have the frequency changed (eg. stepper motor control)
Now puts itself to sleep to save power, when it knows nothing is required and it'll be woken up by SysTick before
Change Math library to avoid putting constants in RAM
1v10 : Increase FIFO size for VL
Marginally decrease amount of F4 vars to ensure they all fit in one flash sector
Allow strings to be longer than the max token size
'"key" in obj' syntax
Detect if in FOR or WHILE loop, and if not, disallow break and continue
Change min setInterval time to 0.1ms - F4 can get close to this
Better analog pin error message
USB support on Olimexino/Maple
Start of multiple COM port support (ioEvent queue)
Ctrl-C now clears the input line
Save state of 'echo' into flash with save()
Add 'setBusyIndicator(pin)' to set pin high when Espruino is busy
Inbuilt function handling speed improvements
Allow Serial comms via other UARTS. Serial1/2.onData and print/println
now inserts elements into arrays in the correct order (GetLength can be (is) now much faster)
Faster code to work out pins from strings
Automatically convert IDs in form A#,A##,B#,B## etc into numbers.
Built-in constants for LED1/BTN/etc.
1v09 : Enabled 'abs' by default
Added flash programming to STM32F4
analogWrite now working!
1v08 : Add preliminary STM32F4 support
Allowed test cases to test timers - eg. code in jsinteractive.c
Fix memory leak for timer
Fix memory leak for digitalWrite
1v07 : Fix string charAt
Fix watch on different pin
Pass arguments to event handlers - eg. time
digitalWrite/Read to take arrays of pins, and int for value
1v06 : Add break + continue
Add switch statement
Handle /r, /r/n or just /n for newlines - phone compatible
Handle different type of delete
1v05 : Allow setWatch/setTimeout/setInterval with a string
Handle adding Open bracket then deleting it
When calling a NAMED function, zero the scopes - this stops scope table overflow
1v04 : Renamed to Espruino
Fixed issue with event add when out of memory
If out of memory happens during a timer, kill all timers

378
Espruino/Espruino/LICENSE Normal file
View File

@ -0,0 +1,378 @@
All files in this package are Copyright 2013 Gordon Williams, Pur3 Ltd unless
otherwise noted.
-------------------------------------------------------------------------------
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
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/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

913
Espruino/Espruino/Makefile Executable file
View File

@ -0,0 +1,913 @@
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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/.
#
# -----------------------------------------------------------------------------
# Makefile for Espruino
# -----------------------------------------------------------------------------
# Set ONE of the following environment variables to compile for that board:
#
# ESPRUINO_1V0=1 # Espruino board rev 1.0
# ESPRUINO_1V1=1 # Espruino board rev 1.1 and 1.2
# ESPRUINO_1V3=1 # Espruino board rev 1.3
# OLIMEX=1 # Olimexino STM32
# OLIMEX_BOOTLOADER=1 # Olimexino STM32 with bootloader
# HYSTM32_24=1 # HY STM32 2.4 Ebay boards
# HYSTM32_28=1 # HY STM32 2.8 Ebay boards
# HYSTM32_32=1 # HY STM32 3.2 VCT6 Ebay boards
# STM32VLDISCOVERY=1
# STM32F3DISCOVERY=1
# STM32F4DISCOVERY=1
# CARAMBOLA=1
# RASPBERRYPI=1
# LPC1768=1 # beta
# Or nothing for standard linux compile
#
# Also:
#
# DEBUG=1 # add debug symbols (-g)
# RELEASE=1 # Force release-style compile (no asserts, etc)
# SINGLETHREAD=1 # Compile single-threaded to make compilation errors easier to find
# BOOTLOADER=1 # make the bootloader (not Espruino)
ifndef SINGLETHREAD
MAKEFLAGS=-j5 # multicore
endif
INCLUDE=-I$(ROOT) -I$(ROOT)/targets -I$(ROOT)/src -I$(ROOT)/gen
LIBS=
DEFINES=
CFLAGS=-Wall -Wextra -Wconversion -Werror=implicit-function-declaration -fdiagnostics-show-option
OPTIMIZEFLAGS=
#-fdiagnostics-show-option - shows which flags can be used with -Werror
# Espruino flags...
USE_MATH=1
ifeq ($(shell uname -m),armv6l)
RASPBERRYPI=1 # just a guess
endif
# Gordon's car ECU (extremely beta!)
ifdef ECU
STM32F4DISCOVERY=1
#HYSTM32_32=1
USE_TRIGGER=1
DEFINES += -DECU
endif
ifdef RELEASE
# force no asserts to be compiled in
DEFINES += -DNO_ASSERT
endif
CWD = $(shell pwd)
ROOT = $(CWD)
PRECOMPILED_OBJS=
PLATFORM_CONFIG_FILE=gen/platform_config.h
###################################################
# When adding stuff here, also remember build_pininfo, platform_config.h, jshardware.c
ifdef ESPRUINO_1V0
PROJ_NAME=espruino_espruino_1v0
USE_BOOTLOADER=1
BOOTLOADER_PROJ_NAME=bootloader_espruino_1v0
USB=1
#USE_NET=1
#USE_CC3000=1
USE_GRAPHICS=1
USE_FILESYSTEM=1
FAMILY=STM32F1
CHIP=STM32F103RG
BOARD=ESPRUINOBOARD_R1_0
DEFINES+=-DESPRUINOBOARD
STLIB=STM32F10X_XL
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_hd.o
OPTIMIZEFLAGS+=-O3
else ifdef ESPRUINO_1V1
PROJ_NAME=espruino_espruino_1v1
DEFINES+=-DESPRUINO_1V1
USE_BOOTLOADER=1
BOOTLOADER_PROJ_NAME=bootloader_espruino_1v1
USB=1
USE_GRAPHICS=1
USE_FILESYSTEM=1
FAMILY=STM32F1
CHIP=STM32F103RC
BOARD=ESPRUINOBOARD_R1_1
DEFINES+=-DESPRUINOBOARD
STLIB=STM32F10X_XL
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_hd.o
OPTIMIZEFLAGS+=-O3
else ifdef ESPRUINO_1V3
PROJ_NAME=espruino_espruino_1v3
DEFINES+=-DESPRUINO_1V3
USE_BOOTLOADER=1
BOOTLOADER_PROJ_NAME=bootloader_espruino_1v3
USB=1
#USE_NET=1
#USE_CC3000=1
USE_GRAPHICS=1
USE_FILESYSTEM=1
FAMILY=STM32F1
CHIP=STM32F103RD
BOARD=ESPRUINOBOARD
STLIB=STM32F10X_XL
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_hd.o
OPTIMIZEFLAGS+=-O3
else ifdef OLIMEX
PROJ_NAME=espruino_olimexino_stm32
USB=1
USE_FILESYSTEM=1
FAMILY=STM32F1
CHIP=STM32F103RB
BOARD=OLIMEXINO_STM32
STLIB=STM32F10X_MD
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_md.o
OPTIMIZEFLAGS+=-Os # short on program memory
else ifdef OLIMEX_BOOTLOADER
PROJ_NAME=espruino_olimexino_bootloader_stm32
USB=1
USE_FILESYSTEM=1
FAMILY=STM32F1
CHIP=STM32F103RB_MAPLE
DEFINES += -DSTM32F103RB
SAVE_ON_FLASH=1
BOARD=OLIMEXINO_STM32_BOOTLOADER
STLIB=STM32F10X_MD
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_md.o
OPTIMIZEFLAGS+=-Os # short on program memory
else ifdef HYSTM32_24
PROJ_NAME=espruino_hystm32_24_ve
USB=1
USE_GRAPHICS=1
USE_LCD_FSMC=1
USE_FILESYSTEM=1
USE_FILESYSTEM_SDIO=1
FAMILY=STM32F1
CHIP=STM32F103VE
BOARD=HYSTM32_24
STLIB=STM32F10X_HD
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_hd.o
OPTIMIZEFLAGS+=-O3
else ifdef HYSTM32_28
PROJ_NAME=espruino_hystm32_28_rb
USB=1
USE_GRAPHICS=1
USE_LCD_FSMC=1
DEFINES+=-DILI9325_BITBANG # bit-bang the LCD driver
SAVE_ON_FLASH=1
#USE_FILESYSTEM=1 # just normal SPI
FAMILY=STM32F1
CHIP=STM32F103RB
BOARD=HYSTM32_28
STLIB=STM32F10X_MD
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_md.o
OPTIMIZEFLAGS+=-Os
else ifdef HYSTM32_32
PROJ_NAME=espruino_hystm32_32_vc
USB=1
USE_GRAPHICS=1
USE_LCD_FSMC=1
USE_FILESYSTEM=1
USE_FILESYSTEM_SDIO=1
FAMILY=STM32F1
CHIP=STM32F103VC
BOARD=HYSTM32_32
STLIB=STM32F10X_HD
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_hd.o
OPTIMIZEFLAGS+=-O3
else ifdef STM32F4DISCOVERY
PROJ_NAME=espruino_stm32f4discovery
USB=1
#USE_NET=1
#USE_CC3000=1
USE_GRAPHICS=1
DEFINES += -DUSE_USB_OTG_FS=1
FAMILY=STM32F4
CHIP=STM32F407
BOARD=STM32F4DISCOVERY
STLIB=STM32F4XX
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f4xx.o
OPTIMIZEFLAGS+=-O3
else ifdef SMARTWATCH
PROJ_NAME=espruino_smartwatch
DEFINES+=-DHSE_VALUE=26000000UL
USB=1
FAMILY=STM32F2
CHIP=STM32F205RG
BOARD=SMARTWATCH
STLIB=STM32F2XX
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f2/lib/startup_stm32f2xx.o
OPTIMIZEFLAGS+=-O3
else ifdef STM32F3DISCOVERY
PROJ_NAME=espruino_stm32f3discovery
USB=1
FAMILY=STM32F3
CHIP=STM32F303
BOARD=STM32F3DISCOVERY
STLIB=STM32F3XX
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f3/lib/startup_stm32f30x.o
OPTIMIZEFLAGS+=-O3
else ifdef STM32VLDISCOVERY
PROJ_NAME=espruino_stm32vldiscovery
FAMILY=STM32F1
CHIP=STM32F100RB
BOARD=STM32VLDISCOVERY
STLIB=STM32F10X_MD_VL
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_md_vl.o
OPTIMIZEFLAGS+=-Os # short on program memory
else ifdef TINYCHIP
PROJ_NAME=espruino_stm32f103tbu
FAMILY=STM32F1
CHIP=STM32F103TB
BOARD=TINYCHIP
STLIB=STM32F10X_MD
PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f1/lib/startup_stm32f10x_md.o
OPTIMIZEFLAGS+=-Os # short on program memory
else ifdef LPC1768
PROJ_NAME=espruino_LPC1768
MBED=1
FAMILY=LPC1768
CHIP=LPC1768
BOARD=LPC1768
MBED_GCC_CS_DIR=$(ROOT)/targets/libmbed/LPC1768/GCC_CS
PRECOMPILED_OBJS+=$(MBED_GCC_CS_DIR)/sys.o $(MBED_GCC_CS_DIR)/cmsis_nvic.o $(MBED_GCC_CS_DIR)/system_LPC17xx.o $(MBED_GCC_CS_DIR)/core_cm3.o $(MBED_GCC_CS_DIR)/startup_LPC17xx.o
LIBS+=-L$(MBED_GCC_CS_DIR) -lmbed
OPTIMIZEFLAGS+=-O3
else ifdef CARAMBOLA
PROJ_NAME=espruino_carambola
DEFINES += -DCARAMBOLA
LINUX=1
USE_FILESYSTEM=1
USB=1
USE_GRAPHICS=1
USE_NET=1
else ifdef RASPBERRYPI
PROJ_NAME=espruino
BOARD=LINUX
DEFINES += -DRASPBERRYPI
LINUX=1
USE_FILESYSTEM=1
USB=1
USE_GRAPHICS=1
#USE_LCD_SDL=1
USE_NET=1
else
PROJ_NAME=espruino
BOARD=LINUX
LINUX=1
USE_FILESYSTEM=1
USB=1
USE_GRAPHICS=1
USE_LCD_SDL=1
USE_NET=1
endif
ifdef DEBUG
#OPTIMIZEFLAGS=-Os -g
OPTIMIZEFLAGS=-g
endif
WRAPPERFILE=gen/jswrapper.c
WRAPPERSOURCES = \
src/jswrap_pin.c \
src/jswrap_functions.c \
src/jswrap_modules.c \
src/jswrap_interactive.c \
src/jswrap_json.c \
src/jswrap_object.c \
src/jswrap_string.c \
src/jswrap_array.c \
src/jswrap_arraybuffer.c \
src/jswrap_serial.c \
src/jswrap_spi_i2c.c \
src/jswrap_onewire.c \
src/jswrap_io.c
# it is important that _pin comes before stuff which uses
# integers (as the check for int *includes* the chek for pin)
SOURCES = \
src/jslex.c \
src/jsvar.c \
src/jsutils.c \
src/jsparse.c \
src/jsinteractive.c \
src/jsdevices.c \
$(WRAPPERFILE)
CPPSOURCES =
ifdef BOOTLOADER
ifndef USE_BOOTLOADER
$(error Using bootloader on device that is not expecting one)
endif
BUILD_LINKER_FLAGS+=--bootloader
PROJ_NAME=$(BOOTLOADER_PROJ_NAME)
WRAPPERSOURCES =
SOURCES = \
targets/stm32_boot/main.c \
targets/stm32_boot/utils.c
OPTIMIZEFLAGS=-Os
else # !BOOTLOADER
ifdef USE_BOOTLOADER
BUILD_LINKER_FLAGS+=--using_bootloader
STM32LOADER_FLAGS+=-p /dev/ttyACM0 -a 0x08002800
endif
endif
ifdef SAVE_ON_FLASH
DEFINES+=-DSAVE_ON_FLASH
endif
ifdef USE_FILESYSTEM
DEFINES += -DUSE_FILESYSTEM
WRAPPERSOURCES += libs/jswrap_fat.c
ifndef LINUX
INCLUDE += -I$(ROOT)/libs/fat_sd
SOURCES += \
libs/fat_sd/fattime.c \
libs/fat_sd/ff.c
#libs/fat_sd/option/ccsbcs.c # for LFN support (see _USE_LFN in ff.h)
ifdef USE_FILESYSTEM_SDIO
DEFINES += -DUSE_FILESYSTEM_SDIO
SOURCES += \
libs/fat_sd/sdio_diskio.c \
libs/fat_sd/sdio_sdcard.c
else #USE_FILESYSTEM_SDIO
SOURCES += \
libs/fat_sd/spi_diskio.c
endif #USE_FILESYSTEM_SDIO
endif #!LINUX
endif #USE_FILESYSTEM
ifdef USE_MATH
DEFINES += -DUSE_MATH
WRAPPERSOURCES += libs/jswrap_math.c
ifndef LINUX
INCLUDE += -I$(ROOT)/libs/math
SOURCES += \
libs/math/acosh.c \
libs/math/asin.c \
libs/math/asinh.c \
libs/math/atan.c \
libs/math/atanh.c \
libs/math/cbrt.c \
libs/math/chbevl.c \
libs/math/clog.c \
libs/math/cmplx.c \
libs/math/const.c \
libs/math/cosh.c \
libs/math/drand.c \
libs/math/exp10.c \
libs/math/exp2.c \
libs/math/exp.c \
libs/math/fabs.c \
libs/math/floor.c \
libs/math/isnan.c \
libs/math/log10.c \
libs/math/log2.c \
libs/math/log.c \
libs/math/mtherr.c \
libs/math/polevl.c \
libs/math/pow.c \
libs/math/powi.c \
libs/math/round.c \
libs/math/setprec.c \
libs/math/sin.c \
libs/math/sincos.c \
libs/math/sindg.c \
libs/math/sinh.c \
libs/math/sqrt.c \
libs/math/tan.c \
libs/math/tandg.c \
libs/math/tanh.c \
libs/math/unity.c
#libs/math/mod2pi.c
#libs/math/mtst.c
#libs/math/dtestvec.c
endif
endif
ifdef USE_GRAPHICS
DEFINES += -DUSE_GRAPHICS
WRAPPERSOURCES += libs/graphics/jswrap_graphics.c
INCLUDE += -I$(ROOT)/libs/graphics
SOURCES += \
libs/graphics/bitmap_font_8x8.c \
libs/graphics/graphics.c \
libs/graphics/lcd_arraybuffer.c \
libs/graphics/lcd_js.c
ifdef USE_LCD_SDL
DEFINES += -DUSE_LCD_SDL
SOURCES += libs/graphics/lcd_sdl.c
LIBS += -lSDL
INCLUDE += -I/usr/include/SDL
endif
ifdef USE_LCD_FSMC
DEFINES += -DUSE_LCD_FSMC
SOURCES += libs/graphics/lcd_fsmc.c
endif
endif
ifdef USE_NET
DEFINES += -DUSE_NET
WRAPPERSOURCES += libs/http/jswrap_http.c
INCLUDE += -I$(ROOT)/libs/http
SOURCES += \
libs/http/httpserver.c
ifdef LINUX
#LIBS += -l...
#INCLUDE += -I...
endif
endif
ifdef USE_CC3000
DEFINES += -DUSE_CC3000 -DSEND_NON_BLOCKING
WRAPPERSOURCES += libs/jswrap_cc3000.c
INCLUDE += -I$(ROOT)/libs/cc3000
SOURCES += \
libs/cc3000/board_spi.c \
libs/cc3000/cc3000_common.c \
libs/cc3000/evnt_handler.c \
libs/cc3000/hci.c \
libs/cc3000/netapp.c \
libs/cc3000/nvmem.c \
libs/cc3000/security.c \
libs/cc3000/socket.c \
libs/cc3000/wlan.c
endif
ifdef USE_TRIGGER
DEFINES += -DUSE_TRIGGER
WRAPPERSOURCES += libs/trigger/jswrap_trigger.c
INCLUDE += -I$(ROOT)/libs/trigger
SOURCES += \
./libs/trigger/trigger.c
endif
ifdef USB
DEFINES += -DUSB
endif
ifeq ($(FAMILY), STM32F1)
ARCHFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd -mthumb-interwork -mfloat-abi=soft
ARM=1
STM32=1
INCLUDE += -I$(ROOT)/targetlibs/stm32f1 -I$(ROOT)/targetlibs/stm32f1/lib
DEFINES += -DSTM32F1
SOURCES += \
targetlibs/stm32f1/lib/misc.c \
targetlibs/stm32f1/lib/stm32f10x_adc.c \
targetlibs/stm32f1/lib/stm32f10x_bkp.c \
targetlibs/stm32f1/lib/stm32f10x_can.c \
targetlibs/stm32f1/lib/stm32f10x_cec.c \
targetlibs/stm32f1/lib/stm32f10x_crc.c \
targetlibs/stm32f1/lib/stm32f10x_dac.c \
targetlibs/stm32f1/lib/stm32f10x_dbgmcu.c \
targetlibs/stm32f1/lib/stm32f10x_dma.c \
targetlibs/stm32f1/lib/stm32f10x_exti.c \
targetlibs/stm32f1/lib/stm32f10x_flash.c \
targetlibs/stm32f1/lib/stm32f10x_fsmc.c \
targetlibs/stm32f1/lib/stm32f10x_gpio.c \
targetlibs/stm32f1/lib/stm32f10x_i2c.c \
targetlibs/stm32f1/lib/stm32f10x_iwdg.c \
targetlibs/stm32f1/lib/stm32f10x_pwr.c \
targetlibs/stm32f1/lib/stm32f10x_rcc.c \
targetlibs/stm32f1/lib/stm32f10x_rtc.c \
targetlibs/stm32f1/lib/stm32f10x_sdio.c \
targetlibs/stm32f1/lib/stm32f10x_spi.c \
targetlibs/stm32f1/lib/stm32f10x_tim.c \
targetlibs/stm32f1/lib/stm32f10x_usart.c \
targetlibs/stm32f1/lib/stm32f10x_wwdg.c \
targetlibs/stm32f1/lib/system_stm32f10x.c
ifdef USB
INCLUDE += -I$(ROOT)/targetlibs/stm32f1/usblib -I$(ROOT)/targetlibs/stm32f1/usb
SOURCES += \
targetlibs/stm32f1/usblib/otgd_fs_cal.c \
targetlibs/stm32f1/usblib/otgd_fs_dev.c \
targetlibs/stm32f1/usblib/otgd_fs_int.c \
targetlibs/stm32f1/usblib/otgd_fs_pcd.c \
targetlibs/stm32f1/usblib/usb_core.c \
targetlibs/stm32f1/usblib/usb_init.c \
targetlibs/stm32f1/usblib/usb_int.c \
targetlibs/stm32f1/usblib/usb_mem.c \
targetlibs/stm32f1/usblib/usb_regs.c \
targetlibs/stm32f1/usblib/usb_sil.c \
targetlibs/stm32f1/usb/usb_desc.c \
targetlibs/stm32f1/usb/usb_endp.c \
targetlibs/stm32f1/usb/usb_istr.c \
targetlibs/stm32f1/usb/usb_prop.c \
targetlibs/stm32f1/usb/usb_pwr.c \
targetlibs/stm32f1/usb/usb_utils.c
endif #USB
endif #STM32F1
ifeq ($(FAMILY), STM32F2)
ARCHFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m3 -mthumb-interwork -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
ARM=1
STM32=1
INCLUDE += -I$(ROOT)/targetlibs/stm32f2 -I$(ROOT)/targetlibs/stm32f2/lib
DEFINES += -DSTM32F2
SOURCES += \
targetlibs/stm32f2/lib/misc.c \
targetlibs/stm32f2/lib/stm32f2xx_adc.c \
targetlibs/stm32f2/lib/stm32f2xx_can.c \
targetlibs/stm32f2/lib/stm32f2xx_crc.c \
targetlibs/stm32f2/lib/stm32f2xx_cryp_aes.c\
targetlibs/stm32f2/lib/stm32f2xx_cryp.c \
targetlibs/stm32f2/lib/stm32f2xx_cryp_des.c\
targetlibs/stm32f2/lib/stm32f2xx_cryp_tdes.c\
targetlibs/stm32f2/lib/stm32f2xx_dac.c \
targetlibs/stm32f2/lib/stm32f2xx_dbgmcu.c \
targetlibs/stm32f2/lib/stm32f2xx_dcmi.c \
targetlibs/stm32f2/lib/stm32f2xx_dma.c \
targetlibs/stm32f2/lib/stm32f2xx_exti.c \
targetlibs/stm32f2/lib/stm32f2xx_flash.c \
targetlibs/stm32f2/lib/stm32f2xx_fsmc.c \
targetlibs/stm32f2/lib/stm32f2xx_gpio.c \
targetlibs/stm32f2/lib/stm32f2xx_hash.c \
targetlibs/stm32f2/lib/stm32f2xx_hash_md5.c \
targetlibs/stm32f2/lib/stm32f2xx_hash_sha1.c \
targetlibs/stm32f2/lib/stm32f2xx_i2c.c \
targetlibs/stm32f2/lib/stm32f2xx_iwdg.c \
targetlibs/stm32f2/lib/stm32f2xx_pwr.c \
targetlibs/stm32f2/lib/stm32f2xx_rcc.c \
targetlibs/stm32f2/lib/stm32f2xx_rng.c \
targetlibs/stm32f2/lib/stm32f2xx_rtc.c \
targetlibs/stm32f2/lib/stm32f2xx_sdio.c \
targetlibs/stm32f2/lib/stm32f2xx_spi.c \
targetlibs/stm32f2/lib/stm32f2xx_syscfg.c \
targetlibs/stm32f2/lib/stm32f2xx_tim.c \
targetlibs/stm32f2/lib/stm32f2xx_usart.c \
targetlibs/stm32f2/lib/stm32f2xx_wwdg.c \
targetlibs/stm32f2/lib/system_stm32f2xx.c
ifdef USB
INCLUDE += -I$(ROOT)/targetlibs/stm32f2/usblib -I$(ROOT)/targetlibs/stm32f2/usb
SOURCES += \
targetlibs/stm32f2/usb/usbd_cdc_vcp.c \
targetlibs/stm32f2/usb/usb_irq_handlers.c \
targetlibs/stm32f2/usb/usbd_desc.c \
targetlibs/stm32f2/usb/usbd_usr.c \
targetlibs/stm32f2/usb/usb_bsp.c \
targetlibs/stm32f2/usblib/usbd_req.c \
targetlibs/stm32f2/usblib/usb_dcd_int.c \
targetlibs/stm32f2/usblib/usbd_core.c \
targetlibs/stm32f2/usblib/usbd_cdc_core.c \
targetlibs/stm32f2/usblib/usbd_ioreq.c \
targetlibs/stm32f2/usblib/usb_core.c \
targetlibs/stm32f2/usblib/usb_dcd.c
#targetlibs/stm32f2/usblib/usb_otg.c \
#targetlibs/stm32f2/usblib/usb_bsp_template.c \
#targetlibs/stm32f2/usblib/usbd_cdc_if_template.c \
#targetlibs/stm32f2/usblib/usb_hcd.c \
#targetlibs/stm32f2/usblib/usb_hcd_int.c
endif #USB
endif #STM32F2
ifeq ($(FAMILY), STM32F3)
ARCHFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
ARM=1
STM32=1
INCLUDE += -I$(ROOT)/targetlibs/stm32f3 -I$(ROOT)/targetlibs/stm32f3/lib
DEFINES += -DSTM32F3
SOURCES += \
targetlibs/stm32f3/lib/stm32f30x_adc.c \
targetlibs/stm32f3/lib/stm32f30x_can.c \
targetlibs/stm32f3/lib/stm32f30x_comp.c \
targetlibs/stm32f3/lib/stm32f30x_crc.c \
targetlibs/stm32f3/lib/stm32f30x_dac.c \
targetlibs/stm32f3/lib/stm32f30x_dbgmcu.c \
targetlibs/stm32f3/lib/stm32f30x_dma.c \
targetlibs/stm32f3/lib/stm32f30x_exti.c \
targetlibs/stm32f3/lib/stm32f30x_flash.c \
targetlibs/stm32f3/lib/stm32f30x_gpio.c \
targetlibs/stm32f3/lib/stm32f30x_i2c.c \
targetlibs/stm32f3/lib/stm32f30x_iwdg.c \
targetlibs/stm32f3/lib/stm32f30x_misc.c \
targetlibs/stm32f3/lib/stm32f30x_opamp.c \
targetlibs/stm32f3/lib/stm32f30x_pwr.c \
targetlibs/stm32f3/lib/stm32f30x_rcc.c \
targetlibs/stm32f3/lib/stm32f30x_rtc.c \
targetlibs/stm32f3/lib/stm32f30x_spi.c \
targetlibs/stm32f3/lib/stm32f30x_syscfg.c \
targetlibs/stm32f3/lib/stm32f30x_tim.c \
targetlibs/stm32f3/lib/stm32f30x_usart.c \
targetlibs/stm32f3/lib/stm32f30x_wwdg.c \
targetlibs/stm32f3/lib/system_stm32f30x.c
ifdef USB
INCLUDE += -I$(ROOT)/targetlibs/stm32f3/usblib -I$(ROOT)/targetlibs/stm32f3/usb
SOURCES += \
targetlibs/stm32f3/usblib/usb_core.c \
targetlibs/stm32f3/usblib/usb_init.c \
targetlibs/stm32f3/usblib/usb_int.c \
targetlibs/stm32f3/usblib/usb_mem.c \
targetlibs/stm32f3/usblib/usb_regs.c \
targetlibs/stm32f3/usblib/usb_sil.c \
targetlibs/stm32f3/usb/usb_desc.c \
targetlibs/stm32f3/usb/usb_endp.c \
targetlibs/stm32f3/usb/usb_istr.c \
targetlibs/stm32f3/usb/usb_prop.c \
targetlibs/stm32f3/usb/usb_pwr.c \
targetlibs/stm32f3/usb/usb_utils.c
endif #USB
endif #STM32F3
ifeq ($(FAMILY), STM32F4)
ARCHFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
ARM=1
STM32=1
INCLUDE += -I$(ROOT)/targetlibs/stm32f4 -I$(ROOT)/targetlibs/stm32f4/lib
DEFINES += -DSTM32F4
SOURCES += \
targetlibs/stm32f4/lib/misc.c \
targetlibs/stm32f4/lib/stm32f4xx_adc.c \
targetlibs/stm32f4/lib/stm32f4xx_can.c \
targetlibs/stm32f4/lib/stm32f4xx_crc.c \
targetlibs/stm32f4/lib/stm32f4xx_cryp_aes.c \
targetlibs/stm32f4/lib/stm32f4xx_cryp.c \
targetlibs/stm32f4/lib/stm32f4xx_cryp_des.c \
targetlibs/stm32f4/lib/stm32f4xx_cryp_tdes.c \
targetlibs/stm32f4/lib/stm32f4xx_dac.c \
targetlibs/stm32f4/lib/stm32f4xx_dbgmcu.c \
targetlibs/stm32f4/lib/stm32f4xx_dcmi.c \
targetlibs/stm32f4/lib/stm32f4xx_dma.c \
targetlibs/stm32f4/lib/stm32f4xx_exti.c \
targetlibs/stm32f4/lib/stm32f4xx_flash.c \
targetlibs/stm32f4/lib/stm32f4xx_fsmc.c \
targetlibs/stm32f4/lib/stm32f4xx_gpio.c \
targetlibs/stm32f4/lib/stm32f4xx_hash.c \
targetlibs/stm32f4/lib/stm32f4xx_hash_md5.c \
targetlibs/stm32f4/lib/stm32f4xx_hash_sha1.c \
targetlibs/stm32f4/lib/stm32f4xx_i2c.c \
targetlibs/stm32f4/lib/stm32f4xx_iwdg.c \
targetlibs/stm32f4/lib/stm32f4xx_pwr.c \
targetlibs/stm32f4/lib/stm32f4xx_rcc.c \
targetlibs/stm32f4/lib/stm32f4xx_rng.c \
targetlibs/stm32f4/lib/stm32f4xx_rtc.c \
targetlibs/stm32f4/lib/stm32f4xx_sdio.c \
targetlibs/stm32f4/lib/stm32f4xx_spi.c \
targetlibs/stm32f4/lib/stm32f4xx_syscfg.c \
targetlibs/stm32f4/lib/stm32f4xx_tim.c \
targetlibs/stm32f4/lib/stm32f4xx_usart.c \
targetlibs/stm32f4/lib/stm32f4xx_wwdg.c \
targetlibs/stm32f4/lib/system_stm32f4xx.c
ifdef USB
INCLUDE += -I$(ROOT)/targetlibs/stm32f4/usblib -I$(ROOT)/targetlibs/stm32f4/usb
SOURCES += \
targetlibs/stm32f4/usblib/usb_core.c \
targetlibs/stm32f4/usblib/usbd_cdc_core.c \
targetlibs/stm32f4/usblib/usb_dcd.c \
targetlibs/stm32f4/usblib/usb_dcd_int.c \
targetlibs/stm32f4/usblib/usbd_core.c \
targetlibs/stm32f4/usblib/usbd_ioreq.c \
targetlibs/stm32f4/usblib/usbd_req.c \
targetlibs/stm32f4/usb/usb_bsp.c \
targetlibs/stm32f4/usb/usbd_cdc_vcp.c \
targetlibs/stm32f4/usb/usbd_desc.c \
targetlibs/stm32f4/usb/usbd_usr.c
#targetlibs/stm32f4/usblib/usb_hcd.c
#targetlibs/stm32f4/usblib/usb_hcd_int.c
#targetlibs/stm32f4/usblib/usb_otg.c
endif #USB
endif #STM32F4
ifdef MBED
ARCHFLAGS += -mcpu=cortex-m3 -mthumb
ARM=1
INCLUDE+=-I$(ROOT)/targetlibs/libmbed -I$(ROOT)/targetlibs/libmbed/$(CHIP) -I$(ROOT)/targetlibs/libmbed/$(CHIP)/GCC_CS
DEFINES += -DMBED
INCLUDE += -I$(ROOT)/targetlibs/mbed
SOURCES += targets/mbed/main.c
CPPSOURCES += targets/mbed/jshardware.cpp
endif
ifdef ARM
LINKER_FILE = gen/linker.ld
PININFOFILE=$(ROOT)/gen/jshardware_pininfo.c
DEFINES += -DARM
INCLUDE += -I$(ROOT)/targetlibs/arm
OPTIMIZEFLAGS += -fno-common -fno-exceptions -fdata-sections -ffunction-sections
# -flto -fuse-linker-plugin
# -flto - link time optimisation - could be good for ST's libs
# GCC suggests use of -fuse-linker-plugin with flto
# Does not work - get errors like : `sqrt' referenced in section `.text.asin' of /tmp/ccJheOub.ltrans9.ltrans.o: defined in discarded section `.text' of libs/math/sqrt.o (symbol from plugin)
# 4.6
#export CCPREFIX=arm-linux-gnueabi-
# 4.5
#export CCPREFIX=~/sat/bin/arm-none-eabi-
# 4.4
export CCPREFIX=arm-none-eabi-
endif # ARM
ifdef PININFOFILE
SOURCES += $(PININFOFILE)
endif
ifdef CARAMBOLA
TOOLCHAIN_DIR=$(shell cd ~/workspace/carambola/staging_dir/toolchain-*/bin;pwd)
export STAGING_DIR=$(TOOLCHAIN_DIR)
export CCPREFIX=$(TOOLCHAIN_DIR)/mipsel-openwrt-linux-
endif
ifdef RASPBERRYPI
ifneq ($(shell uname -m),armv6l)
# eep. let's cross compile
export CCPREFIX=targetlibs/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-
PROJ_NAME=espruino_raspberrypi
endif
endif
ifdef STM32
DEFINES += -DFAKE_STDLIB
# FAKE_STDLIB is for Espruino - it uses its own standard library so we don't have to link in the normal one + get bloated
DEFINES += -DSTM32 -DUSE_STDPERIPH_DRIVER=1 -D$(CHIP) -D$(BOARD) -D$(STLIB)
INCLUDE += -I$(ROOT)/targets/stm32
ifndef BOOTLOADER
SOURCES += \
targets/stm32/main.c \
targets/stm32/jshardware.c \
targets/stm32/stm32_it.c
endif
endif
ifdef LINUX
DEFINES += -DLINUX
INCLUDE += -I$(ROOT)/targets/linux
SOURCES += \
targets/linux/main.c \
targets/linux/jshardware.c
LIBS += -lm # maths lib
endif
SOURCES += $(WRAPPERSOURCES)
SOURCEOBJS = $(SOURCES:.c=.o) $(CPPSOURCES:.cpp=.o)
OBJS = $(SOURCEOBJS) $(PRECOMPILED_OBJS)
# -ffreestanding -nodefaultlibs -nostdlib -fno-common
# -nodefaultlibs -nostdlib -nostartfiles
# -fdata-sections -ffunction-sections are to help remove unused code
CFLAGS += $(OPTIMIZEFLAGS) -c $(ARCHFLAGS) $(DEFINES) $(INCLUDE)
# -Wl,--gc-sections helps remove unused code
# -Wl,--whole-archive checks for duplicates
LDFLAGS += $(OPTIMIZEFLAGS) $(ARCHFLAGS) -Wl,--gc-sections
ifdef LINKER_FILE
LDFLAGS += -T$(LINKER_FILE)
endif
export CC=$(CCPREFIX)gcc
export LD=$(CCPREFIX)gcc
export AR=$(CCPREFIX)ar
export AS=$(CCPREFIX)as
export OBJCOPY=$(CCPREFIX)objcopy
export OBJDUMP=$(CCPREFIX)objdump
export GDB=$(CCPREFIX)gdb
.PHONY: proj
all: proj
ifeq ($(V),1)
quiet_=
Q=
else
quiet_=quiet_
Q=@
export SILENT=1
endif
$(WRAPPERFILE): scripts/build_jswrapper.py $(WRAPPERSOURCES)
@echo Generating JS wrappers
$(Q)echo WRAPPERSOURCES = $(WRAPPERSOURCES)
$(Q)echo DEFINES = $(DEFINES)
$(Q)python scripts/build_jswrapper.py $(WRAPPERSOURCES) $(DEFINES)
ifdef PININFOFILE
$(PININFOFILE): scripts/build_pininfo.py
@echo Generating pin info
$(Q)python scripts/build_pininfo.py $(BOARD) $(PININFOFILE)
endif
$(LINKER_FILE): scripts/build_linker.py
@echo Generating linker scripts
$(Q)python scripts/build_linker.py $(BOARD) $(LINKER_FILE) $(BUILD_LINKER_FLAGS)
$(PLATFORM_CONFIG_FILE): boards/$(BOARD).py scripts/build_platform_config.py
@echo Generating platform configs
$(Q)python scripts/build_platform_config.py $(BOARD)
compile=$(CC) $(CFLAGS) $(DEFINES) $< -o $@
link=$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
obj_dump=$(OBJDUMP) -x -S $(PROJ_NAME).elf > $(PROJ_NAME).lst
obj_to_bin=$(OBJCOPY) -O $1 $(PROJ_NAME).elf $(PROJ_NAME).$2
quiet_compile= CC $@
quiet_link= LD $@
quiet_obj_dump= GEN $(PROJ_NAME).lst
quiet_obj_to_bin= GEN $(PROJ_NAME).$2
%.o: %.c $(PLATFORM_CONFIG_FILE)
@echo $($(quiet_)compile)
@$(call compile)
.cpp.o: $(PLATFORM_CONFIG_FILE)
@echo $($(quiet_)compile)
@$(call compile)
.s.o:
@echo $($(quiet_)compile)
@$(call compile)
ifdef LINUX # ---------------------------------------------------
proj: $(PLATFORM_CONFIG_FILE) $(PROJ_NAME)
$(PROJ_NAME): $(OBJS)
@echo $($(quiet_)link)
@$(call link)
else # embedded, so generate bin, etc ---------------------------
$(PROJ_NAME).elf: $(OBJS) $(LINKER_FILE)
@echo $($(quiet_)link)
@$(call link)
$(PROJ_NAME).lst : $(PROJ_NAME).elf
@echo $($(quiet_)obj_dump)
@$(call obj_dump)
$(PROJ_NAME).hex: $(PROJ_NAME).elf
@echo $(call $(quiet_)obj_to_bin,ihex,hex)
@$(call obj_to_bin,ihex,hex)
$(PROJ_NAME).srec : $(PROJ_NAME).elf
@echo $(call $(quiet_)obj_to_bin,srec,srec)
@$(call obj_to_bin,srec,srec)
$(PROJ_NAME).bin : $(PROJ_NAME).elf
@echo $(call $(quiet_)obj_to_bin,binary,bin)
@$(call obj_to_bin,binary,bin)
proj: $(PROJ_NAME).lst $(PROJ_NAME).hex $(PROJ_NAME).srec $(PROJ_NAME).bin
flash: all
ifdef OLIMEX_BOOTLOADER
echo Olimexino Serial bootloader
dfu-util -a1 -d 0x1EAF:0x0003 -D $(PROJ_NAME).bin
else
ifdef MBED
cp $(PROJ_NAME).bin /media/MBED;sync
else
echo ST-LINK flash
~/bin/st-flash write $(PROJ_NAME).bin 0x08000000
endif
endif
serialflash: all
echo STM32 inbuilt serial bootloader, set BOOT0=1, BOOT1=0
python scripts/stm32loader.py -ew $(STM32LOADER_FLAGS) $(PROJ_NAME).bin
# python scripts/stm32loader.py -ewv $(PROJ_NAME).bin
gdb:
echo "target extended-remote :4242" > gdbinit
echo "file $(PROJ_NAME).elf" >> gdbinit
#echo "load" >> gdbinit
echo "break main" >> gdbinit
echo "break HardFault_Handler" >> gdbinit
$(GDB) -x gdbinit
rm gdbinit
endif # ---------------------------------------------------
clean:
@echo Cleaning targets
$(Q)find . -name *.o | grep -v libmbed | grep -v arm-bcm2708 | xargs rm -f
$(Q)rm -f $(ROOT)/gen/*.c $(ROOT)/gen/*.h $(ROOT)/gen/*.ld
$(Q)rm -f $(PROJ_NAME).elf
$(Q)rm -f $(PROJ_NAME).hex
$(Q)rm -f $(PROJ_NAME).bin
$(Q)rm -f $(PROJ_NAME).srec
$(Q)rm -f $(PROJ_NAME).lst

158
Espruino/Espruino/README.md Normal file
View File

@ -0,0 +1,158 @@
Espruino JavaScript for Microcontrollers
========================================
<pre>
_____ _
| __|___ ___ ___ _ _|_|___ ___
| __|_ -| . | _| | | | | . |
|_____|___| _|_| |___|_|_|_|___|
|_|
</pre>
http://www.espruino.com
**NOTE:** This software is beta and is provided as-is, and won't be considered even remotely final until we've released the Espruino Board. As such, don't expect support, and do expect it to change rapidly and without warning. Build your own documentation (see **Building**), as the API may be different from the one described on the Espruino website.
The KickStarter campaign said the Espruino Board will have some things which this repository does not yet have (like working CC3000 support). These are works in progress and should be done by the time you get your board (or will be available as a software update).
About
-----
It'd probably help to read the [FAQ](http://www.espruino.com/FAQ), and specifically the page about [Performance](http://www.espruino.com/Performance) as it contains information about how Espruino itself works.
There's also the auto-generated [Reference](http://www.espruino.com/Reference) for JavaScript commands as well as the [Tutorials](http://www.espruino.com/Tutorials) on the website. However please note that this repository is under heavy development, and the documentation on the Espruino website will match the version [available for download](http://www.espruino.com/Download) but **not** the latest version from Git.
License
-------
Please see the [LICENSE](LICENSE) file
Found a Bug?
------------
Please check that:
* It hasn't [already been found](https://github.com/espruino/Espruino/issues) or [been covered on our forum](www.espruino.com/Forum)
* You're not just looking at outdated documentation (See the [Building](#Building) section to see how to build documentation)
Please [submit bugs](https://github.com/espruino/Espruino/issues) with clear steps to reproduce them (and ideally a test case for the ```tests``` directory), and if at all possible try and include a patch to fix them. Please be aware that we have a whole bunch of outstanding issues (some quite large), so if you report something (especially if it doesn't contain a test or a pull request) it may not be fixed for quite some time.
Contributing
------------
Please see [CONTRIBUTING.md](CONTRIBUTING.md)
Current State
-------------
You can download binaries from http://www.espruino.com/Download (these aren't the latest, but are more likely to work with your board)
Please note that this is BETA. We've been working hard on the Espruino Board support but we haven't had time to check the other boards properly.
* Espruino Board - working
* Linux - working
* STM32VLDISCOVERY - WORKING
* STM32F3DISCOVERY - WORKING
* STM32F4DISCOVERY - WORKING
* HY STM32 2.4" - WORKING
* HY STM32 2.8" - WORKING, but screen is not black at startup
* HY STM32 3.2" - WORKING
* Olimexino - WORKING
* Carambola - ?
* Raspberry Pi - WORKING
* Sony SmartWatch - USB VCP support still needed
* MBed platforms - have not worked for a while - hardware wrapper still needed
* Arduino - has never worked. Compiles but doesn't even seem to get past init
Using
-----
If you're using Espruino for your own personal projects - go ahead, we hope you have fun - and please let us know what you do with it on http://www.espruino.com/Forum!
However if you're planning on selling the Espruino software on your own board, please talk to us:
* Read the terms of the MPLv2 Licence that Espruino is distributed under, and make sure you comply with it
* You won't be able to call your board 'Espruino' but you must explain clearly that it uses 'Espruino' internally (we own the trademark)
* If you're profiting from Espruino without contributing anything back, we won't support you (or your users)
Building
--------
Espruino is easy to build under Linux, and it is possible to build under MacOS. We'd strongly suggest that you DO NOT TRY AND BUILD UNDER WINDOWS, and instead use a Virtual Machine. There's a good post on this here: http://forum.espruino.com/conversations/151
We suggest that you use the CodeSourcery GCC compiler, but paths in Makefile may need changing...
``` BOARDNAME=1 RELEASE=1 make```
* See the top of Makefile for board names
* Without `RELEASE=1`, assertions are kept in the code (which is good for debugging, bad for performance + code size)
* `BOARDNAME=1 RELEASE=1 make serialflash` will flash to /dev/ttyUSB0 using the STM32 serial bootloader (what's needed for Espruino + HY boards)
* `BOARDNAME=1 RELEASE=1 make flash` will flash using st-flash if discovery, or maple bootloader if using that board
You can build documentation by running:
``` python scripts/build_docs.py ```
This will create a file called ```functions.html```
Directories and Files
---------------------
* `ChangeLog`: What's new
* `TODO`: List of things to do
* `boards/`: Information on boards, used to auto-generate a lot of the code
* `code/`: Example JavaScript code
* `gen/`: Auto-Generated Source Files
* `libs/`: Optional libraries to include in Espruino (Math, Filesystem, Graphics, etc)
* `linker/`: Linker files for various processors
* `misc/`: random other stuff
* `scripts/`: Scripts for generating files in gen, and for analysing code/compilation/etc
* `src/`: Main source code
* `targetlibs/`: Libraries for targeted architectures
* `targets/`: Specific code for targeted architectures
* `tests/`: Testcases
* `dist_*`: files to be copied into distribution zip file
Adding more devices
-------------------
Currently there are a bunch of different files to modify. Eventually the plan is to fit everything into boards/BOARDNAME.py and to auto-generate the rest of the config files.
* Most build options handled in `Makefile`
* Extra libraries like USB/LCD/filesystem in `Makefile`
* Linker Scripts are in `linker/`
* `boards/*.py` files handle loading the list of available pins so the relevant headers + docs can be created
* Processor-specific code in `targets/stm32`, `targets/linux`, etc.
* Processor-specific libs in `targetlibs/foo`
* `src/jshardware.h` is effectively a simple abstraction layer for SPI/I2C/etc
* `targets/stm32/jshardware.c` also has flash-size-specific defines
* `libs/fat_sd` and `libs/lcd` still have some device-specific defines in too
Adding libraries
-------------------
* Create `jswrap_mylib.c/h` in `libs/`
* Create library functions (see examples in other jswrap files, also the comments in `scripts/common.py`)
Arduino Compile (beta)
----------------------
* Ensure that `targets/arduino/utility` is symlinked to `src`
* Symlink `...arduino_workspace/libraries/Espruino` to `targets/arduino`
Cross Compile for Raspberry Pi
------------------------------
```
cd targetlibs
mkdir raspberrypi
cd raspberrypi
git clone git://github.com/raspberrypi/tools.git
sudo apt-get install ia32-libs
```
Cross Compile for Carambola (OpenWRT)
-------------------------------------
* Follow instructions at <https://github.com/8devices/carambola> to set toolchain up in ```~/workspace/carambola```
* Run ```CARAMBOLA=1 make```

View File

@ -0,0 +1,91 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "Espruino Board rev 1.3",
'link' : [ "http://www.espruino.com/kick" ],
'variables' : 2000,
};
chip = {
'part' : "STM32F103RCT6",
'family' : "STM32F1",
'package' : "LQFP64",
'ram' : 48,
'flash' : 256,
'speed' : 72,
'usart' : 5,
'spi' : 3,
'i2c' : 2,
'adc' : 3,
'dac' : 2,
};
# left-right, or top-bottom order
board = {
'right' : [ 'A15', 'A14', 'A13', 'A10', 'A9', 'A8', 'C11', 'C10', 'C9', 'C8', 'C7', 'C6', 'C5', 'C4', 'B15', 'B14', 'B13', '3.3', 'VBAT', 'GND' ],
'left' : [ 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'B12', 'C12', 'C15', 'C0', 'C1', 'C2', 'C3', 'A0', 'A1', '3.3', 'VBAT', 'GND' ],
'bottom' : [ 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'B0', 'B1', 'B10', 'B11' ]
};
devices = {
'OSC' : { 'pin_in' : 'D0',
'pin_out' : 'D1' },
'OSC_RTC' : { 'pin_in' : 'C14',
'pin_out' : 'C15' },
'LED1' : { 'pin' : 'A13' },
'LED2' : { 'pin' : 'A14' },
'LED3' : { 'pin' : 'A15' },
'BTN1' : { 'pin' : 'B12' },
'USB' : { 'pin_disc' : 'C13',
'pin_dm' : 'A11',
'pin_bp' : 'A12' },
'SD' : { 'pin_cs' : 'D2',
'pin_di' : 'B15',
'pin_do' : 'B14',
'pin_clk' : 'B13' },
'BLUETOOTH' : { 'pin_tx' : 'A9',
'pin_rx' : 'A10' },
};
board_css = """
#board {
width: 431px;
height: 585px;
left: 300px;
background-image: url(img/ESPRUINOBOARD.jpg);
}
#boardcontainer {
height: 585px;
}
#left {
top: 45px;
right: 431px;
}
#right {
top: 45px;
left: 431px;
}
#bottom {
top: 280px;
left: 128px;
}
.leftpin { height: 24px; }
.rightpin { height: 24px; }
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xe.csv', 6, 10, 11)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

View File

@ -0,0 +1,90 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "Espruino Board rev 1.0",
'link' : [ "http://www.espruino.com/kick" ],
'variables' : 2000,
};
chip = {
'part' : "STM32F103RGT6",
'family' : "STM32F1",
'package' : "LQFP64",
'ram' : 96,
'flash' : 1024,
'speed' : 72,
'usart' : 5,
'spi' : 3,
'i2c' : 2,
'adc' : 3,
'dac' : 2,
};
# left-right, or top-bottom order
board = {
'top' : [ 'D2', 'C11', 'C10', 'A14', 'A14', 'A13', 'A10', 'A9', 'A8', 'C9', 'C8', 'C7', 'C6', 'B15', 'B14', 'B13', 'B12', '3.3', 'VBAT', 'GND' ],
'bottom' : [ 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'C13', 'C14', 'C15', 'C0', 'C1', 'C2', 'C3', 'A0', 'A1', 'A2', '3.3', 'VBAT', 'GND' ],
'mid' : ['B2', 'B1', 'B0', 'C5', 'C4', 'A7', 'A6', 'A5', 'A4', 'A3' ]
};
devices = {
'OSC' : { 'pin_in' : 'D0',
'pin_out' : 'D1' },
'LED1' : { 'pin' : 'B7' },
'LED2' : { 'pin' : 'B8' },
'LED3' : { 'pin' : 'B9' },
'BTN1' : { 'pin' : 'A3' },
'USB' : { 'pin_disc' : 'C12',
'pin_dm' : 'A11',
'pin_bp' : 'A12' },
'SD' : { 'pin_cs' : 'D2',
'pin_di' : 'B15',
'pin_do' : 'B14',
'pin_clk' : 'B13' },
'BLUETOOTH' : { 'pin_tx' : 'A9',
'pin_rx' : 'A10' },
};
board_css = """
#board {
width: 585px;
height: 431px;
top: 280px;
background-image: url(img/ESPRUINOBOARD_R1_0.jpg);
}
#boardcontainer {
height: 1000px;
}
#top {
top: -20px;
left: 43px;
}
#bottom {
top: 431px;
left: 43px;
}
#mid {
top: 48px;
left: 280px;
}
.midpin {
padding: 3px;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xe.csv', 6, 10, 11)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

View File

@ -0,0 +1,89 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "Espruino Board rev 1.1",
'link' : [ "http://www.espruino.com/kick" ],
'variables' : 2000,
};
chip = {
'part' : "STM32F103RCT6",
'family' : "STM32F1",
'package' : "LQFP64",
'ram' : 48,
'flash' : 256,
'speed' : 72,
'usart' : 5,
'spi' : 3,
'i2c' : 2,
'adc' : 3,
'dac' : 2,
};
# left-right, or top-bottom order
board = {
'right' : [ 'A15', 'A14', 'A13', 'A10', 'A9', 'A8', 'C11', 'C10', 'C9', 'C8', 'C7', 'C6', 'C5', 'C4', 'B15', 'B14', 'B13', '3.3', 'VBAT', 'GND' ],
'left' : [ 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'C13', 'C14', 'C15', 'C0', 'C1', 'C2', 'C3', 'A0', 'A1', '3.3', 'VBAT', 'GND' ],
'bottom' : [ 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'B0', 'B1', 'B10', 'B11' ]
};
devices = {
'OSC' : { 'pin_in' : 'D0',
'pin_out' : 'D1' },
'LED1' : { 'pin' : 'C13' },
'LED2' : { 'pin' : 'C14' },
'LED3' : { 'pin' : 'C15' },
'BTN1' : { 'pin' : 'B12' },
'USB' : { 'pin_disc' : 'C12',
'pin_dm' : 'A11',
'pin_bp' : 'A12' },
'SD' : { 'pin_cs' : 'D2',
'pin_di' : 'B15',
'pin_do' : 'B14',
'pin_clk' : 'B13' },
'BLUETOOTH' : { 'pin_tx' : 'A9',
'pin_rx' : 'A10' },
};
board_css = """
#board {
width: 431px;
height: 585px;
left: 300px;
background-image: url(img/ESPRUINOBOARD.jpg);
}
#boardcontainer {
height: 585px;
}
#left {
top: 45px;
right: 431px;
}
#right {
top: 45px;
left: 431px;
}
#bottom {
top: 280px;
left: 128px;
}
.leftpin { height: 24px; }
.rightpin { height: 24px; }
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xe.csv', 6, 10, 11)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

View File

@ -0,0 +1,139 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "STM32 2.4 inch LCD Board (VET6)",
'variables' : 2800,
};
chip = {
'part' : "STM32F103VE", #T6
'family' : "STM32F1",
'package' : "LQFP100",
'ram' : 64,
'flash' : 512,
'speed' : 72,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
'adc' : 3,
'dac' : 2,
};
# left-right, or top-bottom order
board = {
'top' : [ 'GND','3V3','A2','A12','A9','C8','D13','B14','B12','C11','D2','B5','B1','E2','E4','E6','C3','A1','E0','3V3','','','3V3','B4','A15','A13','A14','JRTCK','B3','NRST','DBGGRQ','DBGACK' ],
'top2' : [ 'GND','3V3','A3','A11','A10','C9','C7','B15','B13','C10','C12','D3','B2','B0','E3','E5','C2','A0','A4','3V3','','','3V3','GND','GND','GND','GND','GND','GND','GND','GND','GND' ],
'bottom2' : [ 'A6','A5','A7','D6','C4','C5','E10','E9','E8','E7','D1','D0','D15','D14','B6','A6','C6','A7','B7','A5', ],
'bottom' : [ 'GND','3V3','B11','E1','B10','D7','D10','D9','D8','E15','E14','E13','E12','E11','D4','D5','D11','C13','3V3','GND' ],
'left' : [ 'B8','B9','D12','A8','C0','C1','GND' ],
};
board["top"].reverse()
board["top2"].reverse()
devices = {
'OSC' : { 'pin_1' : 'D0',
'pin_2' : 'D1' },
'OSC_RTC' : { 'pin_1' : 'C14',
'pin_2' : 'C15' },
'LED1' : { 'pin' : 'C6' },
'LED2' : { 'pin' : 'C7' },
'LED3' : { 'pin' : 'D13' },
'LED4' : { 'pin' : 'D6' },
'BTN1' : { 'pin' : 'E5', "inverted":1 },
'BTN2' : { 'pin' : 'E4' },# TODO inverted?
'BTN3' : { 'pin' : 'E3' },# TODO inverted?
'BTN4' : { 'pin' : 'E4' },# TODO inverted?
'POT1' : { 'pin' : 'C0' },
'POT2' : { 'pin' : 'C1' },
'USB' : { 'pin_disc' : 'B7',
'pin_dm' : 'A11',
'pin_bp' : 'A12' },
'SD' : { 'pin_cmd' : 'D2',
'pin_d0' : 'C8',
'pin_d1' : 'C9',
'pin_d2' : 'C10',
'pin_d3' : 'C11',
'pin_clk' : 'C12' },
'TOUCHSCREEN' : {
'pin_irq' : 'B6',
'pin_cs' : 'B7',
'pin_sck' : 'A5',
'pin_miso' : 'A6',
'pin_mosi' : 'A7'
},
'LCD' : {
'width' : 320, 'height' : 240, 'bpp' : 16, 'controller' : 'fsmc',
'pin_d0' : 'D14',
'pin_d1' : 'D15',
'pin_d2' : 'D0',
'pin_d3' : 'D1',
'pin_d4' : 'E7',
'pin_d5' : 'E8',
'pin_d6' : 'E9',
'pin_d7' : 'E10',
'pin_d8' : 'E11',
'pin_d9' : 'E12',
'pin_d10' : 'E13',
'pin_d11' : 'E14',
'pin_d12' : 'E15',
'pin_d13' : 'D8',
'pin_d14' : 'D9',
'pin_d15' : 'D10',
'pin_rd' : 'D4',
'pin_wr' : 'D5',
'pin_cs' : 'D7',
'pin_rs' : 'D11'
},
};
board_css = """
#board {
width: 1170px;
height: 834px;
left: 100px;
top: 200px;
background-image: url(img/HYSTM32_24.jpg);
}
#boardcontainer {
height: 1250px;
}
#left {
top: 130px;
right: 1120px;
}
#top {
top: 40px;
left: 120px;
}
#top2 {
top: 110px;
left: 120px;
}
#bottom {
top: 760px;
left: 330px;
}
#bottom2 {
top: 690px;
left: 330px;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xe.csv', 6, 10, 11)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

View File

@ -0,0 +1,133 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "STM32 2.8 inch LCD Board (RBT6)",
'variables' : 510, # FIXME we could get 700, but we don't have enough flash
};
chip = {
'part' : "STM32F103RB", #T6
'family' : "STM32F1",
'package' : "LQFP64",
'ram' : 20,
'flash' : 128,
'speed' : 72,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
'adc' : 3,
'dac' : 0,
};
# left-right, or top-bottom order
board = {
'top' : [ '5V','A8','A10','A12','A14','B0','B2','B4','B6','C8','C10','C12','C14','3V3', ],
'top2' : [ 'GND','A9','A11','A13','A15','B1','B3','B5','B7','C9','C11','C13','C15','GND' ],
'bottom2' : [ 'GND','C1','C3','C5','C7','A1','A3','A5','A7','B9','B11','B13','B15','GND' ],
'bottom' : [ '5V','C0','C2','C4','C6','A0','A2','A4','A6','B8','B10','B12','B14','3V3' ],
'right' : [ '3V3','B4','A15','A13','A14','RTCK','B3','NRST','NC','5V' ],
};
board["top"].reverse()
board["top2"].reverse()
devices = {
'OSC' : { 'pin_1' : 'D0',
'pin_2' : 'D1' },
'OSC_RTC' : { 'pin_1' : 'C14',
'pin_2' : 'C15' },
'LED1' : { 'pin' : 'A2' },
'LED2' : { 'pin' : 'A3' },
'BTN1' : { 'pin' : 'A0', "inverted":1 },
'BTN2' : { 'pin' : 'A1' },# TODO inverted?
'POT1' : { 'pin' : 'B0' },
'USB' : { 'pin_disc' : 'D2',
'pin_dm' : 'A11',
'pin_bp' : 'A12' },
'SD' : { 'pin_cs' : 'B7',
'pin_sck' : 'A5',
'pin_miso' : 'A6',
'pin_mosi' : 'A7'
},
'TOUCHSCREEN' : {
'pin_irq' : 'C13',
'pin_cs' : 'A4',
'pin_sck' : 'A5',
'pin_miso' : 'A6',
'pin_mosi' : 'A7'
},
'LCD' : {
'width' : 320, 'height' : 240, 'bpp' : 16, 'controller' : 'fsmc',
'pin_d0' : 'C0',
'pin_d1' : 'C1',
'pin_d2' : 'C2',
'pin_d3' : 'C3',
'pin_d4' : 'C4',
'pin_d5' : 'C5',
'pin_d6' : 'C6',
'pin_d7' : 'C7',
'pin_d8' : 'B8',
'pin_d9' : 'B9',
'pin_d10' : 'B10',
'pin_d11' : 'B11',
'pin_d12' : 'B12',
'pin_d13' : 'B13',
'pin_d14' : 'B14',
'pin_d15' : 'B15',
'pin_rd' : 'C11',
'pin_wr' : 'C10',
'pin_cs' : 'C8',
'pin_rs' : 'C9',
'pin_backlight' : 'C12',
},
};
board_css = """
#board {
width: 980px;
height: 770px;
top: 220px;
background-image: url(img/HYSTM32_28.jpg);
}
#boardcontainer {
height: 1300px;
}
#top {
top: 40px;
left: 320px;
}
#top2 {
top: 80px;
left: 320px;
}
#bottom {
top: 720px;
left: 320px;
}
#bottom2 {
top: 680px;
left: 320px;
}
#right {
top: 350px;
left: 960px;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xb.csv', 6, 10, 11)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

View File

@ -0,0 +1,133 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "HY-MiniSTM32V 3.2 inch LCD Board (VCT6)",
'link' : [ "http://www.hotmcu.com/hyministm32v-dev-board-32-tft-lcd-module-p-5.html" ],
'variables' : 254,
};
chip = {
'part' : "STM32F103VC",
'family' : "STM32F1",
'package' : "LQFP100",
'ram' : 48,
'flash' : 256,
'speed' : 72,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
'adc' : 3,
'dac' : 2,
};
# left-right, or top-bottom order
board = {
'bottom' : [ 'GND', 'E0','E2','E4','E6','C13','C15','C1','C3','GND','VDDA','A1','A3','A5','A7','C5','B1','E7','E9','E11','E13','E15','B11', 'GND' ],
'bottom2' : [ '5V','E1','E3','E5','VBAT','C14','C0','C2','GND','VREF+','A0','A2','A4','A6','C4','B0','B2','E8','E10','E12','E14','B10','GND','3V3' ],
'top' : [ 'GND', 'B12','B14','D8','D10','D12','D14','C6','C8','A8','A10','A12','A14','GND','C10','C12','D1','D3','D5','D7','B4','B6','B8','GND' ],
'top2' : [ '5V', 'B13','B15','D9','D11','D13','D15','C7','C9','A9','A11','A13','A15','3V3','C11','D0','D2','D4','D6','B3','B5','B7','B9','3V3' ],
};
board["top"].reverse()
board["top2"].reverse()
devices = {
'OSC' : { 'pin_1' : 'D0',
'pin_2' : 'D1' },
'OSC_RTC' : { 'pin_1' : 'C14',
'pin_2' : 'C15' },
'LED1' : { 'pin' : 'B0' },
'LED2' : { 'pin' : 'B1' },
'BTN1' : { 'pin' : 'C13', "inverted":1 },
'BTN2' : { 'pin' : 'B2' }, # TODO inverted?
'USB' : { 'pin_disc' : 'B7',
'pin_dm' : 'A11',
'pin_bp' : 'A12' },
'SD' : { 'pin_cmd' : 'D2',
'pin_cd' : 'D3',
'pin_d0' : 'C8',
'pin_d1' : 'C9',
'pin_d2' : 'C10',
'pin_d3' : 'C11',
'pin_clk' : 'C12' },
'TOUCHSCREEN' : {
'pin_irq' : 'B6',
'pin_cs' : 'A4',
'pin_sck' : 'A5',
'pin_miso' : 'A6',
'pin_mosi' : 'A7'
},
'LCD' : {
'width' : 320, 'height' : 240, 'bpp' : 16, 'controller' : 'fsmc',
'pin_d0' : 'D14',
'pin_d1' : 'D15',
'pin_d2' : 'D0',
'pin_d3' : 'D1',
'pin_d4' : 'E7',
'pin_d5' : 'E8',
'pin_d6' : 'E9',
'pin_d7' : 'E10',
'pin_d8' : 'E11',
'pin_d9' : 'E12',
'pin_d10' : 'E13',
'pin_d11' : 'E14',
'pin_d12' : 'E15',
'pin_d13' : 'D8',
'pin_d14' : 'D9',
'pin_d15' : 'D10',
'pin_rd' : 'D4',
'pin_wr' : 'D5',
'pin_cs' : 'D7',
'pin_rs' : 'D11'
},
};
board_css = """
#board {
width: 1025px;
height: 837px;
top: 240px;
background-image: url(img/HYSTM32_32.jpg);
}
#boardcontainer {
height: 1300px;
}
#top {
top: 40px;
left: 210px;
}
#top2 {
top: 110px;
left: 210px;
}
#bottom {
top: 770px;
left: 210px;
}
#bottom2 {
top: 700px;
left: 210px;
}
#otherpins {
display: none;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xe.csv', 6, 10, 11)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

View File

@ -0,0 +1,44 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "Normal Linux Compile",
'default_console' : "EV_USBSERIAL",
};
chip = {
'part' : "LINUX",
'family' : "LINUX",
'package' : "",
'ram' : -1,
'flash' : -1,
'speed' : -1,
'usart' : 0,
'spi' : 1,
'i2c' : 0,
'adc' : 0,
'dac' : 0,
};
# left-right, or top-bottom order
board = {
};
devices = {
};
board_css = """
""";
def get_pins():
return []

View File

@ -0,0 +1,46 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
# placeholder
info = {
'name' : "MBed LPC1768",
'link' : [ "http://www.espruino.com/kick" ],
'variables' : 2000, #?
};
chip = {
'part' : "LPC1768",
'family' : "LPC1768",
# 'package' : "LQFP64",
# 'ram' : ,
# 'flash' : ,
# 'speed' : ,
# 'usart' : ,
# 'spi' : ,
# 'i2c' : ,
# 'adc'
# 'dac'
};
# left-right, or top-bottom order
board = {
};
devices = {
};
board_css = """
""";
def get_pins():
return []

View File

@ -0,0 +1,173 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
import json;
info = {
'name' : "Olimexino STM32 / Leaflabs Maple",
'link' : [ "https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/", "http://leaflabs.com/devices/maple/" ],
'variables' : 715,
};
chip = {
'part' : "STM32F103RB", #T6
'family' : "STM32F1",
'package' : "LQFP64",
'ram' : 20,
'flash' : 128,
'speed' : 72,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
'adc' : 3,
'dac' : 0,
};
# left-right, or top-bottom order
board = {
'top' : [ 'D14', 'GND', 'D13', 'D12', 'D11','D10', 'D9', 'D8', '', 'D7', 'D6', 'D5', 'D4', 'D3', 'D2', 'D1', 'D0'],
'bottom' : [ 'RST', '3.3', '3.3A', 'GNDA', 'GND', 'VIN', '', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5'],
'right' : [ 'D23','D25','D27','D29','D31','D33','D35','D37' ],
'right2' : [ 'D24','D26','D28','D30','D32','D34','D36','GND' ],
'left' : [ '3V3','D7','D29','D12','D13' ],
'left2' : [ 'GND','D8','D20','D11','D4' ],
'_pinmap' : { 'A0':'D15', 'A1':'D16', 'A2':'D17', 'A3':'D18', 'A4':'D19', 'A5':'D20' }
};
board["left"].reverse()
board["left2"].reverse()
board["right"].reverse()
board["right2"].reverse()
devices = {
# 'OSC' : { 'pin_1' : 'D0',
# 'pin_2' : 'D1' },
'OSC_RTC' : { 'pin_1' : 'D22',
'pin_2' : 'D23' },
'LED1' : { 'pin' : 'D13' },
'LED2' : { 'pin' : 'D3' },
'BTN1' : { 'pin' : 'D38' }, # 'C9'
'USB' : { 'pin_disc' : 'D39',
'pin_dm' : 'D40',
'pin_bp' : 'D41'
},
'SD' : { 'pin_cs' : 'D25',#'D2',
'pin_di' : 'D34',#'B15',
'pin_do' : 'D33',#'B14',
'pin_clk' : 'D32'}, #'B13'
};
board_css = """
#board {
width: 540px;
height: 418px;
top: 300px;
left: 200px;
background-image: url(img/OLIMEXINO_STM32.jpg);
}
#boardcontainer {
height: 850px;
}
#top {
top: -20px;
left: 140px;
}
#bottom {
top: 431px;
left: 220px;
}
#left {
top: 155px;
right: 520px;
}
#left2 {
top:155px;
left: 20px;
}
#right {
top: 155px;
left: 520px;
}
#right2 {
top: 155px;
right: 20px;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xb.csv', 6, 10, 11)
# Olimexino/Maple pins have stupid names
pinmapping = {
'D0' :'PA3',
'D1' :'PA2',
'D2' :'PA0',
'D3' :'PA1',
'D4' :'PB5',
'D5' :'PB6',
'D6' :'PA8',
'D7' :'PA9',
'D8' :'PA10',
'D9' :'PB7',
'D10':'PA4',
'D11':'PA7',
'D12':'PA6',
'D13':'PA5',
'D14':'PB8',
'D15':'PC0', # shared with A0-A15
'D16':'PC1',
'D17':'PC2',
'D18':'PC3',
'D19':'PC4',
'D20':'PC5',
'D21':'PC13',
'D22':'PC14',
'D23':'PC15',
'D24':'PB9',
'D25':'PD2',
'D26':'PC10',
'D27':'PB0',
'D28':'PB1',
'D29':'PB10',
'D30':'PB11',
'D31':'PB12',
'D32':'PB13',
'D33':'PB14',
'D34':'PB15',
'D35':'PC6',
'D36':'PC7',
'D37':'PC8',
'D38':'PC9', # for button
'D39':'PC12', # for USB disc
'D40':'PA11', # for USB dm
'D41':'PA12', # for USB dp
};
newpins = []
for newname in pinmapping:
# print newname
pin = pinutils.findpin(pins, pinmapping[newname], True)
pin["name"] = "P"+newname
pin["sortingname"] = newname[0] + newname[1:].rjust(2,'0')
newpins.append(pin)
# Because 'pinmapping' is NOT stored in order!!!
newpins = sorted(newpins, key=lambda pin: pin["sortingname"])
# print(json.dumps(newpins, sort_keys=True, indent=2))
return newpins

View File

@ -0,0 +1,173 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
import json;
info = {
'name' : "Olimexino STM32 / Leaflabs Maple (with bootloader)",
'link' : [ "https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/", "http://leaflabs.com/devices/maple/" ],
'variables' : 254,
};
chip = {
'part' : "STM32F103RB", #T6
'family' : "STM32F1",
'package' : "LQFP64",
'ram' : 17, # bootloader :(
'flash' : 108, # bootloader :(
'speed' : 72,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
'adc' : 3,
'dac' : 0,
};
# left-right, or top-bottom order
board = {
'top' : [ 'D14', 'GND', 'D13', 'D12', 'D11','D10', 'D9', 'D8', '', 'D7', 'D6', 'D5', 'D4', 'D3', 'D2', 'D1', 'D0'],
'bottom' : [ 'RST', '3.3', '3.3A', 'GNDA', 'GND', 'VIN', '', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5'],
'right' : [ 'D23','D25','D27','D29','D31','D33','D35','D37' ],
'right2' : [ 'D24','D26','D28','D30','D32','D34','D36','GND' ],
'left' : [ '3V3','D7','D29','D12','D13' ],
'left2' : [ 'GND','D8','D20','D11','D4' ],
'_pinmap' : { 'A0':'D15', 'A1':'D16', 'A2':'D17', 'A3':'D18', 'A4':'D19', 'A5':'D20' }
};
board["left"].reverse()
board["left2"].reverse()
board["right"].reverse()
board["right2"].reverse()
devices = {
# 'OSC' : { 'pin_1' : 'D0',
# 'pin_2' : 'D1' },
'OSC_RTC' : { 'pin_1' : 'D22',
'pin_2' : 'D23' },
'LED1' : { 'pin' : 'D13' },
'LED2' : { 'pin' : 'D3' },
'BTN1' : { 'pin' : 'D38' }, # 'C9'
'USB' : { 'pin_disc' : 'D39',
'pin_dm' : 'D40',
'pin_bp' : 'D41'
},
'SD' : { 'pin_cs' : 'D25',#'D2',
'pin_di' : 'D34',#'B15',
'pin_do' : 'D33',#'B14',
'pin_clk' : 'D32'}, #'B13'
};
board_css = """
#board {
width: 540px;
height: 418px;
top: 300px;
left: 200px;
background-image: url(img/OLIMEXINO_STM32.jpg);
}
#boardcontainer {
height: 850px;
}
#top {
top: -20px;
left: 140px;
}
#bottom {
top: 431px;
left: 220px;
}
#left {
top: 155px;
right: 520px;
}
#left2 {
top:155px;
left: 20px;
}
#right {
top: 155px;
left: 520px;
}
#right2 {
top: 155px;
right: 20px;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xb.csv', 6, 10, 11)
# Olimexino/Maple pins have stupid names
pinmapping = {
'D0' :'PA3',
'D1' :'PA2',
'D2' :'PA0',
'D3' :'PA1',
'D4' :'PB5',
'D5' :'PB6',
'D6' :'PA8',
'D7' :'PA9',
'D8' :'PA10',
'D9' :'PB7',
'D10':'PA4',
'D11':'PA7',
'D12':'PA6',
'D13':'PA5',
'D14':'PB8',
'D15':'PC0', # shared with A0-A15
'D16':'PC1',
'D17':'PC2',
'D18':'PC3',
'D19':'PC4',
'D20':'PC5',
'D21':'PC13',
'D22':'PC14',
'D23':'PC15',
'D24':'PB9',
'D25':'PD2',
'D26':'PC10',
'D27':'PB0',
'D28':'PB1',
'D29':'PB10',
'D30':'PB11',
'D31':'PB12',
'D32':'PB13',
'D33':'PB14',
'D34':'PB15',
'D35':'PC6',
'D36':'PC7',
'D37':'PC8',
'D38':'PC9', # for button
'D39':'PC12', # for USB disc
'D40':'PA11', # for USB dm
'D41':'PA12', # for USB dp
};
newpins = []
for newname in pinmapping:
# print newname
pin = pinutils.findpin(pins, pinmapping[newname], True)
pin["name"] = "P"+newname
pin["sortingname"] = newname[0] + newname[1:].rjust(2,'0')
newpins.append(pin)
# Because 'pinmapping' is NOT stored in order!!!
newpins = sorted(newpins, key=lambda pin: pin["sortingname"])
# print(json.dumps(newpins, sort_keys=True, indent=2))
return newpins

View File

@ -0,0 +1,56 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "Sony Smartwatch",
'link' : [ "http://developer.sonymobile.com/services/open-smartwatch-project/smartwatch-hacker-guide/" ],
'variables' : 4000,
};
chip = {
'part' : "STM32F205RG",
'family' : "STM32F2",
'package' : "LQFP48", # FIXME
'hse' : 26000000, # oscillator
'ram' : 132,
'flash' : 1024,
'speed' : 130, # FIXME
'usart' : 3, # FIXME
'spi' : 2, # FIXME
'i2c' : 2, # FIXME
};
# left-right, or top-bottom order
board = {
};
devices = {
'OSC' : { 'pin_1' : 'D0',
'pin_2' : 'D1' },
'BTN1' : { 'pin' : 'B11' },
};
#define BUZZER (&PIN_PB8 )
#define BUTTON (&PIN_PB11)
#define POWER (&PIN_PC3 )
#define USB_CONNECTED (&PIN_PA9 )
#define LIGHT_SENSOR (&PIN_PA9 )
#define BATTERY_VOLTAGE (&PIN_PA9 )
board_css = """
""";
def get_pins():
# FIXME NEED STM32F2 PINS
pins = pinutils.scan_pin_file([], 'stm32f103xe.csv', 6, 10, 11)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

View File

@ -0,0 +1,126 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
import json;
info = {
'name' : "STM32 F3 Discovery",
'link' : [ "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF254044" ],
'variables' : 1720,
};
chip = {
'part' : "STM32F303VCT6",
'family' : "STM32F3",
'package' : "LQFP100",
'ram' : 40,
'flash' : 256,
'speed' : 72,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
'adc' : 4,
'dac' : 2,
};
# left-right, or top-bottom order
board = {
'left' : [ '3V','GND','C1','C3','A1','A3','F4','A5','A7','C5','B1','E7','E9','E11','E13','E15','B11','B13','B15','D9','D11','D13','D15','C6','GND' ],
'left2' : [ '3V','NRST','C0','C2','F2','A0','A2','A4','A6','C4','B0','B2','E8','E10','E12','E14','B10','B12','B14','D8','D10','D12','D14','C7','GND' ],
'right2' : [ '5V','F9','D0','C14','E6','E4','E2','E0','B8','BOOT0','B6','B4','D7','D5','D3','D1','C12','C10','A14','F6','A12','A10','A8','C8','GND' ],
'right' : [ '5V','F10','F1','C15','C13','E5','E3','E1','B9','VDD','B7','B5','B3','D6','D4','D2','D0','C11','A15','A13','A11','A9','C9','NC','GND' ],
};
devices = {
'OSC' : { 'pin_1' : 'F0',
'pin_2' : 'F1' },
'OSC_RTC' : { 'pin_1' : 'C14',
'pin_2' : 'C15' },
'LED1' : { 'pin' : 'E9' },
'LED2' : { 'pin' : 'E8' },
'LED3' : { 'pin' : 'E10' },
'LED4' : { 'pin' : 'E15' },
'LED5' : { 'pin' : 'E11' },
'LED6' : { 'pin' : 'E14' },
'LED7' : { 'pin' : 'E12' },
'LED8' : { 'pin' : 'E13' },
'BTN1' : { 'pin' : 'A0' },
'USB' : { 'pin_otg_pwr' : 'C0',#
'pin_dm' : 'A11',
'pin_bp' : 'A12',
'pin_vbus' : 'A9',#
'pin_id' : 'A10', },#
'GYRO' : { 'device' : 'L3GD20',
'pin_cs' : 'E3',
'pin_sck' : 'A5',
'pin_miso' : 'A6',
'pin_mosi' : 'A7',
'pin_int1' : 'E0',
'pin_int2' : 'E1',
},
'MEMS' : { 'device' : 'LSM303DLHC)',
'pin_sda' : 'B7',
'pin_scl' : 'B6',
'pin_drdy' : 'E2',
'pin_int1' : 'E4',
'pin_int2' : 'E5',
},
'MIC' : { 'device' : 'MP45DT02',
'pin_clk' : 'C3',
'pin_dout' : 'B10', },
'AUDIO' : { 'device' : 'CS43L22',
'pin_sda' : 'B9',
'pin_scl' : 'B6',
'pin_mclk' : 'C7',
'pin_sclk' : 'C10',
'pin_sdin' : 'C12',
'pin_lrck' : 'A4',
'pin_nrst' : 'D4',
},
};
board_css = """
#board {
width: 598px;
height: 891px;
left: 200px;
background-image: url(img/STM32F3DISCOVERY.jpg);
}
#boardcontainer {
height: 891px;
}
#left {
top: 320px;
right: 530px;
}
#left2 {
top: 320px;
left: 85px;
}
#right2 {
top: 320px;
right: 80px;
}
#right {
top: 320px;
left: 530px;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f303.csv', 3, 6, 7)
pins = pinutils.scan_pin_af_file(pins, 'stm32f303_af.csv', 1, 2)
# print(json.dumps(pins, sort_keys=True, indent=2))
# return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
return pinutils.fill_gaps_in_pin_list(pins)

View File

@ -0,0 +1,111 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "STM32 F4 Discovery",
'link' : [ "http://www.st.com/stm32f4-discovery" ],
'default_console' : "EV_SERIAL2", # FIXME: This was S2 because of pin conflict. Not sure if it's really an issue?
'variables' : 5450,
};
chip = {
'part' : "STM32F407VGT6",
'family' : "STM32F4",
'package' : "LQFP100",
'ram' : 192,
'flash' : 1024,
'speed' : 168,
'usart' : 6,
'spi' : 3,
'i2c' : 3,
'adc' : 3,
'dac' : 2,
};
# left-right, or top-bottom order
board = {
'left' : [ 'GND', 'VDD', 'GND', 'C1','C3','A1','A3','A5','A7','C5','B1','GND','E7','E9','E11','E13','E15','B11','B13','B15','D9','D11','D13','D15','GND'],
'left2' : [ 'GND', 'VDD', 'NRST', 'C0','C2','A0','A2','A4','A6','C4','B0','B2','E8','E10','E12','E14','B10','B12','B14','D8','D10','D12','D14','NC','GND'],
'right2' : [ 'GND', '5V', '3V3', 'H0', 'C14','E6','E4','E2','E0','B8','BOOT0','B6','B4','D7','D5','D3','D1','C12','C10','A14','A10','A8','C8','C6','GND'],
'right' : [ 'GND', '5V', '3V3', 'H1', 'C15','C13','E5','E3','E1','B9','VDD','B7','B5','B3','D6','D4','D2','D0','C11','A15','A13','A9','C9','C7','GND'],
};
devices = {
'OSC' : { 'pin_1' : 'H0',
'pin_2' : 'H1' },
'OSC_RTC' : { 'pin_1' : 'C14',
'pin_2' : 'C15' },
'LED1' : { 'pin' : 'D13' },
'LED2' : { 'pin' : 'D12' },
'LED3' : { 'pin' : 'D14' },
'LED4' : { 'pin' : 'D15' },
'BTN1' : { 'pin' : 'A0' },
'USB' : { 'pin_otg_pwr' : 'C0',
'pin_dm' : 'A11',
'pin_bp' : 'A12',
'pin_vbus' : 'A9',
'pin_id' : 'A10', },
'MEMS' : { 'device' : 'LIS302DL',
'pin_cs' : 'E3',
'pin_int1' : 'E0',
'pin_int2' : 'E1',
'pin_mosi' : 'A7',
'pin_miso' : 'A6',
'pin_sck' : 'A5' },
'MIC' : { 'device' : 'MP45DT02',
'pin_clk' : 'C3',
'pin_dout' : 'B10', },
'AUDIO' : { 'device' : 'CS43L22',
'pin_sda' : 'B9',
'pin_scl' : 'B6',
'pin_mclk' : 'C7',
'pin_sclk' : 'C10',
'pin_sdin' : 'C12',
'pin_lrck' : 'A4',
'pin_nrst' : 'D4',
},
};
board_css = """
#board {
width: 680px;
height: 1020px;
left: 200px;
background-image: url(img/STM32F4DISCOVERY.jpg);
}
#boardcontainer {
height: 1020px;
}
#left {
top: 375px;
right: 590px;
}
#left2 {
top: 375px;
left: 105px;
}
#right {
top: 375px;
left: 550px;
}
#right2 {
top: 375px;
right: 145px;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f40x.csv', 6, 9, 10)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

View File

@ -0,0 +1,80 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "STM32 VL Discovery",
'link' : [ "http://www.st.com/stm32-discovery" ],
'variables' : 254,
};
chip = {
'part' : "STM32F100RBT6",
'family' : "STM32F1",
'package' : "LQFP64",
'ram' : 8,
'flash' : 128,
'speed' : 24,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
'adc' : 3,
'dac' : 0,
};
# left-right, or top-bottom order
board = {
'left' : [ 'GND', 'NC', '3.3', 'VBAT', 'C13', 'C14', 'C15', 'D0', 'D1', 'RST', 'C0', 'C1', 'C2', 'C3', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'C4', 'C5', 'B0', 'B1', 'B2', 'GND' ],
'right' : [ 'GND', 'NC', '5V', 'B9', 'B8', 'BOOT', 'B7', 'B6', 'B5', 'B4', 'B3', 'D2', 'C12', 'C11', 'C10', 'A15', 'A14', 'A13', 'A12', 'A11', 'A10', 'A9', 'A8', 'C9', 'C8', 'C7', 'C6', 'GND' ],
'bottom' : [ 'B10','B11','B12','B13','B14','B15' ],
};
devices = {
'OSC' : { 'pin_1' : 'D0',
'pin_2' : 'D1' },
'OSC_RTC' : { 'pin_1' : 'C14',
'pin_2' : 'C15' },
'LED1' : { 'pin' : 'C9' },
'LED2' : { 'pin' : 'C8' },
'BTN1' : { 'pin' : 'A0' },
};
board_css = """
#board {
width: 376px;
height: 750px;
left: 200px;
background-image: url(img/STM32VLDISCOVERY.jpg);
}
#boardcontainer {
height: 950px;
}
#left {
top: 40px;
right: 330px;
}
#right {
top: 40px;
left: 330px;
}
#bottom {
top: 710px;
left: 125px;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xb.csv', 6, 10, 11)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

View File

@ -0,0 +1,49 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 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.
# ----------------------------------------------------------------------------------------
import pinutils;
info = {
'name' : "Single Chip",
'link' : [ "http://www.st.com/stm32-discovery" ],
'variables' : 700,
};
chip = {
'part' : "STM32F103TBU6",
'family' : "STM32F1",
'package' : "VFQFPN36",
'ram' : 20,
'flash' : 128,
'speed' : 24,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
};
# left-right, or top-bottom order
board = {
};
devices = {
'OSC' : { 'pin_1' : 'D0',
'pin_2' : 'D1' },
'LED1' : { 'pin' : 'C9' },
'BTN1' : { 'pin' : 'A0' },
};
board_css = """
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xb.csv', 6, 10, 11)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -0,0 +1,4 @@
Board Images
===========
These images are used to create the documentation for boards on the Espruino Website

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -0,0 +1,4 @@
Pin Definitions
=============
The files in this directory have been compiled from the microcontroller datasheets. They are read by various scripts during Espruino's compilation and are used to automatically set the correct Alternate Function registers.

Binary file not shown.

View File

@ -0,0 +1,101 @@
LFBGA100,LQFP48,TFBGA64,LQFP64,VFQFPN36,,Name,Type,IO,After Reset,Default,Remap
A3,0,,0,1,0,PE2,I/O,FT,PE2,TRACECK,
B3,0,,0,2,0,PE3,I/O,FT,PE3,TRACED0,
C3,0,,0,3,0,PE4,I/O,FT,PE4,TRACED1,
D3,0,,0,4,0,PE5,I/O,FT,PE5,TRACED2,
E3,0,,0,5,0,PE6,I/O,FT,PE6,TRACED3,
B2,1,B2,1,6,0,VBAT,S,,VBAT,,
A2,2,A2,2,7,0,PC13-TAMPERRTC(5),I/O,,PC13,TAMPER-RTC,I/O
A1,3,A1,3,8,0,PC14-OSC32_IN(5),I/O,,PC14,OSC32_IN,I/O
B1,4,B1,4,9,0,PC15-OSC32_OUT(5),I/O,,PC15,OSC32_OUT,I/O
C2,0,0,0,10,0,VSS_5,S,,VSS_5,,
D2,0,0,0,11,0,VDD_5,S,,VDD_5,,
C1,5,C1,5,12,2,OSC_IN,I,,OSC_IN,,
D1,6,D1,6,13,3,OSC_OUT,O,,OSC_OUT,,
E1,7,E1,7,14,4,NRST,I/O,,NRST,,
F1,0,E3,8,15,0,PC0,I/O,,PC0,ADC12_IN10,
F2,0,E2,9,16,0,PC1,I/O,,PC1,ADC12_IN11,
E2,0,F2,10,17,0,PC2,I/O,,PC2,ADC12_IN12,
F3,0,-(7),11,18,0,PC3,I/O,,PC3,ADC12_IN13,
G1,8,F1,12,19,5,VSSA,S,,VSSA,,
H1,0,0,0,20,0,VREF-,S,,VREFJ1,,
J1,0,G1(7),0,21,0,VREF+,S,,VREF+,,
K1,9,H1,13,22,6,VDDA,S,,VDDA,,
G2,10,G2,14,23,7,PA0-WKUP,I/O,,PA0,WKUP/USART2_CTS/ADC12_IN0/TIM2_CH1_ETR,
H2,11,H2,15,24,8,PA1,I/O,,PA1,USART2_RTS/ADC12_IN1/TIM2_CH2,
J2,12,F3,16,25,9,PA2,I/O,,PA2,USART2_TX/ADC12_IN2/TIM2_CH3,
K2,13,G3,17,26,10,PA3,I/O,,PA3,USART2_RX/ADC12_IN3/TIM2_CH4,
E4,0,C2,18,27,0,VSS_4,S,,VSS_4,,
F4,0,D2,19,28,0,VDD_4,S,,VDD_4,,
G3,14,H3,20,29,11,PA4,I/O,,PA4,SPI1_NSS/USART2_CK/ADC12_IN4,
H3,15,F4,21,30,12,PA5,I/O,,PA5,SPI1_SCK/ADC12_IN5,
J3,16,G4,22,31,13,PA6,I/O,,PA6,SPI1_MISO/ADC12_IN6/TIM3_CH1,TIM1_BKIN
K3,17,H4,23,32,14,PA7,I/O,,PA7,SPI1_MOSI/ADC12_IN7/TIM3_CH2,TIM1_CH1N
G4,0,H5,24,33,,PC4,I/O,PC4,,ADC12_IN14,
H4,0,H6,25,34,,PC5,I/O,PC5,,ADC12_IN15,
J4,18,F5,26,35,15,PB0,I/O,,PB0,ADC12_IN8/TIM3_CH3,TIM1_CH2N
K4,19,G5,27,36,16,PB1,I/O,,PB1,ADC12_IN9/TIM3_CH4,TIM1_CH3N
G5,20,G6,28,37,17,PB2,I/O,FT,PB2/BOOT1,,
H5,0,0,0,38,0,PE7,I/O,FT,PE7,,TIM1_ETR
J5,0,0,0,39,0,PE8,I/O,FT,PE8,,TIM1_CH1N
K5,0,0,0,40,0,PE9,I/O,FT,PE9,,TIM1_CH1
G6,0,0,0,41,0,PE10,I/O,FT,PE10,,TIM1_CH2N
H6,0,0,0,42,0,PE11,I/O,FT,PE11,,TIM1_CH2
J6,0,0,0,43,0,PE12,I/O,FT,PE12,,TIM1_CH3N
K6,0,0,0,44,0,PE13,I/O,FT,PE13,,TIM1_CH3
G7,0,0,0,45,0,PE14,I/O,FT,PE14,,TIM1_CH4
H7,0,0,0,46,0,PE15,I/O,FT,PE15,,TIM1_BKIN
J7,21,G7,29,47,0,PB10,I/O,FT,PB10,I2C2_SCL/USART3_TX,TIM2_CH3
K7,22,H7,30,48,0,PB11,I/O,FT,PB11,I2C2_SDA/USART3_RX,TIM2_CH4
E7,23,D6,31,49,18,VSS_1,S,,VSS_1,,
F7,24,E6,32,50,19,VDD_1,S,,VDD_1,,
K8,25,H8,33,51,0,PB12,I/O,FT,PB12,SPI2_NSS/I2C2_SMBAl/USART3_CK/TIM1_BKIN,
J8,26,G8,34,52,0,PB13,I/O,FT,PB13,SPI2_SCK/USART3_CTS/TIM1_CH1N,
H8,27,F8,35,53,0,PB14,I/O,FT,PB14,SPI2_MISO/USART3_RTS/TIM1_CH2N,
G8,28,F7,36,54,0,PB15,I/O,FT,PB15,SPI2_MOSI/TIM1_CH3N,
K9,0,0,0,55,0,PD8,I/O,FT,PD8,,USART3_TX
J9,0,0,0,56,0,PD9,I/O,FT,PD9,,USART3_RX
H9,0,0,0,57,0,PD10,I/O,FT,PD10,,USART3_CK
G9,0,0,0,58,0,PD11,I/O,FT,PD11,,USART3_CTS
K10,0,0,0,59,0,PD12,I/O,FT,PD12,,TIM4_CH1/USART3_RTS
J10,0,0,0,60,0,PD13,I/O,FT,PD13,,TIM4_CH2
H10,0,0,0,61,0,PD14,I/O,FT,PD14,,TIM4_CH3
G10,0,0,0,62,0,PD15,I/O,FT,PD15,,TIM4_CH4
F10,0,F6,37,63,0,PC6,I/O,FT,PC6,,TIM3_CH1
E10,,E7,38,64,0,PC7,I/O,FT,PC7,,TIM3_CH2
F9,,E8,39,65,0,PC8,I/O,FT,PC8,,TIM3_CH3
E9,0,D8,40,66,0,PC9,I/O,FT,PC9,,TIM3_CH4
D9,29,D7,41,67,20,PA8,I/O,FT,PA8,USART1_CK/TIM1_CH1/MCO,
C9,30,C7,42,68,21,PA9,I/O,FT,PA9,USART1_TX/TIM1_CH2,
D10,31,C6,43,69,22,PA10,I/O,FT,PA10,USART1_RX/TIM1_CH3,
C10,32,C8,44,70,23,PA11,I/O,FT,PA11,USART1_CTS/CANRX/USBDM/TIM1_CH4,
B10,33,B8,45,71,24,PA12,I/O,FT,PA12,USART1_RTS/CANTX/USBDP/TIM1_ETR,
A10,34,A8,46,72,25,PA13,I/O,FT,JTMS/SWDIO,,PA13
F8,0,0,0,73,0,Not,connected,,,,
E6,35,D5,47,74,26,VSS_2,S,,VSS_2,,
F6,36,E5,48,75,27,VDD_2,S,,VDD_2,,
A9,37,A7,49,76,28,PA14,I/O,FT,JTCK/SWCLK,,PA14
A8,38,A6,50,77,29,PA15,I/O,FT,JTDI,,TIM2_CH1_ETR/PA15/SPI1_NSS
B9,0,B7,51,78,,PC10,I/O,FT,PC10,,USART3_TX
B8,0,B6,52,79,,PC11,I/O,FT,PC11,,USART3_RX
C8,0,C5,53,80,,PC12,I/O,FT,PC12,,USART3_CK
D8,5,C1,5,81,2,PD0,I/O,FT,OSC_IN,,CANRX
E8,6,D1,6,82,3,PD1,I/O,FT,OSC_OUT,,CANTX
B7,,B5,54,83,0,PD2,I/O,FT,PD2,TIM3_ETR,
C7,0,0,0,84,0,PD3,I/O,FT,PD3,,USART2_CTS
D7,0,0,0,85,0,PD4,I/O,FT,PD4,,USART2_RTS
B6,0,0,0,86,0,PD5,I/O,FT,PD5,,USART2_TX
C6,0,0,0,87,0,PD6,I/O,FT,PD6,,USART2_RX
D6,0,0,0,88,0,PD7,I/O,FT,PD7,,USART2_CK
A7,39,A5,55,89,30,PB3,I/O,FT,JTDO,,TIM2_CH2/PB3/TRACESWO/SPI1_SCK
A6,40,A4,56,90,31,PB4,I/O,FT,JNTRST,,TIM3_CH1/PB4/SPI1_MISO
C5,41,C4,57,91,32,PB5,I/O,,PB5,I2C1_SMBAl,TIM3_CH2/SPI1_MOSI
B5,42,D3,58,92,33,PB6,I/O,FT,PB6,I2C1_SCL/TIM4_CH1,USART1_TX
A5,43,C3,59,93,34,PB7,I/O,FT,PB7,I2C1_SDA/TIM4_CH2,USART1_RX
D5,44,B4,60,94,35,BOOT0,I,,BOOT0,,
B4,45,B3,61,95,0,PB8,I/O,FT,PB8,TIM4_CH3,I2C1_SCL/CANRX
A4,46,A3,62,96,0,PB9,I/O,FT,PB9,TIM4_CH4,I2C1_SDA/CANTX
D4,0,0,0,97,0,PE0,I/O,FT,PE0,TIM4_ETR,
C4,0,0,0,98,0,PE1,I/O,FT,PE1,,
E5,47,D4,63,99,36,VSS_3,S,,VSS_3,,
F5,48,E4,64,100,1,VDD_3,S,,VDD_3,,
1 LFBGA100 LQFP48 TFBGA64 LQFP64 VFQFPN36 Name Type IO After Reset Default Remap
2 A3 0 0 1 0 PE2 I/O FT PE2 TRACECK
3 B3 0 0 2 0 PE3 I/O FT PE3 TRACED0
4 C3 0 0 3 0 PE4 I/O FT PE4 TRACED1
5 D3 0 0 4 0 PE5 I/O FT PE5 TRACED2
6 E3 0 0 5 0 PE6 I/O FT PE6 TRACED3
7 B2 1 B2 1 6 0 VBAT S VBAT
8 A2 2 A2 2 7 0 PC13-TAMPERRTC(5) I/O PC13 TAMPER-RTC I/O
9 A1 3 A1 3 8 0 PC14-OSC32_IN(5) I/O PC14 OSC32_IN I/O
10 B1 4 B1 4 9 0 PC15-OSC32_OUT(5) I/O PC15 OSC32_OUT I/O
11 C2 0 0 0 10 0 VSS_5 S VSS_5
12 D2 0 0 0 11 0 VDD_5 S VDD_5
13 C1 5 C1 5 12 2 OSC_IN I OSC_IN
14 D1 6 D1 6 13 3 OSC_OUT O OSC_OUT
15 E1 7 E1 7 14 4 NRST I/O NRST
16 F1 0 E3 8 15 0 PC0 I/O PC0 ADC12_IN10
17 F2 0 E2 9 16 0 PC1 I/O PC1 ADC12_IN11
18 E2 0 F2 10 17 0 PC2 I/O PC2 ADC12_IN12
19 F3 0 -(7) 11 18 0 PC3 I/O PC3 ADC12_IN13
20 G1 8 F1 12 19 5 VSSA S VSSA
21 H1 0 0 0 20 0 VREF- S VREFJ1
22 J1 0 G1(7) 0 21 0 VREF+ S VREF+
23 K1 9 H1 13 22 6 VDDA S VDDA
24 G2 10 G2 14 23 7 PA0-WKUP I/O PA0 WKUP/USART2_CTS/ADC12_IN0/TIM2_CH1_ETR
25 H2 11 H2 15 24 8 PA1 I/O PA1 USART2_RTS/ADC12_IN1/TIM2_CH2
26 J2 12 F3 16 25 9 PA2 I/O PA2 USART2_TX/ADC12_IN2/TIM2_CH3
27 K2 13 G3 17 26 10 PA3 I/O PA3 USART2_RX/ADC12_IN3/TIM2_CH4
28 E4 0 C2 18 27 0 VSS_4 S VSS_4
29 F4 0 D2 19 28 0 VDD_4 S VDD_4
30 G3 14 H3 20 29 11 PA4 I/O PA4 SPI1_NSS/USART2_CK/ADC12_IN4
31 H3 15 F4 21 30 12 PA5 I/O PA5 SPI1_SCK/ADC12_IN5
32 J3 16 G4 22 31 13 PA6 I/O PA6 SPI1_MISO/ADC12_IN6/TIM3_CH1 TIM1_BKIN
33 K3 17 H4 23 32 14 PA7 I/O PA7 SPI1_MOSI/ADC12_IN7/TIM3_CH2 TIM1_CH1N
34 G4 0 H5 24 33 PC4 I/O PC4 ADC12_IN14
35 H4 0 H6 25 34 PC5 I/O PC5 ADC12_IN15
36 J4 18 F5 26 35 15 PB0 I/O PB0 ADC12_IN8/TIM3_CH3 TIM1_CH2N
37 K4 19 G5 27 36 16 PB1 I/O PB1 ADC12_IN9/TIM3_CH4 TIM1_CH3N
38 G5 20 G6 28 37 17 PB2 I/O FT PB2/BOOT1
39 H5 0 0 0 38 0 PE7 I/O FT PE7 TIM1_ETR
40 J5 0 0 0 39 0 PE8 I/O FT PE8 TIM1_CH1N
41 K5 0 0 0 40 0 PE9 I/O FT PE9 TIM1_CH1
42 G6 0 0 0 41 0 PE10 I/O FT PE10 TIM1_CH2N
43 H6 0 0 0 42 0 PE11 I/O FT PE11 TIM1_CH2
44 J6 0 0 0 43 0 PE12 I/O FT PE12 TIM1_CH3N
45 K6 0 0 0 44 0 PE13 I/O FT PE13 TIM1_CH3
46 G7 0 0 0 45 0 PE14 I/O FT PE14 TIM1_CH4
47 H7 0 0 0 46 0 PE15 I/O FT PE15 TIM1_BKIN
48 J7 21 G7 29 47 0 PB10 I/O FT PB10 I2C2_SCL/USART3_TX TIM2_CH3
49 K7 22 H7 30 48 0 PB11 I/O FT PB11 I2C2_SDA/USART3_RX TIM2_CH4
50 E7 23 D6 31 49 18 VSS_1 S VSS_1
51 F7 24 E6 32 50 19 VDD_1 S VDD_1
52 K8 25 H8 33 51 0 PB12 I/O FT PB12 SPI2_NSS/I2C2_SMBAl/USART3_CK/TIM1_BKIN
53 J8 26 G8 34 52 0 PB13 I/O FT PB13 SPI2_SCK/USART3_CTS/TIM1_CH1N
54 H8 27 F8 35 53 0 PB14 I/O FT PB14 SPI2_MISO/USART3_RTS/TIM1_CH2N
55 G8 28 F7 36 54 0 PB15 I/O FT PB15 SPI2_MOSI/TIM1_CH3N
56 K9 0 0 0 55 0 PD8 I/O FT PD8 USART3_TX
57 J9 0 0 0 56 0 PD9 I/O FT PD9 USART3_RX
58 H9 0 0 0 57 0 PD10 I/O FT PD10 USART3_CK
59 G9 0 0 0 58 0 PD11 I/O FT PD11 USART3_CTS
60 K10 0 0 0 59 0 PD12 I/O FT PD12 TIM4_CH1/USART3_RTS
61 J10 0 0 0 60 0 PD13 I/O FT PD13 TIM4_CH2
62 H10 0 0 0 61 0 PD14 I/O FT PD14 TIM4_CH3
63 G10 0 0 0 62 0 PD15 I/O FT PD15 TIM4_CH4
64 F10 0 F6 37 63 0 PC6 I/O FT PC6 TIM3_CH1
65 E10 E7 38 64 0 PC7 I/O FT PC7 TIM3_CH2
66 F9 E8 39 65 0 PC8 I/O FT PC8 TIM3_CH3
67 E9 0 D8 40 66 0 PC9 I/O FT PC9 TIM3_CH4
68 D9 29 D7 41 67 20 PA8 I/O FT PA8 USART1_CK/TIM1_CH1/MCO
69 C9 30 C7 42 68 21 PA9 I/O FT PA9 USART1_TX/TIM1_CH2
70 D10 31 C6 43 69 22 PA10 I/O FT PA10 USART1_RX/TIM1_CH3
71 C10 32 C8 44 70 23 PA11 I/O FT PA11 USART1_CTS/CANRX/USBDM/TIM1_CH4
72 B10 33 B8 45 71 24 PA12 I/O FT PA12 USART1_RTS/CANTX/USBDP/TIM1_ETR
73 A10 34 A8 46 72 25 PA13 I/O FT JTMS/SWDIO PA13
74 F8 0 0 0 73 0 Not connected
75 E6 35 D5 47 74 26 VSS_2 S VSS_2
76 F6 36 E5 48 75 27 VDD_2 S VDD_2
77 A9 37 A7 49 76 28 PA14 I/O FT JTCK/SWCLK PA14
78 A8 38 A6 50 77 29 PA15 I/O FT JTDI TIM2_CH1_ETR/PA15/SPI1_NSS
79 B9 0 B7 51 78 PC10 I/O FT PC10 USART3_TX
80 B8 0 B6 52 79 PC11 I/O FT PC11 USART3_RX
81 C8 0 C5 53 80 PC12 I/O FT PC12 USART3_CK
82 D8 5 C1 5 81 2 PD0 I/O FT OSC_IN CANRX
83 E8 6 D1 6 82 3 PD1 I/O FT OSC_OUT CANTX
84 B7 B5 54 83 0 PD2 I/O FT PD2 TIM3_ETR
85 C7 0 0 0 84 0 PD3 I/O FT PD3 USART2_CTS
86 D7 0 0 0 85 0 PD4 I/O FT PD4 USART2_RTS
87 B6 0 0 0 86 0 PD5 I/O FT PD5 USART2_TX
88 C6 0 0 0 87 0 PD6 I/O FT PD6 USART2_RX
89 D6 0 0 0 88 0 PD7 I/O FT PD7 USART2_CK
90 A7 39 A5 55 89 30 PB3 I/O FT JTDO TIM2_CH2/PB3/TRACESWO/SPI1_SCK
91 A6 40 A4 56 90 31 PB4 I/O FT JNTRST TIM3_CH1/PB4/SPI1_MISO
92 C5 41 C4 57 91 32 PB5 I/O PB5 I2C1_SMBAl TIM3_CH2/SPI1_MOSI
93 B5 42 D3 58 92 33 PB6 I/O FT PB6 I2C1_SCL/TIM4_CH1 USART1_TX
94 A5 43 C3 59 93 34 PB7 I/O FT PB7 I2C1_SDA/TIM4_CH2 USART1_RX
95 D5 44 B4 60 94 35 BOOT0 I BOOT0
96 B4 45 B3 61 95 0 PB8 I/O FT PB8 TIM4_CH3 I2C1_SCL/CANRX
97 A4 46 A3 62 96 0 PB9 I/O FT PB9 TIM4_CH4 I2C1_SDA/CANTX
98 D4 0 0 0 97 0 PE0 I/O FT PE0 TIM4_ETR
99 C4 0 0 0 98 0 PE1 I/O FT PE1
100 E5 47 D4 63 99 36 VSS_3 S VSS_3
101 F5 48 E4 64 100 1 VDD_3 S VDD_3

View File

@ -0,0 +1,145 @@
LFBGA144,LFBGA100,WLCSP64,LQFP64,LQFP100,LQFP144,Name,Type,IO,After Reset,Default,Remap
A3,A3,0,0,1,1,PE2,I/O,FT,PE2,TRACECK/FSMC_A23,
A2,B3,0,0,2,2,PE3,I/O,FT,PE3,TRACED0/FSMC_A19,
B2,C3,0,0,3,3,PE4,I/O,FT,PE4,TRACED1/FSMC_A20,
B3,D3,0,0,4,4,PE5,I/O,FT,PE5,TRACED2/FSMC_A21,
B4,E3,0,0,5,5,PE6,I/O,FT,PE6,TRACED3/FSMC_A22,
C2,B2,C6,1,6,6,VBAT,S,VBAT,,,
A1,A2,C8,2,7,7,PC13-TAMPER-RTC,I/O,,PC13,TAMPER-RTC,
B1,A1,B8,3,8,8,PC14-OSC32_IN,I/O,,PC14,OSC32_IN,
C1,B1,B7,4,9,9,PC15-OSC32_OUT,I/O,,PC15,OSC32_OUT,
C3,0,0,0,0,10,PF0,I/O,FT,PF0,FSMC_A0,
C4,0,0,0,0,11,PF1,I/O,FT,PF1,FSMC_A1,
D4,0,0,0,0,12,PF2,I/O,FT,PF2,FSMC_A2,
E2,0,0,0,0,13,PF3,I/O,FT,PF3,FSMC_A3,
E3,0,0,0,0,14,PF4,I/O,FT,PF4,FSMC_A4,
E4,0,0,0,0,15,PF5,I/O,FT,PF5,FSMC_A5,
D2,C2,0,0,10,16,VSS_5,S,,VSS_5,,
D3,D2,0,0,11,17,VDD_5,S,,VDD_5,,
F3,0,0,0,0,18,PF6,I/O,,PF6,ADC3_IN4/FSMC_NIORD,
F2,0,0,0,0,19,PF7,I/O,,PF7,ADC3_IN5/FSMC_NREG,
G3,0,0,0,0,20,PF8,I/O,,PF8,ADC3_IN6/FSMC_NIOWR,
G2,0,0,0,0,21,PF9,I/O,,PF9,ADC3_IN7/FSMC_CD,
G1,0,0,0,0,22,PF10,I/O,,PF10,ADC3_IN8/FSMC_INTR,
D1,C1,D8,5,12,23,OSC_IN,I,,OSC_IN,,
E1,D1,D7,6,13,24,OSC_OUT,O,,OSC_OUT,,
F1,E1,C7,7,14,25,NRST,I/O,,NRST,,
H1,F1,E8,8,15,26,PC0,I/O,,PC0,ADC123_IN10,
H2,F2,F8,9,16,27,PC1,I/O,,PC1,ADC123_IN11,
H3,E2,D6,10,17,28,PC2,I/O,,PC2,ADC123_IN12,
H4,F3,0,11,18,29,PC3,I/O,,PC3,ADC123_IN13,
J1,G1,E7,12,19,30,VSSA,S,,VSSA,,
K1,H1,0,0,20,31,VREF-,S,,VREF-,,
L1,J1,F7,0,21,32,VREF+,S,,VREF+,,
M1,K1,G8,13,22,33,VDDA,S,,VDDA,,
J2,G2,F6,14,23,34,PA0-WKUP,I/O,,PA0,WKUP/USART2_CTS/ADC123_IN0/TIM2_CH1_ETR/TIM5_CH1/TIM8_ETR,
K2,H2,E6,15,24,35,PA1,I/O,,PA1,USART2_RTS/ADC123_IN1/TIM5_CH2/TIM2_CH2,
L2,J2,H8,16,25,36,PA2,I/O,,PA2,USART2_TX/TIM5_CH3/ADC123_IN2/TIM2_CH3,
M2,K2,G7,17,26,37,PA3,I/O,,PA3,USART2_RX/TIM5_CH4/ADC123_IN3/TIM2_CH4,
G4,E4,F5,18,27,38,VSS_4,S,,VSS_4,,
F4,F4,G6,19,28,39,VDD_4,S,,VDD_4,,
J3,G3,H7,20,29,40,PA4,I/O,,PA4,SPI1_NSS/USART2_CK/DAC_OUT1/ADC12_IN4,
K3,H3,E5,21,30,41,PA5,I/O,,PA5,SPI1_SCK/DAC_OUT2/ADC12_IN5,
L3,J3,G5,22,31,42,PA6,I/O,,PA6,SPI1_MISO/TIM8_BKIN/ADC12_IN6/TIM3_CH1,TIM1_BKIN
M3,K3,G4,23,32,43,PA7,I/O,,PA7,SPI1_MOSI/TIM8_CH1N/ADC12_IN7/TIM3_CH2,TIM1_CH1N
J4,G4,H6,24,33,44,PC4,I/O,,PC4,ADC12_IN14,
K4,H4,H5,25,34,45,PC5,I/O,,PC5,ADC12_IN15,
L4,J4,H4,26,35,46,PB0,I/O,,PB0,ADC12_IN8/TIM3_CH3/TIM8_CH2N,TIM1_CH2N
M4,K4,F4,27,36,47,PB1,I/O,,PB1,ADC12_IN9/TIM3_CH4/TIM8_CH3N,TIM1_CH3N
J5,G5,H3,28,37,48,PB2,I/O,FT,PB2/BOOT1,,
M5,0,0,0,0,49,PF11,I/O,FT,PF11,FSMC_NIOS16,
L5,0,0,0,0,50,PF12,I/O,FT,PF12,FSMC_A6,
H5,0,0,0,0,51,VSS_6,S,,VSS_6,,
G5,0,0,0,0,52,VDD_6,S,,VDD_6,,
K5,0,0,0,0,53,PF13,I/O,FT,PF13,FSMC_A7,
M6,0,0,0,0,54,PF14,I/O,FT,PF14,FSMC_A8,
L6,0,0,0,0,55,PF15,I/O,FT,PF15,FSMC_A9,
K6,0,0,0,0,56,PG0,I/O,FT,PG0,FSMC_A10,
J6,0,0,0,0,57,PG1,I/O,FT,PG1,FSMC_A11,
M7,H5,0,0,38,58,PE7,I/O,FT,PE7,FSMC_D4,TIM1_ETR
L7,J5,0,0,39,59,PE8,I/O,FT,PE8,FSMC_D5,TIM1_CH1N
K7,K5,0,0,40,60,PE9,I/O,FT,PE9,FSMC_D6,TIM1_CH1
H6,0,0,0,0,61,VSS_7,S,,VSS_7,,
G6,0,0,0,0,62,VDD_7,S,,VDD_7,,
J7,G6,0,0,41,63,PE10,I/O,FT,PE10,FSMC_D7,TIM1_CH2N
H8,H6,0,0,42,64,PE11,I/O,FT,PE11,FSMC_D8,TIM1_CH2
J8,J6,0,0,43,65,PE12,I/O,FT,PE12,FSMC_D9,TIM1_CH3N
K8,K6,0,0,44,66,PE13,I/O,FT,PE13,FSMC_D10,TIM1_CH3
L8,G7,0,0,45,67,PE14,I/O,FT,PE14,FSMC_D11,TIM1_CH4
M8,H7,0,0,46,68,PE15,I/O,FT,PE15,FSMC_D12,TIM1_BKIN
M9,J7,G3,29,47,69,PB10,I/O,FT,PB10,I2C2_SCL/USART3_TX,TIM2_CH3
M10,K7,F3,30,48,70,PB11,I/O,FT,PB11,I2C2_SDA/USART3_RX,TIM2_CH4
H7,E7,H2,31,49,71,VSS_1,S,,VSS_1,,
G7,F7,H1,32,50,72,VDD_1,S,,VDD_1,,
M11,K8,G2,33,51,73,PB12,I/O,FT,PB12,SPI2_NSS/I2S2_WS/I2C2_SMBA/USART3_CK/TIM1_BKIN,
M12,J8,G1,34,52,74,PB13,I/O,FT,PB13,SPI2_SCK/I2S2_CK/USART3_CTS/TIM1_CH1N,
L11,H8,F2,35,53,75,PB14,I/O,FT,PB14,SPI2_MISO/TIM1_CH2N/USART3_RTS,
L12,G8,F1,36,54,76,PB15,I/O,FT,PB15,SPI2_MOSI/I2S2_SD/TIM1_CH3N,
L9,K9,0,0,55,77,PD8,I/O,FT,PD8,FSMC_D13,USART3_TX
K9,J9,0,0,56,78,PD9,I/O,FT,PD9,FSMC_D14,USART3_RX
J9,H9,0,0,57,79,PD10,I/O,FT,PD10,FSMC_D15,USART3_CK
H9,G9,0,0,58,80,PD11,I/O,FT,PD11,FSMC_A16,USART3_CTS
L10,K10,0,0,59,81,PD12,I/O,FT,PD12,FSMC_A17,TIM4_CH1/USART3_RTS
K10,J10,0,0,60,82,PD13,I/O,FT,PD13,FSMC_A18,TIM4_CH2
G8,0,0,0,0,83,VSS_8,S,,VSS_8,,
F8,0,0,0,0,84,VDD_8,S,,VDD_8,,
K11,H10,0,0,61,85,PD14,I/O,FT,PD14,FSMC_D0,TIM4_CH3
K12,G10,0,0,62,86,PD15,I/O,FT,PD15,FSMC_D1,TIM4_CH4
J12,0,0,0,0,87,PG2,I/O,FT,PG2,FSMC_A12,
J11,0,0,0,0,88,PG3,I/O,FT,PG3,FSMC_A13,
J10,0,0,0,0,89,PG4,I/O,FT,PG4,FSMC_A14,
H12,0,0,0,0,90,PG5,I/O,FT,PG5,FSMC_A15,
H11,0,0,0,0,91,PG6,I/O,FT,PG6,FSMC_INT2,
H10,0,0,0,0,92,PG7,I/O,FT,PG7,FSMC_INT3,
G11,0,0,0,0,93,PG8,I/O,FT,PG8,,
G10,0,0,0,0,94,VSS_9,S,,VSS_9,,
F10,0,0,0,0,95,VDD_9,S,,VDD_9,,
G12,F10,E1,37,63,96,PC6,I/O,FT,PC6,I2S2_MCK/TIM8_CH1/SDIO_D6,TIM3_CH1
F12,E10,E2,38,64,97,PC7,I/O,FT,PC7,I2S3_MCK/TIM8_CH2/SDIO_D7,TIM3_CH2
F11,F9,E3,39,65,98,PC8,I/O,FT,PC8,TIM8_CH3/SDIO_D0,TIM3_CH3
E11,E9,D1,40,66,99,PC9,I/O,FT,PC9,TIM8_CH4/SDIO_D1,TIM3_CH4
E12,D9,E4,41,67,100,PA8,I/O,FT,PA8,USART1_CK/TIM1_CH1/MCO,
D12,C9,D2,42,68,101,PA9,I/O,FT,PA9,USART1_TX/TIM1_CH2,
D11,D10,D3,43,69,102,PA10,I/O,FT,PA10,USART1_RX/TIM1_CH3,
C12,C10,C1,44,70,103,PA11,I/O,FT,PA11,USART1_CTS/USBDM/CAN_RX/TIM1_CH4,
B12,B10,C2,45,71,104,PA12,I/O,FT,PA12,USART1_RTS/USBDP/CAN_TX/TIM1_ETR,
A12,A10,D4,46,72,105,PA13,I/O,FT,JTMS-SWDIO,,PA13
C11,F8,0,0,73,106,,,,,,
G9,E6,B1,47,74,107,VSS_2,S,,VSS_2,,
F9,F6,A1,48,75,108,VDD_2,S,,VDD_2,,
A11,A9,B2,49,76,109,PA14,I/O,FT,JTCK-SWCLK,,PA14
A10,A8,C3,50,77,110,PA15,I/O,FT,JTDI,SPI3_NSS/I2S3_WS,TIM2_CH1_ETR/PA15/SPI1_NSS
B11,B9,A2,51,78,111,PC10,I/O,FT,PC10,UART4_TX/SDIO_D2,USART3_TX
B10,B8,B3,52,79,112,PC11,I/O,FT,PC11,UART4_RX/SDIO_D3,USART3_RX
C10,C8,C4,53,80,113,PC12,I/O,FT,PC12,UART5_TX/SDIO_CK,USART3_CK
E10,D8,D8,5,81,114,PD0,I/O,FT,OSC_IN,FSMC_D2,CAN_RX
D10,E8,D7,6,82,115,PD1,I/O,FT,OSC_OUT,FSMC_D3,CAN_TX
E9,B7,A3,54,83,116,PD2,I/O,FT,PD2,TIM3_ETR/UART5_RX/SDIO_CMD,
D9,C7,0,0,84,117,PD3,I/O,FT,PD3,FSMC_CLK,USART2_CTS
C9,D7,0,0,85,118,PD4,I/O,FT,PD4,FSMC_NOE,USART2_RTS
B9,B6,0,0,86,119,PD5,I/O,FT,PD5,FSMC_NWE,USART2_TX
E7,0,0,0,0,120,VSS_10,S,,VSS_10,,
F7,0,0,0,0,121,VDD_10,S,,VDD_10,,
A8,C6,0,0,87,122,PD6,I/O,FT,PD6,FSMC_NWAIT,USART2_RX
A9,D6,0,0,88,123,PD7,I/O,FT,PD7,FSMC_NE1/FSMC_NCE2,USART2_CK
E8,0,0,0,0,124,PG9,I/O,FT,PG9,FSMC_NE2/FSMC_NCE3,
D8,0,0,0,0,125,PG10,I/O,FT,PG10,FSMC_NCE4_1/FSMC_NE3,
C8,0,0,0,0,126,PG11,I/O,FT,PG11,FSMC_NCE4_2,
B8,0,0,0,0,127,PG12,I/O,FT,PG12,FSMC_NE4,
D7,0,0,0,0,128,PG13,I/O,FT,PG13,FSMC_A24,
C7,0,0,0,0,129,PG14,I/O,FT,PG14,FSMC_A25,
E6,0,0,0,0,130,VSS_11,S,,VSS_11,,
F6,0,0,0,0,131,VDD_11,S,,VDD_11,,
B7,0,0,0,0,132,PG15,I/O,FT,PG15,,
A7,A7,A4,55,89,133,PB3,I/O,FT,JTDO,SPI3_SCK/I2S3_CK,PB3/TRACESWO/TIM2_CH2/SPI1_SCK
A6,A6,B4,56,90,134,PB4,I/O,FT,NJTRST,SPI3_MISO,PB4/TIM3_CH1/SPI1_MISO
B6,C5,A5,57,91,135,PB5,I/O,,PB5,I2C1_SMBA/SPI3_MOSI/I2S3_SD,TIM3_CH2/SPI1_MOSI
C6,B5,B5,58,92,136,PB6,I/O,FT,PB6,I2C1_SCL/TIM4_CH1,USART1_TX
D6,A5,C5,59,93,137,PB7,I/O,FT,PB7,I2C1_SDA/FSMC_NADV/TIM4_CH2,USART1_RX
D5,D5,A6,60,94,138,BOOT0,I,,BOOT0,,
C5,B4,D5,61,95,139,PB8,I/O,FT,PB8,TIM4_CH3/SDIO_D4,I2C1_SCL/CAN_RX
B5,A4,B6,62,96,140,PB9,I/O,FT,PB9,TIM4_CH4/SDIO_D5,I2C1_SDA/CAN_TX
A5,D4,0,0,97,141,PE0,I/O,FT,PE0,TIM4_ETR/FSMC_NBL0,
A4,C4,0,0,98,142,PE1,I/O,FT,PE1,FSMC_NBL1,
E5,E5,A7,63,99,143,VSS_3,S,,VSS_3,,
F5,F5,A8,64,100,144,VDD_3,S,,VDD_3,,
1 LFBGA144 LFBGA100 WLCSP64 LQFP64 LQFP100 LQFP144 Name Type IO After Reset Default Remap
2 A3 A3 0 0 1 1 PE2 I/O FT PE2 TRACECK/FSMC_A23
3 A2 B3 0 0 2 2 PE3 I/O FT PE3 TRACED0/FSMC_A19
4 B2 C3 0 0 3 3 PE4 I/O FT PE4 TRACED1/FSMC_A20
5 B3 D3 0 0 4 4 PE5 I/O FT PE5 TRACED2/FSMC_A21
6 B4 E3 0 0 5 5 PE6 I/O FT PE6 TRACED3/FSMC_A22
7 C2 B2 C6 1 6 6 VBAT S VBAT
8 A1 A2 C8 2 7 7 PC13-TAMPER-RTC I/O PC13 TAMPER-RTC
9 B1 A1 B8 3 8 8 PC14-OSC32_IN I/O PC14 OSC32_IN
10 C1 B1 B7 4 9 9 PC15-OSC32_OUT I/O PC15 OSC32_OUT
11 C3 0 0 0 0 10 PF0 I/O FT PF0 FSMC_A0
12 C4 0 0 0 0 11 PF1 I/O FT PF1 FSMC_A1
13 D4 0 0 0 0 12 PF2 I/O FT PF2 FSMC_A2
14 E2 0 0 0 0 13 PF3 I/O FT PF3 FSMC_A3
15 E3 0 0 0 0 14 PF4 I/O FT PF4 FSMC_A4
16 E4 0 0 0 0 15 PF5 I/O FT PF5 FSMC_A5
17 D2 C2 0 0 10 16 VSS_5 S VSS_5
18 D3 D2 0 0 11 17 VDD_5 S VDD_5
19 F3 0 0 0 0 18 PF6 I/O PF6 ADC3_IN4/FSMC_NIORD
20 F2 0 0 0 0 19 PF7 I/O PF7 ADC3_IN5/FSMC_NREG
21 G3 0 0 0 0 20 PF8 I/O PF8 ADC3_IN6/FSMC_NIOWR
22 G2 0 0 0 0 21 PF9 I/O PF9 ADC3_IN7/FSMC_CD
23 G1 0 0 0 0 22 PF10 I/O PF10 ADC3_IN8/FSMC_INTR
24 D1 C1 D8 5 12 23 OSC_IN I OSC_IN
25 E1 D1 D7 6 13 24 OSC_OUT O OSC_OUT
26 F1 E1 C7 7 14 25 NRST I/O NRST
27 H1 F1 E8 8 15 26 PC0 I/O PC0 ADC123_IN10
28 H2 F2 F8 9 16 27 PC1 I/O PC1 ADC123_IN11
29 H3 E2 D6 10 17 28 PC2 I/O PC2 ADC123_IN12
30 H4 F3 0 11 18 29 PC3 I/O PC3 ADC123_IN13
31 J1 G1 E7 12 19 30 VSSA S VSSA
32 K1 H1 0 0 20 31 VREF- S VREF-
33 L1 J1 F7 0 21 32 VREF+ S VREF+
34 M1 K1 G8 13 22 33 VDDA S VDDA
35 J2 G2 F6 14 23 34 PA0-WKUP I/O PA0 WKUP/USART2_CTS/ADC123_IN0/TIM2_CH1_ETR/TIM5_CH1/TIM8_ETR
36 K2 H2 E6 15 24 35 PA1 I/O PA1 USART2_RTS/ADC123_IN1/TIM5_CH2/TIM2_CH2
37 L2 J2 H8 16 25 36 PA2 I/O PA2 USART2_TX/TIM5_CH3/ADC123_IN2/TIM2_CH3
38 M2 K2 G7 17 26 37 PA3 I/O PA3 USART2_RX/TIM5_CH4/ADC123_IN3/TIM2_CH4
39 G4 E4 F5 18 27 38 VSS_4 S VSS_4
40 F4 F4 G6 19 28 39 VDD_4 S VDD_4
41 J3 G3 H7 20 29 40 PA4 I/O PA4 SPI1_NSS/USART2_CK/DAC_OUT1/ADC12_IN4
42 K3 H3 E5 21 30 41 PA5 I/O PA5 SPI1_SCK/DAC_OUT2/ADC12_IN5
43 L3 J3 G5 22 31 42 PA6 I/O PA6 SPI1_MISO/TIM8_BKIN/ADC12_IN6/TIM3_CH1 TIM1_BKIN
44 M3 K3 G4 23 32 43 PA7 I/O PA7 SPI1_MOSI/TIM8_CH1N/ADC12_IN7/TIM3_CH2 TIM1_CH1N
45 J4 G4 H6 24 33 44 PC4 I/O PC4 ADC12_IN14
46 K4 H4 H5 25 34 45 PC5 I/O PC5 ADC12_IN15
47 L4 J4 H4 26 35 46 PB0 I/O PB0 ADC12_IN8/TIM3_CH3/TIM8_CH2N TIM1_CH2N
48 M4 K4 F4 27 36 47 PB1 I/O PB1 ADC12_IN9/TIM3_CH4/TIM8_CH3N TIM1_CH3N
49 J5 G5 H3 28 37 48 PB2 I/O FT PB2/BOOT1
50 M5 0 0 0 0 49 PF11 I/O FT PF11 FSMC_NIOS16
51 L5 0 0 0 0 50 PF12 I/O FT PF12 FSMC_A6
52 H5 0 0 0 0 51 VSS_6 S VSS_6
53 G5 0 0 0 0 52 VDD_6 S VDD_6
54 K5 0 0 0 0 53 PF13 I/O FT PF13 FSMC_A7
55 M6 0 0 0 0 54 PF14 I/O FT PF14 FSMC_A8
56 L6 0 0 0 0 55 PF15 I/O FT PF15 FSMC_A9
57 K6 0 0 0 0 56 PG0 I/O FT PG0 FSMC_A10
58 J6 0 0 0 0 57 PG1 I/O FT PG1 FSMC_A11
59 M7 H5 0 0 38 58 PE7 I/O FT PE7 FSMC_D4 TIM1_ETR
60 L7 J5 0 0 39 59 PE8 I/O FT PE8 FSMC_D5 TIM1_CH1N
61 K7 K5 0 0 40 60 PE9 I/O FT PE9 FSMC_D6 TIM1_CH1
62 H6 0 0 0 0 61 VSS_7 S VSS_7
63 G6 0 0 0 0 62 VDD_7 S VDD_7
64 J7 G6 0 0 41 63 PE10 I/O FT PE10 FSMC_D7 TIM1_CH2N
65 H8 H6 0 0 42 64 PE11 I/O FT PE11 FSMC_D8 TIM1_CH2
66 J8 J6 0 0 43 65 PE12 I/O FT PE12 FSMC_D9 TIM1_CH3N
67 K8 K6 0 0 44 66 PE13 I/O FT PE13 FSMC_D10 TIM1_CH3
68 L8 G7 0 0 45 67 PE14 I/O FT PE14 FSMC_D11 TIM1_CH4
69 M8 H7 0 0 46 68 PE15 I/O FT PE15 FSMC_D12 TIM1_BKIN
70 M9 J7 G3 29 47 69 PB10 I/O FT PB10 I2C2_SCL/USART3_TX TIM2_CH3
71 M10 K7 F3 30 48 70 PB11 I/O FT PB11 I2C2_SDA/USART3_RX TIM2_CH4
72 H7 E7 H2 31 49 71 VSS_1 S VSS_1
73 G7 F7 H1 32 50 72 VDD_1 S VDD_1
74 M11 K8 G2 33 51 73 PB12 I/O FT PB12 SPI2_NSS/I2S2_WS/I2C2_SMBA/USART3_CK/TIM1_BKIN
75 M12 J8 G1 34 52 74 PB13 I/O FT PB13 SPI2_SCK/I2S2_CK/USART3_CTS/TIM1_CH1N
76 L11 H8 F2 35 53 75 PB14 I/O FT PB14 SPI2_MISO/TIM1_CH2N/USART3_RTS
77 L12 G8 F1 36 54 76 PB15 I/O FT PB15 SPI2_MOSI/I2S2_SD/TIM1_CH3N
78 L9 K9 0 0 55 77 PD8 I/O FT PD8 FSMC_D13 USART3_TX
79 K9 J9 0 0 56 78 PD9 I/O FT PD9 FSMC_D14 USART3_RX
80 J9 H9 0 0 57 79 PD10 I/O FT PD10 FSMC_D15 USART3_CK
81 H9 G9 0 0 58 80 PD11 I/O FT PD11 FSMC_A16 USART3_CTS
82 L10 K10 0 0 59 81 PD12 I/O FT PD12 FSMC_A17 TIM4_CH1/USART3_RTS
83 K10 J10 0 0 60 82 PD13 I/O FT PD13 FSMC_A18 TIM4_CH2
84 G8 0 0 0 0 83 VSS_8 S VSS_8
85 F8 0 0 0 0 84 VDD_8 S VDD_8
86 K11 H10 0 0 61 85 PD14 I/O FT PD14 FSMC_D0 TIM4_CH3
87 K12 G10 0 0 62 86 PD15 I/O FT PD15 FSMC_D1 TIM4_CH4
88 J12 0 0 0 0 87 PG2 I/O FT PG2 FSMC_A12
89 J11 0 0 0 0 88 PG3 I/O FT PG3 FSMC_A13
90 J10 0 0 0 0 89 PG4 I/O FT PG4 FSMC_A14
91 H12 0 0 0 0 90 PG5 I/O FT PG5 FSMC_A15
92 H11 0 0 0 0 91 PG6 I/O FT PG6 FSMC_INT2
93 H10 0 0 0 0 92 PG7 I/O FT PG7 FSMC_INT3
94 G11 0 0 0 0 93 PG8 I/O FT PG8
95 G10 0 0 0 0 94 VSS_9 S VSS_9
96 F10 0 0 0 0 95 VDD_9 S VDD_9
97 G12 F10 E1 37 63 96 PC6 I/O FT PC6 I2S2_MCK/TIM8_CH1/SDIO_D6 TIM3_CH1
98 F12 E10 E2 38 64 97 PC7 I/O FT PC7 I2S3_MCK/TIM8_CH2/SDIO_D7 TIM3_CH2
99 F11 F9 E3 39 65 98 PC8 I/O FT PC8 TIM8_CH3/SDIO_D0 TIM3_CH3
100 E11 E9 D1 40 66 99 PC9 I/O FT PC9 TIM8_CH4/SDIO_D1 TIM3_CH4
101 E12 D9 E4 41 67 100 PA8 I/O FT PA8 USART1_CK/TIM1_CH1/MCO
102 D12 C9 D2 42 68 101 PA9 I/O FT PA9 USART1_TX/TIM1_CH2
103 D11 D10 D3 43 69 102 PA10 I/O FT PA10 USART1_RX/TIM1_CH3
104 C12 C10 C1 44 70 103 PA11 I/O FT PA11 USART1_CTS/USBDM/CAN_RX/TIM1_CH4
105 B12 B10 C2 45 71 104 PA12 I/O FT PA12 USART1_RTS/USBDP/CAN_TX/TIM1_ETR
106 A12 A10 D4 46 72 105 PA13 I/O FT JTMS-SWDIO PA13
107 C11 F8 0 0 73 106
108 G9 E6 B1 47 74 107 VSS_2 S VSS_2
109 F9 F6 A1 48 75 108 VDD_2 S VDD_2
110 A11 A9 B2 49 76 109 PA14 I/O FT JTCK-SWCLK PA14
111 A10 A8 C3 50 77 110 PA15 I/O FT JTDI SPI3_NSS/I2S3_WS TIM2_CH1_ETR/PA15/SPI1_NSS
112 B11 B9 A2 51 78 111 PC10 I/O FT PC10 UART4_TX/SDIO_D2 USART3_TX
113 B10 B8 B3 52 79 112 PC11 I/O FT PC11 UART4_RX/SDIO_D3 USART3_RX
114 C10 C8 C4 53 80 113 PC12 I/O FT PC12 UART5_TX/SDIO_CK USART3_CK
115 E10 D8 D8 5 81 114 PD0 I/O FT OSC_IN FSMC_D2 CAN_RX
116 D10 E8 D7 6 82 115 PD1 I/O FT OSC_OUT FSMC_D3 CAN_TX
117 E9 B7 A3 54 83 116 PD2 I/O FT PD2 TIM3_ETR/UART5_RX/SDIO_CMD
118 D9 C7 0 0 84 117 PD3 I/O FT PD3 FSMC_CLK USART2_CTS
119 C9 D7 0 0 85 118 PD4 I/O FT PD4 FSMC_NOE USART2_RTS
120 B9 B6 0 0 86 119 PD5 I/O FT PD5 FSMC_NWE USART2_TX
121 E7 0 0 0 0 120 VSS_10 S VSS_10
122 F7 0 0 0 0 121 VDD_10 S VDD_10
123 A8 C6 0 0 87 122 PD6 I/O FT PD6 FSMC_NWAIT USART2_RX
124 A9 D6 0 0 88 123 PD7 I/O FT PD7 FSMC_NE1/FSMC_NCE2 USART2_CK
125 E8 0 0 0 0 124 PG9 I/O FT PG9 FSMC_NE2/FSMC_NCE3
126 D8 0 0 0 0 125 PG10 I/O FT PG10 FSMC_NCE4_1/FSMC_NE3
127 C8 0 0 0 0 126 PG11 I/O FT PG11 FSMC_NCE4_2
128 B8 0 0 0 0 127 PG12 I/O FT PG12 FSMC_NE4
129 D7 0 0 0 0 128 PG13 I/O FT PG13 FSMC_A24
130 C7 0 0 0 0 129 PG14 I/O FT PG14 FSMC_A25
131 E6 0 0 0 0 130 VSS_11 S VSS_11
132 F6 0 0 0 0 131 VDD_11 S VDD_11
133 B7 0 0 0 0 132 PG15 I/O FT PG15
134 A7 A7 A4 55 89 133 PB3 I/O FT JTDO SPI3_SCK/I2S3_CK PB3/TRACESWO/TIM2_CH2/SPI1_SCK
135 A6 A6 B4 56 90 134 PB4 I/O FT NJTRST SPI3_MISO PB4/TIM3_CH1/SPI1_MISO
136 B6 C5 A5 57 91 135 PB5 I/O PB5 I2C1_SMBA/SPI3_MOSI/I2S3_SD TIM3_CH2/SPI1_MOSI
137 C6 B5 B5 58 92 136 PB6 I/O FT PB6 I2C1_SCL/TIM4_CH1 USART1_TX
138 D6 A5 C5 59 93 137 PB7 I/O FT PB7 I2C1_SDA/FSMC_NADV/TIM4_CH2 USART1_RX
139 D5 D5 A6 60 94 138 BOOT0 I BOOT0
140 C5 B4 D5 61 95 139 PB8 I/O FT PB8 TIM4_CH3/SDIO_D4 I2C1_SCL/CAN_RX
141 B5 A4 B6 62 96 140 PB9 I/O FT PB9 TIM4_CH4/SDIO_D5 I2C1_SDA/CAN_TX
142 A5 D4 0 0 97 141 PE0 I/O FT PE0 TIM4_ETR/FSMC_NBL0
143 A4 C4 0 0 98 142 PE1 I/O FT PE1 FSMC_NBL1
144 E5 E5 A7 63 99 143 VSS_3 S VSS_3
145 F5 F5 A8 64 100 144 VDD_3 S VDD_3

View File

@ -0,0 +1,102 @@
LQFP100,LQFP64,LQFP48,Name,Type,IO,Alternate,Additional
1,,,PE2,I/O,FT,TRACECK/TIM3_CH1/TSC_G7_IO1,
2,,,PE3,I/O,FT,TRACED0/TIM3_CH2/TSC_G7_IO2,
3,,,PE4,I/O,FT,TRACED1/TIM3_CH3/TSC_G7_IO3,
4,,,PE5,I/O,FT,TRACED2/TIM3_CH4/TSC_G7_IO4,
5,,,PE6,I/O,FT,TRACED3,WKUP3/RTC_TAMP3
6,1,1,VBAT,S,,Backup power supply,
7,2,2,PC13,I/O,TC,TIM1_CH1N,WKUP2/RTC_TAMP1/RTC_TS/RTC_OUT
8,3,3,PC14-OSC32_IN(PC14),I/O,TC,,OSC32_IN
9,4,4,PC15-OSC32_OUT(PC15),I/O,TC,,OSC32_OUT
10,,,PF9,I/O,FT,TIM15_CH1/SPI2_SCK,
11,,,PF10,I/O,FT,TIM15_CH2/SPI2_SCK,
12,5,5,PF0-OSC_IN(PF0),I/O,FTf,TIM1_CH3N/I2C2_SDA,OSC_IN
13,6,6,PF1-OSC_OUT(PF1),I/O,FTf,I2C2_SCL,OSC_OUT
14,7,7,NRST,I/O,RST,Device reset input/internal reset output (active low),
15,8,,PC0,I/O,TTa,,ADC12_IN6/COMP7_INM
16,9,,PC1,I/O,TTa,,ADC12_IN7/COMP7_INP
17,10,,PC2,I/O,TTa,COMP7_OUT,ADC12_IN8
18,11,,PC3,I/O,TTa,TIM1_BKIN2,ADC12_IN9
19,,,PF2,I/O,TTa,,ADC12_IN10
20,12,8,VSSA/VREFS,,,Analog ground/Negative reference voltage,
21,,,VREF+,S,,Positive reference voltage,
22,,,VDDA,S,,Analog power supply,
,13,9,VDDA/VREF+,S,,Analog power supply/Positive reference voltage,
23,14,10,PA0,I/O,TTa,USART2_CTS/TIM2_CH1_ETR/TIM8_BKIN/TIM8_ETR/TSC_G1_IO1/COMP1_OUT,ADC1_IN1/COMP1_INM/RTC_TAMP2/WKUP1/COMP7_INP
24,15,11,PA1,I/O,TTa,USART2_RTS/TIM2_CH2/TSC_G1_IO2/TIM15_CH1N,ADC1_IN2/COMP1_INP/OPAMP1_VINP/OPAMP3_VINP
25,16,12,PA2,I/O,TTa,USART2_TX/TIM2_CH3/TIM15_CH1/TSC_G1_IO3/COMP2_OUT,ADC1_IN3/COMP2_INM/AOP1_OUT
26,17,13,PA3,I/O,TTa,USART2_RX/TIM2_CH4/TIM15_CH2/TSC_G1_IO4,ADC1_IN4/OPAMP1_VINP/COMP2_INP/OPAMP1_VINM
27,18,,PF4,I/O,TTa,COMP1_OUT,ADC1_IN5
28,19,,VDD_4,S,(1),,
29,20,14,PA4,I/O,TTa,SPI1_NSS/SPI3_NSS/I2S3_WS/USART2_CK/TSC_G2_IO1/TIM3_CH2,ADC2_IN1/DAC1_OUT1/OPAMP4_VINP/COMP1_INM4/COMP2_INM4/COMP3_INM4/COMP4_INM4/COMP5_INM4/COMP6_INM4/COMP7_INM4
30,21,15,PA5,I/O,TTa,SPI1_SCK/TIM2_CH1_ETR/TSC_G2_IO2,ADC2_IN2/DAC1_OUT2/OPAMP1_VINP/OPAMP2_VINM/OPAMP3_VINP/COMP1_INM5/COMP2_INM5/COMP3_INM5/COMP4_INM5/COMP5_INM5/COMP6_INM5/COMP7_INM5
31,22,16,PA6,I/O,TTa,SPI1_MISO/TIM3_CH1/TIM8_BKIN/TIM1_BKIN/TIM16_CH1/COMP1_OUT/TSC_G2_IO3,ADC2_IN3/AOP2_OUT
32,23,17,PA7,I/O,TTa,SPI1_MOSI/TIM3_CH2/TIM17_CH1/TIM1_CH1N/TIM8_CH1N/TSC_G2_IO4/COMP2_OUT,ADC2_IN4/COMP2_IN/OPAMP2_VINP/OPAMP1_VINP
33,24,,PC4,I/O,TTa,USART1_TX,ADC2_IN5
34,25,,PC5,I/O,TTa,USART1_RX/TSC_G3_IO1ADC2_IN11/OPAMP2_VINM/OPAMP1_VINM,ADC2_IN11/OPAMP2_VINM/OPAMP1_VINM
35,26,18,PB0,I/O,TTa,TIM3_CH3/TIM1_CH2N/TIM8_CH2N/TSC_G3_IO2,ADC3_IN12/COMP4_INP/OPAMP3_VINP/OPAMP2_VINP
36,27,19,PB1,I/O,TTa,TIM3_CH4/TIM1_CH3N/TIM8_CH3N/COMP4_OUT/TSC_G3_IO3,ADC3_IN1/AOP3_OUT
37,28,20,PB2,I/O,TTa,TSC_G3_IO4,ADC2_IN12/COMP4_INM/OPAMP3_VINM
38,,,PE7,I/O,TTa,TIM1_ETR,ADC3_IN13/COMP4_INP
39,,,PE8,I/O,TTa,TIM1_CH1N,COMP4_INM/ADC34_IN6
40,,,PE9,I/O,TTa,TIM1_CH1,ADC3_IN2
41,,,PE10,I/O,TTa,TIM1_CH2N,ADC3_IN14
42,,,PE11,I/O,TTa,TIM1_CH2,ADC3_IN15
43,,,PE12,I/O,TTa,TIM1_CH3N,ADC3_IN16
44,,,PE13,I/O,TTa,TIM1_CH3,ADC3_IN3
45,,,PE14,I/O,TTa,TIM1_CH4/TIM1_BKIN2,ADC4_IN1
46,,,PE15,I/O,TTa,USART3_RX/TIM1_BKIN,ADC4_IN2
47,29,21,PB10,I/O,TTa,USART3_TX/TIM2_CH3/TSC_SYNC,COMP5_INM/OPAMP4_VINM/OPAMP3_VINM
48,30,22,PB11,I/O,TTa,USART3_RX/TIM2_CH4/TSC_G6_IO1,COMP6_INP/OPAMP4_VINP
49,31,23,VSS_2,S,,Digital ground,
50,32,24,VDD_2,S,,Digital power supply,
51,33,25,PB12,I/O,TTa,SPI2_NSS/I2S2_WS/I2C2_SMBA/USART3_CK/TIM1_BKIN/TSC_G6_IO2,ADC4_IN3/COMP3_INM/AOP4_OUT
52,34,26,PB13,I/O,TTa,SPI2_SCK/I2S2_CK/USART3_CTS/TIM1_CH1N/TSC_G6_IO3,ADC3_IN5/COMP5_INP/OPAMP4_VINP/OPAMP3_VINP
53,35,27,PB14,I/O,TTa,SPI2_MISO/I2S2ext_SD/USART3_RTS/TIM1_CH2N/TIM15_CH1/TSC_G6_IO4,COMP3_INP/ADC4_IN4/OPAMP2_VINP
54,36,28,PB15,I/O,TTa,SPI2_MOSI/I2S2_SD/TIM1_CH3N/TIM15_CH1N/TIM15_CH2,ADC4_IN5/RTC_REFIN/COMP6_INM
55,,,PD8,I/O,TTa,USART3_TX,ADC4_IN12/OPAMP4_VINM
56,,,PD9,I/O,TTa,USART3_RX,ADC4_IN13
57,,,PD10,I/O,TTa,USART3_CK,ADC34_IN7/COMP6_INM
58,,,PD11,I/O,TTa,USART3_CTS,ADC34_IN8/COMP6_INP/OPAMP4_VINP
59,,,PD12,I/O,TTa,USART3_RTS/TIM4_CH1/TSC_G8_IO1,ADC34_IN9/COMP5_INP
60,,,PD13,I/O,TTa,TIM4_CH2/TSC_G8_IO2,ADC34_IN10/COMP5_INM
61,,,PD14,I/O,TTa,TIM4_CH3/TSC_G8_IO3,COMP3_INP/ADC34_IN11/OPAMP2_VINP
62,,,PD15,I/O,TTa,SPI2_NSS/TIM4_CH4/TSC_G8_IO4,COMP3_INM
63,37,,PC6,I/O,FT,I2S2_MCK/COMP6_OUT/TIM8_CH1/TIM3_CH1,
64,38,,PC7,I/O,FT,I2S3_MCK/TIM8_CH2/TIM3_CH2/COMP5_OUT,
65,39,,PC8,I/O,FT,TIM8_CH3/TIM3_CH3/COMP3_OUT,
66,40,,PC9,I/O,FT,TIM8_CH4/TIM8_BKIN2/TIM3_CH4/I2S_CKIN,
67,41,29,PA8,I/O,FT,I2C2_SMBA/I2S2_MCK/USART1_CK/TIM1_CH1/TIM4_ETR/MCO/COMP3_OUT,
68,42,30,PA9,I/O,FTf,I2C2_SCL/I2S3_MCK/USART1_TX/TIM1_CH2/TIM2_CH3/TIM15_BKIN/TSC_G4_IO1/COMP5_OUT,
69,43,31,PA10,I/O,FTf,I2C2_SDA/USART1_RX/TIM1_CH3/TIM2_CH4/TIM8_BKIN/TIM17_BKIN/TSC_G4_IO2/COMP6_OUT,
70,44,32,PA11,I/O,FT,USART1_CTS/USBDM/CAN_RX/TIM1_CH1N/TIM1_CH4/TIM1_BKIN2/TIM4_CH1/COMP1_OUT,
71,45,33,PA12,I/O,FT,USART1_RTS/USBDP/CAN_TX/TIM1_CH2N/TIM1_ETR/TIM4_CH2/TIM16_CH1/COMP2_OUT,
72,46,34,PA13,I/O,FT,USART3_CTS/TIM4_CH3/TIM16_CH1N/TSC_G4_IO3/IR_OUT/SWDAT-JTMS,
73,,,PF6,I/O,FTf,I2C2_SCL/USART3_RTS/TIM4_CH4,
74,47,35,VSS_3,S,,Ground,
75,48,36,VDD_3,S,,Digital power supply,
76,49,37,PA14,I/O,FTf,I2C1_SDA/USART2_TX/TIM8_CH2/TIM1_BKIN/TSC_G4_IO4/SWCLK-JTCK,
77,50,38,PA15,I/O,FTf,I2C1_SCL/SPI1_NSS/SPI3_NSS/I2S3_WS/JTDI/USART2_RX/TIM1_BKIN/TIM2_CH1_ETR/TIM8_CH1,
78,51,,PC10,I/O,FT,SPI3_SCK/I2S3_CK/USART3_TX/UART4_TX/TIM8_CH1N,
79,52,,PC11,I/O,FT,SPI3_MISO/I2S3ext_SD/USART3_RX/UART4_RX/TIM8_CH2N,
80,53,,PC12,I/O,FT,SPI3_MOSI/I2S3_SD/USART3_CK/UART5_TX/TIM8_CH3N,
81,,,PD0,I/O,FT,CAN_RX,
82,,,PD1,I/O,FT,CAN_TX/TIM8_CH4/TIM8_BKIN2,
83,54,,PD2,I/O,FT,UART5_RX/TIM3_ETR/TIM8_BKIN,
84,,,PD3,I/O,FT,USART2_CTS/TIM2_CH1_ETR,
85,,,PD4,I/O,FT,USART2_RTS/TIM2_CH2,
86,,,PD5,I/O,FT,USART2_TX,
87,,,PD6,I/O,FT,USART2_RX/TIM2_CH4,
88,,,PD7,I/O,FT,USART2_CK/TIM2_CH3,
89,55,39,PB3,I/O,FT,SPI3_SCK/I2S3_CK/SPI1_SCK/USART2_TX/TIM2_CH2/TIM3_ETR/TIM4_ETR/TIM8_CH1N/TSC_G5_IO1/JTDOTRACESWO,
90,56,40,PB4,I/O,FT,SPI3_MISO/I2S3ext_SD/SPI1_MISO/USART2_RX/TIM3_CH1/TIM16_CH1/TIM17_BKIN/TIM8_CH2N/TSC_G5_IO2/NJTRST,
91,57,41,PB5,I/O,FT,SPI3_MOSI/SPI1_MOSI/I2S3_SD/I2C1_SMBA/USART2_CK/TIM16_BKIN/TIM3_CH2/TIM8_CH3N/TIM17_CH1,
92,58,42,PB6,I/O,FTf,I2C1_SCL/USART1_TX/TIM16_CH1N/TIM4_CH1/TIM8_CH1/TSC_G5_IO3/TIM8_ETR/TIM8_BKIN2,
93,59,43,PB7,I/O,FTf,I2C1_SDA/USART1_RX/TIM3_CH4/TIM4_CH2/TIM17_CH1N/TIM8_BKIN/TSC_G5_IO4,
94,60,44,BOOT0,I,B,Boot memory selection,
95,61,45,PB8,I/O,FTf,I2C1_SCL/CAN_RX/TIM16_CH1/TIM4_CH3/TIM8_CH2/TIM1_BKIN/TSC_SYNC/COMP1_OUT,
96,62,46,PB9,I/O,FTf,I2C1_SDA/CAN_TX/TIM17_CH1/TIM4_CH4/TIM8_CH3/IR_OUT/COMP2_OUT,
97,,,PE0,I/O,FT,USART1_TX/TIM4_ETR/TIM16_CH1,
98,,,PE1,I/O,FT,USART1_RX/TIM17_CH1,
99,63,47,VSS_1,S,,Ground,
100,64,48,VDD_1,S,,Digital power supply,
1 LQFP100 LQFP64 LQFP48 Name Type IO Alternate Additional
2 1 PE2 I/O FT TRACECK/TIM3_CH1/TSC_G7_IO1
3 2 PE3 I/O FT TRACED0/TIM3_CH2/TSC_G7_IO2
4 3 PE4 I/O FT TRACED1/TIM3_CH3/TSC_G7_IO3
5 4 PE5 I/O FT TRACED2/TIM3_CH4/TSC_G7_IO4
6 5 PE6 I/O FT TRACED3 WKUP3/RTC_TAMP3
7 6 1 1 VBAT S Backup power supply
8 7 2 2 PC13 I/O TC TIM1_CH1N WKUP2/RTC_TAMP1/RTC_TS/RTC_OUT
9 8 3 3 PC14-OSC32_IN(PC14) I/O TC OSC32_IN
10 9 4 4 PC15-OSC32_OUT(PC15) I/O TC OSC32_OUT
11 10 PF9 I/O FT TIM15_CH1/SPI2_SCK
12 11 PF10 I/O FT TIM15_CH2/SPI2_SCK
13 12 5 5 PF0-OSC_IN(PF0) I/O FTf TIM1_CH3N/I2C2_SDA OSC_IN
14 13 6 6 PF1-OSC_OUT(PF1) I/O FTf I2C2_SCL OSC_OUT
15 14 7 7 NRST I/O RST Device reset input/internal reset output (active low)
16 15 8 PC0 I/O TTa ADC12_IN6/COMP7_INM
17 16 9 PC1 I/O TTa ADC12_IN7/COMP7_INP
18 17 10 PC2 I/O TTa COMP7_OUT ADC12_IN8
19 18 11 PC3 I/O TTa TIM1_BKIN2 ADC12_IN9
20 19 PF2 I/O TTa ADC12_IN10
21 20 12 8 VSSA/VREFS Analog ground/Negative reference voltage
22 21 VREF+ S Positive reference voltage
23 22 VDDA S Analog power supply
24 13 9 VDDA/VREF+ S Analog power supply/Positive reference voltage
25 23 14 10 PA0 I/O TTa USART2_CTS/TIM2_CH1_ETR/TIM8_BKIN/TIM8_ETR/TSC_G1_IO1/COMP1_OUT ADC1_IN1/COMP1_INM/RTC_TAMP2/WKUP1/COMP7_INP
26 24 15 11 PA1 I/O TTa USART2_RTS/TIM2_CH2/TSC_G1_IO2/TIM15_CH1N ADC1_IN2/COMP1_INP/OPAMP1_VINP/OPAMP3_VINP
27 25 16 12 PA2 I/O TTa USART2_TX/TIM2_CH3/TIM15_CH1/TSC_G1_IO3/COMP2_OUT ADC1_IN3/COMP2_INM/AOP1_OUT
28 26 17 13 PA3 I/O TTa USART2_RX/TIM2_CH4/TIM15_CH2/TSC_G1_IO4 ADC1_IN4/OPAMP1_VINP/COMP2_INP/OPAMP1_VINM
29 27 18 PF4 I/O TTa COMP1_OUT ADC1_IN5
30 28 19 VDD_4 S (1)
31 29 20 14 PA4 I/O TTa SPI1_NSS/SPI3_NSS/I2S3_WS/USART2_CK/TSC_G2_IO1/TIM3_CH2 ADC2_IN1/DAC1_OUT1/OPAMP4_VINP/COMP1_INM4/COMP2_INM4/COMP3_INM4/COMP4_INM4/COMP5_INM4/COMP6_INM4/COMP7_INM4
32 30 21 15 PA5 I/O TTa SPI1_SCK/TIM2_CH1_ETR/TSC_G2_IO2 ADC2_IN2/DAC1_OUT2/OPAMP1_VINP/OPAMP2_VINM/OPAMP3_VINP/COMP1_INM5/COMP2_INM5/COMP3_INM5/COMP4_INM5/COMP5_INM5/COMP6_INM5/COMP7_INM5
33 31 22 16 PA6 I/O TTa SPI1_MISO/TIM3_CH1/TIM8_BKIN/TIM1_BKIN/TIM16_CH1/COMP1_OUT/TSC_G2_IO3 ADC2_IN3/AOP2_OUT
34 32 23 17 PA7 I/O TTa SPI1_MOSI/TIM3_CH2/TIM17_CH1/TIM1_CH1N/TIM8_CH1N/TSC_G2_IO4/COMP2_OUT ADC2_IN4/COMP2_IN/OPAMP2_VINP/OPAMP1_VINP
35 33 24 PC4 I/O TTa USART1_TX ADC2_IN5
36 34 25 PC5 I/O TTa USART1_RX/TSC_G3_IO1ADC2_IN11/OPAMP2_VINM/OPAMP1_VINM ADC2_IN11/OPAMP2_VINM/OPAMP1_VINM
37 35 26 18 PB0 I/O TTa TIM3_CH3/TIM1_CH2N/TIM8_CH2N/TSC_G3_IO2 ADC3_IN12/COMP4_INP/OPAMP3_VINP/OPAMP2_VINP
38 36 27 19 PB1 I/O TTa TIM3_CH4/TIM1_CH3N/TIM8_CH3N/COMP4_OUT/TSC_G3_IO3 ADC3_IN1/AOP3_OUT
39 37 28 20 PB2 I/O TTa TSC_G3_IO4 ADC2_IN12/COMP4_INM/OPAMP3_VINM
40 38 PE7 I/O TTa TIM1_ETR ADC3_IN13/COMP4_INP
41 39 PE8 I/O TTa TIM1_CH1N COMP4_INM/ADC34_IN6
42 40 PE9 I/O TTa TIM1_CH1 ADC3_IN2
43 41 PE10 I/O TTa TIM1_CH2N ADC3_IN14
44 42 PE11 I/O TTa TIM1_CH2 ADC3_IN15
45 43 PE12 I/O TTa TIM1_CH3N ADC3_IN16
46 44 PE13 I/O TTa TIM1_CH3 ADC3_IN3
47 45 PE14 I/O TTa TIM1_CH4/TIM1_BKIN2 ADC4_IN1
48 46 PE15 I/O TTa USART3_RX/TIM1_BKIN ADC4_IN2
49 47 29 21 PB10 I/O TTa USART3_TX/TIM2_CH3/TSC_SYNC COMP5_INM/OPAMP4_VINM/OPAMP3_VINM
50 48 30 22 PB11 I/O TTa USART3_RX/TIM2_CH4/TSC_G6_IO1 COMP6_INP/OPAMP4_VINP
51 49 31 23 VSS_2 S Digital ground
52 50 32 24 VDD_2 S Digital power supply
53 51 33 25 PB12 I/O TTa SPI2_NSS/I2S2_WS/I2C2_SMBA/USART3_CK/TIM1_BKIN/TSC_G6_IO2 ADC4_IN3/COMP3_INM/AOP4_OUT
54 52 34 26 PB13 I/O TTa SPI2_SCK/I2S2_CK/USART3_CTS/TIM1_CH1N/TSC_G6_IO3 ADC3_IN5/COMP5_INP/OPAMP4_VINP/OPAMP3_VINP
55 53 35 27 PB14 I/O TTa SPI2_MISO/I2S2ext_SD/USART3_RTS/TIM1_CH2N/TIM15_CH1/TSC_G6_IO4 COMP3_INP/ADC4_IN4/OPAMP2_VINP
56 54 36 28 PB15 I/O TTa SPI2_MOSI/I2S2_SD/TIM1_CH3N/TIM15_CH1N/TIM15_CH2 ADC4_IN5/RTC_REFIN/COMP6_INM
57 55 PD8 I/O TTa USART3_TX ADC4_IN12/OPAMP4_VINM
58 56 PD9 I/O TTa USART3_RX ADC4_IN13
59 57 PD10 I/O TTa USART3_CK ADC34_IN7/COMP6_INM
60 58 PD11 I/O TTa USART3_CTS ADC34_IN8/COMP6_INP/OPAMP4_VINP
61 59 PD12 I/O TTa USART3_RTS/TIM4_CH1/TSC_G8_IO1 ADC34_IN9/COMP5_INP
62 60 PD13 I/O TTa TIM4_CH2/TSC_G8_IO2 ADC34_IN10/COMP5_INM
63 61 PD14 I/O TTa TIM4_CH3/TSC_G8_IO3 COMP3_INP/ADC34_IN11/OPAMP2_VINP
64 62 PD15 I/O TTa SPI2_NSS/TIM4_CH4/TSC_G8_IO4 COMP3_INM
65 63 37 PC6 I/O FT I2S2_MCK/COMP6_OUT/TIM8_CH1/TIM3_CH1
66 64 38 PC7 I/O FT I2S3_MCK/TIM8_CH2/TIM3_CH2/COMP5_OUT
67 65 39 PC8 I/O FT TIM8_CH3/TIM3_CH3/COMP3_OUT
68 66 40 PC9 I/O FT TIM8_CH4/TIM8_BKIN2/TIM3_CH4/I2S_CKIN
69 67 41 29 PA8 I/O FT I2C2_SMBA/I2S2_MCK/USART1_CK/TIM1_CH1/TIM4_ETR/MCO/COMP3_OUT
70 68 42 30 PA9 I/O FTf I2C2_SCL/I2S3_MCK/USART1_TX/TIM1_CH2/TIM2_CH3/TIM15_BKIN/TSC_G4_IO1/COMP5_OUT
71 69 43 31 PA10 I/O FTf I2C2_SDA/USART1_RX/TIM1_CH3/TIM2_CH4/TIM8_BKIN/TIM17_BKIN/TSC_G4_IO2/COMP6_OUT
72 70 44 32 PA11 I/O FT USART1_CTS/USBDM/CAN_RX/TIM1_CH1N/TIM1_CH4/TIM1_BKIN2/TIM4_CH1/COMP1_OUT
73 71 45 33 PA12 I/O FT USART1_RTS/USBDP/CAN_TX/TIM1_CH2N/TIM1_ETR/TIM4_CH2/TIM16_CH1/COMP2_OUT
74 72 46 34 PA13 I/O FT USART3_CTS/TIM4_CH3/TIM16_CH1N/TSC_G4_IO3/IR_OUT/SWDAT-JTMS
75 73 PF6 I/O FTf I2C2_SCL/USART3_RTS/TIM4_CH4
76 74 47 35 VSS_3 S Ground
77 75 48 36 VDD_3 S Digital power supply
78 76 49 37 PA14 I/O FTf I2C1_SDA/USART2_TX/TIM8_CH2/TIM1_BKIN/TSC_G4_IO4/SWCLK-JTCK
79 77 50 38 PA15 I/O FTf I2C1_SCL/SPI1_NSS/SPI3_NSS/I2S3_WS/JTDI/USART2_RX/TIM1_BKIN/TIM2_CH1_ETR/TIM8_CH1
80 78 51 PC10 I/O FT SPI3_SCK/I2S3_CK/USART3_TX/UART4_TX/TIM8_CH1N
81 79 52 PC11 I/O FT SPI3_MISO/I2S3ext_SD/USART3_RX/UART4_RX/TIM8_CH2N
82 80 53 PC12 I/O FT SPI3_MOSI/I2S3_SD/USART3_CK/UART5_TX/TIM8_CH3N
83 81 PD0 I/O FT CAN_RX
84 82 PD1 I/O FT CAN_TX/TIM8_CH4/TIM8_BKIN2
85 83 54 PD2 I/O FT UART5_RX/TIM3_ETR/TIM8_BKIN
86 84 PD3 I/O FT USART2_CTS/TIM2_CH1_ETR
87 85 PD4 I/O FT USART2_RTS/TIM2_CH2
88 86 PD5 I/O FT USART2_TX
89 87 PD6 I/O FT USART2_RX/TIM2_CH4
90 88 PD7 I/O FT USART2_CK/TIM2_CH3
91 89 55 39 PB3 I/O FT SPI3_SCK/I2S3_CK/SPI1_SCK/USART2_TX/TIM2_CH2/TIM3_ETR/TIM4_ETR/TIM8_CH1N/TSC_G5_IO1/JTDOTRACESWO
92 90 56 40 PB4 I/O FT SPI3_MISO/I2S3ext_SD/SPI1_MISO/USART2_RX/TIM3_CH1/TIM16_CH1/TIM17_BKIN/TIM8_CH2N/TSC_G5_IO2/NJTRST
93 91 57 41 PB5 I/O FT SPI3_MOSI/SPI1_MOSI/I2S3_SD/I2C1_SMBA/USART2_CK/TIM16_BKIN/TIM3_CH2/TIM8_CH3N/TIM17_CH1
94 92 58 42 PB6 I/O FTf I2C1_SCL/USART1_TX/TIM16_CH1N/TIM4_CH1/TIM8_CH1/TSC_G5_IO3/TIM8_ETR/TIM8_BKIN2
95 93 59 43 PB7 I/O FTf I2C1_SDA/USART1_RX/TIM3_CH4/TIM4_CH2/TIM17_CH1N/TIM8_BKIN/TSC_G5_IO4
96 94 60 44 BOOT0 I B Boot memory selection
97 95 61 45 PB8 I/O FTf I2C1_SCL/CAN_RX/TIM16_CH1/TIM4_CH3/TIM8_CH2/TIM1_BKIN/TSC_SYNC/COMP1_OUT
98 96 62 46 PB9 I/O FTf I2C1_SDA/CAN_TX/TIM17_CH1/TIM4_CH4/TIM8_CH3/IR_OUT/COMP2_OUT
99 97 PE0 I/O FT USART1_TX/TIM4_ETR/TIM16_CH1
100 98 PE1 I/O FT USART1_RX/TIM17_CH1
101 99 63 47 VSS_1 S Ground
102 100 64 48 VDD_1 S Digital power supply

Binary file not shown.

View File

@ -0,0 +1,94 @@
AF n° ,Port & Pin ,AF0 ,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,AF8 ,AF9 ,AF10 ,AF11 ,AF12 ,AF13,AF14 ,AF15 ,Name ,,,,,,,,,,,,,,,,
7,PA0 ,,TIM2_CH1_ETR ,,TSC_G1_IO1 ,,,,USART2_CTS ,COMP1_OUT ,TIM8_BKIN ,TIM8_ETR ,,,,,EVENT OUT
5,PA1 ,,TIM2_CH2 ,,TSC_G1_IO2 ,,,,USART2_RTS ,,TIM15_CH1N ,,,,,,EVENT OUT
6,PA2 ,,TIM2_CH3 ,,TSC_G1_IO3 ,,,,USART2_TX ,COMP2_OUT ,TIM15_CH1 ,,,,,,EVENT OUT
5,PA3 ,,TIM2_CH4 ,,TSC_G1_IO4 ,,,,USART2_RX ,,TIM15_CH2 ,,,,,,EVENT OUT ,,,,,,,,SPI3_,,,,,,,,,
6,PA4 ,,,TIM3_CH2 ,TSC_G2_IO1 ,,SPI1_NSS ,NSS/ I2S3_,USART2_CK ,,,,,,,,EVENT OUT ,,,,,,,,WS ,,,,,,,,,
4,PA5 ,,TIM2_CH1_ETR ,,TSC_G2_IO2 ,,SPI1_SCK ,,,,,,,,,,EVENT OUT
8,PA6 ,,TIM16_CH1 ,TIM3_CH1 ,TSC_G2_IO3 ,TIM8_BKIN ,SPI1_MISO ,TIM1_BKIN ,,COMP1_OUT ,,,,,,,EVENT OUT
8,PA7 ,,TIM17_CH1 ,TIM3_CH2 ,TSC_G2_IO4 ,TIM8_CH1N ,SPI1_MOSI ,TIM1_CH1N ,,COMP2_OUT ,,,,,,,EVENT OUT
8,PA8 ,MCO ,,,,I2C2_SMBA ,I2S2_MCK ,TIM1_CH1 ,USART1_CK ,COMP3_OUT ,,TIM4_ETR ,,,,,EVENT OUT
9,PA9 ,,,,TSC_G4_IO1 ,I2C2_SCL ,I2S3_MCK ,TIM1_CH2 ,USART1_TX ,COMP5_OUT ,TIM15_BKIN ,TIM2_CH3 ,,,,,EVENT OUT
9,PA10 ,,TIM17_BKIN ,,TSC_G4_IO2 ,I2C2_SDA ,,TIM1_CH3 ,USART1_RX ,COMP6_OUT ,,TIM2_CH4 ,TIM8_BKIN ,,,,EVENT OUT
9,PA11 ,,,,,,,TIM1_CH1N ,USART1_CTS ,COMP1_OUT ,CAN_RX ,TIM4_CH1 ,TIM1_CH4 ,TIM1_BKIN2 ,,USBDM ,EVENT OUT
9,PA12 ,,TIM16_CH1 ,,,,,TIM1_CH2N ,USART1_RTS ,COMP2_OUT ,CAN_TX ,TIM4_CH2 ,TIM1_ETR ,,,USBDP ,EVENT OUT
7,PA13 ,SWDAT-JTMS ,TIM16_CH1N ,,TSC_G4_IO3 ,,IR_OUT ,,USART3_CTS ,,,TIM4_CH3 ,,,,,EVENT OUT
7,PA14 ,SWCLK-JTCK ,,,TSC_G4_IO4 ,I2C1_SDA ,TIM8_CH2 ,TIM1_BKIN ,USART2_TX ,,,,,,,,EVENT OUT
9,PA15 ,JTDI ,TIM2_CH1_ETR ,TIM8_CH1 ,,I2C1_SCL ,SPI1_NSS ,SPI3_NSS/ I2S3_WS ,USART2_RX ,,TIM1_BKIN ,,,,,,EVENT OUT ,Port ,,,,,,,,,,,,,,,,
AF n° ,& Pin ,AF0 ,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,AF8 ,AF9 ,AF10 ,AF12 ,,,,AF15 ,Name ,,,,,,,,,,,,,,,,
5,PB0 ,,,TIM3_CH3 ,TSC_G3_IO2 ,TIM8_CH2N ,,TIM1_CH2N ,,,,,,,,,EVENT OUT
6,PB1 ,,,TIM3_CH4 ,TSC_G3_IO3 ,TIM8_CH3N ,,TIM1_CH3N ,,COMP4_OUT ,,,,,,,EVENT OUT
2,PB2 ,,,,TSC_G3_IO4 ,,,,,,,,,,,,EVENT OUT
10,PB3 ,JTDO-TRACE SWO ,TIM2_CH2 ,TIM4_ETR ,TSC_G5_IO1 ,TIM8_CH1N ,SPI1_SCK ,SPI3_SCK /I2S3_CK ,USART2_TX ,,,TIM3_ETR ,,,,,EVENT OUT
10,PB4 ,NJTRST ,TIM16_CH1 ,TIM3_CH1 ,TSC_G5_IO2 ,TIM8_CH2N ,SPI1_MISO ,SPI3_MISO/ I2S3ext_SD ,USART2_RX ,,,TIM17_BKIN ,,,,,EVENT OUT
9,PB5 ,,TIM16_BKIN ,TIM3_CH2 ,TIM8_CH3N ,I2C1_SMBA ,SPI1_MOSI ,SPI3_MOSI/ I2S3_SD ,USART2_CK ,,,TIM17_CH1 ,,,,,EVENT OUT
9,PB6 ,,TIM16_CH1N ,TIM4_CH1 ,TSC_G5_IO3 ,I2C1_SCL ,TIM8_CH1 ,TIM8_ETR ,USART1_TX ,,,TIM8_BKIN2 ,,,,,EVENT OUT
8,PB7 ,,TIM17_CH1N ,TIM4_CH2 ,TSC_G5_IO4 ,I2C1_SDA ,TIM8_BKIN ,,USART1_RX ,,,TIM3_CH4 ,,,,,EVENT OUT
10,PB8 ,,TIM16_CH1 ,TIM4_CH3 ,TSC_SYNC ,I2C1_SCL ,,,,COMP1_OUT ,CAN_RX ,TIM8_CH2 ,TIM1_BKIN ,,,,EVENT OUT
9,PB9 ,,TIM17_CH1 ,TIM4_CH4 ,,I2C1_SDA ,,IR_OUT ,,COMP2_OUT ,CAN_TX ,TIM8_CH3 ,,,,,EVENT OUT
4,PB10 ,,TIM2_CH3 ,,TSC_SYNC ,,,,USART3_TX ,,,,,,,,EVENT OUT
4,PB11 ,,TIM2_CH4 ,,TSC_G6_IO1 ,,,,USART3_RX ,,,,,,,,EVENT OUT
6,PB12 ,,,,TSC_G6_IO2 ,I2C2_SMBA ,SPI2_NSS/ I2S2_WS ,TIM1_BKIN ,USART3_CK ,,,,,,,,EVENT OUT
AF n° ,& Pin ,AF0 ,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,AF8 ,AF9 ,AF10 ,AF12 ,,,,AF15 ,Name ,,,,,,,,,,,,,,,,
5,PB13 ,,,,TSC_G6_IO3 ,,SPI2_SCK/ I2S2_CK ,TIM1_CH1N ,USART3_CTS ,,,,,,,,EVENT OUT
6,PB14 ,,TIM15_CH1 ,,TSC_G6_IO4 ,,SPI2_MISO/ I2S2ext_SD ,TIM1_CH2N ,USART3_RTS ,,,,,,,,EVENT OUT
5,PB15 ,,TIM15_CH2 ,TIM15_CH1N ,,TIM1_CH3N ,SPI2_MOSI/ I2S2_SD ,,,,,,,,,,EVENT OUT
AF n° ,Port & Pin Name ,,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,,,,,,,,
1,PC0 ,,EVENTOUT ,,,,,,,,,,,,,,
1,PC1 ,,EVENTOUT ,,,,,,,,,,,,,,
2,PC2 ,,EVENTOUT ,,COMP7_OUT ,,,,,,,,,,,,
2,PC3 ,,EVENTOUT ,,,,,TIM1_BKIN2 ,,,,,,,,,
2,PC4 ,,EVENTOUT ,,,,,,USART1_TX ,,,,,,,,
3,PC5 ,,EVENTOUT ,,TSC_G3_IO1 ,,,,USART1_RX ,,,,,,,,
5,PC6 ,,EVENTOUT ,TIM3_CH1 ,,TIM8_CH1 ,,I2S2_MCK ,COMP6_OUT ,,,,,,,,
5,PC7 ,,EVENTOUT ,TIM3_CH2 ,,TIM8_CH2 ,,I2S3_MCK ,COMP5_OUT ,,,,,,,,
4,PC8 ,,EVENTOUT ,TIM3_CH3 ,,TIM8_CH3 ,,,COMP3_OUT ,,,,,,,,
5,PC9 ,,EVENTOUT ,TIM3_CH4 ,,TIM8_CH4 ,I2S_CKIN ,TIM8_BKIN2 ,,,,,,,,,
5,PC10 ,,EVENTOUT ,,,TIM8_CH1N ,UART4_TX ,SPI3_SCK/I2S3_CK ,USART3_TX ,,,,,,,,
5,PC11 ,,EVENTOUT ,,,TIM8_CH2N ,UART4_RX ,SPI3_MISO/I2S3ext_SD ,USART3_RX ,,,,,,,,
5,PC12 ,,EVENTOUT ,,,TIM8_CH3N ,UART5_TX ,SPI3_MOSI/I2S3_SD ,USART3_CK ,,,,,,,,
,PC13 ,,,,,TIM1_CH1N ,,,,,,,,,,,
,PC14 ,,,,,,,,,,,,,,,,
,PC15 ,,,,,,,,,,,,,,,,
AF n° ,Port & Pin Name ,AF1 ,AF2 ,AF3 ,AF1 ,AF5 ,AF6 ,AF7 ,,,,,,,,,
2,PD0 ,EVENTOUT ,,,,,,CAN_RX ,,,,,,,,,
4,PD1 ,EVENTOUT ,,,TIM8_CH4 ,,TIM8_BKIN2 ,CAN_TX ,,,,,,,,,
4,PD2 ,EVENTOUT ,TIM3_ETR ,,TIM8_BKIN ,UART5_RX ,,,,,,,,,,,
3,PD3 ,EVENTOUT ,TIM2_CH1_ETR ,,,,,USART2_CTS ,,,,,,,,,
3,PD4 ,EVENTOUT ,TIM2_CH2 ,,,,,USART2_RTS ,,,,,,,,,
2,PD5 ,EVENTOUT ,,,,,,USART2_TX ,,,,,,,,,
3,PD6 ,EVENTOUT ,TIM2_CH4 ,,,,,USART2_RX ,,,,,,,,,
3,PD7 ,EVENTOUT ,TIM2_CH3 ,,,,,USART2_CK ,,,,,,,,,
2,PD8 ,EVENTOUT ,,,,,,USART3_TX ,,,,,,,,,
2,PD9 ,EVENTOUT ,,,,,,USART3_RX ,,,,,,,,,
2,PD10 ,EVENTOUT ,,,,,,USART3_CK ,,,,,,,,,
2,PD11 ,EVENTOUT ,,,,,,USART3_CTS ,,,,,,,,,
4,PD12 ,EVENTOUT ,TIM4_CH1 ,TSC_G8_IO1 ,,,,USART3_RTS ,,,,,,,,,
3,PD13 ,EVENTOUT ,TIM4_CH2 ,TSC_G8_IO2 ,,,,,,,,,,,,,
3,PD14 ,EVENTOUT ,TIM4_CH3 ,TSC_G8_IO3 ,,,,,,,,,,,,,
4,PD15 ,EVENTOUT ,TIM4_CH4 ,TSC_G8_IO4 ,,,SPI2_NSS ,,,,,,,,,,
AF n° ,Port & Pin Name ,AF0 ,AF1 ,AF2 ,AF3 ,AF4 ,AF6 ,AF7 ,,,,,,,,,
4,PE0 ,,EVENTOUT ,TIM4_ETR ,,TIM16_CH1 ,,USART1_TX ,,,,,,,,,
3,PE1 ,,EVENTOUT ,,,TIM17_CH1 ,,USART1_RX ,,,,,,,,,
4,PE2 ,TRACECK ,EVENTOUT ,TIM3_CH1 ,TSC_G7_IO1 ,,,,,,,,,,,,
4,PE3 ,TRACED0 ,EVENTOUT ,TIM3_CH2 ,TSC_G7_IO2 ,,,,,,,,,,,,
4,PE4 ,TRACED1 ,EVENTOUT ,TIM3_CH3 ,TSC_G7_IO3 ,,,,,,,,,,,,
4,PE5 ,TRACED2 ,EVENTOUT ,TIM3_CH4 ,TSC_G7_IO4 ,,,,,,,,,,,,
2,PE6 ,TRACED3 ,EVENTOUT ,,,,,,,,,,,,,,
2,PE7 ,,EVENTOUT ,TIM1_ETR ,,,,,,,,,,,,,
2,PE8 ,,EVENTOUT ,TIM1_CH1N ,,,,,,,,,,,,,
2,PE9 ,,EVENTOUT ,TIM1_CH1 ,,,,,,,,,,,,,
2,PE10 ,,EVENTOUT ,TIM1_CH2N ,,,,,,,,,,,,,
2,PE11 ,,EVENTOUT ,TIM1_CH2 ,,,,,,,,,,,,,
2,PE12 ,,EVENTOUT ,TIM1_CH3N ,,,,,,,,,,,,,
2,PE13 ,,EVENTOUT ,TIM1_CH3 ,,,,,,,,,,,,,
3,PE14 ,,EVENTOUT ,TIM1_CH4 ,,,TIM1_BKIN2 ,,,,,,,,,,
3,PE15 ,,EVENTOUT ,TIM1_BKIN ,,,,USART3_RX ,,,,,,,,,
AF n° ,Port & Pin Name ,,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,,,,,,,,
2,PF0 ,,,,,I2C2_SDA ,,TIM1_CH3N ,,,,,,,,,
1,PF1 ,,,,,I2C2_SCL ,,,,,,,,,,,
1,PF2 ,,EVENTOUT ,,,,,,,,,,,,,,
2,PF4 ,,EVENTOUT ,COMP1_OUT ,,,,,,,,,,,,,
4,PF6 ,,EVENTOUT ,TIM4_CH4 ,,I2C2_SCL ,,,USART3_RTS ,,,,,,,,
3,PF9 ,,EVENTOUT ,,TIM15_CH1 ,,SPI2_SCK ,,,,,,,,,,
3,PF10 ,,EVENTOUT ,,TIM15_CH2 ,,SPI2_SCK ,,,,,,,,,,
1 AF n° ,Port & Pin ,AF0 ,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,AF8 ,AF9 ,AF10 ,AF11 ,AF12 ,AF13,AF14 ,AF15 ,Name ,,,,,,,,,,,,,,,,
2 7,PA0 ,,TIM2_CH1_ETR ,,TSC_G1_IO1 ,,,,USART2_CTS ,COMP1_OUT ,TIM8_BKIN ,TIM8_ETR ,,,,,EVENT OUT
3 5,PA1 ,,TIM2_CH2 ,,TSC_G1_IO2 ,,,,USART2_RTS ,,TIM15_CH1N ,,,,,,EVENT OUT
4 6,PA2 ,,TIM2_CH3 ,,TSC_G1_IO3 ,,,,USART2_TX ,COMP2_OUT ,TIM15_CH1 ,,,,,,EVENT OUT
5 5,PA3 ,,TIM2_CH4 ,,TSC_G1_IO4 ,,,,USART2_RX ,,TIM15_CH2 ,,,,,,EVENT OUT ,,,,,,,,SPI3_,,,,,,,,,
6 6,PA4 ,,,TIM3_CH2 ,TSC_G2_IO1 ,,SPI1_NSS ,NSS/ I2S3_,USART2_CK ,,,,,,,,EVENT OUT ,,,,,,,,WS ,,,,,,,,,
7 4,PA5 ,,TIM2_CH1_ETR ,,TSC_G2_IO2 ,,SPI1_SCK ,,,,,,,,,,EVENT OUT
8 8,PA6 ,,TIM16_CH1 ,TIM3_CH1 ,TSC_G2_IO3 ,TIM8_BKIN ,SPI1_MISO ,TIM1_BKIN ,,COMP1_OUT ,,,,,,,EVENT OUT
9 8,PA7 ,,TIM17_CH1 ,TIM3_CH2 ,TSC_G2_IO4 ,TIM8_CH1N ,SPI1_MOSI ,TIM1_CH1N ,,COMP2_OUT ,,,,,,,EVENT OUT
10 8,PA8 ,MCO ,,,,I2C2_SMBA ,I2S2_MCK ,TIM1_CH1 ,USART1_CK ,COMP3_OUT ,,TIM4_ETR ,,,,,EVENT OUT
11 9,PA9 ,,,,TSC_G4_IO1 ,I2C2_SCL ,I2S3_MCK ,TIM1_CH2 ,USART1_TX ,COMP5_OUT ,TIM15_BKIN ,TIM2_CH3 ,,,,,EVENT OUT
12 9,PA10 ,,TIM17_BKIN ,,TSC_G4_IO2 ,I2C2_SDA ,,TIM1_CH3 ,USART1_RX ,COMP6_OUT ,,TIM2_CH4 ,TIM8_BKIN ,,,,EVENT OUT
13 9,PA11 ,,,,,,,TIM1_CH1N ,USART1_CTS ,COMP1_OUT ,CAN_RX ,TIM4_CH1 ,TIM1_CH4 ,TIM1_BKIN2 ,,USBDM ,EVENT OUT
14 9,PA12 ,,TIM16_CH1 ,,,,,TIM1_CH2N ,USART1_RTS ,COMP2_OUT ,CAN_TX ,TIM4_CH2 ,TIM1_ETR ,,,USBDP ,EVENT OUT
15 7,PA13 ,SWDAT-JTMS ,TIM16_CH1N ,,TSC_G4_IO3 ,,IR_OUT ,,USART3_CTS ,,,TIM4_CH3 ,,,,,EVENT OUT
16 7,PA14 ,SWCLK-JTCK ,,,TSC_G4_IO4 ,I2C1_SDA ,TIM8_CH2 ,TIM1_BKIN ,USART2_TX ,,,,,,,,EVENT OUT
17 9,PA15 ,JTDI ,TIM2_CH1_ETR ,TIM8_CH1 ,,I2C1_SCL ,SPI1_NSS ,SPI3_NSS/ I2S3_WS ,USART2_RX ,,TIM1_BKIN ,,,,,,EVENT OUT ,Port ,,,,,,,,,,,,,,,,
18 AF n° ,& Pin ,AF0 ,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,AF8 ,AF9 ,AF10 ,AF12 ,,,,AF15 ,Name ,,,,,,,,,,,,,,,,
19 5,PB0 ,,,TIM3_CH3 ,TSC_G3_IO2 ,TIM8_CH2N ,,TIM1_CH2N ,,,,,,,,,EVENT OUT
20 6,PB1 ,,,TIM3_CH4 ,TSC_G3_IO3 ,TIM8_CH3N ,,TIM1_CH3N ,,COMP4_OUT ,,,,,,,EVENT OUT
21 2,PB2 ,,,,TSC_G3_IO4 ,,,,,,,,,,,,EVENT OUT
22 10,PB3 ,JTDO-TRACE SWO ,TIM2_CH2 ,TIM4_ETR ,TSC_G5_IO1 ,TIM8_CH1N ,SPI1_SCK ,SPI3_SCK /I2S3_CK ,USART2_TX ,,,TIM3_ETR ,,,,,EVENT OUT
23 10,PB4 ,NJTRST ,TIM16_CH1 ,TIM3_CH1 ,TSC_G5_IO2 ,TIM8_CH2N ,SPI1_MISO ,SPI3_MISO/ I2S3ext_SD ,USART2_RX ,,,TIM17_BKIN ,,,,,EVENT OUT
24 9,PB5 ,,TIM16_BKIN ,TIM3_CH2 ,TIM8_CH3N ,I2C1_SMBA ,SPI1_MOSI ,SPI3_MOSI/ I2S3_SD ,USART2_CK ,,,TIM17_CH1 ,,,,,EVENT OUT
25 9,PB6 ,,TIM16_CH1N ,TIM4_CH1 ,TSC_G5_IO3 ,I2C1_SCL ,TIM8_CH1 ,TIM8_ETR ,USART1_TX ,,,TIM8_BKIN2 ,,,,,EVENT OUT
26 8,PB7 ,,TIM17_CH1N ,TIM4_CH2 ,TSC_G5_IO4 ,I2C1_SDA ,TIM8_BKIN ,,USART1_RX ,,,TIM3_CH4 ,,,,,EVENT OUT
27 10,PB8 ,,TIM16_CH1 ,TIM4_CH3 ,TSC_SYNC ,I2C1_SCL ,,,,COMP1_OUT ,CAN_RX ,TIM8_CH2 ,TIM1_BKIN ,,,,EVENT OUT
28 9,PB9 ,,TIM17_CH1 ,TIM4_CH4 ,,I2C1_SDA ,,IR_OUT ,,COMP2_OUT ,CAN_TX ,TIM8_CH3 ,,,,,EVENT OUT
29 4,PB10 ,,TIM2_CH3 ,,TSC_SYNC ,,,,USART3_TX ,,,,,,,,EVENT OUT
30 4,PB11 ,,TIM2_CH4 ,,TSC_G6_IO1 ,,,,USART3_RX ,,,,,,,,EVENT OUT
31 6,PB12 ,,,,TSC_G6_IO2 ,I2C2_SMBA ,SPI2_NSS/ I2S2_WS ,TIM1_BKIN ,USART3_CK ,,,,,,,,EVENT OUT
32 AF n° ,& Pin ,AF0 ,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,AF8 ,AF9 ,AF10 ,AF12 ,,,,AF15 ,Name ,,,,,,,,,,,,,,,,
33 5,PB13 ,,,,TSC_G6_IO3 ,,SPI2_SCK/ I2S2_CK ,TIM1_CH1N ,USART3_CTS ,,,,,,,,EVENT OUT
34 6,PB14 ,,TIM15_CH1 ,,TSC_G6_IO4 ,,SPI2_MISO/ I2S2ext_SD ,TIM1_CH2N ,USART3_RTS ,,,,,,,,EVENT OUT
35 5,PB15 ,,TIM15_CH2 ,TIM15_CH1N ,,TIM1_CH3N ,SPI2_MOSI/ I2S2_SD ,,,,,,,,,,EVENT OUT
36 AF n° ,Port & Pin Name ,,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,,,,,,,,
37 1,PC0 ,,EVENTOUT ,,,,,,,,,,,,,,
38 1,PC1 ,,EVENTOUT ,,,,,,,,,,,,,,
39 2,PC2 ,,EVENTOUT ,,COMP7_OUT ,,,,,,,,,,,,
40 2,PC3 ,,EVENTOUT ,,,,,TIM1_BKIN2 ,,,,,,,,,
41 2,PC4 ,,EVENTOUT ,,,,,,USART1_TX ,,,,,,,,
42 3,PC5 ,,EVENTOUT ,,TSC_G3_IO1 ,,,,USART1_RX ,,,,,,,,
43 5,PC6 ,,EVENTOUT ,TIM3_CH1 ,,TIM8_CH1 ,,I2S2_MCK ,COMP6_OUT ,,,,,,,,
44 5,PC7 ,,EVENTOUT ,TIM3_CH2 ,,TIM8_CH2 ,,I2S3_MCK ,COMP5_OUT ,,,,,,,,
45 4,PC8 ,,EVENTOUT ,TIM3_CH3 ,,TIM8_CH3 ,,,COMP3_OUT ,,,,,,,,
46 5,PC9 ,,EVENTOUT ,TIM3_CH4 ,,TIM8_CH4 ,I2S_CKIN ,TIM8_BKIN2 ,,,,,,,,,
47 5,PC10 ,,EVENTOUT ,,,TIM8_CH1N ,UART4_TX ,SPI3_SCK/I2S3_CK ,USART3_TX ,,,,,,,,
48 5,PC11 ,,EVENTOUT ,,,TIM8_CH2N ,UART4_RX ,SPI3_MISO/I2S3ext_SD ,USART3_RX ,,,,,,,,
49 5,PC12 ,,EVENTOUT ,,,TIM8_CH3N ,UART5_TX ,SPI3_MOSI/I2S3_SD ,USART3_CK ,,,,,,,,
50 ,PC13 ,,,,,TIM1_CH1N ,,,,,,,,,,,
51 ,PC14 ,,,,,,,,,,,,,,,,
52 ,PC15 ,,,,,,,,,,,,,,,,
53 AF n° ,Port & Pin Name ,AF1 ,AF2 ,AF3 ,AF1 ,AF5 ,AF6 ,AF7 ,,,,,,,,,
54 2,PD0 ,EVENTOUT ,,,,,,CAN_RX ,,,,,,,,,
55 4,PD1 ,EVENTOUT ,,,TIM8_CH4 ,,TIM8_BKIN2 ,CAN_TX ,,,,,,,,,
56 4,PD2 ,EVENTOUT ,TIM3_ETR ,,TIM8_BKIN ,UART5_RX ,,,,,,,,,,,
57 3,PD3 ,EVENTOUT ,TIM2_CH1_ETR ,,,,,USART2_CTS ,,,,,,,,,
58 3,PD4 ,EVENTOUT ,TIM2_CH2 ,,,,,USART2_RTS ,,,,,,,,,
59 2,PD5 ,EVENTOUT ,,,,,,USART2_TX ,,,,,,,,,
60 3,PD6 ,EVENTOUT ,TIM2_CH4 ,,,,,USART2_RX ,,,,,,,,,
61 3,PD7 ,EVENTOUT ,TIM2_CH3 ,,,,,USART2_CK ,,,,,,,,,
62 2,PD8 ,EVENTOUT ,,,,,,USART3_TX ,,,,,,,,,
63 2,PD9 ,EVENTOUT ,,,,,,USART3_RX ,,,,,,,,,
64 2,PD10 ,EVENTOUT ,,,,,,USART3_CK ,,,,,,,,,
65 2,PD11 ,EVENTOUT ,,,,,,USART3_CTS ,,,,,,,,,
66 4,PD12 ,EVENTOUT ,TIM4_CH1 ,TSC_G8_IO1 ,,,,USART3_RTS ,,,,,,,,,
67 3,PD13 ,EVENTOUT ,TIM4_CH2 ,TSC_G8_IO2 ,,,,,,,,,,,,,
68 3,PD14 ,EVENTOUT ,TIM4_CH3 ,TSC_G8_IO3 ,,,,,,,,,,,,,
69 4,PD15 ,EVENTOUT ,TIM4_CH4 ,TSC_G8_IO4 ,,,SPI2_NSS ,,,,,,,,,,
70 AF n° ,Port & Pin Name ,AF0 ,AF1 ,AF2 ,AF3 ,AF4 ,AF6 ,AF7 ,,,,,,,,,
71 4,PE0 ,,EVENTOUT ,TIM4_ETR ,,TIM16_CH1 ,,USART1_TX ,,,,,,,,,
72 3,PE1 ,,EVENTOUT ,,,TIM17_CH1 ,,USART1_RX ,,,,,,,,,
73 4,PE2 ,TRACECK ,EVENTOUT ,TIM3_CH1 ,TSC_G7_IO1 ,,,,,,,,,,,,
74 4,PE3 ,TRACED0 ,EVENTOUT ,TIM3_CH2 ,TSC_G7_IO2 ,,,,,,,,,,,,
75 4,PE4 ,TRACED1 ,EVENTOUT ,TIM3_CH3 ,TSC_G7_IO3 ,,,,,,,,,,,,
76 4,PE5 ,TRACED2 ,EVENTOUT ,TIM3_CH4 ,TSC_G7_IO4 ,,,,,,,,,,,,
77 2,PE6 ,TRACED3 ,EVENTOUT ,,,,,,,,,,,,,,
78 2,PE7 ,,EVENTOUT ,TIM1_ETR ,,,,,,,,,,,,,
79 2,PE8 ,,EVENTOUT ,TIM1_CH1N ,,,,,,,,,,,,,
80 2,PE9 ,,EVENTOUT ,TIM1_CH1 ,,,,,,,,,,,,,
81 2,PE10 ,,EVENTOUT ,TIM1_CH2N ,,,,,,,,,,,,,
82 2,PE11 ,,EVENTOUT ,TIM1_CH2 ,,,,,,,,,,,,,
83 2,PE12 ,,EVENTOUT ,TIM1_CH3N ,,,,,,,,,,,,,
84 2,PE13 ,,EVENTOUT ,TIM1_CH3 ,,,,,,,,,,,,,
85 3,PE14 ,,EVENTOUT ,TIM1_CH4 ,,,TIM1_BKIN2 ,,,,,,,,,,
86 3,PE15 ,,EVENTOUT ,TIM1_BKIN ,,,,USART3_RX ,,,,,,,,,
87 AF n° ,Port & Pin Name ,,AF1 ,AF2 ,AF3 ,AF4 ,AF5 ,AF6 ,AF7 ,,,,,,,,
88 2,PF0 ,,,,,I2C2_SDA ,,TIM1_CH3N ,,,,,,,,,
89 1,PF1 ,,,,,I2C2_SCL ,,,,,,,,,,,
90 1,PF2 ,,EVENTOUT ,,,,,,,,,,,,,,
91 2,PF4 ,,EVENTOUT ,COMP1_OUT ,,,,,,,,,,,,,
92 4,PF6 ,,EVENTOUT ,TIM4_CH4 ,,I2C2_SCL ,,,USART3_RTS ,,,,,,,,
93 3,PF9 ,,EVENTOUT ,,TIM15_CH1 ,,SPI2_SCK ,,,,,,,,,,
94 3,PF10 ,,EVENTOUT ,,TIM15_CH2 ,,SPI2_SCK ,,,,,,,,,,

Binary file not shown.

View File

@ -0,0 +1,180 @@
LQFP64,WLCSP90,LQFP100,LQFP144,UFBGA176,LQFP176,Name,Type,IO,Alternate,Additional
0,0,1,1,A2,1,PE2,I/O,FT,TRACECLK/FSMC_A23/ETH_MII_TXD3/EVENTOUT,
0,0,2,2,A1,2,PE3,I/O,FT,TRACED0/FSMC_A19/EVENTOUT,
0,0,3,3,B1,3,PE4,I/O,FT,TRACED1/FSMC_A20/DCMI_D4/EVENTOUT,
0,0,4,4,B2,4,PE5,I/O,FT,TRACED2/FSMC_A21/TIM9_CH1/DCMI_D6/EVENTOUT,
0,0,5,5,B3,5,PE6,I/O,FT,TRACED3/FSMC_A22/TIM9_CH2/DCMI_D7/EVENTOUT,
1,A10,6,6,C1,6,VBAT,S,,,
0,0,0,0,D2,7,PI8,I/O,FT,EVENTOUT,RTC_AF2
2,A9,7,7,D1,8,PC13,I/O,FT,EVENTOUT,RTC_AF1
3,B10,8,8,E1,9,PC14-OSC32_IN(PC14),I/O,FT,EVENTOUT,OSC32_IN(4)
4,B9,9,9,F1,10,PC15-OSC32_OUT(PC15),I/O,FT,EVENTOUT,OSC32_OUT(4)
0,0,0,0,D3,11,PI9,I/O,FT,CAN1_RX/EVENTOUT,
0,0,0,0,E3,12,PI10,I/O,FT,ETH_MII_RX_ER/EVENTOUT,
0,0,0,0,E4,13,PI11,I/O,FT,OTG_HS_ULPI_DIR/EVENTOUT,
0,0,0,0,F2,14,VSS,S,,,
0,0,0,0,F3,15,VDD,S,,,
0,0,0,10,E2,16,PF0,I/O,FT,FSMC_A0/I2C2_SDA/EVENTOUT,
0,0,0,11,H3,17,PF1,I/O,FT,FSMC_A1/I2C2_SCL/EVENTOUT,
0,0,0,12,H2,18,PF2,I/O,FT,FSMC_A2/I2C2_SMBA/EVENTOUT,
0,0,0,13,J2,19,PF3,I/O,FT,FSMC_A3/EVENTOUT,ADC3_IN9
0,0,0,14,J3,20,PF4,I/O,FT,FSMC_A4/EVENTOUT,ADC3_IN14
0,0,0,15,K3,21,PF5,I/O,FT,FSMC_A5/EVENTOUT,ADC3_IN15
0,C9,10,16,G2,22,VSS,S,,,
0,B8,11,17,G3,23,VDD,S,,,
0,0,0,18,K2,24,PF6,I/O,FT,TIM10_CH1/FSMC_NIORD/EVENTOUT,ADC3_IN4
0,0,0,19,K1,25,PF7,I/O,FT,TIM11_CH1/FSMC_NREG/EVENTOUT,ADC3_IN5
0,0,0,20,L3,26,PF8,I/O,FT,TIM13_CH1/FSMC_NIOWR/EVENTOUT,ADC3_IN6
0,0,0,21,L2,27,PF9,I/O,FT,TIM14_CH1/FSMC_CD/EVENTOUT,ADC3_IN7
0,0,0,22,L1,28,PF10,I/O,FT,FSMC_INTR/EVENTOUT,ADC3_IN8
5,F10,12,23,G1,29,PH0-OSC_IN(PH0),I/O,FT,EVENTOUT,OSC_IN(4)
6,F9,13,24,H1,30,PH1-OSC_OUT(PH1),I/O,FT,EVENTOUT,OSC_OUT(4)
7,G10,14,25,J1,31,NRST,I/O,RST,,
8,E10,15,26,M2,32,PC0,I/O,FT,OTG_HS_ULPI_STP/EVENTOUT,ADC123_IN10
9,0,16,27,M3,33,PC1,I/O,FT,ETH_MDC/EVENTOUT,ADC123_IN11
10,D10,17,28,M4,34,PC2,I/O,FT,SPI2_MISO/OTG_HS_ULPI_DIR/TH_MII_TXD2/I2S2ext_SD/EVENTOUT,ADC123_IN12
11,E9,18,29,M5,35,PC3,I/O,FT,SPI2_MOSI/I2S2_SD/OTG_HS_ULPI_NXT/ETH_MII_TX_CLK/EVENTOUT,ADC123_IN13
0,0,19,30,G3,36,VDD,S,,,
12,H10,20,31,M1,37,VSSA,S,,,
0,0,0,0,N1,0,VREFΓÇô,S,,,
0,0,21,32,P1,38,VREF+,S,,,
13,G9,22,33,R1,39,VDDA,S,,,
14,C10,23,34,N3,40,PA0-WKUP(PA0),I/O,FT,USART2_CTS/UART4_TX/ETH_MII_CRS/TIM2_CH1_ETR/TIM5_CH1/TIM8_ETR/EVENTOUT,ADC123_IN0/WKUP(4)
15,F8,24,35,N2,41,PA1,I/O,FT,USART2_RTS/UART4_RX/ETH_RMII_REF_CLK/ETH_MII_RX_CLK/TIM5_CH2/TIM2_CH2/EVENTOUT,ADC123_IN1
16,J10,25,36,P2,42,PA2,I/O,FT,USART2_TX/TIM5_CH3/TIM9_CH1/TIM2_CH3/ETH_MDIO/EVENTOUT,ADC123_IN2
0,0,0,0,F4,43,PH2,I/O,FT,ETH_MII_CRS/EVENTOUT,
0,0,0,0,G4,44,PH3,I/O,FT,ETH_MII_COL/EVENTOUT,
0,0,0,0,H4,45,PH4,I/O,FT,I2C2_SCL/OTG_HS_ULPI_NXT/EVENTOUT,
0,0,0,0,J4,46,PH5,I/O,FT,I2C2_SDA/EVENTOUT,
17,H9,26,37,R2,47,PA3,I/O,FT,USART2_RX/TIM5_CH4/TIM9_CH2/TIM2_CH4/OTG_HS_ULPI_D0/ETH_MII_COL/EVENTOUT,ADC123_IN3
18,E5,27,38,0,48,VSS,S,,,
,D9,,,L4,0,BYPASS_REG,I,FT,,
19,E4,28,39,K4,49,VDD,S,,,
20,J9,29,40,N4,50,PA4,I/O,TC,SPI1_NSS/SPI3_NSS/USART2_CK/DCMI_HSYNC/OTG_HS_SOF/I2S3_WS/EVENTOUT,ADC12_IN4/DAC1_OUT
21,G8,30,41,P4,51,PA5,I/O,TC,SPI1_SCK/OTG_HS_ULPI_CK/TIM2_CH1_ETR/TIM8_CHIN/EVENTOUT,ADC12_IN5/DAC2_OUT
22,H8,31,42,P3,52,PA6,I/O,FT,SPI1_MISO/TIM8_BKIN/TIM13_CH1/DCMI_PIXCLK/TIM3_CH1/TIM1_BKIN/EVENTOUT,ADC12_IN6
23,J8,32,43,R3,53,PA7,I/O,FT,SPI1_MOSI/TIM8_CH1N/TIM14_CH1/TIM3_CH2/ETH_MII_RX_DV/TIM1_CH1N/RMII_CRS_DV/EVENTOUT,ADC12_IN7
24,0,33,44,N5,54,PC4,I/O,FT,ETH_RMII_RX_D0/ETH_MII_RX_D0/EVENTOUT,ADC12_IN14
25,0,34,45,P5,55,PC5,I/O,FT,ETH_RMII_RX_D1/ETH_MII_RX_D1/EVENTOUT,ADC12_IN15
26,G7,35,46,R5,56,PB0,I/O,FT,TIM3_CH3/TIM8_CH2N/OTG_HS_ULPI_D1/ETH_MII_RXD2/TIM1_CH2N/EVENTOUT,ADC12_IN8
27,H7,36,47,R4,57,PB1,I/O,FT,TIM3_CH4/TIM8_CH3N/OTG_HS_ULPI_D2/ETH_MII_RXD3/TIM1_CH3N/EVENTOUT,ADC12_IN9
28,J7,37,48,M6,58,PB2-BOOT1(PB2),I/O,FT,EVENTOUT,
0,0,0,49,R6,59,PF11,I/O,FT,DCMI_12/EVENTOUT,
0,0,0,50,P6,60,PF12,I/O,FT,FSMC_A6/EVENTOUT,
0,0,0,51,M8,61,VSS,S,,,
0,0,0,52,N8,62,VDD,S,,,
0,0,0,53,N6,63,PF13,I/O,FT,FSMC_A7/EVENTOUT,
0,0,0,54,R7,64,PF14,I/O,FT,FSMC_A8/EVENTOUT,
0,0,0,55,P7,65,PF15,I/O,FT,FSMC_A9/EVENTOUT,
0,0,0,56,N7,66,PG0,I/O,FT,FSMC_A10/EVENTOUT,
0,0,0,57,M7,67,PG1,I/O,FT,FSMC_A11/EVENTOUT,
0,G6,38,58,R8,68,PE7,I/O,FT,FSMC_D4/TIM1_ETR/EVENTOUT,
0,H6,39,59,P8,69,PE8,I/O,FT,FSMC_D5/TIM1_CH1N/EVENTOUT,
0,J6,40,60,P9,70,PE9,I/O,FT,FSMC_D6/TIM1_CH1/EVENTOUT,
0,0,0,61,M9,71,VSS,S,,,
0,0,0,62,N9,72,VDD,S,,,
0,F6,41,63,R9,73,PE10,I/O,FT,FSMC_D7/TIM1_CH2N/EVENTOUT,
0,J5,42,64,P10,74,PE11,I/O,FT,FSMC_D8/TIM1_CH2/EVENTOUT,
0,H5,43,65,R10,75,PE12,I/O,FT,FSMC_D9/TIM1_CH3N/EVENTOUT,
0,G5,44,66,N11,76,PE13,I/O,FT,FSMC_D10/TIM1_CH3/EVENTOUT,
0,F5,45,67,P11,77,PE14,I/O,FT,FSMC_D11/TIM1_CH4/EVENTOUT,
0,G4,46,68,R11,78,PE15,I/O,FT,FSMC_D12/TIM1_BKIN/EVENTOUT,
29,H4,47,69,R12,79,PB10,I/O,FT,SPI2_SCK/I2S2_CK/I2C2_SCL/USART3_TX/OTG_HS_ULPI_D3/ETH_MII_RX_ER/TIM2_CH3/EVENTOUT,
30,J4,48,70,R13,80,PB11,I/O,FT,I2C2_SDA/USART3_RX/OTG_HS_ULPI_D4/ETH_RMII_TX_EN/ETH_MII_TX_EN/TIM2_CH4/EVENTOUT,
31,F4,49,71,M10,81,VCAP_1,S,,,
32,0,50,72,N10,82,VDD,S,,,
0,0,0,0,M11,83,PH6,I/O,FT,I2C2_SMBA/TIM12_CH1/ETH_MII_RXD2/EVENTOUT,
0,0,0,0,N12,84,PH7,I/O,FT,I2C3_SCL/ETH_MII_RXD3/EVENTOUT,
0,0,0,0,M12,85,PH8,I/O,FT,I2C3_SDA/DCMI_HSYNC/EVENTOUT,
0,0,0,0,M13,86,PH9,I/O,FT,I2C3_SMBA/TIM12_CH2/DCMI_D0/EVENTOUT,
0,0,0,0,L13,87,PH10,I/O,FT,TIM5_CH1/DCMI_D1/EVENTOUT,
0,0,0,0,L12,88,PH11,I/O,FT,TIM5_CH2/DCMI_D2/EVENTOUT,
0,0,0,0,K12,89,PH12,I/O,FT,TIM5_CH3/DCMI_D3/EVENTOUT,
0,0,0,0,H12,90,VSS,S,,,
0,0,0,0,J12,91,VDD,S,,,
33,J3,51,73,P12,92,PB12,I/O,FT,SPI2_NSS/I2S2_WS/I2C2_SMBA/USART3_CK/TIM1_BKIN/CAN2_RX/OTG_HS_ULPI_D5/ETH_RMII_TXD0/ETH_MII_TXD0/OTG_HS_ID/EVENTOUT,
34,J1,52,74,P13,93,PB13,I/O,FT,SPI2_SCK/I2S2_CK/USART3_CTS/TIM1_CH1N/CAN2_TX/OTG_HS_ULPI_D6/ETH_RMII_TXD1/ETH_MII_TXD1/EVENTOUT,OTG_HS_VBUS
35,J2,53,75,R14,94,PB14,I/O,FT,SPI2_MISO/TIM1_CH2N/TIM12_CH1/OTG_HS_DM/USART3_RTS/TIM8_CH2N/I2S2ext_SD/EVENTOUT,
36,H1,54,76,R15,95,PB15,I/O,FT,SPI2_MOSI/I2S2_SD/TIM1_CH3N/TIM8_CH3N/TIM12_CH2/OTG_HS_DP/EVENTOUT,
0,H2,55,77,P15,96,PD8,I/O,FT,FSMC_D13/USART3_TX/EVENTOUT,
0,H3,56,78,P14,97,PD9,I/O,FT,FSMC_D14/USART3_RX/EVENTOUT,
0,G3,57,79,N15,98,PD10,I/O,FT,FSMC_D15/USART3_CK/EVENTOUT,
0,G1,58,80,N14,99,PD11,I/O,FT,FSMC_CLE/FSMC_A16/USART3_CTS/EVENTOUT,
0,G2,59,81,N13,100,PD12,I/O,FT,FSMC_ALE/FSMC_A17/TIM4_CH1/USART3_RTS/EVENTOUT,
0,0,60,82,M15,101,PD13,I/O,FT,FSMC_A18/TIM4_CH2/EVENTOUT,
0,0,0,83,0,102,VSS,S,,,
0,0,0,84,J13,103,VDD,S,,,
0,F2,61,85,M14,104,PD14,I/O,FT,FSMC_D0/TIM4_CH3/EVENTOUT/EVENTOUT,
0,F1,62,86,L14,105,PD15,I/O,FT,FSMC_D1/TIM4_CH4/EVENTOUT,
0,0,0,87,L15,106,PG2,I/O,FT,FSMC_A12/EVENTOUT,
0,0,0,88,K15,107,PG3,I/O,FT,FSMC_A13/EVENTOUT,
0,0,0,89,K14,108,PG4,I/O,FT,FSMC_A14/EVENTOUT,
0,0,0,90,K13,109,PG5,I/O,FT,FSMC_A15/EVENTOUT,
0,0,0,91,J15,110,PG6,I/O,FT,FSMC_INT2/EVENTOUT,
0,0,0,92,J14,111,PG7,I/O,FT,FSMC_INT3/USART6_CK/EVENTOUT,
0,0,0,93,H14,112,PG8,I/O,FT,USART6_RTS/ETH_PPS_OUT/EVENTOUT,
0,0,0,94,G12,113,VSS,S,,,
0,0,0,95,H13,114,VDD,S,,,
37,F3,63,96,H15,115,PC6,I/O,FT,I2S2_MCK/TIM8_CH1/SDIO_D6/USART6_TX/DCMI_D0/TIM3_CH1/EVENTOUT,
38,E1,64,97,G15,116,PC7,I/O,FT,I2S3_MCK/TIM8_CH2/SDIO_D7/USART6_RX/DCMI_D1/TIM3_CH2/EVENTOUT,
39,E2,65,98,G14,117,PC8,I/O,FT,TIM8_CH3/SDIO_D0/TIM3_CH3/USART6_CK/DCMI_D2/EVENTOUT,
40,E3,66,99,F14,118,PC9,I/O,FT,I2S_CKIN/MCO2/TIM8_CH4/SDIO_D1//I2C3_SDA/DCMI_D3/TIM3_CH4/EVENTOUT,
41,D1,67,100,F15,119,PA8,I/O,FT,MCO1/USART1_CK/TIM1_CH1/I2C3_SCL/OTG_FS_SOF/EVENTOUT,
42,D2,68,101,E15,120,PA9,I/O,FT,USART1_TX/TIM1_CH2/I2C3_SMBA/DCMI_D0/EVENTOUT,OTG_FS_VBUS
43,D3,69,102,D15,121,PA10,I/O,FT,USART1_RX/TIM1_CH3/OTG_FS_ID/DCMI_D1/EVENTOUT,
44,C1,70,103,C15,122,PA11,I/O,FT,USART1_CTS/CAN1_RX/TIM1_CH4/OTG_FS_DM/EVENTOUT,
45,C2,71,104,B15,123,PA12,I/O,FT,USART1_RTS/CAN1_TX/TIM1_ETR/OTG_FS_DP/EVENTOUT,
46,F8,72,105,A15,124,PA13(JTMS-SWDIO),I/O,FT,JTMS-SWDIO/EVENTOUT,
47,B1,73,106,F13,125,VCAP_2,S,,,
0,E7,74,107,F12,126,VSS,S,,,
48,E6,75,108,G13,127,VDD,S,,,
0,0,0,0,E12,128,PH13,I/O,FT,TIM8_CH1N/CAN1_TX/EVENTOUT,
0,0,0,0,E13,129,PH14,I/O,FT,TIM8_CH2N/DCMI_D4/EVENTOUT,
0,0,0,0,D13,130,PH15,I/O,FT,TIM8_CH3N/DCMI_D11/EVENTOUT,
0,C3,0,0,E14,131,PI0,I/O,FT,TIM5_CH4/SPI2_NSS/I2S2_WS/DCMI_D13/EVENTOUT,
0,B2,0,0,D14,132,PI1,I/O,FT,SPI2_SCK/I2S2_CK/DCMI_D8/EVENTOUT,
0,0,0,0,C14,133,PI2,I/O,FT,TIM8_CH4/SPI2_MISO/DCMI_D9/I2S2ext_SD/EVENTOUT,
0,0,0,0,C13,134,PI3,I/O,FT,TIM8_ETR/SPI2_MOSI/I2S2_SD/DCMI_D10/EVENTOUT,
0,0,0,0,D9,135,VSS,S,,,
0,0,0,0,C9,136,VDD,S,,,
49,A2,76,109,A14,137,PA14(JTCK-SWCLK),I/O,FT,JTCK-SWCLK/EVENTOUT,
50,B3,77,110,A13,138,PA15(JTDI),I/O,FT,JTDI/SPI3_NSS/I2S3_WS/TIM2_CH1_ETR/SPI1_NSS/EVENTOUT,
51,D5,78,111,B14,139,PC10,I/O,FT,SPI3_SCK/I2S3_CK/UART4_TX/SDIO_D2/DCMI_D8/USART3_TX/EVENTOUT,
52,C4,79,112,B13,140,PC11,I/O,FT,UART4_RX/SPI3_MISO/SDIO_D3/DCMI_D4/USART3_RX/I2S3ext_SD/EVENTOUT,
53,A3,80,113,A12,141,PC12,I/O,FT,UART5_TX/SDIO_CK/DCMI_D9/SPI3_MOSI/I2S3_SD/USART3_CK/EVENTOUT,
0,D6,81,114,B12,142,PD0,I/O,FT,FSMC_D2/CAN1_RX/EVENTOUT,
0,C5,82,115,C12,143,PD1,I/O,FT,FSMC_D3/CAN1_TX/EVENTOUT,
54,B4,83,116,D12,144,PD2,I/O,FT,TIM3_ETR/UART5_RX/SDIO_CMD/DCMI_D11/EVENTOUT,
0,0,84,117,D11,145,PD3,I/O,FT,FSMC_CLK/USART2_CTS/EVENTOUT,
0,A4,85,118,D10,146,PD4,I/O,FT,FSMC_NOE/USART2_RTS/EVENTOUT,
0,C6,86,119,C11,147,PD5,I/O,FT,FSMC_NWE/USART2_TX/EVENTOUT,
0,0,0,120,D8,148,VSS,S,,,
0,0,0,121,C8,149,VDD,S,,,
0,B5,87,122,B11,150,PD6,I/O,FT,FSMC_NWAIT/USART2_RX/EVENTOUT,
0,A5,88,123,A11,151,PD7,I/O,FT,USART2_CK/FSMC_NE1/FSMC_NCE2/EVENTOUT,
0,0,0,124,C10,152,PG9,I/O,FT,USART6_RX/FSMC_NE2/FSMC_NCE3/EVENTOUT,
0,0,0,125,B10,153,PG10,I/O,FT,FSMC_NCE4_1/FSMC_NE3/EVENTOUT,
0,0,0,126,B9,154,PG11,I/O,FT,FSMC_NCE4_2/ETH_MII_TX_EN/ETH,_RMII_TX_EN/EVENTOUT
0,0,0,127,B8,155,PG12,I/O,FT,FSMC_NE4/USART6_RTS/EVENTOUT,
0,0,0,128,A8,156,PG13,I/O,FT,FSMC_A24/USART6_CTS/ETH_MII_TXD0/ETH_RMII_TXD0/EVENTOUT,
0,0,0,129,A7,157,PG14,I/O,FT,FSMC_A25/USART6_TX/ETH_MII_TXD1/ETH_RMII_TXD1/EVENTOUT,
0,E8,0,130,D7,158,VSS,S,,,
0,F7,0,131,C7,159,VDD,S,,,
0,0,0,132,B7,160,PG15,I/O,FT,USART6_CTS/DCMI_D13/EVENTOUT,
55,B6,89,133,A10,161,PB3(JTDO/TRACESWO),I/O,FT,JTDO/TRACESWO/SPI3_SCK/I2S3_CK/TIM2_CH2/SPI1_SCK/EVENTOUT,
56,A6,90,134,A9,162,PB4(NJTRST),I/O,FT,NJTRST/SPI3_MISO/TIM3_CH1/SPI1_MISO/I2S3ext_SD/EVENTOUT,
57,D7,91,135,A6,163,PB5,I/O,FT,I2C1_SMBA/CAN2_RX/OTG_HS_ULPI_D7/ETH_PPS_OUT/TIM3_CH2/SPI1_MOSI/SPI3_MOSI/DCMI_D10/I2S3_SD/EVENTOUT,
58,C7,92,136,B6,164,PB6,I/O,FT,I2C1_SCL/TIM4_CH1/CAN2_TX/DCMI_D5/USART1_TX/EVENTOUT,
59,B7,93,137,B5,165,PB7,I/O,FT,I2C1_SDA/FSMC_NL/DCMI_VSYNC/USART1_RX/TIM4_CH2/EVENTOUT,
60,A7,94,138,D6,166,BOOT0,I,B,,VPP
61,D8,95,139,A5,167,PB8,I/O,FT,TIM4_CH3/SDIO_D4/TIM10_CH1/DCMI_D6/ETH_MII_TXD3/I2C1_SCL/CAN1_RX/EVENTOUT,
62,C8,96,140,B4,168,PB9,I/O,FT,SPI2_NSS/I2S2_WS/TIM4_CH4/TIM11_CH1/SDIO_D5/DCMI_D7/I2C1_SDA/CAN1_TX/EVENTOUT,
0,0,97,141,A4,169,PE0,I/O,FT,TIM4_ETR/FSMC_NBL0/DCMI_D2/EVENTOUT,
0,0,98,142,A3,170,PE1,I/O,FT,FSMC_NBL1/DCMI_D3/EVENTOUT,
63,0,99,0,D5,0,VSS,S,,,
0,A8,0,143,C6,171,PDR_ON,I,FT,,
64,A1,100,144,C5,172,VDD,S,,,
0,0,0,0,D4,173,PI4,I/O,FT,TIM8_BKIN/DCMI_D5/EVENTOUT,
0,0,0,0,C4,174,PI5,I/O,FT,TIM8_CH1/DCMI_VSYNC/EVENTOUT,
0,0,0,0,C3,175,PI6,I/O,FT,TIM8_CH2/DCMI_D6/EVENTOUT,
0,0,0,0,C2,176,PI7,I/O,FT,TIM8_CH3/DCMI_D7/EVENTOUT,
1 LQFP64 WLCSP90 LQFP100 LQFP144 UFBGA176 LQFP176 Name Type IO Alternate Additional
2 0 0 1 1 A2 1 PE2 I/O FT TRACECLK/FSMC_A23/ETH_MII_TXD3/EVENTOUT
3 0 0 2 2 A1 2 PE3 I/O FT TRACED0/FSMC_A19/EVENTOUT
4 0 0 3 3 B1 3 PE4 I/O FT TRACED1/FSMC_A20/DCMI_D4/EVENTOUT
5 0 0 4 4 B2 4 PE5 I/O FT TRACED2/FSMC_A21/TIM9_CH1/DCMI_D6/EVENTOUT
6 0 0 5 5 B3 5 PE6 I/O FT TRACED3/FSMC_A22/TIM9_CH2/DCMI_D7/EVENTOUT
7 1 A10 6 6 C1 6 VBAT S
8 0 0 0 0 D2 7 PI8 I/O FT EVENTOUT RTC_AF2
9 2 A9 7 7 D1 8 PC13 I/O FT EVENTOUT RTC_AF1
10 3 B10 8 8 E1 9 PC14-OSC32_IN(PC14) I/O FT EVENTOUT OSC32_IN(4)
11 4 B9 9 9 F1 10 PC15-OSC32_OUT(PC15) I/O FT EVENTOUT OSC32_OUT(4)
12 0 0 0 0 D3 11 PI9 I/O FT CAN1_RX/EVENTOUT
13 0 0 0 0 E3 12 PI10 I/O FT ETH_MII_RX_ER/EVENTOUT
14 0 0 0 0 E4 13 PI11 I/O FT OTG_HS_ULPI_DIR/EVENTOUT
15 0 0 0 0 F2 14 VSS S
16 0 0 0 0 F3 15 VDD S
17 0 0 0 10 E2 16 PF0 I/O FT FSMC_A0/I2C2_SDA/EVENTOUT
18 0 0 0 11 H3 17 PF1 I/O FT FSMC_A1/I2C2_SCL/EVENTOUT
19 0 0 0 12 H2 18 PF2 I/O FT FSMC_A2/I2C2_SMBA/EVENTOUT
20 0 0 0 13 J2 19 PF3 I/O FT FSMC_A3/EVENTOUT ADC3_IN9
21 0 0 0 14 J3 20 PF4 I/O FT FSMC_A4/EVENTOUT ADC3_IN14
22 0 0 0 15 K3 21 PF5 I/O FT FSMC_A5/EVENTOUT ADC3_IN15
23 0 C9 10 16 G2 22 VSS S
24 0 B8 11 17 G3 23 VDD S
25 0 0 0 18 K2 24 PF6 I/O FT TIM10_CH1/FSMC_NIORD/EVENTOUT ADC3_IN4
26 0 0 0 19 K1 25 PF7 I/O FT TIM11_CH1/FSMC_NREG/EVENTOUT ADC3_IN5
27 0 0 0 20 L3 26 PF8 I/O FT TIM13_CH1/FSMC_NIOWR/EVENTOUT ADC3_IN6
28 0 0 0 21 L2 27 PF9 I/O FT TIM14_CH1/FSMC_CD/EVENTOUT ADC3_IN7
29 0 0 0 22 L1 28 PF10 I/O FT FSMC_INTR/EVENTOUT ADC3_IN8
30 5 F10 12 23 G1 29 PH0-OSC_IN(PH0) I/O FT EVENTOUT OSC_IN(4)
31 6 F9 13 24 H1 30 PH1-OSC_OUT(PH1) I/O FT EVENTOUT OSC_OUT(4)
32 7 G10 14 25 J1 31 NRST I/O RST
33 8 E10 15 26 M2 32 PC0 I/O FT OTG_HS_ULPI_STP/EVENTOUT ADC123_IN10
34 9 0 16 27 M3 33 PC1 I/O FT ETH_MDC/EVENTOUT ADC123_IN11
35 10 D10 17 28 M4 34 PC2 I/O FT SPI2_MISO/OTG_HS_ULPI_DIR/TH_MII_TXD2/I2S2ext_SD/EVENTOUT ADC123_IN12
36 11 E9 18 29 M5 35 PC3 I/O FT SPI2_MOSI/I2S2_SD/OTG_HS_ULPI_NXT/ETH_MII_TX_CLK/EVENTOUT ADC123_IN13
37 0 0 19 30 G3 36 VDD S
38 12 H10 20 31 M1 37 VSSA S
39 0 0 0 0 N1 0 VREFΓÇô S
40 0 0 21 32 P1 38 VREF+ S
41 13 G9 22 33 R1 39 VDDA S
42 14 C10 23 34 N3 40 PA0-WKUP(PA0) I/O FT USART2_CTS/UART4_TX/ETH_MII_CRS/TIM2_CH1_ETR/TIM5_CH1/TIM8_ETR/EVENTOUT ADC123_IN0/WKUP(4)
43 15 F8 24 35 N2 41 PA1 I/O FT USART2_RTS/UART4_RX/ETH_RMII_REF_CLK/ETH_MII_RX_CLK/TIM5_CH2/TIM2_CH2/EVENTOUT ADC123_IN1
44 16 J10 25 36 P2 42 PA2 I/O FT USART2_TX/TIM5_CH3/TIM9_CH1/TIM2_CH3/ETH_MDIO/EVENTOUT ADC123_IN2
45 0 0 0 0 F4 43 PH2 I/O FT ETH_MII_CRS/EVENTOUT
46 0 0 0 0 G4 44 PH3 I/O FT ETH_MII_COL/EVENTOUT
47 0 0 0 0 H4 45 PH4 I/O FT I2C2_SCL/OTG_HS_ULPI_NXT/EVENTOUT
48 0 0 0 0 J4 46 PH5 I/O FT I2C2_SDA/EVENTOUT
49 17 H9 26 37 R2 47 PA3 I/O FT USART2_RX/TIM5_CH4/TIM9_CH2/TIM2_CH4/OTG_HS_ULPI_D0/ETH_MII_COL/EVENTOUT ADC123_IN3
50 18 E5 27 38 0 48 VSS S
51 D9 L4 0 BYPASS_REG I FT
52 19 E4 28 39 K4 49 VDD S
53 20 J9 29 40 N4 50 PA4 I/O TC SPI1_NSS/SPI3_NSS/USART2_CK/DCMI_HSYNC/OTG_HS_SOF/I2S3_WS/EVENTOUT ADC12_IN4/DAC1_OUT
54 21 G8 30 41 P4 51 PA5 I/O TC SPI1_SCK/OTG_HS_ULPI_CK/TIM2_CH1_ETR/TIM8_CHIN/EVENTOUT ADC12_IN5/DAC2_OUT
55 22 H8 31 42 P3 52 PA6 I/O FT SPI1_MISO/TIM8_BKIN/TIM13_CH1/DCMI_PIXCLK/TIM3_CH1/TIM1_BKIN/EVENTOUT ADC12_IN6
56 23 J8 32 43 R3 53 PA7 I/O FT SPI1_MOSI/TIM8_CH1N/TIM14_CH1/TIM3_CH2/ETH_MII_RX_DV/TIM1_CH1N/RMII_CRS_DV/EVENTOUT ADC12_IN7
57 24 0 33 44 N5 54 PC4 I/O FT ETH_RMII_RX_D0/ETH_MII_RX_D0/EVENTOUT ADC12_IN14
58 25 0 34 45 P5 55 PC5 I/O FT ETH_RMII_RX_D1/ETH_MII_RX_D1/EVENTOUT ADC12_IN15
59 26 G7 35 46 R5 56 PB0 I/O FT TIM3_CH3/TIM8_CH2N/OTG_HS_ULPI_D1/ETH_MII_RXD2/TIM1_CH2N/EVENTOUT ADC12_IN8
60 27 H7 36 47 R4 57 PB1 I/O FT TIM3_CH4/TIM8_CH3N/OTG_HS_ULPI_D2/ETH_MII_RXD3/TIM1_CH3N/EVENTOUT ADC12_IN9
61 28 J7 37 48 M6 58 PB2-BOOT1(PB2) I/O FT EVENTOUT
62 0 0 0 49 R6 59 PF11 I/O FT DCMI_12/EVENTOUT
63 0 0 0 50 P6 60 PF12 I/O FT FSMC_A6/EVENTOUT
64 0 0 0 51 M8 61 VSS S
65 0 0 0 52 N8 62 VDD S
66 0 0 0 53 N6 63 PF13 I/O FT FSMC_A7/EVENTOUT
67 0 0 0 54 R7 64 PF14 I/O FT FSMC_A8/EVENTOUT
68 0 0 0 55 P7 65 PF15 I/O FT FSMC_A9/EVENTOUT
69 0 0 0 56 N7 66 PG0 I/O FT FSMC_A10/EVENTOUT
70 0 0 0 57 M7 67 PG1 I/O FT FSMC_A11/EVENTOUT
71 0 G6 38 58 R8 68 PE7 I/O FT FSMC_D4/TIM1_ETR/EVENTOUT
72 0 H6 39 59 P8 69 PE8 I/O FT FSMC_D5/TIM1_CH1N/EVENTOUT
73 0 J6 40 60 P9 70 PE9 I/O FT FSMC_D6/TIM1_CH1/EVENTOUT
74 0 0 0 61 M9 71 VSS S
75 0 0 0 62 N9 72 VDD S
76 0 F6 41 63 R9 73 PE10 I/O FT FSMC_D7/TIM1_CH2N/EVENTOUT
77 0 J5 42 64 P10 74 PE11 I/O FT FSMC_D8/TIM1_CH2/EVENTOUT
78 0 H5 43 65 R10 75 PE12 I/O FT FSMC_D9/TIM1_CH3N/EVENTOUT
79 0 G5 44 66 N11 76 PE13 I/O FT FSMC_D10/TIM1_CH3/EVENTOUT
80 0 F5 45 67 P11 77 PE14 I/O FT FSMC_D11/TIM1_CH4/EVENTOUT
81 0 G4 46 68 R11 78 PE15 I/O FT FSMC_D12/TIM1_BKIN/EVENTOUT
82 29 H4 47 69 R12 79 PB10 I/O FT SPI2_SCK/I2S2_CK/I2C2_SCL/USART3_TX/OTG_HS_ULPI_D3/ETH_MII_RX_ER/TIM2_CH3/EVENTOUT
83 30 J4 48 70 R13 80 PB11 I/O FT I2C2_SDA/USART3_RX/OTG_HS_ULPI_D4/ETH_RMII_TX_EN/ETH_MII_TX_EN/TIM2_CH4/EVENTOUT
84 31 F4 49 71 M10 81 VCAP_1 S
85 32 0 50 72 N10 82 VDD S
86 0 0 0 0 M11 83 PH6 I/O FT I2C2_SMBA/TIM12_CH1/ETH_MII_RXD2/EVENTOUT
87 0 0 0 0 N12 84 PH7 I/O FT I2C3_SCL/ETH_MII_RXD3/EVENTOUT
88 0 0 0 0 M12 85 PH8 I/O FT I2C3_SDA/DCMI_HSYNC/EVENTOUT
89 0 0 0 0 M13 86 PH9 I/O FT I2C3_SMBA/TIM12_CH2/DCMI_D0/EVENTOUT
90 0 0 0 0 L13 87 PH10 I/O FT TIM5_CH1/DCMI_D1/EVENTOUT
91 0 0 0 0 L12 88 PH11 I/O FT TIM5_CH2/DCMI_D2/EVENTOUT
92 0 0 0 0 K12 89 PH12 I/O FT TIM5_CH3/DCMI_D3/EVENTOUT
93 0 0 0 0 H12 90 VSS S
94 0 0 0 0 J12 91 VDD S
95 33 J3 51 73 P12 92 PB12 I/O FT SPI2_NSS/I2S2_WS/I2C2_SMBA/USART3_CK/TIM1_BKIN/CAN2_RX/OTG_HS_ULPI_D5/ETH_RMII_TXD0/ETH_MII_TXD0/OTG_HS_ID/EVENTOUT
96 34 J1 52 74 P13 93 PB13 I/O FT SPI2_SCK/I2S2_CK/USART3_CTS/TIM1_CH1N/CAN2_TX/OTG_HS_ULPI_D6/ETH_RMII_TXD1/ETH_MII_TXD1/EVENTOUT OTG_HS_VBUS
97 35 J2 53 75 R14 94 PB14 I/O FT SPI2_MISO/TIM1_CH2N/TIM12_CH1/OTG_HS_DM/USART3_RTS/TIM8_CH2N/I2S2ext_SD/EVENTOUT
98 36 H1 54 76 R15 95 PB15 I/O FT SPI2_MOSI/I2S2_SD/TIM1_CH3N/TIM8_CH3N/TIM12_CH2/OTG_HS_DP/EVENTOUT
99 0 H2 55 77 P15 96 PD8 I/O FT FSMC_D13/USART3_TX/EVENTOUT
100 0 H3 56 78 P14 97 PD9 I/O FT FSMC_D14/USART3_RX/EVENTOUT
101 0 G3 57 79 N15 98 PD10 I/O FT FSMC_D15/USART3_CK/EVENTOUT
102 0 G1 58 80 N14 99 PD11 I/O FT FSMC_CLE/FSMC_A16/USART3_CTS/EVENTOUT
103 0 G2 59 81 N13 100 PD12 I/O FT FSMC_ALE/FSMC_A17/TIM4_CH1/USART3_RTS/EVENTOUT
104 0 0 60 82 M15 101 PD13 I/O FT FSMC_A18/TIM4_CH2/EVENTOUT
105 0 0 0 83 0 102 VSS S
106 0 0 0 84 J13 103 VDD S
107 0 F2 61 85 M14 104 PD14 I/O FT FSMC_D0/TIM4_CH3/EVENTOUT/EVENTOUT
108 0 F1 62 86 L14 105 PD15 I/O FT FSMC_D1/TIM4_CH4/EVENTOUT
109 0 0 0 87 L15 106 PG2 I/O FT FSMC_A12/EVENTOUT
110 0 0 0 88 K15 107 PG3 I/O FT FSMC_A13/EVENTOUT
111 0 0 0 89 K14 108 PG4 I/O FT FSMC_A14/EVENTOUT
112 0 0 0 90 K13 109 PG5 I/O FT FSMC_A15/EVENTOUT
113 0 0 0 91 J15 110 PG6 I/O FT FSMC_INT2/EVENTOUT
114 0 0 0 92 J14 111 PG7 I/O FT FSMC_INT3/USART6_CK/EVENTOUT
115 0 0 0 93 H14 112 PG8 I/O FT USART6_RTS/ETH_PPS_OUT/EVENTOUT
116 0 0 0 94 G12 113 VSS S
117 0 0 0 95 H13 114 VDD S
118 37 F3 63 96 H15 115 PC6 I/O FT I2S2_MCK/TIM8_CH1/SDIO_D6/USART6_TX/DCMI_D0/TIM3_CH1/EVENTOUT
119 38 E1 64 97 G15 116 PC7 I/O FT I2S3_MCK/TIM8_CH2/SDIO_D7/USART6_RX/DCMI_D1/TIM3_CH2/EVENTOUT
120 39 E2 65 98 G14 117 PC8 I/O FT TIM8_CH3/SDIO_D0/TIM3_CH3/USART6_CK/DCMI_D2/EVENTOUT
121 40 E3 66 99 F14 118 PC9 I/O FT I2S_CKIN/MCO2/TIM8_CH4/SDIO_D1//I2C3_SDA/DCMI_D3/TIM3_CH4/EVENTOUT
122 41 D1 67 100 F15 119 PA8 I/O FT MCO1/USART1_CK/TIM1_CH1/I2C3_SCL/OTG_FS_SOF/EVENTOUT
123 42 D2 68 101 E15 120 PA9 I/O FT USART1_TX/TIM1_CH2/I2C3_SMBA/DCMI_D0/EVENTOUT OTG_FS_VBUS
124 43 D3 69 102 D15 121 PA10 I/O FT USART1_RX/TIM1_CH3/OTG_FS_ID/DCMI_D1/EVENTOUT
125 44 C1 70 103 C15 122 PA11 I/O FT USART1_CTS/CAN1_RX/TIM1_CH4/OTG_FS_DM/EVENTOUT
126 45 C2 71 104 B15 123 PA12 I/O FT USART1_RTS/CAN1_TX/TIM1_ETR/OTG_FS_DP/EVENTOUT
127 46 F8 72 105 A15 124 PA13(JTMS-SWDIO) I/O FT JTMS-SWDIO/EVENTOUT
128 47 B1 73 106 F13 125 VCAP_2 S
129 0 E7 74 107 F12 126 VSS S
130 48 E6 75 108 G13 127 VDD S
131 0 0 0 0 E12 128 PH13 I/O FT TIM8_CH1N/CAN1_TX/EVENTOUT
132 0 0 0 0 E13 129 PH14 I/O FT TIM8_CH2N/DCMI_D4/EVENTOUT
133 0 0 0 0 D13 130 PH15 I/O FT TIM8_CH3N/DCMI_D11/EVENTOUT
134 0 C3 0 0 E14 131 PI0 I/O FT TIM5_CH4/SPI2_NSS/I2S2_WS/DCMI_D13/EVENTOUT
135 0 B2 0 0 D14 132 PI1 I/O FT SPI2_SCK/I2S2_CK/DCMI_D8/EVENTOUT
136 0 0 0 0 C14 133 PI2 I/O FT TIM8_CH4/SPI2_MISO/DCMI_D9/I2S2ext_SD/EVENTOUT
137 0 0 0 0 C13 134 PI3 I/O FT TIM8_ETR/SPI2_MOSI/I2S2_SD/DCMI_D10/EVENTOUT
138 0 0 0 0 D9 135 VSS S
139 0 0 0 0 C9 136 VDD S
140 49 A2 76 109 A14 137 PA14(JTCK-SWCLK) I/O FT JTCK-SWCLK/EVENTOUT
141 50 B3 77 110 A13 138 PA15(JTDI) I/O FT JTDI/SPI3_NSS/I2S3_WS/TIM2_CH1_ETR/SPI1_NSS/EVENTOUT
142 51 D5 78 111 B14 139 PC10 I/O FT SPI3_SCK/I2S3_CK/UART4_TX/SDIO_D2/DCMI_D8/USART3_TX/EVENTOUT
143 52 C4 79 112 B13 140 PC11 I/O FT UART4_RX/SPI3_MISO/SDIO_D3/DCMI_D4/USART3_RX/I2S3ext_SD/EVENTOUT
144 53 A3 80 113 A12 141 PC12 I/O FT UART5_TX/SDIO_CK/DCMI_D9/SPI3_MOSI/I2S3_SD/USART3_CK/EVENTOUT
145 0 D6 81 114 B12 142 PD0 I/O FT FSMC_D2/CAN1_RX/EVENTOUT
146 0 C5 82 115 C12 143 PD1 I/O FT FSMC_D3/CAN1_TX/EVENTOUT
147 54 B4 83 116 D12 144 PD2 I/O FT TIM3_ETR/UART5_RX/SDIO_CMD/DCMI_D11/EVENTOUT
148 0 0 84 117 D11 145 PD3 I/O FT FSMC_CLK/USART2_CTS/EVENTOUT
149 0 A4 85 118 D10 146 PD4 I/O FT FSMC_NOE/USART2_RTS/EVENTOUT
150 0 C6 86 119 C11 147 PD5 I/O FT FSMC_NWE/USART2_TX/EVENTOUT
151 0 0 0 120 D8 148 VSS S
152 0 0 0 121 C8 149 VDD S
153 0 B5 87 122 B11 150 PD6 I/O FT FSMC_NWAIT/USART2_RX/EVENTOUT
154 0 A5 88 123 A11 151 PD7 I/O FT USART2_CK/FSMC_NE1/FSMC_NCE2/EVENTOUT
155 0 0 0 124 C10 152 PG9 I/O FT USART6_RX/FSMC_NE2/FSMC_NCE3/EVENTOUT
156 0 0 0 125 B10 153 PG10 I/O FT FSMC_NCE4_1/FSMC_NE3/EVENTOUT
157 0 0 0 126 B9 154 PG11 I/O FT FSMC_NCE4_2/ETH_MII_TX_EN/ETH _RMII_TX_EN/EVENTOUT
158 0 0 0 127 B8 155 PG12 I/O FT FSMC_NE4/USART6_RTS/EVENTOUT
159 0 0 0 128 A8 156 PG13 I/O FT FSMC_A24/USART6_CTS/ETH_MII_TXD0/ETH_RMII_TXD0/EVENTOUT
160 0 0 0 129 A7 157 PG14 I/O FT FSMC_A25/USART6_TX/ETH_MII_TXD1/ETH_RMII_TXD1/EVENTOUT
161 0 E8 0 130 D7 158 VSS S
162 0 F7 0 131 C7 159 VDD S
163 0 0 0 132 B7 160 PG15 I/O FT USART6_CTS/DCMI_D13/EVENTOUT
164 55 B6 89 133 A10 161 PB3(JTDO/TRACESWO) I/O FT JTDO/TRACESWO/SPI3_SCK/I2S3_CK/TIM2_CH2/SPI1_SCK/EVENTOUT
165 56 A6 90 134 A9 162 PB4(NJTRST) I/O FT NJTRST/SPI3_MISO/TIM3_CH1/SPI1_MISO/I2S3ext_SD/EVENTOUT
166 57 D7 91 135 A6 163 PB5 I/O FT I2C1_SMBA/CAN2_RX/OTG_HS_ULPI_D7/ETH_PPS_OUT/TIM3_CH2/SPI1_MOSI/SPI3_MOSI/DCMI_D10/I2S3_SD/EVENTOUT
167 58 C7 92 136 B6 164 PB6 I/O FT I2C1_SCL/TIM4_CH1/CAN2_TX/DCMI_D5/USART1_TX/EVENTOUT
168 59 B7 93 137 B5 165 PB7 I/O FT I2C1_SDA/FSMC_NL/DCMI_VSYNC/USART1_RX/TIM4_CH2/EVENTOUT
169 60 A7 94 138 D6 166 BOOT0 I B VPP
170 61 D8 95 139 A5 167 PB8 I/O FT TIM4_CH3/SDIO_D4/TIM10_CH1/DCMI_D6/ETH_MII_TXD3/I2C1_SCL/CAN1_RX/EVENTOUT
171 62 C8 96 140 B4 168 PB9 I/O FT SPI2_NSS/I2S2_WS/TIM4_CH4/TIM11_CH1/SDIO_D5/DCMI_D7/I2C1_SDA/CAN1_TX/EVENTOUT
172 0 0 97 141 A4 169 PE0 I/O FT TIM4_ETR/FSMC_NBL0/DCMI_D2/EVENTOUT
173 0 0 98 142 A3 170 PE1 I/O FT FSMC_NBL1/DCMI_D3/EVENTOUT
174 63 0 99 0 D5 0 VSS S
175 0 A8 0 143 C6 171 PDR_ON I FT
176 64 A1 100 144 C5 172 VDD S
177 0 0 0 0 D4 173 PI4 I/O FT TIM8_BKIN/DCMI_D5/EVENTOUT
178 0 0 0 0 C4 174 PI5 I/O FT TIM8_CH1/DCMI_VSYNC/EVENTOUT
179 0 0 0 0 C3 175 PI6 I/O FT TIM8_CH2/DCMI_D6/EVENTOUT
180 0 0 0 0 C2 176 PI7 I/O FT TIM8_CH3/DCMI_D7/EVENTOUT

Binary file not shown.

View File

@ -0,0 +1,67 @@
SPI2.setup({baud:1600000, mosi:B15});
leds = Graphics.createArrayBuffer(16,16,24,{zigzag:true});
leds.flip = function() { SPI2.send4bit(leds.buffer, 0b0001, 0b0011); }
i=0;
function step() {
i++; if (i>90) i = 0;
leds.clear();
leds.setColor(0,0,0.1);
leds.setFontVector(20);
leds.drawString("Hello",-(i-35),-5);
leds.flip();
}
setInterval(step,50);
// Pong
var leds = Graphics.createArrayBuffer(16,16,24,{zigzag:true});
leds.flip = function() { SPI2.send4bit(leds.buffer, 0b0001, 0b0011); }
function onInit() {
I2C1.setup({scl:B6,sda:B7});
I2C1.writeTo(0x52, [0xF0,0x55]) ;
I2C1.writeTo(0x52, [0xFB,0x00])
SPI2.setup({baud:1600000, mosi:B15});
}
onInit();
function read() {
var d = I2C1.readFrom(0x52, 6);
I2C1.writeTo(0x52, 0);
bx = bx + dx;
by = by + dy;
if (by<0) {
by=0;
dy=Math.abs(dy);
}
if (by>15) {
by=15;
dy=-Math.abs(dy);
}
if (bx<0) {
bx=0;
dx=Math.abs(dx);
}
if (bx>15) {
bx=15;
dx=-Math.abs(dx);
}
var b1 = d[0]/16;
var b2 = d[1]/16;
leds.clear();
leds.setColor(0.1,0,0);
leds.fillRect(0,b1-3,0,b1+3);
leds.fillRect(15,b2-3,15,b2+3);
leds.setColor(0,0.1,0.1);
leds.fillRect(bx,by,bx,by);
leds.flip();
}
var bx = 12;
var by = 13.6;
var dx = 1;
var dy = 0.8;
onInit();
setInterval(read,100);

View File

@ -0,0 +1,36 @@
// Accelerometer on F4:
// init - see LIS302DL_CTRL_REG1_ADDR
SPI1.send([0x20,0b01000111], E3);
function getAcc() {
var accx = SPI1.send([0xA9,0], E3)[1];
var accy = SPI1.send([0xAB,0], E3)[1];
if (accx>127) accx-=256;
if (accy>127) accy-=256;
analogWrite(LED2, accx/128.0);
analogWrite(LED4, -accx/128.0);
analogWrite(LED1, accy/128.0);
analogWrite(LED3, -accy/128.0);
}
setInterval(getAcc, 100);
function onInit() {
SPI1.send([0x20,0b01000111], E3);
}
var avrx=0.0, avry=0.0;
function getAcc() {
var accx = SPI1.send([0xA9,0], E3)[1];
var accy = SPI1.send([0xAB,0], E3)[1];
if (accx>127) accx-=256;
if (accy>127) accy-=256;
avrx = 0.1*accx + 0.9*avrx;
avry = 0.1*accy + 0.9*avry;
analogWrite(LED2, avrx/128.0);
analogWrite(LED4, -avrx/128.0);
analogWrite(LED1, avry/128.0);
analogWrite(LED3, -avry/128.0);
}
onInit();setInterval(getAcc, 10);

View File

@ -0,0 +1,86 @@
var servo = [0.75,0.730152,0.717071];
function servoTimer() {
digitalPulse(B12,1,1+Math.clip(servo[0],0,1));
digitalPulse(B13,1,1+Math.clip(servo[1],0,1));
digitalPulse(B14,1,1+Math.clip(servo[2],0,1));
}
function moveTo(x,y) {
// print(x+","+y);return;
var d = Math.sqrt(x*x+y*y);
var s1 = 2*Math.asin(d/2);
var a = (180-s1)/2;
var b = Math.atan(x / y);
var s2 = 90-(a+b);
// print(s1+","+s2);
servo[1] = 0.5 - ((s1-(Math.PI*0.5)) / Math.PI)*0.7;
servo[2] = 0.7 - 0.7*(s2 / Math.PI);
}
var pos = 3.82;
function step() {
pos = pos+0.02;
if (pos>4) pos=0;
var i = pos|0;
var f = pos-i;
if (i==0) moveTo(0, 0.5 + f);
if (i==1) moveTo(f, 1.5);
if (i==2) moveTo(1, 1.5-f);
if (i==3) moveTo(1-f, 0.5);
}
setInterval(servoTimer, 50);
setInterval(step, 50);
// --------------------------------------------------
var servo = [0.9,0.505683,0.57334];
function servoTimer() {
digitalPulse(B12,1,1+Math.clip(servo[0],0,1));
digitalPulse(B13,1,1+Math.clip(servo[1],0,1));
digitalPulse(B14,1,1+Math.clip(servo[2],0,1));
}
function moveTo(x,y) {
// print(x+","+y);return;
var d = Math.sqrt(x*x+y*y);
var s1 = 2*Math.asin(d/2);
var a = (180-s1)/2;
var b = Math.atan(x / y);
var s2 = 90-(a+b);
// print(s1+","+s2);
servo[1] = 0.5 - ((s1-(Math.PI*0.5)) / Math.PI)*0.7;
servo[2] = 0.7 - 0.7*(s2 / Math.PI);
}
var pos = 1;
function step() {
// do a zig-zag motion over x and y
pos = pos + 0.0005;
if (pos>=1) pos=1;
var bars = 20.0;
var p = pos*bars;
var y = Math.floor(p);
var x = p-y;
if (y&1 == 1) x=1-x;
x = x-0.5;
var z = y/bars - 0.5;
// work out y, x and z are between -0.5 and 0.5
y = func(x,z)*0.4;
var ry = 0.5;
var rx = 0.5;
var xt = Math.cos(ry)*x + Math.sin(ry)*z;
z = Math.cos(ry)*z - Math.sin(ry)*x; x=xt;
var yt = Math.cos(rx)*y + Math.sin(rx)*z;
z = Math.cos(rx)*z - Math.sin(rx)*y; y=yt;
z += 4;
f = [0.5 + 2*(x*2.5/z), 1.0 + 2*(y*2.5/z)];
moveTo(f[0], f[1]);
}
function func(dx,dy) {
var r = 30*Math.sqrt(dx*dx + dy*dy) + 0.001;
return Math.sin(r)/r;
}
var f = [0.283096,1.367057];
setInterval(servoTimer, 20);
setInterval(step, 20);
setWatch("pos=0", BTN, { repeat: true });

View File

@ -0,0 +1,68 @@
var FAN_SPEED_IN = E3;
var FAN_SPEED_OUT = E1;
var LEDS = [D12,D13,D14,D15];
var IMG = (
"11111110"+
"10000010"+
"10000010"+
"10000010"+
"10000010"+
"10000010"+
"10000010"+
"11111110");
var pos = 0;
function onDigit(e) {
digitalWrite(LEDS, (IMG[pos]=="1") ? 255 : 0);
pos++;
}
var digitInterval = setInterval(onDigit, 10);
function onFanMovement(e) {
var d = e.time-lastTime;
lastTime = e.time;
pos = 0;
changeInterval(digitInterval, 1000*d/(7*8));
}
setWatch(onFanMovement, FAN_SPEED_IN, { repeat: true, edge: 'falling' });
digitalWrite(FAN_SPEED_OUT,0)
var IMG = (
"10000000"+
"10000000"+
"10000000"+
"10000000"+
"10000000"+
"10000000"+
"10000000"+
"10000000");
var IMG = (
"0000000"+
"0000000"+
"0000000"+
"1111000"+
"1001000"+
"1001000"+
"1001000"+
"1111000");
var IMG = (
"00010000"+
"00010000"+
"00010000"+
"11111111"+
"00010000"+
"00010000"+
"00010000"+
"00010000");
var IMG = (
"00011000"+
"00111100"+
"00011000"+
"00000000"+
"01100110"+
"00011000"+
"01100110"+
"00000000");

View File

@ -0,0 +1,37 @@
var x = 0;
var step = function () {
x++;
digitalPulse(D0,1,1.25+(x/320.0));digitalPulse(D1,1,1.8-(y/40.0));
if ((x>20) && ((x&1)!=0)) str+=getCol();
if (x>160) { print(str);str="";
x=0;
y++;
if (y>25) clearInterval(stepInterval);
}
};
var cols = " .,-~:;=!*#$@";
var rangeMin = 0.414068;
var rangeMax = 0.52;
var getCol = function () {
var a = analogRead(A1);if (a>max)max=a;if (a<min)min=a;
a = cols.length*(a-rangeMin)/(rangeMax-rangeMin);
if (a<0) a=0;
if (a>=cols.length) a=cols.length-1;
return cols.charAt(a);
};
var start = function () {
x=0;
y=0;str="";min=1;max=0;
stepInterval = setInterval(step,25);
};
var stepInterval = 0;
var y = 26;
var str = "";
var stop = function () { clearInterval(stepInterval);stepInterval=undefined; };
var startOrStop = function () { if (stepInterval==undefined)
start();
else
stop();
};
var min = 0.4065;
var max = 0.516121;

View File

@ -0,0 +1,66 @@
SPI1.setup({baud:3200000, mosi:A7});
var arr = [255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0];
setInterval("SPI1.send4bit(arr, 0b0001, 0b0011);", 200)
SPI1.setup({baud:3200000, mosi:A7});
SPI1.send4bit([255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0], 0b0001, 0b0011);
SPI1.setup({baud:3200000, mosi:A7});
SPI1.send(1)
var arr = new Uint8Array(75)
n=0;for(i=0;i<25;i++) {
arr[n++] = i*10;
arr[n++] = 0;
arr[n++] = 0;
}
SPI1.send4bit(arr, 0b0001, 0b0011);
function () {
x++;
n=0;for(i=0;i<25;i++) {
arr[n++] = 128+Math.sin(i*0.5+x*0.06)*127;
arr[n++] = 128+Math.sin(i+x*0.05)*127;
arr[n++] = 128+Math.sin(i*1.2+x*0.07)*127;
}
SPI1.send4bit(arr, 0b0001, 0b0011);
}
// --------------------------------------------------------------------------------------
var arr = new Uint8Array(75);
function () {
amt += dir;
if (amt < 0) {
amt = 0;
} else if (amt > 1.5 && dir>0) {
amt = 3;
dir = 0;
} else {
if (!BTN1.read()) dir = -0.01;
}
if (amt<1 && BTN1.read()) dir = 0.04;
var n = 0;
for(var i=0;i<25;i++) {
var c = 255*(2*amt - (Math.abs(i-12.5)/12.5 +0.5));
arr[n++] = Math.clip(256+c*2, 0, 255);
arr[n++] = Math.clip(64+c, 0, 255);
arr[n++] = Math.clip(c/2, 0, 255);
}
SPI1.send4bit(arr, 0b0001, 0b0011);
}
var amt = 22.5;
var stepInterval = 1;
function onInit() {
stepInterval = setInterval(step, 100);
}
var dir = 0.1;
SPI1.setup({baud:3200000, mosi:A7});
setInterval(step, 50);

View File

@ -0,0 +1,18 @@
var cmd="";
Serial1.onData(function (e) {
if (e.data=="\r") {
print("'"+cmd+"' = "+eval(cmd));
cmd="";
} else cmd+=e.data;
});
var cmd="";
Serial1.onData(function (e) {
Serial1.print(e.data);
if (e.data=="\r") {
var s = "'"+cmd+"' = "+eval(cmd);
print(s);
Serial1.println(s);
cmd="";
} else cmd+=e.data;
});

View File

@ -0,0 +1,37 @@
function boxcoords(i) {
while (i>4) i-=4;
if (i<1) {
return [i,0];
} else if (i<2) {
return [1,i-1];
} else if (i<3) {
return [3-i,1];
} else {
return [0,4-i];
}
}
clearInterval(0);
var pos = 0.0;
var coords = [];
setInterval(function() {
pos+=0.01;
coords = boxcoords(pos);
digitalPulse("A1",1,1+coords[0]);
digitalPulse("A2",1,1+coords[1]);
},20);
setWatch(function() {
if (digitalRead("A0")) {
digitalWrite("C9",1);
setTimeout(function() {
digitalWrite("C9", 0);
setTimeout(function() {
digitalWrite("C9", 1);
setTimeout(function() {
digitalWrite("C9", 0);
}, 301);
}, 302);
}, 303);
}}, "A0", true);

View File

@ -0,0 +1,245 @@
// ctrl-c crashes it!
var PINS = {
iCrank:C8,
iInl:C10,
iExh:C9,
iSpare:C11,
oInl:E8,
oExh:E10,
oDashECU:E9,
oDashOil:E11,
oDashTemp:E12,
oDashRPM:E13,
aBat:C5,
aTPS:A3,
aMAP:B0,
aWater:C1,
aAir:B1,
aLambdaM:A2,
aLambdaP:A1,
oCoil1:D6,
oCoil2:D7,
oCoil3:D10,
oCoil4:D11,
oInj1:E3,
oInj2:E4,
oInj3:E5,
oInj4:E6,
};
var ECU = {
"pInl":2.598771,
"pExh":43.764055,
"RPM":125.030327,
"TPS":0.260746,
"mapx":0.12503,
"mapy":1.607461,
"spk":10,
"spkStart":8.499636,
"vBat":16.765931,
"spkLen":2,
"expInl":20,
"expExh":20};
var MAPS = {
spk : new Float32Array( [
// 0, 1, 2, 3, 4, 5, 6, 7, RPM
5, 13, 13, 13, 18, 24, 27, 27,
5, 13, 13, 13, 18, 24, 27, 27,
5, 13, 13, 13, 20, 24, 27, 27,
5, 14, 13, 20, 25, 26, 25, 25,
5, 16, 20, 24, 24, 25, 25, 25,
5, 15, 20, 23, 24, 24, 24, 24,
5, 6, 18, 20, 21, 21, 21, 21,
5, 6, 18, 20, 21, 21, 21, 21,
] ),
fuel : new Float32Array( [
0x1C, 0x0F, 0x0E, 0x0B, 0x0C, 0x0C, 0x13, 0x12,
0x1C, 0x10, 0x0E, 0x0C, 0x16, 0x17, 0x23, 0x2A,
0x1C, 0x1F, 0x1B, 0x1E, 0x1D, 0x26, 0x32, 0x33,
0x2E, 0x31, 0x27, 0x24, 0x24, 0x30, 0x3F, 0x3D,
0x37, 0x3E, 0x2F, 0x35, 0x39, 0x49, 0x48, 0x46,
0x43, 0x45, 0x45, 0x4F, 0x55, 0x52, 0x4C, 0x44,
0x4D, 0x45, 0x51, 0x55, 0x58, 0x53, 0x4F, 0x48,
0x4D, 0x4C, 0x5A, 0x56, 0x55, 0x52, 0x4E, 0x48,
] ),
inl : new Int8Array( [
0, 0, 0, 0, 0, -3, -3, -3, // le5
-4, -4, -13, -19, -9, -3, -3, -3,
-2, -2, -13, -17, -6, -2, -2, -2,
-2, -2, -13, -17, -6, -2, -2, -2,
-24, -24, -24, -24, -24, -13, -7, -7,
-24, -24, -24, -24, -24, -13, -7, -7,
-24, -24, -24, -24, -24, -13, -7, -7,
-24, -24, -24, -24, -24, -13, -7, -7,
] ),
exh : new Int8Array( [
0, 0, 5, 9, 9, 14, 14, 14, // le5
0, 13, 24, 24, 19, 15, 15, 17,
0, 13, 22, 18, 15, 12, 14, 16,
0, 8, 22, 14, 10, 10, 12, 14,
0, 7, 10, 12, 17, 11, 10, 10,
0, 7, 10, 12, 17, 11, 10, 10,
0, 7, 10, 12, 17, 11, 10, 10,
0, 7, 10, 12, 17, 11, 10, 10,
] )
};
function watchInlet(e) {
ECU.pInl = Math.wrap(Trig.getPosAtTime(e.time),180);
var diff = ECU.pInl - ECU.expInl;
ECU.drvInl = 0.8 + (diff / 10);
analogWrite(PINS.oInl, ECU.drvInl);
}
function watchExhaust(e) {
ECU.pExh = Math.wrap(Trig.getPosAtTime(e.time)+90,180)-90;
var diff = ECU.expExh - ECU.pExh;
ECU.drvExh = 0.8 + (diff / 10);
analogWrite(PINS.oExh, ECU.drvExh);
}
// inl = 46 .. 96 (on)
// exh = -2.5(off) .. 47(on)
// NOTE: a degree value of -7.75*6 will occur on the first tooth after
function onTimer() {
ECU.RPM = Trig.getRPM();
ECU.TPS = analogRead(PINS.aTPS);
ECU.MAP = Math.clip((0.1449 / (1.125-analogRead(PINS.aMAP))) - 0.125,0,1);
ECU.vBat = analogRead(PINS.aBat)*18.804;
ECU.mapx = Math.clip(ECU.RPM/1000, 0, 7);
ECU.mapy = Math.clip(ECU.TPS*10-1,0,8);
ECU.spk = -MAPS.spk.interpolate2d(8,ECU.mapx, ECU.mapy);
ECU.spkLen = 1.5 + Math.clip((13.5-ECU.vBat)*0.1,0,0.5);
ECU.expInl = 90+MAPS.inl.interpolate2d(8,ECU.mapx, ECU.mapy);
ECU.expExh = MAPS.exh.interpolate2d(8,ECU.mapx, ECU.mapy);
ECU.spkStart = ECU.spk - (ECU.RPM*ECU.spkLen*6/1000);
ECU.fuel = MAPS.fuel.interpolate2d(8,ECU.mapx, ECU.mapy) * ECU.trim;
Trig.setTrigger(0,ECU.spkStart,[LED1,PINS.oCoil1,PINS.oCoil4],ECU.spkLen);
Trig.setTrigger(1,180+ECU.spkStart,[LED3,PINS.oCoil2,PINS.oCoil3],ECU.spkLen);
Trig.setTrigger(2,0,[PINS.oInj1,PINS.oInj2,PINS.oInj3,PINS.oInj4],ECU.fuel);
Trig.setTrigger(3,180,[PINS.oInj1,PINS.oInj2,PINS.oInj3,PINS.oInj4],ECU.fuel);
ECU.lambda = 7+15.25*(analogRead(PINS.aLambdaP) - analogRead(PINS.aLambdaM));
if (ECU.RPM>500 && ECU.lambda>7.5)
ECU.trim = (ECU.trim*0.99) + (0.01*Math.clip(ECU.trim*ECU.lambda/15,0.05,0.2));
var a = Trig.getErrorArray();
if (a.length>0) print(JSON.stringify(a));
}
function onInit() {
Serial1.setup(9600, {"rx":B7,"tx":B6});
Serial1.setConsole();
clearInterval();
setInterval(onTimer,25);
clearWatch();
Trig.setup(PINS.iCrank, { teethTotal:60, teethMissing:2, minRPM:30, keyPosition: -7.75*360/60 });
setWatch(watchInlet, PINS.iInl, {repeat:true, edge:'falling'});
setWatch(watchExhaust, PINS.iExh, {repeat:true, edge:'falling'});
PINS.oCoil1.reset();
PINS.oCoil2.reset();
PINS.oCoil3.reset();
PINS.oCoil4.reset();
LED1.reset();
LED2.reset();
LED3.reset();
LED4.reset();
Trig.setTrigger(0,0,[LED1,PINS.oCoil1,PINS.oCoil4],5);
Trig.setTrigger(1,180,[LED3,PINS.oCoil2,PINS.oCoil3],5);
Trig.setTrigger(2,90,[LED2],5);
Trig.setTrigger(3,270,[LED4],5);
}
onInit();
// 1.808 at 3000rpm idle
digitalPulse(PINS.oInj1,1,10);digitalPulse(PINS.oInj2,1,10);digitalPulse(PINS.oInj3,1,10);digitalPulse(PINS.oInj4,1,10);
// lambda
//0.183596 9.8
//0.354009 12.4
//(12.4-9.8)/(0.354009-0.183596)
E8.reset();Trig.setTrigger(0,10,[E8],100);
setInterval("print(JSON.stringify(ECU))",1000);
PINS.oCoil1.reset();
PINS.oCoil3.reset();
Trig.setTrigger(0,1,[PINS.oCoil1,PINS.oCoil3],5);
//---------------------------------------------------------
//E8.reset();Trig.setTrigger(0,10,[E8],100);
E8.reset();setInterval("var t=getTime();E8.writeAtTime(1,t+0.005);E8.writeAtTime(0,t+0.006);",100);
LED3.reset();setInterval("var t=getTime();LED3.writeAtTime(1,t);LED3.writeAtTime(1,t+1);LED3.writeAtTime(0,t+2);",1500);
LED4.reset();setInterval("var t=getTime();LED4.writeAtTime(1,t+1);LED4.writeAtTime(0,t+2);",1600);
LED3.reset();var t=getTime();LED3.writeAtTime(1,t+10);LED3.writeAtTime(0,t+11);LED3.writeAtTime(1,t+12);LED3.writeAtTime(0,t+13);
var t=getTime();LED3.writeAtTime(1,t+2);LED3.writeAtTime(0,t+3);
LED1.reset();LED2.reset();E8.reset();
var t=getTime();for (i=0;i<8;i++) E8.writeAtTime(i&1,t+i);
LED1.reset();LED2.reset();E8.reset();
var t=getTime();E8.writeAtTime(i&1,t+0);E8.writeAtTime(i&1,t+1);
LED1.reset();LED2.reset();
var t=getTime();LED3.write(1);for (i=0;i<8;i++) LED3.writeAtTime(i&1,t+i+1);
//---------------------------------------------------------
function step() {
// print([C8.read(),C9.read(),C10.read(),C11.read()]);
}
setInterval(step,500);
Trig.setup(BTN2);
var x=0;
function step() {
var t = Trig.getPosAtTime(getTime());
LCD.drawString(t+" ",0,0,0,0xFFFF);
LCD.setPixel(x, 240-t*3, 0xFFFF);
x++;
if (x>319) { x=0; LCD.clear(); }
}
setInterval(step, 50);
["MISSED_TRIG_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","SHORT_TOOTH"]
["SHORT_TOOTH"]
["WHEEL_MISSED_TOOTH","TRIG_TOOTH_CHANGED"]
["MISSED_TOOTH"]
["TRIG_IN_PAST","MISSED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","SHORT_TOOTH"]
["TRIG_IN_PAST","WHEEL_MISSED_TOOTH","WHEEL_MISSED_TRIG_TOOTH"]
["TRIG_IN_PAST","WHEEL_MISSED_TRIG_TOOTH"]
["TRIG_IN_PAST","WHEEL_MISSED_TRIG_TOOTH"]
["WHEEL_MISSED_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TOOTH","WHEEL_MISSED_TRIG_TOOTH"]
["TRIG_IN_PAST","WHEEL_MISSED_TOOTH","WHEEL_MISSED_TRIG_TOOTH"]
["TRIG_IN_PAST","WHEEL_MISSED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["WHEEL_MISSED_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","SHORT_TOOTH"]
["TRIG_IN_PAST","WHEEL_MISSED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","SHORT_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","WHEEL_MISSED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_FUTURE","TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_FUTURE","TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
["TRIG_IN_FUTURE","TRIG_IN_PAST","MISSED_TRIG_TOOTH","WHEEL_MISSED_TOOTH","WHEEL_GAINED_TOOTH","WHEEL_MISSED_TRIG_TOOTH","TRIG_TOOTH_CHANGED"]
>

View File

@ -0,0 +1,56 @@
CRANK=A0;
INL=A1;
EXH=A2;
var tooth = 0;
var toothOn = false;
function doTooth() {
toothOn = !toothOn;
CRANK.write(toothOn && tooth<58);
if (!toothOn) {
tooth++;
if (tooth>59) tooth=0;
LED1.write(tooth==0);
}
}
setInterval(doTooth, 10);
//changeInterval(doTooth, 10); // assert fail?
// -----------------------------------------------------------------
var CRANK = B12;
var INL = D14;
var EXH = D8;
var CRANK = A0;
var INL = A1;
var EXH = A2;
var tooth = 4;
var toothOn = false;
var inletPos = 35.4;
var msPerTooth = 8;
function doTooth() {
toothOn = !toothOn;
CRANK.write(toothOn && tooth<58);
if (!toothOn) {
tooth++;
if (tooth>59) tooth=0;
LED1.write(tooth==0);
if ((0|inletPos)==tooth) {
setTimeout("digitalPulse(INL, 0, 10);", msPerTooth*(inletPos - (0|inletPos)));
}
}
}
function update() {
inletPos = analogRead(C0)*30;
}
var doToothInterval = setInterval(doTooth, 4);
var updateInterval = setInterval(update, 200);
function setRPM(rpm) {
msPerTooth = 1000/rpm;
changeInterval(doToothInterval, msPerTooth/2);
}

View File

@ -0,0 +1,389 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="80"
height="8"
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="digits1.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="31.678384"
inkscape:cx="18.276265"
inkscape:cy="6.7450772"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1723"
inkscape:window-height="1167"
inkscape:window-x="2"
inkscape:window-y="76"
inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid2985"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1044.3622)">
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect2987"
width="1"
height="6"
x="0"
y="1"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect2989"
width="2"
height="1"
x="1"
y="1051.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect2991"
width="2"
height="1"
x="1"
y="1044.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect2993"
width="1"
height="6"
x="3"
y="1045.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect2995"
width="1"
height="8"
x="5"
y="1044.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect2997"
width="2"
height="1"
x="7"
y="1044.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect2999"
width="1"
height="3.0000434"
x="9"
y="1045.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3001"
width="3"
height="1"
x="7"
y="1051.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3003"
width="1"
height="2.9999826"
x="7"
y="1048.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3005"
width="1"
height="0.9999826"
x="8"
y="1048.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3007"
width="2"
height="1"
x="11"
y="1044.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3009"
width="1"
height="2"
x="13"
y="1045.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3011"
width="2"
height="1"
x="11"
y="1047.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3013"
width="1"
height="3"
x="13"
y="1048.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3015"
width="2"
height="1"
x="11"
y="1051.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3017"
width="1"
height="4"
x="15"
y="1044.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3019"
width="1"
height="1"
x="16"
y="1048.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3021"
width="1"
height="8"
x="17"
y="1044.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3023"
width="3"
height="1"
x="19"
y="1044.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3025"
width="1"
height="3"
x="19"
y="1045.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3027"
width="1"
height="1"
x="20"
y="1047.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3029"
width="1"
height="3"
x="21"
y="1048.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3031"
width="2"
height="1"
x="19"
y="1051.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3033"
width="1"
height="6"
x="23"
y="1045.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3035"
width="1"
height="1"
x="24"
y="1051.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3037"
width="2"
height="1"
x="24"
y="1044.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3039"
width="1"
height="1"
x="24"
y="1047.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3041"
width="1"
height="3"
x="25"
y="1048.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3043"
width="3"
height="1"
x="27"
y="0"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3045"
width="1"
height="7"
x="29"
y="1"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3047"
width="1"
height="2"
x="31"
y="1"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3049"
width="1"
height="3"
x="31"
y="4"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3051"
width="1"
height="1"
x="32"
y="3"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3053"
width="1"
height="3"
x="33"
y="4"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3055"
width="1"
height="1"
x="32"
y="7"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3057"
width="1"
height="1"
x="32"
y="0"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3059"
width="1"
height="2"
x="33"
y="1"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3061"
width="1"
height="1"
x="36"
y="0"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3063"
width="1"
height="3"
x="35"
y="1045.3622" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3065"
width="1"
height="6"
x="37"
y="1"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3067"
width="2"
height="1"
x="35"
y="7"
transform="translate(0,1044.3622)" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3069"
width="1"
height="1"
x="36"
y="4"
transform="translate(0,1044.3622)" />
<path
style="fill:none;stroke:#ffaaaa;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M -1,2 42,2"
id="path3092"
inkscape:connector-curvature="0"
transform="translate(0,1044.3622)" />
<path
style="fill:none;stroke:#ffaaaa;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M -1,4 42,4"
id="path3094"
inkscape:connector-curvature="0"
transform="translate(0,1044.3622)" />
<path
style="fill:none;stroke:#ffaaaa;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 42,1050.3622 -43,0"
id="path3098"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,860 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="80"
height="8"
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="digits2.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.4"
inkscape:cx="19.09237"
inkscape:cy="5.5001779"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1250"
inkscape:window-height="1170"
inkscape:window-x="2"
inkscape:window-y="76"
inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid2985"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1044.3622)">
<path
style="fill:none;stroke:#ffaaaa;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M -1,2 42,2"
id="path3092"
inkscape:connector-curvature="0"
transform="translate(0,1044.3622)" />
<path
style="fill:none;stroke:#ffaaaa;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M -1,4 42,4"
id="path3094"
inkscape:connector-curvature="0"
transform="translate(0,1044.3622)" />
<path
style="fill:none;stroke:#ffaaaa;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 42,1050.3622 -43,0"
id="path3098"
inkscape:connector-curvature="0" />
<rect
style="opacity:0.92000002;fill:#000000;stroke:none"
id="rect3887"
width="1"
height="2"
x="5"
y="1040.3622" />
<path
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 7,1041.3622 c 0.081562,-0.693 0.5061534,-0.896 1,-1 l 0,2 -1,0 z"
id="rect3889"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 9,1040.3622 c 0.4884319,0.067 0.9228222,0.2275 1,1 l 0,1 -1,0 z"
id="rect3891"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path3895"
d="m 11,1042.3622 c 0.67553,-0.053 0.978948,-0.4112 1,-1 l 0,-1 -1,0 z"
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path3897"
d="m 13,1041.3622 c 0.212513,0.8569 0.615087,0.8902 1,1 l 0,-2 -1,0 z"
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<use
x="0"
y="0"
xlink:href="#rect3887"
id="use3901"
transform="translate(-5,8)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3901"
id="use3903"
transform="translate(0,-2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3889"
id="use3905"
transform="translate(-7,4)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#path3897"
id="use3907"
transform="translate(-13,10)"
width="80"
height="8" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3909"
width="1"
height="1"
x="3"
y="1041.3622"
ry="1.7382812e-05" />
<rect
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3911"
width="1"
height="1"
x="1"
y="1040.3622"
ry="1.7382812e-05" />
<use
x="0"
y="0"
xlink:href="#rect3909"
id="use3913"
transform="translate(-2,10)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3911"
id="use3917"
transform="translate(0,4)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3901"
id="use3923"
transform="translate(2,1.7382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3923"
id="use3925"
transform="translate(0,-2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3889"
id="use3929"
transform="translate(-2,3.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3891"
id="use3931"
transform="translate(1,3.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3911"
id="use3933"
transform="translate(7,4.0000166)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3933"
id="use3935"
transform="translate(1,1.7187071e-8)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#path3895"
id="use3937"
transform="translate(-1,5.9999996)"
width="80"
height="8" />
<rect
ry="1.7382812e-05"
y="1047.3622"
x="9"
height="1"
width="1"
id="use3939"
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<rect
ry="1.7382812e-05"
y="1047.3622"
x="8"
height="1"
width="1"
id="use3941"
style="opacity:0.92000002;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<use
x="0"
y="0"
xlink:href="#use3903"
id="use3943"
transform="translate(8,2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3903"
id="use3945"
transform="translate(8,4)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3939"
id="use3947"
transform="translate(0,4)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3947"
id="use3949"
transform="translate(1,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3931"
id="use3951"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3887"
id="use3953"
transform="translate(1,9.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3953"
id="use3955"
transform="translate(0,-2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3955"
id="use3957"
transform="translate(0,-2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3957"
id="use3959"
transform="translate(0,-2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#path3895"
id="use3961"
transform="translate(-9,10.000017)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3891"
id="use3963"
transform="translate(-7,4.000017)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3909"
id="use3965"
transform="translate(9,5.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3965"
id="use3967"
transform="translate(1,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3887"
id="use3969"
transform="translate(9,5.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3969"
id="use3971"
transform="translate(0,2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#path3895"
id="use3973"
transform="translate(3,9.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3965"
id="use3975"
transform="translate(0,4)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3975"
id="use3977"
transform="translate(1,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3943"
id="use3979"
transform="translate(8,-4)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#path3897"
id="use3981"
transform="translate(3,5.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3939"
id="use3983"
transform="translate(8,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3969"
id="use3985"
transform="translate(4,-2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3985"
id="use3987"
transform="translate(0,2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3987"
id="use3989"
transform="translate(0,2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3989"
id="use3991"
transform="translate(0,2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3983"
id="use3993"
transform="translate(3,4)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3993"
id="use3995"
transform="translate(1,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3973"
id="use3997"
transform="translate(8,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3887"
id="use3999"
transform="translate(17,7.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3887"
id="use4007"
transform="translate(15,5.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4007"
id="use4009"
transform="translate(0,-2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3935"
id="use4013"
transform="translate(3,3.6562498e-7)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4013"
id="use4015"
transform="translate(1,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4015"
id="use4017"
transform="translate(8,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4017"
id="use4019"
transform="translate(1,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4015"
id="use4021"
transform="translate(12,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3889"
id="use4023"
transform="translate(17,3.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4021"
id="use4025"
transform="translate(1,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#rect3887"
id="use4027"
transform="translate(19,5.9999996)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3907"
id="use4029"
transform="translate(24,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4027"
id="use4031"
transform="translate(0,2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3995"
id="use4033"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3997"
id="use4035"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3951"
id="use4037"
transform="translate(12,1.999983)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4017"
id="use4039"
transform="translate(4,1.999983)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3989"
id="use4045"
transform="translate(8,-1.7e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4045"
id="use4047"
transform="translate(4,2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4047"
id="use4049"
transform="translate(0,-2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4049"
id="use4051"
transform="translate(0,-2)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4021"
id="use4055"
transform="translate(4,-1.7e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4055"
id="use4057"
transform="translate(-1,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3951"
id="use4059"
transform="translate(16,-1.7e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3901"
id="use4061"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3903"
id="use4063"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3905"
id="use4065"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3907"
id="use4067"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3913"
id="use4069"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3917"
id="use4071"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3923"
id="use4073"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3925"
id="use4075"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3961"
id="use4077"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3963"
id="use4079"
transform="translate(32,-3.4382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use3983"
id="use4083"
transform="translate(16,1.7382813e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4065"
id="use4089"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4069"
id="use4093"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4071"
id="use4095"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4073"
id="use4097"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4075"
id="use4099"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4077"
id="use4101"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4079"
id="use4103"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4083"
id="use4105"
transform="translate(4,0)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4069"
id="use4107"
transform="translate(3,1.7e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4067"
id="use4109"
transform="translate(4,-3.999983)"
width="80"
height="8" />
<text
xml:space="preserve"
style="font-size:3.69688487px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Helvetica;-inkscape-font-specification:Akka Bold"
x="0"
y="1039.3622"
id="text4113"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4115"
x="0"
y="1039.3622">1234567</tspan></text>
<use
x="0"
y="0"
xlink:href="#use4039"
id="use4117"
transform="translate(-4,1.74e-5)"
width="80"
height="8" />
<use
x="0"
y="0"
xlink:href="#use4037"
id="use4119"
transform="translate(-4,1.74e-5)"
width="80"
height="8" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,182 @@
#include <avr/io.h>
#include <config.h>
#include <m25p16.h>
#include <spi2.h>
#include <util/delay_basic.h>
#include <util/delay.h>
/* Support for M25P16 2Mbyte flash RAM
BEWARE Programming can only set bits to zero. IT CANNOT CHANGE A ZERO TO A ONE
You must use the Bulk or sector erase to set bits back to a one
RAM_PORT PORT for the RAM CS signal
RAM_CS
and RAM registers
RAM_RDID
RAM_WREN
RAM_BE
RAM_PP
RAM_RDSR
and of functions:
xmit_spi
recv_spi
Additionally, RAM_CS must be defined as an output on the appropriate DDR
*/
void read_ram_id(uint8_t* mem_ptr) {
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_RDID);
mem_ptr[0] = recv_spi();
mem_ptr[1] = recv_spi();
mem_ptr[2] = recv_spi();
RAM_PORT |= 1<<RAM_CS; // deassert cs
}
uint8_t read_ram_status(void) {
uint8_t status;
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_RDSR);
status = recv_spi();
RAM_PORT |= 1<<RAM_CS; // deassert cs
return status;
}
void ram_bulk_erase(void) {
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_WREN); // write enable instruction
RAM_PORT |= (1<<RAM_CS); // deassert cs
_delay_us(1);
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_BE); // bulk erase instruction
RAM_PORT |= (1<<RAM_CS); // deassert cs
while (read_ram_status())
;
}
void ram_sector_erase(uint8_t sector) {
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_WREN); // write enable instruction
RAM_PORT |= (1<<RAM_CS); // deassert cs
_delay_us(1);
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_SE); // sector erase instruction
xmit_spi(sector); // sector erase instruction
xmit_spi(0x00); // sector erase instruction
xmit_spi(0x00); // sector erase instruction
RAM_PORT |= (1<<RAM_CS); // deassert cs
while (read_ram_status())
;
}
void write_flash_page(uint8_t flash_sector,uint8_t flash_page,uint8_t* mem_ptr) {
read_write_flash_ram(0,256,flash_sector,flash_page,0,mem_ptr);
}
void read_flash_page(uint8_t flash_sector,uint8_t flash_page,uint8_t* mem_ptr) {
read_write_flash_ram(1,256,flash_sector,flash_page,0,mem_ptr);
}
void read_write_flash_ram(uint8_t one_read_zero_write,uint16_t bytes_to_readwrite,uint8_t flash_sector,uint8_t flash_page,uint8_t offset,uint8_t* mem_ptr) {
// NB CAUTION page writes which cross page boundaries will wrap
// parameters
// one_read_zero_write = 1 for read, 0 for write
// bytes_to_readwrite to read or write
// flash sector within device
// flash page within device
// offset for first byte to transfer
// POINTER TO ram address for first byte to transfer
uint16_t i;
// for ram device, enter and leave with SCK low
RAM_PORT &= ~(1<<RAM_CS); // assert cs
if (one_read_zero_write) {
xmit_spi(RAM_READ);
} else {
xmit_spi(RAM_WREN); // write enable instruction
RAM_PORT |= (1<<RAM_CS);
_delay_us(1);
RAM_PORT &= ~(1<<RAM_CS);
xmit_spi(RAM_PP);
}
xmit_spi(flash_sector);
xmit_spi(flash_page);
xmit_spi(offset);
for (i=0;i<bytes_to_readwrite;i++) {
if (one_read_zero_write) {
mem_ptr[i] = recv_spi();
} else {
xmit_spi(mem_ptr[i]);
}
}
RAM_PORT |= (1<<RAM_CS);
_delay_ms(400);
while (read_ram_status()) {
_delay_ms(10);
}
}
// write to the RAM status byte. 0 in bottom bit position = ready
void write_ram_status(uint8_t status) {
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_WREN); // write enable instruction
RAM_PORT |= (1<<RAM_CS); // deassert cs
_delay_us(2);
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_WRSR);
xmit_spi(status);
RAM_PORT |= 1<<RAM_CS; // deassert cs
_delay_us(2);
while (read_ram_status() & 0x01)
;
}
void power_up_flash_ram(void) {
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_RES);
RAM_PORT |= 1<<RAM_CS; // deassert cs
_delay_us(30);
}
void power_down_flash_ram(void) {
RAM_PORT &= ~(1<<RAM_CS); // assert cs
xmit_spi(RAM_DP);
RAM_PORT |= 1<<RAM_CS; // deassert cs
}

View File

@ -0,0 +1,140 @@
#include <avr/io.h>
#include <config.h>
/* Requires definitions of:
RAM_CS
RAM_PORT
RAM_DDR
/* Register definitions for M25P16 flash ram */
#define RAM_WREN 0x06 /* write enable */
#define RAM_WRDI 0x04 /* write disable */
#define RAM_RDID 0x9F /* read id */
#define RAM_RDSR 0x05 /* read status */
#define RAM_WRSR 0x01 /* write status */
#define RAM_READ 0x03 /* read data */
#define RAM_FASTREAD 0x0B
#define RAM_PP 0x02 /* page program */
#define RAM_SE 0xD8 /* sector erase */
#define RAM_BE 0xC7 /* bulk erase */
#define RAM_DP 0xB9 /* deep power down */
#define RAM_RES 0xAB /* release from power down, read electronic signature */
/** \brief Read 3 bytes of ID from the M26P16. These should always be 0x20,0x20,0x15
* \param *mem_ptr Pointer to location to store values returned.
*
*/
void read_ram_id(uint8_t* mem_ptr);
/** \brief Select the M25P16 and return 1 byte from the Status register.
* \return returns device status byte.
*
*/
uint8_t read_ram_status(void);
/** \brief Erase the M25P16.
*
* This function issues an erase command, then blocks until the command is complete as shown by
* the status register being zero.
* Note that the erase actually sets all bits to 1. The page program can set bits to 0, but NOT to 1.
* Therefore each page should be considered 'write once' between erase cycles.
*/
void ram_bulk_erase(void);
/** \brief Erase 1 sector of the M25P16.
* \param sector The sector number (0-31) to be erased.
*
* This function issues a sector erase command, then blocks until the command is complete as shown by
* the status register being zero
* For future expansion, no masking of the sector byte to ensure that it does not contain values >31 takes place
* Note that the erase actually sets all bits to 1. The page program can set bits to 0, but NOT to 1.
* Therefore each page should be considered 'write once' between erase cycles.
*/
void ram_sector_erase(uint8_t sector);
/** \brief Write exactly 256 bytes to the selected page of the M26P16 from memory
* \param flash_sector Sector number in the M25P16, range 0..31.
* \param flash_page Page number in the sector.
* \param *mem_ptr Pointer to the data location in memory
*
* The 256 bytes will be exactly aligned with a 256 byte boundary in the memory
* Writing 256 bytes at a time is the most efficient way to write to this device
*
* For reads or writes of less than 256 bytes, or non aligned read or writes use the read_write_flash_ram() function instead.
*/
void write_flash_page(uint8_t flash_sector,uint8_t flash_page,uint8_t* mem_ptr);
/** \brief Read exactly 256 bytes from the selected page of the M26P16 to memory
* \param flash_sector Sector number in the M25P16, range 0..31.
* \param flash_page Page number in the sector.
* \param *mem_ptr Pointer to the data location in memory
*
* The function will carry out the write enable instruction as part of the write
* The 256 bytes will be exactly aligned with a 256 byte boundary in the memory
*
* For reads or writes of less than 256 bytes, or non aligned read or writes use the read_write_flash_ram() function instead.
*/
void read_flash_page(uint8_t flash_sector,uint8_t flash_page,uint8_t* mem_ptr);
/** \brief Perform an arbirary read/write from/to the M26P16
* \param one_read_zero_write Any non-zero value will execute a read from the M25P16, 0 will execute a write to the M25P16
* \param bytes_to_readwrite uint16_t Number of bytes to read or write. Values will typically be less than or exactly 256. See below for why.
* \param flash_sector Sector number in the M25P16, range 0..31.
* \param flash_page Page number in the sector.
* \param offset Position in the page at which to start the read/write
* \param *mem_ptr Pointer to memory location for read/write data
*
* This function would typically only be used for reads or writes of <256 bytes.
*
* IMPORTANT The M25P16 is a block device. It deals in 256 byte pages.
* Writes only every take place to a single 256 byte page.
* If writing >256 bytes, anything other than the last 256 bytes will be overwritten and ignored.
* If offset is non-zero, then be aware that if offset+bytes_to_readwrite > 255, then any write
* will wrap back to the beginning of the page. This is unlikely to be what you want.
*/
void read_write_flash_ram(uint8_t one_read_zero_write,uint16_t bytes_to_readwrite,uint8_t flash_sector,uint8_t flash_page,uint8_t offset,uint8_t* mem_ptr);
/** \brief Write to the status register on the M25P16.
* \param status Value to write
*
* This function blocks until the bottom bit of the status register is clear = device ready.
*/
void write_ram_status(uint8_t status);
/** \brief Issue the command to bring the M25P16 out of power down mode.
*
* This function has no effect if the device is currently in one of the erase modes.
* At power up the deice will be in standby mode, there is no need to issue the power_up_flash_ram() command after a power up.
*/
void power_up_flash_ram(void);
/** \brief Issue the command to put the M25P16 into power down mode.
*
* In Power down mode the device ignores all erase and program instructions.
*
* In this mode the device draws 1uA typically.
* Use the power_up_flash_ram() command to bring the device out of power down mode.
* Removing power completely will also cancel the Deep power down mode - it will power up again in standby mode.
*/
void power_down_flash_ram(void);

View File

@ -0,0 +1,69 @@
/*
#define ACC_I2C_ADDRESS 0x32
#define MAG_I2C_ADDRESS 0x3C
#define LSM303_CTRL_REG1_A 0x20
#define LSM303_CTRL_REG2_A 0x21
#define LSM303_CTRL_REG3_A 0x22
#define LSM303_CTRL_REG4_A 0x23
#define LSM303_CTRL_REG5_A 0x24
#define LSM303_CTRL_REG6_A 0x25 // DLHC only
#define LSM303_HP_FILTER_RESET_A 0x25 // DLH, DLM only
#define LSM303_REFERENCE_A 0x26
#define LSM303_STATUS_REG_A 0x27
#define LSM303_OUT_X_L_A 0x28
#define LSM303_OUT_X_H_A 0x29
#define LSM303_OUT_Y_L_A 0x2A
#define LSM303_OUT_Y_H_A 0x2B
#define LSM303_OUT_Z_L_A 0x2C
#define LSM303_OUT_Z_H_A 0x2D
writeAccReg(LSM303_CTRL_REG1_A, 0x27);
*/
I2C1.setup({scl:B6, sda:B7});var ACC=0x32>>1;
I2C1.writeTo(ACC, [0x20, 0x27])
I2C1.writeTo(ACC, 0x28 | 0x80);I2C1.readFrom(ACC, 6)
peek32(0x40005418) // ISR
#define PERIPH_BASE ((uint32_t)0x40000000)
#define I2C1_BASE (APB1PERIPH_BASE + 0x00005400)
#define I2C_Register_ISR ((uint8_t)0x18)
I2C1.setup({scl:B6, sda:B7});
var ACC=0x32>>1;
I2C1.writeTo(ACC, [0x20, 0x27])
I2C1.writeTo(ACC, 0x28 | 0x80);I2C1.readFrom(ACC, 6)
I2C.prototype.writeAccReg = function(reg,val) {
this.writeTo(0x32>>1, [reg,val]);
}
I2C.prototype.readAccReg = function(reg,count) {
this.writeTo(0x32>>1, reg | 0x80);
return this.readFrom(0x32>>1, count);
}
I2C.prototype.readAcc = function(reg,count) {
var d = this.readAccReg(0x28, 6);
// reconstruct 16 bit data
var a = [d[0] | (d[1]<<8), d[2] | (d[3]<<8), d[4] | (d[5]<<8)];
// deal with sign bit
if (a[0]>=32767) a[0]-=65536;
if (a[1]>=32767) a[1]-=65536;
if (a[2]>=32767) a[2]-=65536;
return a;
}
I2C1.writeAccReg(0x20, 0x27); // turn on
I2C1.readAccReg(0x28, 6); // return array of data
I2C1.setup({scl:B6, sda:B7}); // Setup I2C
I2C1.writeAccReg(0x20, 0x27); // turn Accelerometer on
I2C1.readAcc() // Return acceleration data

View File

@ -0,0 +1,120 @@
var TEMP = [C2,C3,A0];
var COOLER = A2;
var fridgeOn = true;
var dutyCycle = 0.581574;
var temp = 19.640156;
var lcd = {"__proto__":prototype,"data":[B7,B8,B9,C13],"rs":B6,"en":B5,"constructor":LCD};
var tempOff = 18;
var tempOn = 19;
var history = [19.141516,19.34047,19.529809,19.544961,19.602311,19.607742,19.584991,19.489783,19.449727,19.356694,19.209622,19.009655,18.962103,18.793572,18.694277,18.581909,18.397325,18.290515,18.186933,18.090901,18.036967,17.89891,17.823425,17.643374,17.71561,17.646601,17.726387,17.792155,17.90646,18.039127,18.279717,18.439416,18.61111,18.777367,18.927518,19.126387,19.265846,19.378373,19.530878,19.608814];
function onInit() {
lcd = new LCD(B6,B5,C13,B9,B8,B7);
lcd.clear();
lcd.print("Espruino Fridge");
history = [];
historyOnOff = [];
}
function getTemp() {
digitalWrite(TEMP[0],0); // set voltage either side
digitalWrite(TEMP[2],1);
var val = analogRead(TEMP[1]); // read voltage
var ohms = 5600*val/(1-val); // work out ohms
var A = 0.0012874; // Steinhart equation
var B = 0.00023573;
var C = 0.000000095052;
var W = Math.log(ohms);
var temp = 1 / (A + W * (B+C * W*W)) - 273.15;
digitalWrite(TEMP[2],0);
return temp; // and return the temperature
}
function onTimer() {
var currTemp = getTemp();
tempSum += currTemp;
tempCnt++;
temp = temp*0.8 + currTemp*0.2;
if (temp < tempOff) fridgeOn = false;
if (temp > tempOn) fridgeOn = true;
digitalWrite(COOLER, fridgeOn);
dutyCycle = dutyCycle*0.999 + (fridgeOn?1:0)*0.001;
}
function LCD(rs,en,d4,d5,d6,d7) {
this.data = [d7,d6,d5,d4];
this.rs = rs;
this.en = en;
digitalWrite(this.rs, 0);
digitalWrite(this.en, 0);
this.write(0x33,1);
this.write(0x32,1);
this.write(0x28,1);
this.write(0x0C,1);
this.write(0x06,1);
this.write(0x01,1);
}
LCD.prototype.write = function (x,c) {
digitalWrite(this.rs, c==undefined);
digitalWrite(this.data, x>>4);
digitalPulse(this.en, 1, 0.01);
digitalWrite(this.data, x);
digitalPulse(this.en, 1, 0.01);
};
LCD.prototype.clear = function () { this.write(0x01,1); };
LCD.prototype.print = function (str) {
for (var i=0;i<str.length;i++)
this.write(Integer.valueOf(str.charAt(i)));
};
LCD.prototype.cursorFull = function () { this.write(0x0F,1); };
LCD.prototype.cursorUnder = function () { this.write(0x0E,1); };
LCD.prototype.setCursor = function (x,y) { var l=[0x00,0x40,0x14,0x54];this.write(0x80|(l[y]+x),1); };
LCD.prototype.createChar = function (ch,data) {
this.write(0x40 | ((ch&7) << 3), 1);
for (var i=0; i<8; i++) this.write(data[i]);
this.write(0x80,1);
};
function updateLCD() {
// print(JSON.stringify(lcd));
lcd = new LCD(B6,B5,C13,B9,B8,B7);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temp "+((temp*10)|0)/10.0 + " 'C")
lcd.setCursor(0,1);
lcd.print("Duty Cycle "+dutyCycle);
lcd.setCursor(0,2);
lcd.print("Cooler "+(fridgeOn?"On ":"Off")+" "+tempOff+"/"+tempOn);
lcd.setCursor(0,3);
lcd.print("History \0\1\2\3\4\5\6\7");
// update lcd chars
var charData = [[],[],[],[],[],[],[],[]];
for (var i=0;i<history.length;i++) {
var charNo = i/5;
var charBit = 1 << (4-(i%5));
var height = 2 + ((history[i]-tempOff)*2/(tempOn-tempOff))|0;
if (height>7) height=7;
if (height<0) height=0;
var coolerOn = historyOnOff[i];
for (var y=0;y<8;y++)
if ((coolerOn && y<height) || y==height)
charData[charNo][7-y] |= charBit;
}
for (var i=0;i<8;i++)
lcd.createChar(i,charData[i]);
}
function saveHistory() {
if (history.length >= 40)
history.splice(0, history.length-39);
if (historyOnOff.length >= 40)
historyOnOff.splice(0, historyOnOff.length-39);
history.push(tempSum / tempCnt);
historyOnOff.push(fridgeOn);
tempSum = 0;
tempCnt = 0;
}
var tempSum = 58.957409;
var tempCnt = 3;
var historyOnOff = [true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true];
setInterval(onTimer, 1000);
setInterval(saveHistory, 60000);
setInterval(updateLCD, 5000);

View File

@ -0,0 +1,47 @@
OneWire.prototype.getTemp = function (addr) {
this.reset();
this.select(addr);
this.write(0x44, true); // convert
this.reset();
this.select(addr);
this.write(0xBE);
var temp = this.read() + (this.read()<<8);
if (temp > 32767) temp -= 65536;
return temp / 16.0;
};
var ow = new OneWire(C14);
var addr = ow.search()[0];
var history = [];
function step() {
temp = ow.getTemp(addr);
if (history.length>100)
history.splice(0,1);
history.push(temp);
}
function draw() {
LCD.clear();
var lastx = 0;
var lasty = undefined;
for (idx in history) {
var thisx = idx*LCD.WIDTH/history.length;
var thisy = LCD.HEIGHT - (history[idx]-10)*4;
if (lasty!=undefined) LCD.drawLine(lastx, lasty, thisx, thisy, 0xFFF);
lastx = thisx;
lasty = thisy;
}
LCD.drawVectorString(Math.round(temp*10)/10.0, 10,20, 80, 0xFFFF);
LCD.drawVectorString("o", LCD.WIDTH-55, 0,15, 0xFFFF);
LCD.drawVectorString("C", LCD.WIDTH-40, 0,30, 0xFFFF);
}
var y = 240;
var thisy = 240;
var lastx = undefined;
var lasty = 240;
var temp = 0;
setInterval(step, 10000);
setInterval(draw, 10000);

View File

@ -0,0 +1,26 @@
function onInit() {
A0.set();
A2.reset();
}
onInit();
function step() {
a = analogRead(A1);
d1=0;
d2=0;
if (a>b) {
d1 = (a-b)/c;
} else {
d2 = (b-a)/c;
}
analogWrite(A6, d1);
analogWrite(A7, d2);
analogWrite(LED3, d1);
analogWrite(LED2, d2);
}
setInterval(step,10);
b = 0.18;
c = 0.05;

View File

@ -0,0 +1,38 @@
/*http.createServer(function (req, res) {
console.log("Connected");
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello World - ');
res.end(JSON.stringify(req)+'\n');
}).listen(8080);
*/
console.log("Parse: " + JSON.stringify(url.parse("http://localhost/foo.html")));
console.log("Parse: " + JSON.stringify(url.parse("http://www.pur3.co.uk")));
console.log("Parse: " + JSON.stringify(url.parse("http://localhost:82")));
console.log("Parse: " + JSON.stringify(url.parse("http://localhost:82/lala.html?jkhdgs")));
var options = {
host: 'www.google.com',
port: 80,
path: '/index.html',
method: 'GET'
};
var options = {
host: 'localhost',
port: 80,
path: '/',
method: 'GET'
};
http.get("http://www.pur3.co.uk", function(res) {
console.log("Got response: " + JSON.stringify(res));
res.on('data', function(data) {
console.log(">" + data);
});
});/*.on('error', function(e) {
console.log("Got error: " + e.message);
});*/
setTimeout("print('done');", 10000000);

View File

@ -0,0 +1,13 @@
function onPageRequest(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('<html><body>');
res.write('<p>Pin is '+(D25.read()?'on':'off')+'</p>');
res.write('<a href="/on">on</a><br/><a href="/off">off</a>');
res.end('</body></html>');
if (req.url=="/on") digitalWrite(D7, 1);
if (req.url=="/off") digitalWrite(D7, 0);
}
http.createServer(onPageRequest).listen(8080);

View File

@ -0,0 +1,6 @@
http.createServer(function (req, res) {
res.writeHead(200);
res.end();
}).listen(8080);
setTimeout("print('done');", 10000000);

View File

@ -0,0 +1,159 @@
// ------------------------------------------------------- LCD CONTROLLER
echo(0);
// 4 bit interface, 2 line
function LCD(rs,en,d4,d5,d6,d7) {
this.data = [d7,d6,d5,d4];
this.rs = rs;
this.en = en;
digitalWrite(this.rs, 0);
digitalWrite(this.en, 0);
this.write(0x33,1);
this.write(0x32,1);
this.write(0x28,1);
this.write(0x0C,1);
this.write(0x06,1);
this.write(0x01,1);
}
LCD.prototype.write = function(x, c) {
digitalWrite(this.rs, c==undefined);
digitalWrite(this.data, x>>4);
digitalPulse(this.en, 1, 0.01);
digitalWrite(this.data, x);
digitalPulse(this.en, 1, 0.01);
};
LCD.prototype.clear = function() { this.write(0x01,1); }
LCD.prototype.print = function(str) {
for (var i=0;i<str.length;i++)
this.write(Integer.valueOf(str.charAt(i)));
}
/** flashing block for the current cursor */
LCD.prototype.cursorFull = function() { this.write(0x0F,1); }
/** small line under the current cursor */
LCD.prototype.cursorUnder = function() { this.write(0x0E,1); }
/** set cursor pos, top left = 0,0 */
LCD.prototype.setCursor = function(x,y) { var l=[0x00,0x40,0x14,0x54];this.write(0x80|(l[y]+x),1); }
/** set special character 0..7, data is an array(8) of bytes, and then return to home addr */
LCD.prototype.createChar = function(ch, data) {
this.write(0x40 | ((ch&7) << 3), 1);
for (var i=0; i<8; i++) this.write(data[i]);
this.write(0x80,1);
}
echo(1);
// Big characters
LCD.prototype.bigChars = ["415 431151153 3311411115415415","3 3 3223223323315315 3323723","3 3 33 3 3 33 3 33 3 3","726 3322226 3226726 3726226"];
LCD.prototype.bigInit = function() {
this.createChar(1,[31,31,31,31,0,0,0,0]);
this.createChar(2,[0,0,0,0,0,31,31,31,31]);
this.createChar(3,[31,31,31,31,31,31,31,31]);
this.createChar(4,[1,3,7,15,31,31,31,31]);
this.createChar(5,[16,24,28,30,31,31,31,31]);
this.createChar(6,[31,31,31,31,30,28,24,16]);
this.createChar(7,[31,31,31,31,15,7,3,1]);
}
LCD.prototype.bigNum = function(x, num) {
for (var y=0;y<4;y++) {
this.setCursor(x,y);
for (var n=0;n<3;n++) {
var c = this.bigChars[y].charAt(num*3+n);
this.write(c==" "?32:parseInt(c));
}
}
}
LCD.prototype.bigDecimal = function(num) {
lcd.clear();lcd.bigNum(17,num%10);
if (num>9) lcd.bigNum(14,(num/10)%10);
if (num>99) lcd.bigNum(11,(num/100)%10);
if (num>999) lcd.bigNum(8,(num/1000)%10);
if (num>9999) lcd.bigNum(5,(num/10000)%10);
}
// -------------------------------------------------------
var onInit = function () { lcd = new LCD(A4,A5,A0,A1,A2,A3); lcd.bigInit(); };
num=0;
setInterval("num++;lcd.bigNum(17,num%10);if (num>9) lcd.bigNum(14,(num/10)%10);if (num>99) lcd.bigNum(11,(num/100)%10);if (num>999) lcd.bigNum(8,(num/1000)%10);if (num>9999) lcd.bigNum(5,(num/10000)%10);",500);
// -------------------------------------------------------
// see http://arduino.cc/en/uploads/Tutorial/LCD_bb.png for wiring
// VO can usually be grounded
var lcd = new LCD(A4,A5,A0,A1,A2,A3);
lcd.print("Hello World");
lcd.createChar(0,[
0b11111,
0b10001,
0b10101,
0b10101,
0b10001,
0b10101,
0b10001,
0b11111]);
lcd.createChar(1,[
0b11111,
0b10001,
0b10001,
0b10001,
0b10001,
0b10001,
0b10001,
0b11111]);
lcd.write(0);
lcd.write(1);
function showData() {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Current data:");
lcd.setCursor(4,1);
lcd.print("D1 = "+analogRead(D1));
}
setInterval(showData, 1000);
// Draw data with bar graph...
lcd.createChar(0,[0,0,0,0,0,0,0,31]);
lcd.createChar(1,[0,0,0,0,0,0,31,31]);
lcd.createChar(2,[0,0,0,0,0,31,31,31]);
lcd.createChar(3,[0,0,0,0,31,31,31,31]);
lcd.createChar(4,[0,0,0,31,31,31,31,31]);
lcd.createChar(5,[0,0,31,31,31,31,31,31]);
lcd.createChar(6,[0,31,31,31,31,31,31,31]);
lcd.createChar(7,[31,31,31,31,31,31,31,31]);
var history = new Array(20);
function showData() {
for (var i=1;i<history.length;i++) history[i-1]=history[i];
history[history.length-1] = Math.round(analogRead(D1)*16);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Current data:");
digitalWrite(D0,0);
digitalWrite(D2,1);
lcd.setCursor(4,1);
lcd.print("D1 = "+analogRead(D1));
lcd.setCursor(0,2);
for (var i=0;i<history.length;i++) {
var n=history[i];
if (n>16) n=16;
lcd.write((n>8)?(n-9):32);
}
lcd.setCursor(0,3);
for (var i=0;i<history.length;i++) {
var n=history[i];
if (n>8) n=8;
lcd.write((n>0)?(n-1):32);
}
}
setInterval(showData, 5000);

View File

@ -0,0 +1,131 @@
while (true)
LCD.fillRect(Math.random()*320,Math.random()*240,Math.random()*320,Math.random()*240,Math.random()*0xFFFF);
function Touch(callback) {
SPI1.send([0x90,0],B7); // just wake the controller up
var watchFunc = function() {
if (!digitalRead(B6)) {
clearWatch(watch); // clear this watch
// scan and call the callback
var dx = SPI1.send([0x90,0,0],B7);
var dy = SPI1.send([0xD0,0,0],B7);
callback((dx[1]*256+dx[2])*LCD.WIDTH/0x8000, 239-(dy[1]*256+dy[2])*LCD.HEIGHT/0x8000);
// re-add this watch
watch = setWatch(watchFunc, B6, true);
}
};
var watch = setWatch(watchFunc, B6, true);
}
function onInit() {
touch = new Touch(function(x,y) { LCD.fillRect(x-8, y-8, x+8, y+8, 0xFFFF); });
}
onInit();
var x = 320;
function newGraphElement() {
x++;
if (x>319) {
x=0;
LCD.clear();
}
var val = analogRead(C0);
var y = val*240;
LCD.setPixel(x, y, LCD.col(1,0,0));
val = analogRead(C1);
y = val*240;
LCD.setPixel(x, y, LCD.col(0,1,0));
LCD.drawString(val+" ", 0,0,0,0xFFFF);
};
setInterval(newGraphElement, 20);
function onInit() {
SPI1.send([0x90,0],B7); // just wake the controller up
}
function touchFunc() {
if (!digitalRead(B6)) { // touch down
var dx = SPI1.send([0x90,0,0],B7);
var dy = SPI1.send([0xD0,0,0],B7);
touchCallback((dx[1]*256+dx[2])*LCD.WIDTH/0x8000, 239-(dy[1]*256+dy[2])*LCD.HEIGHT/0x8000);
}
};
function touchCallback(x,y) {
LCD.fillRect(x-5,y-5,x+5,y+5,0xFFFF);
}
onInit();
setInterval(touchFunc, 100);
LCD.fillCircle = function(x,y,rad,col) {
var pts = Integer.parseInt(rad)/2;
var a = [];
for (var i=0;i<pts;i++) {
var t = 2*i*Math.PI/pts;
a.push(x+Math.sin(t)*rad);
a.push(y+Math.cos(t)*rad);
}
LCD.fillPoly(a,col);
}
LCD.clear();
while (true)
LCD.drawLine(Math.random()*LCD.WIDTH,Math.random()*LCD.HEIGHT,Math.random()*LCD.WIDTH,Math.random()*LCD.HEIGHT,0xFFFF*Math.random())
// ----------------------------------------------------------- Thermometer
var LCD = function () {};
var onInit = function () {
drawScreen();
SPI1.send([0x90,0],B7); // just wake the controller up
};
var touchFunc = function () {
if (!digitalRead(B6)) { // touch down
var dx = SPI1.send([0x90,0,0],B7);
var dy = SPI1.send([0xD0,0,0],B7);
var pos = [(dx[1]*256+dx[2])*LCD.WIDTH/0x8000, 239-(dy[1]*256+dy[2])*LCD.HEIGHT/0x8000];
touchCallback(pos[0], pos[1]);
lastPos = pos;
} else lastPos = null;
};
var touchCallback = function (x,y) {
if (lastPos!=null) {
temp += 0.05 * (lastPos[1]-y);
if (temp<0) temp=0;
if (temp>40) temp=40;
}
drawScreen();
};
var temp = 10.23;
var drawScreen = function () {
LCD.clear();
var tempStr = Math.round(temp*10)/10.0;
LCD.drawVectorString(tempStr,0,0,100,0xFFFF);
LCD.drawVectorString("o", 260,0, 25, 0xFFFF);
LCD.drawVectorString("C", 280,0, 50, 0xFFFF);
for (var i=0;i<history.length;i++)
LCD.fillRect(i*LCD.WIDTH*1.0/history.length, getScreenHeightForTemp(history[i]), (i+1)*LCD.WIDTH*1.0/history.length, getScreenHeightForTemp(0), LCD.col(1,0,0));
LCD.fillRect(0, getScreenHeightForTemp(temp), LCD.WIDTH-1, getScreenHeightForTemp(temp), LCD.col(0,1,0));
};
var lastPos = null;
var Math = function () {};
var history = new Array(30);
var measure = function () {
var value = analogRead(C0)*40;
for (var i=0;i<history.length-1;i++) history[i]=history[i+1];
history[history.length-1] = value;
digitalWrite(LED1, temp > value);
drawScreen();
};
var getScreenHeightForTemp = function (t) { return LCD.HEIGHT-(1+t*4); };
setInterval(touchFunc, 100);
setInterval(measure, 2000);

View File

@ -0,0 +1,27 @@
I2C1.setup({scl:B6, sda:B7})
LCD.prototype.write = function(x, c) {
var f = (x&0xF0) |8| ((c==undefined)?1:0); print(f);
I2C1.writeTo(0x27, f);
I2C1.writeTo(0x27, f | 4);
I2C1.writeTo(0x27, f);
var f = ((x<<4)&0xF0) |8| ((c==undefined)?1:0); print(f);
I2C1.writeTo(0x27, f);
I2C1.writeTo(0x27, f | 4);
I2C1.writeTo(0x27, f);
};
function LCD(i2c) {
this.i2c = i2c;
this.write(0x33,1);
this.write(0x32,1);
this.write(0x28,1);
this.write(0x0C,1);
this.write(0x06,1);
this.write(0x01,1);
}
LCD.prototype.write = function(x, c) {
var a = (x&0xF0) |8| ((c==undefined)?1:0);
var b = ((x<<4)&0xF0) |8| ((c==undefined)?1:0);
this.i2c.writeTo(0x27, [a,a|4,a,b,b|4,b]);
};

View File

@ -0,0 +1,117 @@
function LCD() {
this.DC = B6;
this.CE = B7;
this.RST = B8;
digitalPulse(this.RST, 0, 10); // pulse reset low
SPI1.setup({ baud: 1000000, sck:B3, mosi:B5 });
}
LCD.prototype.cmd = function (cmd) {
digitalWrite(this.DC,0);
SPI1.send(cmd, this.CE);
};
LCD.prototype.data = function (data) {
digitalWrite(this.DC,1);
SPI1.send(data, this.CE);
};
LCD.prototype.init = function () {
this.cmd(0x21); // fnset extended
this.cmd(0x80 | 0x40); // setvop (experiment with 2nd val to get the right contrast)
this.cmd(0x14); // setbias 4
this.cmd(0x04 | 0x02); // temp control
this.cmd(0x20); // fnset normal
this.cmd(0x08 | 0x04); // dispctl normal
this.pixels = new Uint8Array(6*84);
};
LCD.prototype.setPixel = function (x,y,c) {
var yp = y&7;
y>>=3;
this.cmd(0x40 | y); // Y addr
this.cmd(0x80 | x); // X addr
var p = x+y*84;
if (c) this.pixels[p] |= 1<<yp;
else this.pixels[p] &= ~(1<<yp);
this.data(this.pixels[p]);
this.cmd(0x40); // revert
};
LCD.prototype.clear = function () {
this.pixels = new Uint8Array(6*84);
for (var i=0;i<6;i++) {
this.cmd(0x40 | i); // Y addr
this.cmd(0x80); // X addr
for (var x=0;x<84;x++) this.data(0);
}
this.cmd(0x40); // revert
};
LCD.prototype.blit = function () {
for (var i=0;i<6;i++) {
this.cmd([0x40 | i, 0x80]); // Y addr, X addr
this.data(new Uint8Array(this.pixels.buffer,i*84,84));
}
this.cmd(0x40); // revert
};
LCD.prototype.clear = function () {
this.pixels = new Uint8Array(6*84);
this.blit();
};
// was working - now not??
var lcd = new LCD();
lcd.init()
for (var i=0;i<48;i++) lcd.setPixel(47-i,i,1)
for (var y=0;y<48;y++) {
line="";
for (var x=0;x<48;x++) {
var Xr=0;
var Xi=0;
var Cr=(4.0*x/48)-2.0;
var Ci=(4.0*y/48)-2.0;
var i=0;
while ((i<16) && ((Xr*Xr+Xi*Xi)<4)) {
var t=Xr*Xr - Xi*Xi + Cr;
Xi=2*Xr*Xi+Ci;
Xr=t;
i++;
}
lcd.setPixel(x,y,i&1);
}
}
// ---------------------------------------------------------------------------------
var LCD = Graphics.createArrayBuffer(84,48,1,{vertical_byte:true});
LCD.init = function () {
this.DC = B6;
this.CE = B7;
this.RST = B8;
SPI1.setup({ baud: 200000, sck:B3, mosi:B5 });
digitalPulse(this.RST, 0, 10); // pulse reset low
setTimeout(function() {
digitalWrite(this.DC,0); // cmd
SPI1.send(
[0x21, // fnset extended
0x80 | 0x40, // setvop (experiment with 2nd val to get the right contrast)
0x14, // setbias 4
0x04 | 0x02, // temp control
0x20, // fnset normal
0x08 | 0x04], this.CE); // dispctl normal
}, 100);
};
LCD.flip = function () {
for (var i=0;i<6;i++) {
digitalWrite(this.DC,0); // cmd
SPI1.send(0x40|i, this.CE); // Y addr
SPI1.send(0x80, this.CE); // X addr
digitalWrite(this.DC,1); // data
SPI1.send(new Uint8Array(this.buffer,i*84,84+2), this.CE);
}
// Why +2 in SPI.send? Maybe it needs some time to sort itself out
}
LCD.init();
LCD.clear();LCD.setFontVector(30);LCD.drawString("Hello");LCD.flip();

View File

@ -0,0 +1,186 @@
clearWatch();
clearInterval();
// Spinner
SPI1.setup({baud:3200000, mosi:B5});
var FRONT_BUTTON = A2;
var hours = 3,mins = 20,secs;
var slowdown;
var speed;
var running;
var mode = 0;
var timePressed;
var pos=0;
// button press
setWatch(function(e) {
if (e.time < timePressed+0.01) return; // skip button bounces
timePressed = e.time;
clearInterval();
if (mode == 0) { // clock
setInterval(function() {
secs++;
if (secs>59) {
secs = 0;
mins++;
if (mins>59) {
mins = 0;
hours++;
if (hours>11) {
hours = 0;
}
}
}
var leds = new Uint8Array(12*3);
var secled = parseInt(secs/5);
leds[1+(11-secled)*3] = 255; // green
var minled = parseInt(mins/5);
leds[2+(11-minled)*3] = 255; // blue
leds[0+(11-hours)*3] = 255; // red
SPI1.send4bit(leds, 0b0001, 0b0011);
}, 1000);
} else if (mode == 1) { // spin
speed = 20;
slowdown = 1.1 + Math.random()*0.1;
running = true;
setInterval(function() {
if (!running) {
speed = speed * slowdown;
changeInterval(0,speed);
if (speed > 500) clearInterval();
}
pos++;
if (pos>11) {
pos = 0;
}
var leds = new Uint8Array(12*3);
leds[0+(11-pos)*3] = 255; // red
leds[2+(11-pos)*3] = 255; // blue
SPI1.send4bit(leds, 0b0001, 0b0011);
}, speed);
} else if (mode == 2) { // random flick between 6
speed = 20;
slowdown = 1.1 + Math.random()*0.1;
running = true;
setInterval(function () {
if (!running) {
speed = speed * slowdown;
changeInterval(0,speed);
if (speed > 500) clearInterval();
}
pos = parseInt(Math.random()*6)*2;
var leds = new Uint8Array(12*3);
var r = 1+parseInt(Math.random()*6);
leds[0+(11-pos)*3] = (r&1)?0:255; // red
leds[1+(11-pos)*3] = (r&2)?0:255; // green
leds[2+(11-pos)*3] = (r&4)?0:255; // blue
SPI1.send4bit(leds, 0b0001, 0b0011);
}, speed);
} else if (mode == 3) {
speed = 20;
slowdown = 1.2 + Math.random()*0.1;
running = true;
setInterval(function () {
if (!running) {
speed = speed * slowdown;
changeInterval(0,speed);
if (speed > 500) clearInterval();
}
var patterns = [
[0],
[0,5],
[0,4,8],
[0,3,6,9],
[0,2,4,6,9],
[0,2,4,6,8,10],
];
var r = parseInt(Math.random()*patterns.length);
var leds = new Uint8Array(12*3);
for (i in patterns[r]) {
leds[1+patterns[r][i]*3] = 255; // green
leds[2+patterns[r][i]*3] = 255; // blue
}
SPI1.send4bit(leds, 0b0001, 0b0011);
}, speed);
}
}, FRONT_BUTTON, { repeat: true, edge: "rising" });
// button release
setWatch(function(e) {
if (e.time < timePressed+0.01) return; // skip button bounces
if (e.time > timePressed+1) { // long press
clearInterval();
// go to next mode
mode++;
if (mode>3) mode=0;
print(mode);
// all LEDs off
SPI1.send4bit(new Uint8Array(12*3), 0b0001, 0b0011);
} else {
// short press - signal for animation to slow down and stop
running = false;
}
timePressed = e.time;
}, FRONT_BUTTON, { repeat: true, edge: "falling" });
function onInit() {
// pull the front button down, so we don't need an external resistor
pinMode(FRONT_BUTTON, "input_pulldown");
}
onInit();
// SIMPLE SPIN
SPI1.setup({baud:3200000, mosi:B5});
var FRONT_BUTTON = A2;
var slowdown;
var speed;
var running;
var timePressed;
var pos=0;
// button press
setWatch(function(e) {
if (e.time < timePressed+0.01) return; // skip button bounces
timePressed = e.time;
// remove any animation that may have been happening
clearInterval();
// set up initial values
speed = 20;
slowdown = 1.1 + Math.random()*0.1;
running = true;
// start animation...
setInterval(function() {
if (!running) { // if the button was released...
speed = speed * slowdown; // slow down
changeInterval(0,speed); // use this to slow the timer
if (speed > 500) clearInterval(); // if it's really slow then stop
}
pos++; // spin around
if (pos>11) pos = 0; // wrap around when we get to the least LED
// Now work out what pattern to show - just light up one light (with red and blue LEDs)
var leds = new Uint8Array(12*3);
leds[0+(11-pos)*3] = 255; // red
leds[2+(11-pos)*3] = 255; // blue
SPI1.send4bit(leds, 0b0001, 0b0011); // send to the lights
}, speed); // speed for setInterval
}, FRONT_BUTTON, { repeat: true, edge: "rising" });
// button release
setWatch(function(e) {
timePressed = e.time;
// signal the animation to slow down and stop
running = false;
}, FRONT_BUTTON, { repeat: true, edge: "falling" });
function onInit() {
// pull the front button down, so we don't need an external resistor
pinMode(FRONT_BUTTON, "input_pulldown");
}
onInit();

View File

@ -0,0 +1,184 @@
// Can't run on the VL board - as it has to be quite fast
// Also needs USB to be unplugged, as servicing the USB messes it up
C5.reset();
SPI1.setup({baud:1600000});
function handle(data) {
var l = data.length;
var res = "";
var chs = "\x11\x13\x31\x33";
for (var i=0;i<l;i++) {
var c = Integer.valueOf(data.charAt(i));
res = res + chs.charAt((c>>6)&3) + chs.charAt((c>>4)&3) + chs.charAt((c>>2)&3) + chs.charAt(c&3);
}
return res;
}
function p(data) {
var l = data.length;
for (var i=0;i<l;i++) {
print(Integer.valueOf(data.charAt(i)));
}
}
p(handle("\0\0\xFF\0\xFF\0\xFF\0\0"));
SPI1.send(handle("\0\0\xFF\0\xFF\0\xFF\0\0"));
var pos = 0;
function timer() {
pos++;
if (pos>49) pos = 0;
var cols = "";
for (var i=0;i<50;i++) {
if (i==pos)
cols += "\xFF\x7F\x20";
else
cols += "\x10\x05\0";
}
SPI1.send(handle(cols));
}
setInterval(timer,100);
function testspi() {
SPI1.setup({baud:3200000});
var cols = "";
for (var i=0;i<50;i++) {
cols += "\xFF\x7F\x20";
}
SPI1.send(cols);
}
SPI1.setup({baud:3200000});
var pos = 0;
function timer() {
pos++;
if (pos>49) pos = 0;
var cols = "";
for (var i=0;i<50;i++) {
if (i==pos)
cols += "\xFF\x7F\x20";
else
cols += "\x10\x05\0";
}
SPI1.send4bit(cols, 0x1, 0x3);
}
setInterval(timer,50);
C5.reset();
SPI1.setup({baud:3200000});
// SPI1.setup({baud:3200000,mosi:D11});D10.reset();
var pos = 0;
function timer() {
pos++;
var cols = "";
for (var i=0;i<50;i++) {
cols += "\0\0" + String.fromCharCode((1+Math.sin((i+pos)*0.1))*127);
}
SPI1.send4bit(cols, 0x1, 0x3);
}
setInterval(timer,50);
function timer() {
pos++;
var cols = "";
for (var i=0;i<50;i++) {
cols += String.fromCharCode((1+Math.sin((i+pos)*0.1324))*127) + String.fromCharCode((1+Math.sin((i+pos)*0.1654))*127) + String.fromCharCode((1+Math.sin((i+pos)*0.1))*127);
}
SPI1.send4bit(cols, 0x1, 0x3);
}
SPI1.send4bit([255,0,0], 0b0001, 0b0011);
function timer() {
pos++;
var cols = [];
for (var i=0;i<50;i++) {
cols.push(1+Math.sin((i+pos)*0.1324)*127);
cols.push(1+Math.sin((i+pos)*0.1654)*127);
cols.push(1+Math.sin((i+pos)*0.1)*127);
}
SPI1.send4bit(cols, 0x1, 0x3);
}
function getPattern() {
var cols = [];
for (var i=0;i<50;i++) {
cols.push(i*5);
cols.push(i*5);
cols.push(i*5);
}
return cols;
}
var pos = 0;
function getPattern() {
pos++;
var cols = [];
for (var i=0;i<50;i++) {
cols.push(Math.round((1+Math.sin((i+pos)*0.1324))*127));
cols.push(Math.round((1+Math.sin((i+pos)*0.1654))*127));
cols.push(Math.round((1+Math.sin((i+pos)*0.1))*127));
}
return cols;
}
function doLights() {
SPI1.send4bit(getPattern(), 0b0001, 0b0011);
}
var pos = 0;
function getPattern() {
pos++;
var cols = "";
for (var i=0;i<50;i++) {
cols += String.fromCharCode((1 + Math.sin((i+pos)*0.1324)) * 127) +
String.fromCharCode((1 + Math.sin((i+pos)*0.1654)) * 127) +
String.fromCharCode((1 + Math.sin((i+pos)*0.1)) * 127);
}
return cols;
}
function getPattern() {
pos++;
var cols = "";
for (var i=0;i<50;i++) {
cols += String.fromCharCode(0) +
String.fromCharCode(0) +
String.fromCharCode( Math.random()*255 );
}
return cols;
}
// haloween
function () {
amt += 0.05;
var n = 0;
for(var i=0;i<25;i++) {
arr[n++] = 0;
arr[n++] = Math.clip(90*Math.sin(0.5*i+amt) + 128 + 90*Math.sin((0.3*i-amt)*3.2324), 0, 255);
arr[n++] = 0;
}
SPI1.send4bit(arr, 0b0001, 0b0011);
}

View File

@ -0,0 +1,115 @@
arr = new Uint8Array(26*3);
function step() {
amt += dir;
if (amt < 0) {
amt = 0;
} else if (amt > 1.5 && dir>0) {
amt = 3;
dir = 0;
} else {
if (!BTN1.read()) dir = -0.01;
}
if (amt<1 && BTN1.read()) dir = 0.04;
var n = 0;
for(var i=0;i<25;i++) {
var c = 255*(2*amt - (Math.abs(i-12.5)/12.5 +0.5));
arr[n++] = Math.clip(256+c*2, 0, 255);
arr[n++] = Math.clip(64+c, 0, 255);
arr[n++] = Math.clip(c/2, 0, 255);
}
SPI1.send4bit(arr, 0b0001, 0b0011);
}
var amt = 0;
var stepInterval = 3;
function onInit() {
stepInterval = setInterval(step, 100);
}
var dir = -0.01;
var d = undefined;
setInterval(step, 20);
SPI1.setup({"baud":3200000,"mosi":A7});
>for (i=0;i<25;i++) r[i] = Math.random();
>var r = new Float32Array(25);
>step = function () {
: amt += 0.3;
:
: var n = 0;
: for(var i=0;i<25;i++) {
: var c = 255*(Math.sin(r[i]*220+amt) +0.5);
: arr[n++] = Math.clip(256+c*2, 0, 255);
: arr[n++] = Math.clip(64+c, 0, 255);
: arr[n++] = Math.clip(c/2, 0, 255);
: }
: SPI1.send4bit(arr, 0b0001, 0b0011);
:};
var cols = [new Uint8Array(4),[0,0,255,255],[0,0,0,0]];
function setCol(n,r,g,b) {
cols[0][n] = r*255;
cols[1][n] = g*255;
cols[2][n] = b*255;
}
// christmas
function () {
amt += 0.3;
var n = 0;
for(var i=0;i<25;i++) {
var c = 255*(Math.sin(r[i]*220+amt)*0.5 +0.5);
arr[n++] = Math.clip(c*2, 0, 255);
arr[n++] = Math.clip(c*2-256, 0, 255);
arr[n++] = 0;
}
SPI1.send4bit(arr, 0b0001, 0b0011);
}
// wedding
=function () {
amt += 0.1;
var n = 0;
for(var i=0;i<25;i++) {
var c = Math.sin(i*0.2+amt)*0.5+0.5;
arr[n++] = Math.clip(64+c*128, 0, 255);
arr[n++] = 0;
arr[n++] = Math.clip(255-c*128,0,255);
}
SPI1.send4bit(arr, 0b0001, 0b0011);
}
// patriotic
=function () {
amt += 0.15;
var n = 0;
for(var i=0;i<25;i++) {
var c = (Math.random()*3)|0;
arr[n++] = c<2 ? 255 : 0;
arr[n++] = c==1 ? 255 : 0;
arr[n++] = c>0 ? 255 : 0;
}
SPI1.send4bit(arr, 0b0001, 0b0011);
}
// One end to other
function () {
amt += 0.1;
var pos = (Math.sin(amt)*0.5+0.5)*25;
var n = 0;
for(var i=0;i<25;i++) {
var c = Math.abs(i-pos);
arr[n++] = Math.clip((4-c)*63,0,255);
arr[n++] = 0;
arr[n++] = 0;
}
SPI1.send4bit(arr, 0b0001, 0b0011);
}

View File

@ -0,0 +1,117 @@
// connect from mis-marked D14 to pin below (B15)
var col = {r:127,g:127,b:127};
var onInit = function () {
SPI1.setup({sck:A5,miso:A6,mosi:A7})
SPI1.send([0x90,0],A4); // just wake the controller up
SPI2.setup({baud:1600000,mosi:B15});//B14.reset();
SPI2.send4bit([255,0,0], 0b0001, 0b0011); // test
LCD.clear();
drawCols();
drawRGB();
};
function setColArray(data) {
SPI2.send4bit(data, 0b0001, 0b0011);
}
function setSolidCol(c) {
var d = "";
var cstr = String.fromCharCode(c.r)+String.fromCharCode(c.g)+String.fromCharCode(c.b);
for (var i=0;i<50;i++) d += cstr;
setColArray(d);
}
function setBlendedCol() {
var d = "";
for (var i=0;i<50;i++) {
var a = (i/25.0)+(pos*3)-2;
if (a<0) a=0;
if (a>1) a=1;
d += String.fromCharCode(colFrom.r*(1-a) + colTo.r*a)+
String.fromCharCode(colFrom.g*(1-a) + colTo.g*a)+
String.fromCharCode(colFrom.b*(1-a) + colTo.b*a);
}
setColArray(d);
}
var touchFunc = function () {
if (!digitalRead(B6)) { // touch down
var d = SPI1.send([0x90,0,0xD0,0],A4);
var pos = {x:(d[1]*256+d[2])*LCD.WIDTH/0x8000,
y:(d[3]*256+d[4])*LCD.HEIGHT/0x8000};
touchCallback(pos.x, pos.y);
lastPos = pos;
} else lastPos = null;
};
var touchCallback = function (x,y) {
var b = (y*1.2/LCD.HEIGHT - 0.1)*256;
if (b<0) b=0;
if (b>255) b=255;
// check for colour sliders
if (x>260) { col.b = b; setSolidCol(col); drawRGB(); }
else if (x>200) { col.g = b; setSolidCol(col); drawRGB(); }
else if (x>140) { col.r = b; setSolidCol(col); drawRGB(); }
else { // check for taps on the colour boxes
for (var i=0;i<cols.length;i++) {
var r = getColRect(i);
if (x>r[0] && y>r[1] && x<r[2] && y<r[3]) {
cols[i] = col.clone();
drawCols();
}
}
}
}
function drawRGB() {
for (var i=0;i<240;i+=16) {
LCD.fillRect(200,i,239,i+15,LCD.col(i*1.0/LCD.HEIGHT,0,0));
LCD.fillRect(240,i,279,i+15,LCD.col(0,i*1.0/LCD.HEIGHT,0));
LCD.fillRect(280,i,319,i+15,LCD.col(0,0,i*1.0/LCD.HEIGHT));
}
var cr = col.r*LCD.HEIGHT/256;
var cg = col.g*LCD.HEIGHT/256;
var cb = col.b*LCD.HEIGHT/256;
LCD.fillRect(200,cr-8,239,cr+8,0xFFFF);
LCD.fillRect(240,cg-8,279,cg+8,0xFFFF);
LCD.fillRect(280,cb-8,319,cb+8,0xFFFF);
}
function getColRect(i) {
var x = (i/4)|0;
var y = i - (x*4);
return [x*60,y*60,(x+1)*60,(y+1)*60];
}
function drawCols() {
var s = 60;
for (var i=0;i<cols.length;i++) {
var c = cols[i];
var r = getColRect(i);
LCD.fillRect(r[0],r[1],r[2],r[3],LCD.col(c.r/255.0,c.g/255.0,c.b/255.0));
}
}
var cols = [{"r":228,"g":228,"b":11},{"r":170,"g":226,"b":30},{"r":223,"g":97,"b":30},{"r":245,"g":203,"b":119}];
var colFrom = {"r":228,"g":228,"b":11};
var colTo = {"r":170,"g":226,"b":30};
var pos = 0.28;
function step() {
if (lastPos!=null) return; // touch down, so don't set
// smoothly move between colours
pos += 0.02;
if (pos>1) {
pos = 0;
colFrom = colTo;
colTo = cols[(Math.random()*cols.length)|0];
}
// send data to the LEDs
setBlendedCol();
}
setInterval(step, 100);
onInit();setInterval(touchFunc, 50);
setWatch("save()", BTN1, {edge:"rising", repeat:true});

View File

@ -0,0 +1,146 @@
function onInit() {
SPI1.setup({baud:3200000, mosi:A7});
C3.set(); // Pull the light sensor's potential divider up to 3.3v
}
onInit();
var light = 0.0; // an average
function getPattern() {
var lightInstant = analogRead(C1)*3;
light = lightInstant*0.1 + light*0.9;
var cols = [];
for (var i=0;i<50;i++) {
var c = (-Math.abs(i-25)*10) + light*1024 - 200;
if (c<0) c=0;
if (c>255) c=255;
cols.push(c);
c = (-Math.abs(i-25)*10) + light*1024 - 450;
if (c<0) c=0;
if (c>255) c=255;
cols.push(c);
c = (-Math.abs(i-25)*10) + light*1024 - 600;
if (c<0) c=0;
if (c>255) c=255;
cols.push(c);
}
return cols;
}
function doLights() {
SPI1.send4bit(getPattern(), 0b0001, 0b0011);
}
setInterval(doLights, 50);
SPI1.send4bit([255,0,0], 0b0001, 0b0011);
SPI1.send4bit([0,255,0], 0b0001, 0b0011); // green
SPI1.send4bit([0,0,255], 0b0001, 0b0011); // blue
SPI1.send4bit([255,255,255], 0b0001, 0b0011); // white
function getPattern() {
var cols = [];
for (var i=0;i<50;i++) {
cols.push(i*5);
cols.push(i*5);
cols.push(i*5);
}
return cols;
}
function doLights() {
SPI1.send4bit(getPattern(), 0b0001, 0b0011);
}
doLights();
This is a set of lights that smoothly changes colour and pattern depending on the amount of light in the room.<br />
<br />
Apologies for the video - you'll need to view it in HD, and even then you may not be able top make out all of the code.<br />
<br />
You'll need:
<ul>
<li>
An <a href="http://www.st.com/web/en/catalog/tools/PF252419#">STM32F4DISCOVERY</a> board</li>
<li>
A <a href="http://www.ebay.co.uk/sch/i.html?_nkw=USB+TTL">USB-TTL converter </a>- this is not vital, without it the LEDs will flicker when USB is plugged in, but once you remove it they will be fine</li>
<li>
A <a href="http://www.ebay.co.uk/sch/i.html?_nkw=WS2811">WS2811</a> LED string</li>
<li>
A Light Dependent Resistor (LDR) and matching normal resistor (in my case 200k)</li>
<li>
The <a href="http://www.espruino.com">Espruino JavaScript interpreter</a> Software</li>
</ul>
<br />
I connected:
<ul>
<li>
The white+red wires of the WS2811s to 0v and 5v</li>
<li>
The green wire of the LDR to pin PA7</li>
<li>
The LDR between ground and pin PC1</li>
<li>
A 200kOhm resistor between PC3 and PC1</li>
</ul>
<br />
There's more information on controlling and wiring up the lights on the <a href="http://www.espruino.com/Tutorial+5">Espruino tutorial for WS2811s</a>. The actual code you need to copy and paste in is:<br />
<blockquote>
<code>function onInit() {<br />
&nbsp; SPI1.setup({baud:3200000, mosi:A7});<br />
&nbsp; C3.set(); // Pull the light sensor's potential divider up to 3.3v<br />
}<br />
onInit();<br />
<br />
var light = 0.0; // an average<br />
<br />
function getPattern() {&nbsp;&nbsp;&nbsp;<br />
&nbsp; var lightInstant = analogRead(C1)*3;<br />
&nbsp; light = lightInstant*0.1 + light*0.9;<br />
&nbsp; var cols = [];<br />
&nbsp; for (var i=0;i&lt;50;i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp; var c = (-Math.abs(i-25)*10) + light*1024 - 200;<br />
&nbsp;&nbsp;&nbsp;&nbsp; if (c&lt;0) c=0;<br />
&nbsp;&nbsp;&nbsp;&nbsp; if (c&gt;255) c=255;<br />
&nbsp;&nbsp;&nbsp;&nbsp; cols.push(c);<br />
&nbsp;&nbsp;&nbsp;&nbsp; c = (-Math.abs(i-25)*10) + light*1024 - 450;<br />
&nbsp;&nbsp;&nbsp;&nbsp; if (c&lt;0) c=0;<br />
&nbsp;&nbsp;&nbsp;&nbsp; if (c&gt;255) c=255;<br />
&nbsp;&nbsp;&nbsp;&nbsp; cols.push(c);<br />
&nbsp;&nbsp;&nbsp;&nbsp; c = (-Math.abs(i-25)*10) + light*1024 - 600;<br />
&nbsp;&nbsp;&nbsp;&nbsp; if (c&lt;0) c=0;<br />
&nbsp;&nbsp;&nbsp;&nbsp; if (c&gt;255) c=255;<br />
&nbsp;&nbsp;&nbsp;&nbsp; cols.push(c);<br />
&nbsp; }<br />
&nbsp; return cols;<br />
}<br />
<br />
function doLights() {&nbsp;&nbsp;&nbsp;<br />
&nbsp; SPI1.send4bit(getPattern(), 0b0001, 0b0011);<br />
}<br />
<br />
setInterval(doLights, 50);</code></blockquote>
<br />
And job done! If you type 'save()' it'll keep working even after power off.

View File

@ -0,0 +1,59 @@
var inAnim = false;
var pos = 0;
var anim = [
//[pointer, arm],
[1,0], // folded away
[0.9,0.0], // touching the lid
[0.8,0.05], // push up
[0.7,0.2],
[0.6,0.3],
[0.5,0.5],
[0.3,0.7],
[0.1,1],
[0.25,1], // press
[0,1],
[0.3,0.7],
[1,0],
];
var lastPress = 0;
function onPress(e) {
if (e.time < lastPress + 0.5) return;
lastPress = e.time;
if (inAnim) {
C6.reset(); // light off
} else {
// startanim
C6.set(); // light on
inAnim = true;
pos = 0;
print("interval "+setInterval(onAnimStep, 25));
}
}
function onAnimStep() {
pos += 0.02;
if (pos > anim.length) {
clearInterval(0);
digitalWrite([LED1,LED2,LED3], 0); // off status
inAnim = false;
return;
}
analogWrite(LED1, pos);
analogWrite(LED2, pos-1);
analogWrite(LED3, pos-2);
var i = pos|0;
var f = pos-i;
if (i>anim.length-2) {
i=anim.length-2;
f=1;
}
digitalPulse(B12, 1, 2-Math.clip(anim[i][0]*(1-f) + anim[i+1][0]*f,0,1));
digitalPulse(B13, 1, 2-Math.clip(anim[i][1]*(1-f) + anim[i+1][1]*f,0,1));
}
setWatch(onPress, B15, { repeat:true, edge:'falling' });
s = [1,0];
setInterval("digitalPulse(B12, 1, 2-s[0]);digitalPulse(B13, 1, 2-s[1]);", 50);
clearInterval();

View File

@ -0,0 +1,27 @@
for (y=0;y<128;y++) {
line="";
for (x=0;x<128;x++) {
Xr=0;
Xi=0;
Cr=(4.0*x/128)-2.0;
Ci=(4.0*y/128)-2.0;
iterations=0;
while ((iterations<128) && ((Xr*Xr+Xi*Xi)<4)) {
t=Xr*Xr - Xi*Xi + Cr;
Xi=2*Xr*Xi+Ci;
Xr=t;
iterations++;
}
if (iterations&1)
line += "*";
else
line += " ";
}
print(line);
}
// time ./TinyJSC test ../code/mandel-big.js
// user 0m8.897s - 6/8/2012
// user 0m8.501s - 6/8/2012 - make jsvIs* inline
// user 0m7.160s - 6/8/2012 - no asserts
// user 0m6.60s - 6/8/2012 - add jsvLockAgain instead of lock/getRef

View File

@ -0,0 +1 @@
X1=-2.0;Y1=-2.0;X2=2.0;Y2=2.0;for (y=0;y<32;y++) {print(y);}

View File

@ -0,0 +1,2 @@
X1=-2.0;Y1=-2.0;X2=2.0;Y2=2.0;for (y=0;y<32;y++) {line="";for (x=0;x<32;x++) {Xr=0;Xi=0; Cr=X1+((X2-X1)*x/32);Ci=Y1+((Y2-Y1)*y/32);i=0;while ((i<32) && ((Xr*Xr+Xi*Xi)<4)) {t=Xr*Xr - Xi*Xi + Cr;Xi=2*Xr*Xi+Ci;Xr=t;i++;}if(i&1)line+="*";else line+=" "; } print(line);}

View File

@ -0,0 +1,128 @@
/* Mandelbrot! */
for (y=0;y<32;y++) {
line="";
for (x=0;x<32;x++) {
Xr=0;
Xi=0;
Cr=(4.0*x/32)-2.0;
Ci=(4.0*y/32)-2.0;
iterations=0;
while ((iterations<32) && ((Xr*Xr+Xi*Xi)<4)) {
var t=Xr*Xr - Xi*Xi + Cr;
Xi=2*Xr*Xi+Ci;
Xr=t;
iterations++;
}
if (iterations&1)
line += "*";
else
line += " ";
}
print(line);
}
//smaller
for (y=0;y<16;y++) {
line="";
for (x=0;x<16;x++) {
Xr=0;
Xi=0;
Cr=(4.0*x/16)-2.0;
Ci=(4.0*y/16)-2.0;
iterations=0;
while ((iterations<16) && ((Xr*Xr+Xi*Xi)<4)) {
var t=Xr*Xr - Xi*Xi + Cr;
Xi=2*Xr*Xi+Ci;
Xr=t;
iterations++;
}
if (iterations&1)
line += "*";
else
line += " ";
}
print(line);
}
for (y=0;y<32;y++) {
line="";
for (x=0;x<32;x++) {
var Xr=0;
var Xi=0;
var Cr=(4.0*x/32)-2.0;
var Ci=(4.0*y/32)-2.0;
var i=0;
while ((i<8) && ((Xr*Xr+Xi*Xi)<4)) {
var t=Xr*Xr - Xi*Xi + Cr;
Xi=2*Xr*Xi+Ci;
Xr=t;
i++;
}
if (i&1)
line += "*";
else
line += " ";
}
print(line);
}
y=0;
setInterval(function() { line=""; for (x=0;x<64;x++) {Xr=0;Xi=0; Cr=(4.0*x/64)-2.0;Ci=(4.0*y/64)-2.0;i=0;while ((i<32) && ((Xr*Xr+Xi*Xi)<4)) {t=Xr*Xr - Xi*Xi + Cr;Xi=2*Xr*Xi+Ci;Xr=t;i++;}if (i&1)line += "*";else line += " "; }print(line); y++; }, 1000);
digitalWrite("C9", 1);
digitalWrite("C9", 0);
setWatch(function() {
if (digitalRead("A0")) {
digitalWrite("C9",1);
setTimeout(function() {
digitalWrite("C9", 0);
setTimeout(function() {
digitalWrite("C9", 1);
setTimeout(function() {
digitalWrite("C9", 0);
}, 301);
}, 302);
}, 303);
}}, "A0", true);
setWatch(function() {
if (digitalRead("A0")) {
digitalWrite("C9",1);
setTimeout(function() {
digitalWrite("C9", 0);
}, 303);
}}, "A0", true);
setWatch(function() { print(getTime()); }, "A0", true);
digitalPulse("C9",1,1000);
print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
Serial1.onData(function(e){print(e.data);});
// LCD mandel
for (y=0;y<240;y++) {
for (x=0;x<320;x++) {
var Xr=0;
var Xi=0;
var Cr=(4.0*x/240)-2.0;
var Ci=(4.0*y/240)-2.0;
var i=0;
while ((i<5) && ((Xr*Xr+Xi*Xi)<4)) {
var t=Xr*Xr - Xi*Xi + Cr;
Xi=2*Xr*Xi+Ci;
Xr=t;
i++;
}
LCD.setPixel(x,y, (i&1)?0xFFFFFF:0);
}
}

View File

@ -0,0 +1,46 @@
var sensor = require("DS18B20").getSensor(B12);;
sensor.getTemp();
var g = require("PCD8544").getNokia5110();;
g.clear();
g.drawString("Hello",0,0);
g.drawLine(0,10,84,10);
g.flip();
function onTimer() {
var t = sensor.getTemp();
var tStr = ""+t;
tStr = tStr.substring(0,4);
g.clear();
g.setFontVector(25);
g.drawString(tStr,0,0);
g.flip();
}
var history = new Float32Array(84);
function onTimer() {
var t = sensor.getTemp();
var tStr = ""+t;
tStr = tStr.substring(0,4);
for (i in history) history[i] = history[i+1];
history[history.length-1] = t;
g.clear();
g.setFontVector(25);
g.drawString(tStr,0,0);
var min=20, max=25;
for (x in history) {
y = 47 - ((history[x]-min)*20/(max-min));
if (x==0) g.moveTo(x,y); else g.lineTo(x,y);
}
g.flip();
}
setTimeout('for (i=0;i<30;i++) print(" ")',100)

View File

@ -0,0 +1,156 @@
function NRF(sck, miso, mosi, csn, ce, payload) {
this.CSN = csn;
this.CE = ce;
this.PAYLOAD = payload;
this.BASE_CONFIG = 8; //EN_CRC
this.cmd = ""; // for receiving commands
this.SPI = SPI1;
this.SPI.setup({sck:SCK, miso:MISO, mosi:MOSI});
}
NRF.prototype.C = {
CONFIG :0x00,
STATUS :0x07,
CD :0x09,
RX_ADDR_P0 :0x0A,
RX_ADDR_P1 :0x0B,
TX_ADDR :0x10,
RX_PW_P0 :0x11,
RX_PW_P1 :0x12,
R_REGISTER:0x00,
W_REGISTER:0x20,
R_RX_PAYLOAD:0x61,
W_TX_PAYLOAD:0xA0,
FLUSH_TX:0xE1,
FLUSH_RX:0xE2 };
NRF.prototype.init = function(rxAddr, txAddr) {
digitalWrite(this.CE,0);
digitalWrite(this.CSN,1);
this.setRXAddr(rxAddr);
this.setTXAddr(txAddr);
this.setReg(this.C.RX_PW_P0, this.PAYLOAD);
this.setReg(this.C.RX_PW_P1, this.PAYLOAD);
this.setReg(this.C.CONFIG, this.BASE_CONFIG | 2/*PWR_UP*/ | 1/*PRIM_RX*/); // RX mode
digitalWrite(this.CE,1); // set active
}
NRF.prototype.setReg = function(reg, value) {
this.SPI.send([this.C.W_REGISTER | reg, value], this.CSN);
}
NRF.prototype.setAddr = function(reg, value /* 5 byte array*/) {
value = value.clone();
value.splice(0,0,this.C.W_REGISTER | reg);
this.SPI.send(value, this.CSN);
}
NRF.prototype.setRXAddr = function(adr /* 5 byte array*/) {
this.setAddr(this.C.RX_ADDR_P1,adr);
}
NRF.prototype.setTXAddr = function(adr /* 5 byte array*/) {
this.setAddr(this.C.RX_ADDR_P0,adr);
this.setAddr(this.C.TX_ADDR,adr);
}
NRF.prototype.getReg = function(reg) {
return this.SPI.send([this.C.R_REGISTER | reg, 0], this.CSN)[1];
}
NRF.prototype.getAddr = function(reg) {
var data = this.SPI.send([this.C.R_REGISTER | reg, 0,0,0,0,0], this.CSN);
data.splice(0,1); // remove first
return data;
}
NRF.prototype.getStatus = function(reg) {
return this.getReg(this.C.STATUS);
}
NRF.prototype.dataReady = function() {
return (this.getReg(this.C.STATUS)&14/*RX_P_NO*/)!=14; // next payload
}
NRF.prototype.getData = function() {
var data = [this.C.R_RX_PAYLOAD];
for (var i=0;i<this.PAYLOAD;i++) data.push(0);
data = this.SPI.send(data, this.CSN); // RX_DR bit
data.splice(0,1); // remove first
this.setReg(this.C.STATUS, 64/*RX_DR*/); // clear rx flag
return data;
}
NRF.prototype.send = function(data/* array of length PAYLOAD */) {
this.setReg(this.C.STATUS, 16/*MAX_RT*/|32/*TX_DS*/); // clear flags
digitalWrite(this.CE,0); // disable
this.setReg(this.C.CONFIG, this.BASE_CONFIG | 2/*PWR_UP*/ ); // Set TX mode
this.SPI.send(this.C.FLUSH_TX, this.CSN);
data = data.clone();
data.splice(0,0,this.C.W_TX_PAYLOAD);
this.SPI.send(data, this.CSN);
digitalWrite(this.CE,1); // enable
var n = 1000;
while ((n--) && !(this.getReg(this.C.STATUS)&(16/*MAX_RT*/|32/*TX_DS*/))); // waiting
if (n<=0) print("TX timeout");
var success = true;
if (this.getReg(this.C.STATUS)&16/*MAX_RT*/) {
print("TX not received "+this.getReg(this.C.STATUS));
success = false;
}
digitalWrite(this.CE,0); // disable
this.setReg(this.C.CONFIG, this.BASE_CONFIG | 2/*PWR_UP*/ | 1/*PRIM_RX*/); // RX mode
digitalWrite(this.CE,1); // enable
this.setReg(this.C.STATUS, 16/*MAX_RT*/|32/*TX_DS*/); // clear flags
return success;
}
NRF.prototype.slaveHandler = function() {
while (this.dataReady()) {
data = this.getData();
for (var i in data) {
var ch = data[i];
if (ch==0 && this.cmd!="") {
var c = this.cmd;
this.cmd = "";
print("...>"+c);
var result = ""+eval(c); // evaluate
print("...="+result);
setTimeout(function() {
this.sendString(result); // send the result back
}, 500); // wait
} else if (ch!=0) {
this.cmd += String.fromCharCode(ch);
}
}
}
}
NRF.prototype.masterHandler = function() {
while (this.dataReady()) {
data = this.getData();
for (var i in data) {
var ch = data[i];
if (ch==0 && this.cmd!="") {
print(this.cmd);
this.cmd = "";
} else if (ch!=0) {
this.cmd += String.fromCharCode(ch);
}
}
}
}
NRF.prototype.sendString = function(cmd) {
for (var i=0;i<=cmd.length;i+=this.PAYLOAD) {
var data = [];
for (var n=0;n<this.PAYLOAD;n++) data[n] = Integer.valueOf(cmd[i+n]);
var tries = 3;
while ((tries-- > 0) && !this.send(data));
}
}
// 'master' device (on Espruino)
var nrf = new NRF( A5, A6, A7, C4, C5, 4 );
function onInit() {
nrf.init([0,0,0,0,2], [0,0,0,0,1]);
}
onInit();
setInterval("nrf.masterHandler()",50);
nrf.sendString("1+2");
// 'slave' device (on Olimexino)
var nrf = new NRF( D13, D12, D11, D1, D0, 4 );
function onInit() {
nrf.init([0,0,0,0,1], [0,0,0,0,2]);
}
onInit();
setInterval("nrf.slaveHandler()",50);

View File

@ -0,0 +1 @@
var ow = new OneWire(D0);

View File

@ -0,0 +1,36 @@
Pin.prototype.moveTo = function (pos,time) {
if (time==undefined) time = 1000;
var pin = this;
var t = 0;
var int = setInterval(function() {
digitalPulse(pin, 1, 1+Math.clip(pos,0,1));
t += 20;
if (t>time) clearInterval(int);
}, 20);
};
var VENT = B12;
var WATER = B13;
Pin.prototype.moveTo = function (pos,time) {
if (time==undefined) time = 1000;
var pin = this;
var amt = 0;
if (servoPos==undefined) servoPos = {};
if (servoPos[pin]==undefined) servoPos[pin] = pos;
var int = setInterval(function() {
if (amt>1) {
clearInterval(int);
servoPos[pin] = pos;
amt = 1;
}
digitalPulse(pin, 1, 1+Math.clip(pos*amt + servoPos[pin]*(1-amt),0,1));
amt += 1000.0 / (20*time);
}, 20);
};
function ventClose() { VENT.moveTo(0.65, 2000); }
function ventOpen() { VENT.moveTo(0.1, 2000); }
function waterOn() { WATER.moveTo(0.9, 2000); }
function waterOff() { WATER.moveTo(0.2, 2000); }

View File

@ -0,0 +1,60 @@
var pos = 0.5;
function getPattern1() {
var cols = [];
for (var i=0;i<50;i++) {
cols.push((1 + Math.sin((i+pos)*0.1324)) * 127);
cols.push((1 + Math.sin((i+pos)*0.1654)) * 127);
cols.push((1 + Math.sin((i+pos)*0.1)) * 127);
}
return cols;
}
function getPattern2() {
var cols = "";
for (var i=0;i<50;i++) {
cols += String.fromCharCode((1 + Math.sin((i+pos)*0.1324)) * 127) +
String.fromCharCode((1 + Math.sin((i+pos)*0.1654)) * 127) +
String.fromCharCode((1 + Math.sin((i+pos)*0.1)) * 127);
}
return cols;
}
function getPattern3() {
var cols = new Uint8Array(50*3);
for (var i=0;i<50;i++) {
cols[i*3] = (1 + Math.sin((i+pos)*0.1324)) * 127;
cols[i*3+1] = (1 + Math.sin((i+pos)*0.1654)) * 127;
cols[i*3+2] = (1 + Math.sin((i+pos)*0.1)) * 127;
}
return cols;
}
function getPattern4() {
var cols = new Uint8Array(50*3);
var n = 0;
for (var i=0;i<50;i++) {
cols[n++] = (1 + Math.sin((i+pos)*0.1324)) * 127;
cols[n++] = (1 + Math.sin((i+pos)*0.1654)) * 127;
cols[n++] = (1 + Math.sin((i+pos)*0.1)) * 127;
}
return cols;
}
var t = [];
t.push(getTime());
for (var z=0;z<100;z++) getPattern1();
t.push(getTime());
for (var z=0;z<100;z++) getPattern2();
t.push(getTime());
for (var z=0;z<100;z++) getPattern3();
t.push(getTime());
for (var z=0;z<100;z++) getPattern4();
t.push(getTime());
for (i=0;i<t.length-1;i++)
print("Time "+i+" = "+(t[i+1]-t[i]));
result = true;

View File

@ -0,0 +1,109 @@
clearWatch();
var pressed = false;
setWatch(function() {
if(!pressed)
doColour(red);
pressed = true;
}, C6, { repeat: true, edge:'rising'});
setWatch(function() {
if(!pressed)
doColour(green);
pressed = true;
}, C7, { repeat: true, edge:'rising'});
setWatch(function() {
if(!pressed)
doColour(yellow);
pressed = true;
}, C9, { repeat: true, edge:'rising'});
setWatch(function() {
if(!pressed)
doColour(blue);
pressed = true;
}, C8, { repeat: true, edge:'rising'});
function onInit() {
pinMode(C6, "input_pulldown");
pinMode(C7, "input_pulldown");
pinMode(C8, "input_pulldown");
pinMode(C9, "input_pulldown");
}
onInit();
setWatch(function() {
pressed = false;
clearInterval();
setInterval(doLights, 20);
}, BTN, { repeat: true, edge:'rising'});
function blue() {
var cols = [];
for (var i=0;i<25;i++) {
cols.push(0);
cols.push(0);
cols.push(255);
}
return cols;
}
function red() {
var cols = [];
for (var i=0;i<25;i++) {
cols.push(255);
cols.push(0);
cols.push(0);
}
return cols;
}
function green() {
var cols = [];
for (var i=0;i<25;i++) {
cols.push(0);
cols.push(255);
cols.push(0);
}
return cols;
}
function yellow() {
var cols = [];
for (var i=0;i<25;i++) {
cols.push(255);
cols.push(255);
cols.push(0);
}
return cols;
}
function getPattern() {
pos++;
var cols = [];
for (var i=0;i<25;i++) {
var col = Math.round((Math.sin(i+pos)+1) * 127);
cols.push(col);
col = Math.round((Math.sin(i+pos*1.321124)+1) * 127);
cols.push(col);
cols.push(col);
}
return cols;
}
function doLights() {
SPI1.send4bit(getPattern(), 0b0001, 0b0011);
}
function doColour(col) {
SPI1.send4bit(col(), 0b0001, 0b0011);
clearInterval();
}
var pos = 3668;
clearInterval();
setInterval(doLights, 20);
SPI1.setup({"baud":3200000,"mosi":A7});

View File

@ -0,0 +1,168 @@
clearWatch();
clearInterval();
var TRIG = A0; // ultrasonic trigger
var ECHO = A1; // ultrasonic echo signal
var MOTORS = [B0,B1,A7,A6]; // pins for the motors
var t1 = 0;
var dist = 0;
var inManouver = false;
// Get the distance from the sensor
setWatch(function(e) { t1=e.time; }, ECHO, { repeat:true, edge:'rising' });
setWatch(function(e) { var dt=e.time-t1; dist = (dt*1000000)/57.0; }, ECHO, { repeat:true, edge:'falling' });
// 20 times a second, trigger the distance sensor
setInterval("digitalPulse(TRIG,1, 10/1000.0)",50);
// reverse, turn, and go forwards again
function backup() {
inManouver = true;
digitalWrite(MOTORS, 5); // back
setTimeout(function() {
digitalWrite(MOTORS, 6); // turn
setTimeout(function() {
inManouver = false;
digitalWrite(MOTORS, 6); // forward again
}, 500);
}, 500);
}
function forward() {
digitalWrite(MOTORS, 10);
}
function stop() {
digitalWrite(MOTORS, 0);
}
function onInit() {
forward();
}
function step() {
// if we detect we're getting too close, turn around
if (dist < 20 && !inManouver)
backup();
}
setInterval(step, 100); // check every 100ms to see if we're too close
onInit(); // start going forwards
var TRIG = A0;
var ECHO = A1;
var MOTORS = [B0,B1,A7,A6];
var t1 = 0.91688;
var dist = 76136.251949;
var inManouver = false;
var targetDist = 26.327729;
function backup() {
inManouver = true;
digitalWrite(MOTORS, 5); // back
digitalWrite([LED1,LED2,LED3],4);
setTimeout(function() {
digitalWrite(MOTORS, 6); // turn
digitalWrite([LED1,LED2,LED3],5);
setTimeout(function() {
inManouver = false;
forward();
}, 500);
}, 500);
}
function forward() {
digitalWrite(MOTORS, 10);
digitalWrite([LED1,LED2,LED3],1);
}
function stop() {
digitalWrite(MOTORS, 0);
}
function onInit() {
Serial3.setConsole();
forward();
}
function step() {
if (mode==0) {
if (dist < 20 && !inManouver)
backup();
}
if (mode==1) {
var d = targetDist - dist;
var c = 5;
// print(d);
digitalWrite(MOTORS[0], d<-c);
digitalWrite(MOTORS[1], d>c);
digitalWrite(MOTORS[2], d<-c);
digitalWrite(MOTORS[3], d>c);
}
}
var led = undefined;
var mode = 1;
function onButton() {
mode++;
if (mode>1) mode=0;
digitalWrite([LED1,LED2,LED3], 1+mode);
if (mode == 0) forward();
if (mode == 1) targetDist = dist;
}
setInterval("digitalPulse(TRIG,1, 10/1000.0)", 50);
setInterval(step, 100);
setWatch(function (e) { t1=e.time; }, A1, { repeat:true, edge:'rising' });
setWatch(function (e) { var dt=e.time-t1; dist = (dt*1000000)/57.0; }, A1, { repeat:true, edge:'falling' });
setWatch(onButton, A3, { repeat:true, edge:'rising' });
// simple bluetooth robot control
// Pins for the motors
var MOTORS = [B0,B1,A7,A6];
// Pin values to set
var GO = { FORWARD: 0b1010, BACK : 0b0101, LEFT : 0b0110, RIGHT : 0b1001 };
function move(motorState, time) {
digitalWrite(MOTORS, motorState);
setTimeout("digitalWrite(MOTORS, 0);", 500);
}
Serial3.setup(9600);
Serial3.onData(function(e) {
var command = e.data;
if (command=="w") move(GO.FORWARD, 500);
if (command=="s") move(GO.BACK, 500);
if (command=="a") move(GO.LEFT, 500);
if (command=="d") move(GO.RIGHT, 500);
});
// voice bluetooth robot control
// Pins for the motors
var MOTORS = [B0,B1,A7,A6];
// Pin values to set
var GO = { FORWARD: 0b1010, BACK : 0b0101, LEFT : 0b0110, RIGHT : 0b1001 };
function move(motorState, time) {
digitalWrite(MOTORS, motorState);
setTimeout("digitalWrite(MOTORS, 0);", 500);
}
Serial3.setup(9600);
var command = "";
Serial3.onData(function(e) {
command += e.data;
if (e.data==" " || e.data=="\n") {
command="";
} else {
print(command);
if (command=="forward") move(GO.FORWARD, 500);
if (command=="back") move(GO.BACK, 500);
if (command=="left") move(GO.LEFT, 500);
if (command=="right") move(GO.RIGHT, 500);
}
});

View File

@ -0,0 +1,31 @@
var step = 0;
var bigStep = 0;
var r = require("Encoder").connect(A1,A2,function (s) {
step-=s;
while (step>40) step-=40;
if (step<0) step=0;
bigStep = step>>2;
print(bigStep);
})
var code = [8,1,9,2];
var codeStep = 0;
function onClick() {
if (codeStep<code.length && code[codeStep] == bigStep) {
codeStep++;
if (codeStep >= code.length) {
print("UNLOCKED");
digitalWrite([LED1,LED2,LED3], 0b010);
} else {
print("STEP "+codeStep);
}
} else {
codeStep = 0;
print("WRONG");
digitalWrite([LED1,LED2,LED3], 0b100);
}
}
pinMode(B12, "input_pulldown");
setWatch(onClick, B12, { repeat: true, edge: "rising" });

View File

@ -0,0 +1,30 @@
var servox = D6;
var servoy = D5;
function start() {
x=0;
y=0;
dir=1;
interval = setInterval(step, 50);
}
function stop() {
clearInterval(interval);
}
function step() {
x+=dir;
var lastDir = dir;
if (dir>0 && x>40) dir=-1;
if (dir<0 && x<1) dir=1;
if (dir!=lastDir) {
print(str);
str="";
y++;
if (y>20) stop();
} else {
if (dir>0) str=str+get();
else str=get()+str;
}
digitalPulse(servox,1,1+(x/40.0));
digitalPulse(servoy,1,1+(y/20.0));
}
function get() { return ':'; }

View File

@ -0,0 +1,146 @@
function setServo(pin,pos) {
if (pos<0) pos=0;
if (pos>1) pos=1;
analogWrite(pin, (1+pos) / 50.0, {freq:20});
}
setServo(C7, 0.5); // set servo on pin C7 to mid position
// Servo will continue to be controlled without writing any other code
Or just to show off, you can also overload the 'Pin' object to add a new method to it:
Pin.prototype.servo = function(pos) {
if (pos<0) pos=0;
if (pos>1) pos=1;
analogWrite(this, (1+pos) / 50.0, {freq:20});
}
C7.servo(0.5);
// -------------------------------------------------------- Laser tag
var lastPos = undefined;
function touchCallback(x,y) {
if (lastPos!=undefined && x==undefined) {
lastPos = undefined;
} else if (lastPos==undefined && x!=undefined) {
LCD.clear();
positions = [];
}
if (x!=undefined) {
if (lastPos!=undefined)
LCD.drawLine(x,y,lastPos.x,lastPos.y,0xFFFF);
var pos = {x:x,y:y};
positions.push([ 0.75 - x*0.5 / LCD.WIDTH, 0.75 - y*0.5 / LCD.HEIGHT ]);
lastPos = pos;
}
}
function onInit() {
SPI1.send([0x90,0],B7); // just wake the controller up
}
function touchFunc() {
if (!digitalRead(B6)) { // touch down
var dx = SPI1.send([0x90,0,0],B7);
var dy = SPI1.send([0xD0,0,0],B7);
touchCallback((dx[1]*256+dx[2])*LCD.WIDTH/0x8000, 239-(dy[1]*256+dy[2])*LCD.HEIGHT/0x8000);
} else
touchCallback();
};
onInit();
setInterval(touchFunc, 50);
var servoPos = [0.5,0.5];
function servoFunc() {
digitalPulse(D2, 1, 1+servoPos[0]);
digitalPulse(C11, 1, 1+servoPos[1]);
}
setInterval(servoFunc, 50);
var positions = [];
function servoMove() {
if (positions.length==0) return;
pos = (pos + 1) % positions.length;
servoPos = positions[pos];
}
setInterval(servoMove, 100);
// Sin r/r
function moveTo(x,y) {
LCD.fillRect(x*200,y*200, x*200+2, y*200+2, 0xFFFF);
}
function func(x,y) {
var dx = x-0.5;
var dy = y-0.5;
var r = 30*Math.sqrt(dx*dx + dy*dy) + 0.001;
return Math.sin(r)/r;
}
function step() {
// do a zig-zag motion over x and y
pos = pos + 0.001;
if (pos>=1) pos=0;
var bars = 20.0;
var p = pos*bars;
var y = Math.floor(p);
var x = p-y;
if (y&1 == 1) x=1-x;
y = y/bars;
// work out z
z = func(x,y);
y = y - z*0.2;
moveTo(0.1+x*0.8,0.1+y*0.8);
}
var pos = 0;
setInterval(step, 50);
// when button1 is pressed, clear screen and start again
setWatch("LCD.clear();pos=0;", BTN1, { edge:"falling", repeat: true });
function moveTo(x,y) {
digitalPulse(D2, 1, 1.25+x*0.5);
digitalPulse(C11, 1, 1.25+y*0.5);
x = x * 240; ;
y =239 - (240*y); ocessing - clearing all timers and watches.
LCD.fillRect(x,y,x+1,y+1, 0xFFFF);
};
// super 3d sin r/r
function func(dx,dy) {
var r = 30*Math.sqrt(dx*dx + dy*dy) + 0.001;
return Math.sin(r)/r;
};
function step() {
// do a zig-zag motion over x and y
pos = pos + 0.0005;
if (pos>=1) pos=1;
var bars = 20.0;
var p = pos*bars;
var y = Math.floor(p);
var x = p-y;
if (y&1 == 1) x=1-x;
x = x-0.5;
var z = y/bars - 0.5;
// work out y, x and z are between -0.5 and 0.5
y = func(x,z)*0.4;
var ry = 0.5;
var rx = 0.5;
var xt = Math.cos(ry)*x + Math.sin(ry)*z;
z = Math.cos(ry)*z - Math.sin(ry)*x; x=xt;
var yt = Math.cos(rx)*y + Math.sin(rx)*z;
z = Math.cos(rx)*z - Math.sin(rx)*y; y=yt;
z += 4;
moveTo(0.5 + (x*2.5/z), 0.5 + (y*2.5/z));
};

View File

@ -0,0 +1,189 @@
function foo(a,b) { return a+333*b;};foo(1,4);
function flash(c) {
if (c<=0) return;
setTimeout(function() {
digitalWrite("C9",1);
setTimeout(function() {
digitalWrite("C9",0);
flash(c-1);
}, 250);
}, 250);
}
var count = 0;
setWatch(function() {
if (!digitalRead("A0")) return;
flash(count++);
}, "A0", true);
var count = 0;
setWatch(function () {
if (!digitalRead("A0")) return;
print(count);
count++;
}, "A0", 1);
// measure the time between button presses
var downTime = 0;
setWatch(function(x) {
if (digitalRead("A0"))
downTime = x.time;
else
print(x.time - downTime);
}, "A0", true);
// flash 4 lights on stm32f4 around
var n=1;
setInterval(function () {
n=n>>1;
if (n==0) n=16;
digitalWrite(["D12","D13","D14","D15"],n);
},50);
// just write different analog values...
analogWrite("D12",0.5);
analogWrite("D13",0.25);
analogWrite("D14",0.75);
analogWrite("D15",1);
var ramp = [0,0.05,0.2,0.3,0.5,1,0.5,0.3,0.2,0.05];
var c = 0;
var d = 2;
var e = 4;
var f = 8;
function next() {
c = (c+1)%ramp.length;
d = (d+1)%ramp.length;
e = (e+1)%ramp.length;
f = (f+1)%ramp.length;
analogWrite("D12",ramp[c]);
analogWrite("D13",ramp[d]);
analogWrite("D14",ramp[e]);
analogWrite("D15",ramp[f]);
}
setInterval(next,50);
analogWrite("C9",0.1);
analogWrite("D12",0.5);
analogWrite("D13",0.25);
analogWrite("D14",0.75);
analogWrite("D15",1);
var ramp = [0,0.05,0.2,0.3,0.5,1,0.5,0.3,0.2,0.05];
var c = 0;
var d = 5;
function next() {
c = (c+1)%ramp.length;
d = (d+1)%ramp.length;
analogWrite("C8",ramp[c]);
analogWrite("C9",ramp[d]);
}
setInterval(next,50);
// measure time between keypresses and set light brightness
var bright = 0;
var target = 0;
var lastPress = 0;
setWatch(function(e) {
if (digitalRead("A0"))
lastPress = e.time;
else
target = (e.time-lastPress)/2;
}, "A0",true);
setInterval(function() {
bright=bright*0.9+target*0.1;
analogWrite("C9",bright-0.1);
analogWrite("C8",bright-0.6);
},100);
// speed test
var a = 1;
setInterval("a=!a;digitalWrite('D12',a);", 0);
var b = 1;
setInterval("b=!b;digitalWrite('D13',b);", 0);
// servo test
var coords = [0.876,0.5];
var step = function () {
t+=s;
if (t>1) t=0;
if (t<0.25) {
coords = [t*4,0];
} else if (t<0.5) {
coords = [1,(t-0.25)*4];
} else if (t<0.75) {
coords = [1-((t-0.5)*4),1];
} else {
coords = [0,1-((t-0.75)*4)];
}
};
var step = function () {
t+=s;
if (t>1) t=0;
coords = [0.5 + Math.sin(t*2*Math.PI)*0.5, 0.5+Math.cos(t*2*Math.PI)*0.5];
print(coords[0]+","+coords[1]);
}
var pulse = function () {
digitalPulse(D0,1,1+coords[0]);
digitalPulse(D1,1,1+coords[1]);
}
var t = 0.438;
var s = 0.001;
setInterval("step();pulse();", 50);
var test = function () {
digitalWrite(A0,0);digitalWrite(A2,1); average=average*0.9 + 0.1*analogRead(A1);
if (!on && average<0.4) setOn();
if (on && average>0.5) setOff();
};
var on = 1;
var setOn = function () { on=true; digitalWrite(LED1,1); setTimeout("digitalWrite(LED1,0)",1000);};
var setOff = function () { on=false; digitalWrite(LED2,1); setTimeout("digitalWrite(LED2,0)",1000);};
var average = 0.414431;
setInterval("test()", 100);
// scroller
var leds = [D9,D11,D12,D14];
var state = 10307921510;
var scroll = function () {
state = ((state>>1)&0b0111) | (state<<3);
digitalWrite(leds, state);
};
// ----------------------------------- All 4 lights
var c = 0;
var next = function () {
c+=0.1;
analogWrite(LED1,(Math.sin(c)+1)*0.15);
analogWrite(LED2,(Math.sin(c+Math.PI)+1)*0.15);
};
setInterval(next, 50);
var c = 0;
var next = function () {
c+=0.1;
analogWrite("D12",(Math.sin(c)+1)*0.25);
analogWrite("D13",(Math.sin(c+Math.PI*0.5)+1)*0.25);
analogWrite("D14",(Math.sin(c+Math.PI)+1)*0.25);
analogWrite("D15",(Math.sin(c+Math.PI*1.5)+1)*0.25);
}
setInterval(next, 50);

View File

@ -0,0 +1,8 @@
setWatch(function() {
LED1.set();
setTimeout("LED1.reset();LED2.set();",500);
setTimeout("LED2.reset();LED3.set();",1000);
setTimeout("LED3.reset()",1500);
}, BTN, {repeat: true, edge:"rising"});
setDeepSleep(1);

View File

@ -0,0 +1,22 @@
var msg = "... --- ...";
var led = "C9";
var button = "A0";
var n = 0;
function char() {
var c = msg.charAt(n++);
if (c==".") {
digitalWrite(led,1);
setTimeout("digitalWrite(led,0);", 250);
setTimeout(char, 500);
} else if (c=="-") {
digitalWrite(led,1);
setTimeout("digitalWrite(led,0);", 500);
setTimeout(char, 750);
} else if (c==" ") {
setTimeout(char, 500);
} // else it's the end of the string - do nothing
}
setWatch("if (digitalRead(button)) {n=0;char();}",button,true);
// if this is started many times, we get a memory leak

View File

@ -0,0 +1,58 @@
// Simple stepper
var step = 0;
var steps = [0b0001,0b0010,0b0100,0b1000];
var stepperPins = [D9,D11,D14,D12];
function doStep() {
step = (step+1) % steps.length;
digitalWrite(stepperPins, steps[step]);
}
setInterval(doStep, 200);
// Stepper with dynamic speed
var step = 0;
var targetStep = 0;
var steps = [0b0001,0b0011,0b0010,0b0110,0b0100,0b1100,0b1000,0b1001];
var stepperPins = [D9,D11,D14,D12];
var stepInterval = setInterval(doStep, 100);
var doStep = function () {
var d = step - targetStep;
if (d < 0)
step++;
else if (d > 0)
step--;
if (d==0) { // we're there - sleep
changeInterval(stepInterval, 500);
digitalWrite(stepperPins, 0);
} else {
var time = 100 - Math.abs(d)*4;
if (time<10) time=10;
changeInterval(stepInterval, time);
digitalWrite(stepperPins, steps[step%steps.length]);
}
};
var targetStep = 0;
var stepInterval = setInterval(doStep, 100);
// Then run this to enable microstepping
var doStep = function () {
var d = step - targetStep;
if (d < 0)
step++;
else if (d > 0)
step--;
if (d==0) { // we're there - sleep
changeInterval(stepInterval, 500);
digitalWrite(stepperPins, 0);
} else {
var time = 100 - Math.abs(d)*4;
if (time<50) time=50;
changeInterval(stepInterval, time);
analogWrite(stepperPins[0], Math.sin(0.5*step));
analogWrite(stepperPins[1], Math.sin((0.5*step) + Math.PI*0.5));
analogWrite(stepperPins[2], Math.sin((0.5*step) + Math.PI));
analogWrite(stepperPins[3], Math.sin((0.5*step) + Math.PI*1.5));
}
};

View File

@ -0,0 +1,37 @@
var moveServo = function (p) {
var pulses = 20;
var f = function() { digitalPulse(D0,1,p); if (pulses-->0) setTimeout(f, 50); };
f();
};
var on = 0;
var setOn = function () {
on=true;
digitalWrite(LED1,1);
setTimeout("digitalWrite(LED1,0)",1000);
moveServo(2);
};
var setOff = function () {
on=false;
digitalWrite(LED2,1);
setTimeout("digitalWrite(LED2,0)",1000);
moveServo(1);
};
var test = function () {
digitalWrite(A0,0);
digitalWrite(A2,1);
average=average*0.8 + 0.2*analogRead(A1);
if (!on && average<0.4) setOn();
if (on && average>0.5) setOff();
};
var average = 0;
var blink = function () {
digitalWrite(LED1,1);
setTimeout('digitalWrite(LED1,0)',50);
};
setInterval(test, 200);
setInterval(blink, 5000);

View File

@ -0,0 +1,14 @@
// Code to handle a 5k @ 25 degree C thermistor
function getTemp() {
digitalWrite(D0,0);
digitalWrite(D2,1);
var val = analogRead(D1);
var ohms = 5600*val/(1-val);
var A = 0.00128463;
var B = 0.00023625;
var C = 0.000000092697;
var W = Math.log(ohms);
var temp = 1 / (A + W * (B+C * W*W)) - 273.15
return temp;
}

View File

@ -0,0 +1,29 @@
var tune = "g g C.. C.. g g C.. C.. D D E... E... D D E.. E.. G.. G.... G.. G.... G F E.. E.. G F E.. E.. ";
var tune = "g e g g e g A A g f e d e f";
var tune = "c c c d e e d e f g C C C g g g e e e c c c g f e d c";
var pos = 0;
var BUZZER=A1;
function step() {
var ch = tune[pos];
if (ch!=undefined) pos++;
if (ch==' ' || ch==undefined) freq(0); // off
else if (ch=='a') freq(220.00);
else if (ch=='b') freq(246.94);
else if (ch=='c') freq(261.63);
else if (ch=='d') freq(293.66);
else if (ch=='e') freq(329.63);
else if (ch=='f') freq(349.23);
else if (ch=='g') freq(392.00);
else if (ch=='A') freq(440.00);
else if (ch=='B') freq(493.88);
else if (ch=='C') freq(523.25);
else if (ch=='D') freq(587.33);
else if (ch=='E') freq(659.26);
else if (ch=='F') freq(698.46);
else if (ch=='G') freq(783.99);
}
function freq(freq) {
if (freq==0) digitalWrite(BUZZER,0);
else analogWrite(BUZZER, 0.5, { freq: freq } );
}
setInterval(step, 200);

View File

@ -0,0 +1,29 @@
clearWatch();
clearInterval();
var TRIG = A12;
var ECHO = A8;
var x=0;
var t1 = 0;
function onStart(e) {
t1=e.time;
}
function onStop(e) {
var dt=e.time-t1;
var dist = (dt*1000000)/57.0;
//print("dist="+dist);
//analogWrite(LED1, dist/100);
x++;
if (x>LCD.WIDTH) {
LCD.clear();
x=0;
}
LCD.setPixel(x,dist,0xFFFF);
}
setWatch(onStart, ECHO, { repeat:true, edge:'rising' });
setWatch(onStop, ECHO, { repeat:true, edge:'falling' });
setInterval("digitalPulse(TRIG,1, 10/1000.0)",50);

View File

@ -0,0 +1,16 @@
// Espruino bluetooth voice activation
var command = "";
Serial3.onData(function(e) {
command += e.data;
if (e.data==" " || e.data=="\n") {
command="";
} else {
print(command);
if (command=="red") LED1.set();
if (command=="green") LED2.set();
if (command=="blue") LED3.set();
if (command=="off") { LED1.reset(); LED2.reset(); LED3.reset(); }
}
});

View File

@ -0,0 +1,50 @@
function onInit() {
I2C1.setup({scl:B6,sda:B7});
I2C1.writeTo(0x52, [0xF0,0x55]) ;
I2C1.writeTo(0x52, [0xFB,0x00])
}
function read() {
var d = I2C1.readFrom(0x52, 6);
I2C1.writeTo(0x52, 0);
digitalPulse(B12, 1, 1+(d[0]/256.0));
digitalPulse(B13, 1, 1+(d[1]/256.0));
digitalWrite(LED2, !(d[5]&1));
digitalWrite(LED3, !(d[5]&2));
}
onInit();
setInterval(read,20);
// replay
var pos = 0;
var history = [];
function read() {
var d = I2C1.readFrom(0x52, 6);
I2C1.writeTo(0x52, 0);
var btn = !(d[5]&1);
digitalWrite(LED2, !(d[5]&1));
digitalWrite(LED3, !(d[5]&2));
if (btn) {
if (!lastBtn) {
history = [];
} else {
var v = [d[0],d[1]];
history.push(v);
}
digitalPulse(B12, 1, 1+(d[0]/256.0));
digitalPulse(B13, 1, 1+(d[1]/256.0));
} else {
pos = pos + 1;
if (pos>history.length) pos=0;
if (pos<history.length) {
digitalPulse(B12, 1, 1+(history[pos][0]/256.0));
digitalPulse(B13, 1, 1+(history[pos][1]/256.0));
}
}
lastBtn = btn;
}

View File

@ -0,0 +1,109 @@
Espruino uses a few libraries of code that have been generously given away for
free. Their licences are included below.
-------------------------------------------------------------------------
FATFS
-------------------------------------------------------------------------
/*---------------------------------------------------------------------------/
/ FatFs - FAT file system module include file R0.07c (C)ChaN, 2009
/----------------------------------------------------------------------------/
/ FatFs module is an open source software to implement FAT file system to
/ small embedded systems. This is a free software and is opened for education,
/ research and commercial developments under license policy of following terms.
/
/ Copyright (C) 2009, ChaN, all right reserved.
/
/ * The FatFs module is a free software and there is NO WARRANTY.
/ * No restriction on use. You can use, modify and redistribute it for
/ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
/ * Redistributions of source code must retain the above copyright notice.*/
-------------------------------------------------------------------------
FATFS to SPI bridge
-------------------------------------------------------------------------
/* Copyright (c) 2009, Martin Thomas, ChaN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
-------------------------------------------------------------------------
FATFS to SDIO bridge
-------------------------------------------------------------------------
/* author: ickle */ - No details given with source code. If you have
anything you'd like to include, pleas e-mail us and let us know.
-------------------------------------------------------------------------
8x8 LCD Font
-------------------------------------------------------------------------
/*
http://forum.osdev.org/viewtopic.php?f=2&t=22033
Created Sunday, May 23, 2010 by Quinn Evans
Renamed and updated Monday 24, 2010
This font (Vincent) is released by me into the public domain. I claim no
copyright, and hereby make this software available to the public for any use,
at any time, free of restrictions, legal or otherwise.
*/
-------------------------------------------------------------------------
CC3000 Host Driver Implementation.
-------------------------------------------------------------------------
Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
Neither the name of Texas Instruments Incorporated nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,61 @@
_____ _
| __|___ ___ ___ _ _|_|___ ___
| __|_ -| . | _| | | | | . |
|_____|___| _|_| |___|_|_|_|___|
|_|
Copyright 2013 Gordon Williams
http://www.espruino.com
--------------------------------------------------------------
There are a few different binaries in this ZIP file, for different
types of Microcontroller:
espruino_#v##_hystm32_24_ve.bin
- 'HY'STM32F103VET6 ARM with 2.4" LCD display
This is available from eBay
espruino_#v##_hystm32_28_rb.bin
- 'HY'STM32F103RBT6 ARM with 2.8" LCD display
This is available from eBay
espruino_#v##_hystm32_32_vc.bin
- 'HY'STM32F103VCT6 ARM with 3.2" LCD display
This is available from eBay
espruino_#v##_olimexino_bootloader_stm32
- FOR BOARDS WHERE THE BOOTLOADER IS KEPT INSTALLED
- Olimexino-STM32 Arduino form factor board
- Leaf Labs Maple Arduino form factor board
espruino_#v##_olimexino_stm32.bin
- FOR BOARDS WHERE THE BOOTLOADER IS OVERWRITTEN (Gives Espruino more memory)
- Olimexino-STM32 Arduino form factor board
- Leaf Labs Maple Arduino form factor board
espruino_#v##_stm32vldiscovery.bin
- STM32VLDISCOVERY board
espruino_#v##_stm32f3discovery.bin
- STM32F3DISCOVERY board
espruino_#v##_stm32f4discovery.bin
- STM32F4DISCOVERY board
espruino_#v##_raspberrypi
- Raspberry Pi executable (just copy it to the device and run it)
NOTE: There is GPIO support (which requires you to run Espruino as root)
however there is no Serial, SPI, OneWire or I2C support at the moment so
you're pretty limited!
For information on devices, and on how to flash these binary files on to
each device, please see our website, http://www.espruino.com
NOTES:
* On the STM32F4DISCOVERY the default USART is USART2 (because
USART1 shares some pins with USB). This means you must connect
serial connections to PA2/PA3 NOT PA9/PA10 as you would for
the STM32VLDISCOVERY.

Some files were not shown because too many files have changed in this diff Show More