Skip to content

Commit 735c14a

Browse files
Clean up documentation
1 parent 952f04d commit 735c14a

File tree

15 files changed

+105
-100
lines changed

15 files changed

+105
-100
lines changed

docs/analog.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ The standard Arduino calls can be used to read their values (with
99
3.3V nominally reading as 4095).
1010

1111
int analogRead(pin_size_t pin = A0..A3)
12-
---------------------------------------
12+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1313
Returns a value from 0...4095 correspionding to the ADC reading
1414
of the specific pin.
1515

1616
float analogReadTemp()
17-
----------------------
17+
~~~~~~~~~~~~~~~~~~~~~~
1818
Returns the temperature, in Celsius, of the onboard thermal sensor.
1919
This reading is not exceedingly accurate and of relatively low
2020
resolution, so it is not a replacement for an external temperature
@@ -28,23 +28,21 @@ simulated using the standard method of using pulse width modulation
2828

2929
While up to 16 PWM channels can be generated, they are not independent
3030
and there are significant restrictions as to allowed pins in parallel.
31-
See the [RP2040 datasheet](https://datasheets.raspberrypi.org/rp2040/rp2040-datasheet.pdf)
32-
for full details.
31+
See the `RP2040 datasheet <https://datasheets.raspberrypi.org/rp2040/rp2040-datasheet.pdf>`_ for full details.
3332

3433
void analogWriteFreq(uint32_t freq)
35-
-----------------------------------
34+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3635
Sets the master PWM frequency used (i.e. how often the PWM output cycles).
3736
From 100Hz to 60KHz are supported.
38-
}
3937

4038
void analogWriteRange(uint32_t range) and analogWriteResolution(int res)
41-
------------------------------------------------------------------------
39+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4240
These calls set the maximum PWM value (i.e. writing this value will result in
4341
a PWM duty cycle of 100%)/ either explicitly (range) or as a power-of-two
4442
(res). A range of 16 to 65535 is supported.
4543

4644
void analogWrite(pin_size_t pin, int val)
47-
-----------------------------------------
45+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4846
Writes a PWM value to a specific pin. The PWM machine is enabled and set to
4947
the requested frequency and scale, and the output is generated. This will
50-
continue until a `digitalWrite` or other digital output is performed.
48+
continue until a ``digitalWrite`` or other digital output is performed.

docs/digital.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Digital I/O
22
===========
33

4+
Board-Specific Pins
5+
-------------------
46
The Raspberry Pi Pico RP2040 chip supports up to 30 digital I/O pins,
57
however not all boards provide access to all pins.
68

9+
Tone/noTone
10+
-----------
11+
Simple square wave tone generation is possible for up to 8 channels using
12+
Arduino standard ``tone`` calls. Because these use the PIO to generate the
13+
waveform, they must share resources with other calls such as ``I2S`` or
14+
``Servo`` objects.

docs/eeprom.rst

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,50 @@ writes as the onboard flash chip, not the 100,000 or so of a real EEPROM.**
99
Therefore, do not frequently update the EEPROM or you may prematurely wear
1010
out the flash.
1111

12+
EEPROM Class API
13+
----------------
14+
1215
EEPROM.begin(size=256...4096)
13-
-----------------------------
16+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1417
Call before the first use of the EEPROM data for read or write. It makes a
1518
copy of the emulated EEPROM sector in RAM to allow random update and access.
1619

1720
EEPROM.read(addr), EEPROM[addr]
18-
-------------------------------
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1922
Returns the data at a specific offset in the EEPROM. See `EEPROM.get` later
2023
for a more
2124

2225
EEPROM.write(addr, data), EEPROM[addr] = data
23-
---------------------------------------------
26+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2427
Writes a byte of data at the offset specified. Not persisted to flash until
25-
`EEPROM.commit()` is called.
28+
``EEPROM.commit()`` is called.
2629

2730
EEPROM.commit()
28-
---------------
31+
~~~~~~~~~~~~~~~
2932
Writes the updated data to flash, so next reboot it will be readable.
3033

3134
EEPROM.end()
32-
------------
33-
`EEPROM.commit()` and frees all memory used. Need to call `EEPROM.begin()`
35+
~~~~~~~~~~~~
36+
``EEPROM.commit()`` and frees all memory used. Need to call `EEPROM.begin()`
3437
before the EEPROM can be used again.
3538

3639
EEPROM.get(addr, val)
37-
---------------------
40+
~~~~~~~~~~~~~~~~~~~~~
3841
Copies the (potentially multi-byte) data in EEPROM at the specific byte
3942
offset into the returned value. Useful for reading structures from EEPROM.
4043

4144
EEPROM.put(addr, val)
42-
---------------------
45+
~~~~~~~~~~~~~~~~~~~~~
4346
Copies the (potentially multi-byte) value into EEPROM a the byte offset
44-
supplied. Useful for storing `struct` in EEPROM. Note that any pointers
47+
supplied. Useful for storing ``struct`` in EEPROM. Note that any pointers
4548
inside a written structure will not be valid, and that most C++ objects
46-
like `String` cannot be written to EEPROM this way because of it.
49+
like ``String`` cannot be written to EEPROM this way because of it.
4750

4851
EEPROM.length()
49-
---------------
52+
~~~~~~~~~~~~~~~
5053
Returns the length of the EEPROM (i.e. the value specified in
51-
`EEPROM.begin()` ).
54+
``EEPROM.begin()`` ).
5255

5356
EEPROM Examples
5457
---------------
55-
Three EEPROM [examples](https://github.com/earlephilhower/arduino-pico/tree/master/libraries/EEPROM) are included.
58+
Three EEPROM `examples<https://github.com/earlephilhower/arduino-pico/tree/master/libraries/EEPROM>`_ are included.

docs/i2s.rst

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,83 +5,85 @@ While the RP2040 chip on the Raspberry Pi Pico does not include a hardware
55
I2S device, it is possible to use the PIO (Programmable I/O) state machines
66
to implement one dynamically.
77

8-
This I2S library uses the `pico-extras` I2S audio library and wraps it in
8+
This I2S library uses the ``pico-extras`` I2S audio library and wraps it in
99
an Arduino I2S library. It supports 16 bits/sample and frequencies of up
1010
to 48kHZ, with configurable BCLK, LRCLK(always pin "BCLK + 1"), and DOUT pins.
1111

1212
**Note:** This I2S device takes over the entire PIO1 (second) unit and adjusts
1313
its clock frequency to meet the I2S needs. That means when only 4 Tones
1414
or only 4 Servos may be used when the I2S device is used.
1515

16+
I2S Class API
17+
-------------
18+
1619
bool setBCLK(pin_size_t pin)
17-
----------------------------
18-
Sets the BCLK pin of the I2S device. The LRCLK/word clock will be `pin + 1`
19-
due to limitations of the PIO state machines. Call this before `I2S.begin()`
20+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21+
Sets the BCLK pin of the I2S device. The LRCLK/word clock will be ``pin + 1``
22+
due to limitations of the PIO state machines. Call this before ``I2S.begin()``
2023
Default BCLK = 26, LRCLK = 27
2124

2225
bool setDOUT(pin_size_t pin)
23-
----------------------------
26+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2427
Sets the DOUT pin of the I2S device. Any pin may be used. Default DOUT = 28
25-
Call before `I2S.begin()`
28+
Call before ``I2S.begin()``
2629

2730
bool begin(long sampleRate)
28-
---------------------------
31+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
2932
Start the I2S device up with the given sample rate. The pins selected above
3033
will be turned to output and the I2S will begin to drive silence frames (all
3134
zero) out.
3235

3336
void end()
34-
----------
37+
~~~~~~~~~~
3538
Stops the I2S device. **Note, at present the memory allocated for I2S buffers
36-
is not freed leading to a memory leak when `end()` is called. This is due
37-
to the state of the `pico-extras` release from thich this device came.**
39+
is not freed leading to a memory leak when ``end()`` is called. This is due
40+
to the state of the ``pico-extras`` release which this code uses.**
3841

3942
void flush()
40-
------------
43+
~~~~~~~~~~~~
4144
Sends any partial frames in memory to the I2S output device. They may NOT play
4245
immediately. Potential use case for this call would be when the frequency of
4346
the output will be changing.
4447

4548
size_t write(uint8_t)
46-
---------------------
49+
~~~~~~~~~~~~~~~~~~~~~
4750
Provided for compatibilty, but not very useful. Writes a sample from 0...255
48-
to the I2S buffer. See `write(int16_t)` for a better one
51+
to the I2S buffer. See ``write(int16_t)`` for a better one
4952

5053
size_t write(const uint8_t \*buffer, size_t size)
51-
-------------------------------------------------
54+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5255
Transfers number of bytes from an application buffer to the I2S output buffer.
53-
Be aware that `size` is in *bytes** and not samples. Size must be a multiple
56+
Be aware that ``size`` is in *bytes** and not samples. Size must be a multiple
5457
of **4 bytes** (i.e. one left/right sample). Will not block, so check
5558
the return value to find out how many bytes were actually written.
5659

5760
int availableForWrite()
58-
-----------------------
61+
~~~~~~~~~~~~~~~~~~~~~~~
5962
Returns the number of **32-bit L/R samples** that can be written without
6063
potentially blocking.
6164

6265
bool setFrequency(int newFreq)
63-
------------------------------
66+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6467
Adjusts the I2S output frequency. When changing frequency while I2S output
65-
is underway, be sure to use `I2S.flush()` before changing the frequency to
68+
is underway, be sure to use ``I2S.flush()`` before changing the frequency to
6669
ensure the older data is played at the right frequency.
6770

68-
6971
size_t write(int16_t)
70-
---------------------
72+
~~~~~~~~~~~~~~~~~~~~~
7173
Writes a single 16-bit left or right sample to the I2S output buffer. The
7274
user is required to ensure that an even number of samples is written (i.e.
7375
left and right) over the application lifetime. The application also needs
7476
to track which sample is next to be written (right/left). For this reason,
75-
the `write(void *b, size_t lrsamples)` call may be easier and faster to use.
77+
the ``write(void *b, size_t lrsamples)`` call may be easier and faster to use.
7678

7779
size_t write(const void \*buffer, size_t lrsamples)
78-
---------------------------------------------------
80+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7981
Writes up to size left+right packed samples to the I2S device. Non-blocking,
8082
will writefrom 0...size samples and return that count. Be sure your app
81-
handles partial writes (i.e. by yield()ing and then retrying to write the
83+
handles partial writes (i.e. by ``yield()`` ing and then retrying to write the
8284
remaining data.)
8385

84-
The `onTransmit` callback is not supported.
86+
The ``onTransmit`` callback is not supported.
8587

86-
See the [ESP8266Audio](https://github.com/earlephilhower/ESP8266Audio) library
88+
See the `ESP8266Audio <https://github.com/earlephilhower/ESP8266Audio>`_ library
8789
for a working example, or look at the included sample tone generator.

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
## Welcome to Arduino-Pico
2+
3+
Please go to https://arduino-pico.readthedocs.io/en/latest/ for the
4+
latest documentation.

docs/index.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For the latest version, always check https://github.com/earlephilhower/arduino-p
1818

1919
Getting Help and Contributing <help>
2020
Installation <install>
21-
Using the IDE <ide>
21+
IDE Menus <ide>
2222

2323
Pin (Re)Assignment <pins>
2424

@@ -37,10 +37,3 @@ For the latest version, always check https://github.com/earlephilhower/arduino-p
3737
Using Pico-SDK <sdk>
3838

3939
Licenses <license>
40-
41-
Indices and Tables
42-
==================
43-
44-
* :ref:`genindex`
45-
* :ref:`modindex`
46-
* :ref:`search`

docs/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ To install via GIT (for latest and greatest versions):
4848
Installing both Arduino and CMake
4949
---------------------------------
5050
Tom's Hardware presented a very nice writeup on installing `arduino-pico` on
51-
both Windows and Linux, available at [Tom's Hardware](https://www.tomshardware.com/how-to/program-raspberry-pi-pico-with-arduino-ide)
51+
both Windows and Linux, available at `Tom's Hardware <https://www.tomshardware.com/how-to/program-raspberry-pi-pico-with-arduino-ide>`_ .
5252

5353
If you follow their step-by-step you will also have a fully functional
5454
`CMake`-based environment to build Pico apps on if you outgrow the Arduino

docs/libraries.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Libraries Ported/Optimizef for the RP2040
1+
Libraries Ported/Optimized for the RP2040
22
=========================================
33

44
Most Arduino libraries that work on modern 32-bit CPU based Arduino boards
@@ -8,6 +8,6 @@ The following libraries have undergone additional porting and optimizations
88
specifically for the RP2040 and you should consider using them instead of
99
the generic versions available in the Library Manager
1010

11-
* [Adafruit GFX Library](https://github.com/Bodmer/Adafruit-GFX-Library) by @Bodmer, 2-20x faster than the standard version on the Pico
12-
* [Adafruit ILI9341 Library](https://github.com/Bodmer/Adafruit_ILI9341), again by @Bodmer
13-
* [ESP8266Audio](https://github.com/earlephilhower/ESP8266Audio), ported to use the included `I2S` library
11+
* `Adafruit GFX Library <https://github.com/Bodmer/Adafruit-GFX-Library>`_ by @Bodmer, 2-20x faster than the standard version on the Pico
12+
* `Adafruit ILI9341 Library <https://github.com/Bodmer/Adafruit_ILI9341>`_ again by @Bodmer
13+
* `ESP8266Audio <https://github.com/earlephilhower/ESP8266Audio>_` ported to use the included ``I2S`` library

docs/license.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Arduino-Pico is licensed under the LGPL license as detailed in the included READ
55

66
In addition, it contains code from additional open source projects:
77

8-
* The [Arduino IDE and ArduinoCore-API](https://arduino.cc) are developed and maintained by the Arduino team. The IDE is licensed under GPL.
9-
* The [RP2040 GCC-based toolchain](https://github.com/earlephilhower/pico-quick-toolchain) is licensed under under the GPL.
10-
* The [Pico-SDK](https://github.com/raspberrypi/pico-sdk) and [Pico-Extras](https://github.com/raspberrypi/pico-extras) are by Raspberry Pi (Trading) Ltd and licensed under the BSD 3-Clause license.
11-
* [Arduino-Pico](https://github.com/earlephilhower/arduino-pico) core files are licenses under the LGPL.
12-
* [LittleFS](https://github.com/ARMmbed/littlefs) library written by ARM Limited and released under the [BSD 3-clause license](https://github.com/ARMmbed/littlefs/blob/master/LICENSE.md).
13-
* [UF2CONV.PY](https://github.com/microsoft/uf2) is by Microsoft Corporatio and licensed under the MIT license.
14-
* Some filesystem code taken from the [ESP8266 Arduino Core](https://github.com/esp8266/Arduino) and licensed under the LGPL.
8+
* The `Arduino IDE and ArduinoCore-API <https://arduino.cc>`_ are developed and maintained by the Arduino team. The IDE is licensed under GPL.
9+
* The `RP2040 GCC-based toolchain <https://github.com/earlephilhower/pico-quick-toolchain>`_ is licensed under under the GPL.
10+
* The `Pico-SDK <https://github.com/raspberrypi/pico-sdk>`_ and `Pico-Extras <https://github.com/raspberrypi/pico-extras>`_ are by Raspberry Pi (Trading) Ltd. and licensed under the BSD 3-Clause license.
11+
* `Arduino-Pico <https://github.com/earlephilhower/arduino-pico>`_ core files are licenses under the LGPL.
12+
* `LittleFS <https://github.com/ARMmbed/littlefs>`_ library written by ARM Limited and released under the `BSD 3-clause license <https://github.com/ARMmbed/littlefs/blob/master/LICENSE.md>`_ .
13+
* `UF2CONV.PY <https://github.com/microsoft/uf2>`_ is by Microsoft Corporatio and licensed under the MIT license.
14+
* Some filesystem code taken from the `ESP8266 Arduino Core <https://github.com/esp8266/Arduino>`_ and licensed under the LGPL.

docs/pins.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,33 @@ I/O pins **before calling ::begin**. This is especially helpful when
1111
using third party libraries: the library doesn't need to be modified,
1212
only your own code in `setup()` is needed to adjust pinouts.
1313

14-
I2S:
15-
----
14+
I2S
15+
---
1616

1717
.. code:: cpp
1818
1919
::setBCLK(pin)
2020
::setDOUT(pin)
2121
22-
Serial1 (UART0), Serial2 (UART1):
23-
---------------------------------
22+
Serial1 (UART0), Serial2 (UART1)
23+
--------------------------------
2424

2525
.. code:: cpp
2626
2727
::setRX(pin)
2828
::setTX(pin)
2929
30-
SPI (SPI0), SPI1 (SPI1):
31-
------------------------
30+
SPI (SPI0), SPI1 (SPI1)
31+
-----------------------
3232

3333
.. code:: cpp
3434
3535
::setSCK(pin)
3636
::setRX(pin)
3737
::setTX(pin)
3838
39-
Wire (I2C0), Wire1 (I2C1):
40-
--------------------------
39+
Wire (I2C0), Wire1 (I2C1)
40+
-------------------------
4141

4242
.. code:: cpp
4343

0 commit comments

Comments
 (0)