Skip to content

Commit 7c302c3

Browse files
committed
Improve docs and update to CircuitPython.
1 parent 25ae844 commit 7c302c3

File tree

12 files changed

+115
-42
lines changed

12 files changed

+115
-42
lines changed

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Adafruit CircuitPython
22

3-
[![Build Status](https://travis-ci.org/adafruit/circuitpython.svg?branch=master)](https://travis-ci.org/adafruit/circuitpython)
3+
[![Build Status](https://travis-ci.org/adafruit/circuitpython.svg?branch=master)](https://travis-ci.org/adafruit/circuitpython) [![Doc Status](https://readthedocs.org/projects/circuitpython/badge/?version=latest)](http://circuitpython.readthedocs.io/)
44

55
This is an open source derivative of [MicroPython](http://www.micropython.org)
6-
for use on educational development boards designed and sold by Adafruit
6+
for use on educational development boards designed and sold by [Adafruit](https://www.adafruit.com)
77
including the [Arduino Zero](https://www.arduino.cc/en/Main/ArduinoBoardZero), [Adafruit Feather M0 Basic](https://www.adafruit.com/products/2772), [Adafruit Feather HUZZAH](https://www.adafruit.com/products/2821) and
88
[Adafruit Feather M0 Bluefruit LE](https://www.adafruit.com/products/2995).
99

@@ -15,7 +15,7 @@ This project is in beta. Most APIs should be stable going forward.
1515

1616
## Documentation
1717

18-
Guides and videos are available through the [Adafruit Learning System](https://learn.adafruit.com/) under the [CircuitPython category](https://learn.adafruit.com/category/circuitpython). An API reference is also available on [Read the Docs](http://circuitpython.readthedocs.io/en/latest/?).
18+
Guides and videos are available through the [Adafruit Learning System](https://learn.adafruit.com/) under the [CircuitPython category](https://learn.adafruit.com/category/circuitpython) and [MicroPython category](https://learn.adafruit.com/category/micropython). An API reference is also available on [Read the Docs](http://circuitpython.readthedocs.io/en/latest/?).
1919

2020
## Contributing
2121
See [CONTRIBUTING.md](https://github.com/adafruit/circuitpython/blob/master/CONTRIBUTING.md)
@@ -27,6 +27,24 @@ Contributors who follow the
2727
are welcome to submit pull requests and they will be promptly reviewed by
2828
project admins.
2929

30+
## Differences from [MicroPython](https://github.com/micropython/micropython)
31+
32+
* Port for Atmel SAMD21 (Commonly known as M0 in product names.)
33+
* No `machine` API on Atmel SAMD21 port.
34+
* Only supports Atmel SAMD21 and ESP8266 ports.
35+
* Unified hardware API: [`nativeio`](https://circuitpython.readthedocs.io/en/latest/shared-bindings/nativeio/__init__.html), [`microcontroller`](https://circuitpython.readthedocs.io/en/latest/shared-bindings/microcontroller/__init__.html), [`board`](https://circuitpython.readthedocs.io/en/latest/shared-bindings/board/__init__.html), [`bitbangio`](https://circuitpython.readthedocs.io/en/latest/shared-bindings/bitbangio/__init__.html) (Only available on atmel-samd21 and ESP8266 currently.)
36+
* Tracks MicroPython's releases (not master).
37+
* No module aliasing. (`uos` and `utime` are not available as `os` and `time` respectively.)
38+
* Modules with a CPython counterpart, such as `time`, are strict [subsets](https://circuitpython.readthedocs.io/en/latest/shared-bindings/time/__init__.html) of their [CPython version](https://docs.python.org/3.4/library/time.html?highlight=time#module-time). Therefore, code from CircuitPython is runnable on CPython but not necessarily the reverse.
39+
* tick count is available as [`time.monotonic()`](https://circuitpython.readthedocs.io/en/latest/shared-bindings/time/__init__.html#time.monotonic)
40+
* `os` only available as `uos`
41+
* atmel-samd21 features
42+
* RGB status LED
43+
* Auto-reset after file write over mass storage. (Disable with `samd.disable_autoreset()`)
44+
* Wait state after boot and main run, before REPL.
45+
* Main is one of these: code.txt, code.py, main.py, main.txt
46+
* Boot is one of these: settings.txt, settings.py, boot.py, boot.txt
47+
3048
## Project Structure
3149
Here is an overview of the top-level directories.
3250

atmel-samd/README.md renamed to atmel-samd/README.rst

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
1-
# SAMD21x18
1+
SAMD21x18
2+
=========
23

34
This port brings MicroPython to SAMD21x18 based development boards including the
45
Arduino Zero, Adafruit Feather M0 Basic and Adafruit M0 Bluefruit LE.
56

6-
## Building
7+
Building
8+
--------
79

810
To build for the Arduino Zero:
911

1012
make
1113

12-
To build for other boards you must change it by setting `BOARD`. For example:
14+
To build for other boards you must change it by setting ``BOARD``. For example:
1315

1416
make BOARD=feather_m0_basic
1517

16-
Board names are the directory names in the `boards` folder.
18+
Board names are the directory names in the `boards <https://github.com/adafruit/circuitpython/tree/master/atmel-samd/boards>`_ folder.
1719

18-
## Deploying
20+
Deploying
21+
---------
22+
23+
Arduino Bootloader
24+
^^^^^^^^^^^^^^^^^^
1925

20-
### Arduino Bootloader
2126
If your board has an existing Arduino bootloader on it then you can use bossac
2227
to flash MicroPython. First, activate the bootloader. On Adafruit Feathers you
2328
can double click the reset button and the #13 will fade in and out. Finally,
2429
run bossac:
2530

2631
tools/bossac_osx -e -w -v -b -R build-feather_m0_basic/firmware.bin
2732

28-
### No Bootloader via GDB
33+
No Bootloader via GDB
34+
^^^^^^^^^^^^^^^^^^^^^
35+
2936
This method works for loading MicroPython onto the Arduino Zero via the
3037
programming port rather than the native USB port.
3138

@@ -45,9 +52,11 @@ In another terminal from `micropython/atmel-samd`:
4552
...
4653
(gdb) continue
4754

48-
## Connecting
55+
Connecting
56+
----------
4957

50-
### Serial
58+
Serial
59+
^^^^^^
5160

5261
All boards are currently configured to work over USB rather than UART. To
5362
connect to it from OSX do something like this:
@@ -57,7 +66,14 @@ connect to it from OSX do something like this:
5766
You may not see a prompt immediately because it doesn't know you connected. To
5867
get one either hit enter to get `>>>` or do CTRL-B to get the full header.
5968

60-
### Mass storage
69+
Mass storage
70+
^^^^^^^^^^^^
6171

6272
All boards will also show up as a mass storage device. Make sure to eject it
6373
before referring to any files.
74+
75+
Port Specific modules
76+
---------------------
77+
78+
.. toctree::
79+
bindings/samd/__init__

atmel-samd/bindings/samd/__init__.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@
3535
//| :platform: SAMD21
3636
//|
3737

38-
//| .. method:: enable_autoreset()
38+
//| .. method:: enable_autoreset()
3939
//|
40-
//| Enable autoreset based on USB file write activity.
40+
//| Enable autoreset based on USB file write activity.
4141
//|
4242
STATIC mp_obj_t samd_enable_autoreset(void) {
4343
autoreset_enable();
4444
return mp_const_none;
4545
}
4646
MP_DEFINE_CONST_FUN_OBJ_0(samd_enable_autoreset_obj, samd_enable_autoreset);
4747

48-
//| .. method:: disable_autoreset()
48+
//| .. method:: disable_autoreset()
4949
//|
50-
//| Disable autoreset based on USB file write activity until the next reset
51-
//| or until `enable_autoreset` is called.
50+
//| Disable autoreset based on USB file write activity until the next reset
51+
//| or until `enable_autoreset` is called.
5252
//|
5353
STATIC mp_obj_t samd_disable_autoreset(void) {
5454
autoreset_disable();

conf.py

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,18 @@
5959
#master_doc = 'index'
6060

6161
# General information about the project.
62-
project = 'Adafruit\'s MicroPython'
63-
copyright = '2014-2016, MicroPython contributors (https://github.com/adafruit/micropython/graphs/contributors)'
62+
project = 'Adafruit CircuitPython'
63+
copyright = '2014-2017, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)'
6464

65+
# These are overwritten on ReadTheDocs.
6566
# The version info for the project you're documenting, acts as replacement for
6667
# |version| and |release|, also used in various other places throughout the
6768
# built documents.
6869
#
6970
# The short X.Y version.
70-
version = '1.8'
71+
version = '0.0'
7172
# The full version, including alpha/beta/rc tags.
72-
release = '1.8.6'
73+
release = '0.0.0'
7374

7475
# The language for content autogenerated by Sphinx. Refer to documentation
7576
# for a list of supported languages.
@@ -83,7 +84,40 @@
8384

8485
# List of patterns, relative to source directory, that match files and
8586
# directories to ignore when looking for source files.
86-
exclude_patterns = ["*/build-*", "atmel-samd/asf", "atmel-samd/**.c", "atmel-samd/**.h", "bare-arm", "cc3200", "cc3200/FreeRTOS", "cc3200/hal", "drivers", "esp8266", "examples", "extmod", "lib", "minimal", "mpy-cross", "pic16bit", "py", "qemu-arm", "stmhal", "stmhal/hal", "stmhal/cmsis", "stmhal/usbdev", "stmhal/usbhost", "teensy", "tests", "tools", "unix", "windows", "zephyr"]
87+
exclude_patterns = ["*/build-*",
88+
"atmel-samd/asf",
89+
"atmel-samd/asf_conf",
90+
"atmel-samd/common-hal",
91+
"atmel-samd/boards",
92+
"atmel-samd/QTouch",
93+
"atmel-samd/*.c",
94+
"atmel-samd/*.h",
95+
"bare-arm",
96+
"cc3200",
97+
"cc3200/FreeRTOS",
98+
"cc3200/hal",
99+
"drivers",
100+
"esp8266",
101+
"examples",
102+
"extmod",
103+
"lib",
104+
"minimal",
105+
"mpy-cross",
106+
"pic16bit",
107+
"py",
108+
"qemu-arm",
109+
"shared-module",
110+
"stmhal",
111+
"stmhal/hal",
112+
"stmhal/cmsis",
113+
"stmhal/usbdev",
114+
"stmhal/usbhost",
115+
"teensy",
116+
"tests",
117+
"tools",
118+
"unix",
119+
"windows",
120+
"zephyr"]
87121

88122
# The reST default role (used for this markup: `text`) to use for all
89123
# documents.

docs/drivers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ These are drivers available in separate GitHub repos.
55

66
.. toctree::
77

8-
Register Library <http://adafruit-micropython-register.readthedocs.io/en/latest/>
8+
Register Library <https://circuitpython.readthedocs.io/projects/register/en/latest/>
99
RGB Displays <http://micropython-rgb.readthedocs.io/>
1010
Analog-to-digital converters: ADS1015 and ADS1115 <http://micropython-ads1015.readthedocs.io/>
1111
DS3231 Real-time Clock (Precision RTC) <https://circuitpython.readthedocs.io/projects/ds3231/en/latest/>

index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ docs are low-level API docs and may link out to separate getting started guides.
2424
docs/common_hal
2525
docs/drivers.rst
2626
docs/supported_ports.rst
27-
docs/unsupported_ports.rst
2827
docs/library/index.rst
2928
README
3029
CONTRIBUTING

license.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
MicroPython license information
2-
===============================
1+
MicroPython & CircuitPython license information
2+
===============================================
33

44
The MIT License (MIT)
55

6-
Copyright (c) 2013-2015 Damien P. George, and others
6+
Copyright (c) 2013-2017 Damien P. George, and others
77

88
Permission is hereby granted, free of charge, to any person obtaining a copy
99
of this software and associated documentation files (the "Software"), to deal

shared-bindings/help.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@
2727
#include "lib/utils/pyhelp.h"
2828
#include "shared-bindings/help.h"
2929

30-
//| .. method:: help(object=None)
30+
//| :func:`help` - Built-in method to provide helpful information
31+
//| ========================================================
3132
//|
32-
//| Prints a help method about the given object. When ``object`` is none,
33-
//| prints general port information.
33+
//| .. method:: help(object=None)
34+
//|
35+
//| Prints a help method about the given object. When ``object`` is none,
36+
//| prints general port information.
3437
//|
3538
STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) {
3639
if (n_args == 0) {

shared-bindings/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ follow.
1010
:maxdepth: 3
1111

1212
*/__init__
13+
help

shared-bindings/microcontroller/__init__.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
//|
4444
//| .. module:: microcontroller
4545
//| :synopsis: Pin references and core functionality
46-
//| :platform: SAMD21
46+
//| :platform: SAMD21, ESP8266
4747
//|
4848
//| The `microcontroller` module defines the pins from the perspective of the
4949
//| microcontroller. See `board` for board-specific pin mappings.
@@ -56,10 +56,10 @@
5656
//| Pin
5757
//|
5858

59-
//| .. method:: delay_us(delay)
59+
//| .. method:: delay_us(delay)
6060
//|
61-
//| Dedicated delay method used for very short delays. DO NOT do long delays
62-
//| because it will stall any concurrent code.
61+
//| Dedicated delay method used for very short delays. DO NOT do long delays
62+
//| because it will stall any concurrent code.
6363
//|
6464
STATIC mp_obj_t mcu_delay_us(mp_obj_t delay_obj) {
6565
uint32_t delay = mp_obj_get_int(delay_obj);
@@ -70,19 +70,19 @@ STATIC mp_obj_t mcu_delay_us(mp_obj_t delay_obj) {
7070
}
7171
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mcu_delay_us_obj, mcu_delay_us);
7272

73-
//| .. method:: disable_interrupts()
73+
//| .. method:: disable_interrupts()
7474
//|
75-
//| Disable all interrupts. Be very careful, this can stall everything.
75+
//| Disable all interrupts. Be very careful, this can stall everything.
7676
//|
7777
STATIC mp_obj_t mcu_disable_interrupts(void) {
7878
common_hal_mcu_disable_interrupts();
7979
return mp_const_none;
8080
}
8181
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_disable_interrupts_obj, mcu_disable_interrupts);
8282

83-
//| .. method:: enable_interrupts()
83+
//| .. method:: enable_interrupts()
8484
//|
85-
//| Enable the interrupts that were enabled at the last disable.
85+
//| Enable the interrupts that were enabled at the last disable.
8686
//|
8787
STATIC mp_obj_t mcu_enable_interrupts(void) {
8888
common_hal_mcu_enable_interrupts();

0 commit comments

Comments
 (0)