Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*.dis
*.exe

# Packages
# Packages
############

# Logs and Databases
Expand All @@ -23,6 +23,8 @@
# Build directory
######################
build/
docs/_build/
docs/build/

# Test failure outputs
######################
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ In `micropython/docs`, build the docs:

make MICROPY_PORT=<port_name> html

Where `<port_name>` can be `unix`, `pyboard`, `wipy` or `esp8266`.
Where `<port_name>` can be `unix`, `pyboard`, `wipy`, `esp8266`, or `openmvcam`.

You'll find the index page at `micropython/docs/build/<port_name>/html/index.html`.
13 changes: 7 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
('pyboard', 'the pyboard'),
('wipy', 'the WiPy'),
('esp8266', 'the ESP8266'),
('openmvcam', 'the OpenMV Cam'),
))

# The members of the html_context dict are available inside topindex.html
Expand Down Expand Up @@ -84,7 +85,7 @@

# General information about the project.
project = 'MicroPython'
copyright = '2014-2016, Damien P. George and contributors'
copyright = '2014-2017, Damien P. George, OpenMV LLC, and contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -167,12 +168,12 @@

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = '../../logo/trans-logo.png'
html_logo = '../../openmv-media/logos/openmv-logo-white/web-logo-sticky.png'

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
html_favicon = '../../openmv-media/logos/openmv-logo/favicon.ico'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down Expand Up @@ -247,7 +248,7 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'MicroPython.tex', 'MicroPython Documentation',
'Damien P. George and contributors', 'manual'),
'Damien P. George, OpenMV LLC, and contributors', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -277,7 +278,7 @@
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'micropython', 'MicroPython Documentation',
['Damien P. George and contributors'], 1),
['Damien P. George, OpenMV LLC, and contributors'], 1),
]

# If true, show URL addresses after external links.
Expand All @@ -291,7 +292,7 @@
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'MicroPython', 'MicroPython Documentation',
'Damien P. George and contributors', 'MicroPython', 'One line description of project.',
'Damien P. George, OpenMV LLC, and contributors', 'MicroPython', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
2 changes: 1 addition & 1 deletion docs/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ MicroPython license information

The MIT License (MIT)

Copyright (c) 2013-2015 Damien P. George, and others
Copyright (c) 2013-2017 Damien P. George, OpenMV LLC, and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if "%1" == "clean" (
)


%SPHINXBUILD% 2> nul
%SPHINXBUILD% 1> nul 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
Expand Down
Binary file added docs/openmvcam/cam-v2-pinout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
150 changes: 150 additions & 0 deletions docs/openmvcam/quickref.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
.. _quickref:

Quick reference for the openmvcam
=================================

.. image:: cam-v2-pinout.png
:alt: OpenMV Cam pinout
:width: 700px

General board control
---------------------

See :mod:`pyb`. ::

import pyb

pyb.delay(50) # wait 50 milliseconds
pyb.millis() # number of milliseconds since bootup
pyb.repl_uart(pyb.UART(3, 9600)) # duplicate REPL on UART(3)
pyb.wfi() # pause CPU, waiting for interrupt
pyb.stop() # stop CPU, waiting for external interrupt

LEDs
----

See :ref:`pyb.LED <pyb.LED>`. ::

from pyb import LED

led = LED(1) # red led
led.toggle()
led.on()
led.off()

Pins and GPIO
-------------

See :ref:`pyb.Pin <pyb.Pin>`. ::

from pyb import Pin

p_out = Pin('P7', Pin.OUT_PP)
p_out.high()
p_out.low()

p_in = Pin('P7', Pin.IN, Pin.PULL_UP)
p_in.value() # get value, 0 or 1

Servo control
-------------

See :ref:`pyb.Servo <pyb.Servo>`. ::

from pyb import Servo

s1 = Servo(1) # servo on position 1 (P7)
s1.angle(45) # move to 45 degrees
s1.angle(-60, 1500) # move to -60 degrees in 1500ms
s1.speed(50) # for continuous rotation servos

External interrupts
-------------------

See :ref:`pyb.ExtInt <pyb.ExtInt>`. ::

from pyb import Pin, ExtInt

callback = lambda e: print("intr")
ext = ExtInt(Pin('P7'), ExtInt.IRQ_RISING, Pin.PULL_NONE, callback)

Timers
------

See :ref:`pyb.Timer <pyb.Timer>`. ::

from pyb import Timer

tim = Timer(4, freq=1000)
tim.counter() # get counter value
tim.freq(0.5) # 0.5 Hz
tim.callback(lambda t: pyb.LED(1).toggle())

PWM (pulse width modulation)
----------------------------

See :ref:`pyb.Pin <pyb.Pin>` and :ref:`pyb.Timer <pyb.Timer>`. ::

from pyb import Pin, Timer

p = Pin('P7') # P7 has TIM4, CH1
tim = Timer(4, freq=1000)
ch = tim.channel(1, Timer.PWM, pin=p)
ch.pulse_width_percent(50)

ADC (analog to digital conversion)
----------------------------------

See :ref:`pyb.Pin <pyb.Pin>` and :ref:`pyb.ADC <pyb.ADC>`. ::

from pyb import Pin, ADC

adc = ADC('P6')
adc.read() # read value, 0-4095

DAC (digital to analog conversion)
----------------------------------

See :ref:`pyb.Pin <pyb.Pin>` and :ref:`pyb.DAC <pyb.DAC>`. ::

from pyb import Pin, DAC

dac = DAC('P6')
dac.write(120) # output between 0 and 255

UART (serial bus)
-----------------

See :ref:`pyb.UART <pyb.UART>`. ::

from pyb import UART

uart = UART(3, 9600)
uart.write('hello')
uart.read(5) # read up to 5 bytes

SPI bus
-------

See :ref:`pyb.SPI <pyb.SPI>`. ::

from pyb import SPI

spi = SPI(2, SPI.MASTER, baudrate=200000, polarity=1, phase=0)
spi.send('hello')
spi.recv(5) # receive 5 bytes on the bus
spi.send_recv('hello') # send a receive 5 bytes

I2C bus
-------

See :ref:`pyb.I2C <pyb.I2C>`. ::

from pyb import I2C

i2c = I2C(2, I2C.MASTER, baudrate=100000)
i2c.scan() # returns list of slave addresses
i2c.send('hello', 0x42) # send 5 bytes to slave with address 0x42
i2c.recv(5, 0x42) # receive 5 bytes from slave
i2c.mem_read(2, 0x42, 0x10) # read 2 bytes from slave 0x42, slave memory 0x10
i2c.mem_write('xy', 0x42, 0x10) # write 2 bytes to slave 0x42, slave memory 0x10
39 changes: 39 additions & 0 deletions docs/openmvcam/tutorial/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.. _tutorial-index:

MicroPython tutorial
====================

This tutorial is intended to get you started with your OpenMV Cam.
All you need is a OpenMV Cam and a micro-USB cable to connect it to
your PC. If it is your first time, it is recommended to follow
the tutorial through in the order below.

.. note:: The tutorial is not available yet. It will be in the following weeks.
For now... things to know:

- 0: We're working on the tutorial right now. It will be the next thing to be completed! FINALLY!
- 1: If your camera IC is dirty then you can clean it with a micro fiber cloth doused in isopropyl alcohol.
- 2: You have to manually attach your lens to your OpenMV Cam and focus it yourself (it would cost a fortune for MacroFab to to this for us). Use the helloworld.py script in the IDE to help.
- 3: Be-gentle with the USB connector (it's surface mount only - don't shake side to side).
- 4: Select an area in the IDE's frame buffer and then click copy color to get color tracking settings (starting point settings you'll have to tweak them to make them work for everything).
- 5: Have fun, and if you want to help us out fork our repo and sumbit PRs. You can add new features to the firmware if you think something is missing. You don't have to wait on us.
- 6: Ask questions on the forums. Save email for private stuff.
- 7: Seriously, post questions on the forum, we'll answer really quickly. Don't be afraid of posting things on the forums. We want user feedback so we know what needs to be our focus.

.. toctree::
:maxdepth: 1
:numbered:

Tutorials requiring extra components
------------------------------------

.. toctree::
:maxdepth: 1
:numbered:

Tips, tricks and useful things to know
--------------------------------------

.. toctree::
:maxdepth: 1
:numbered:
11 changes: 11 additions & 0 deletions docs/openmvcam_contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
MicroPython documentation contents
==================================

.. toctree::

openmvcam/quickref.rst
openmvcam/tutorial/index.rst
library/index.rst
reference/index.rst
license.rst

17 changes: 17 additions & 0 deletions docs/openmvcam_index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MicroPython documentation and references
========================================

.. toctree::

openmvcam/quickref.rst
openmvcam/tutorial/index.rst
library/index.rst
reference/index.rst
license.rst

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
6 changes: 3 additions & 3 deletions docs/reference/asm_thumb2_arith.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ the following will add the contents of R0 to itself, placing the result in R0:

* add(r0, r0, r0)

Arithmetic instructions affect the condition flags except where stated.
Arithmetic instructions affect the condition flags except when stated otherwise.

Addition
--------

* add(Rdn, imm8) ``Rdn = Rdn + imm8``
* add(Rd, Rn, imm3) ``Rd = Rn + imm3``
* add(Rd, Rn, Rm) ``Rd = Rn +Rm``
* add(Rd, Rn, Rm) ``Rd = Rn + Rm``
* adc(Rd, Rn) ``Rd = Rd + Rn + carry``

Subtraction
Expand All @@ -40,7 +40,7 @@ Multiplication and division

* mul(Rd, Rn) ``Rd = Rd * Rn``

This produces a 32 bit result with overflow lost. The result may be treated as
This produces a 32 bit result where the overflow bits are lost. The result may be treated as
signed or unsigned according to the definition of the operands.

* sdiv(Rd, Rn, Rm) ``Rd = Rn / Rm``
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/asm_thumb2_compare.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Set if the result is negative.
* C (carry)

An addition sets the carry flag when the result overflows out of the MSB, for example adding
0x80000000 and 0x80000000. By the nature of two's complement arithmetic this behaviour is reversed
0x80000000 and 0x80000000. By the nature of two's complement arithmetic this behavior is reversed
on subtraction, with a borrow indicated by the carry bit being clear. Thus 0x10 - 0x01 is executed
as 0x10 + 0xffffffff which will set the carry bit.

Expand All @@ -59,7 +59,7 @@ These set the APSR (Application Program Status Register) N (negative), Z (zero),
Conditional execution
---------------------

The ``it`` and ``ite`` instructions provide a means of conditionally executing from one to four subsequent
The ``it`` and ``ite`` instructions provide a means of conditionally executing one to four subsequent
instructions without the need for a label.

* it(<condition>) If then
Expand All @@ -86,5 +86,5 @@ subsequent one. Thus:
mov(r0, 200) # runs if r0 != r1
# execution continues here

This may be extended to control the execution of upto four subsequent instructions: it[x[y[z]]]
This may be extended to control the execution of up to four subsequent instructions: it[x[y[z]]]
where x,y,z=t/e; e.g. itt, itee, itete, ittte, itttt, iteee, etc.
Loading