annotate docs/hardware.rst @ 4:7125a66d2f6d draft default tip

Typo
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sun, 19 Aug 2018 13:49:10 +0200
parents eff707b7a302
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
1 Hardware Overview
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
2 *****************
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
3
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
4 The badge consists of several main components:
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
5
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
6 Microcontroller
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
7 ===============
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
8
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
9 The microcontroller controlling everything is an Atmel SAMD21, an ARM Cortex-M0
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
10 microcontroller running at 48MHz. It has native USB support, which lets us
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
11 expose the filesystem on the device as a USB disk and the REPL console as a
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
12 serial device. It's running a custom version of CircuitPython, an
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
13 implementation of the Python language for microcontrollers based on
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
14 MicroPython.
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
15
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
16 All of the GPIO pins are exposed in the ``board`` module, which lets us use
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
17 them from CircuitPython.
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
18
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
19
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
20 Buttons
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
21 =======
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
22
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
23 The device has eight buttons, arranged into two crosses, that can be used to
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
24 control the code running on it. The buttons are connected to GPIO pins on one
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
25 end, and to GND on the other, and they are scanned in the background by the
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
26 ``gamepad`` module. The state of the buttons can be accessed with the
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
27 ``badge.keys()`` function.
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
28
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
29
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
30 Display
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
31 =======
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
32
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
33 There is a display of 14×11 red pixels on the device, controlled by a
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
34 IS31FL3733 chip connected over an I²C bus to the ``board.SDA0`` and
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
35 ``board.SCL0`` pins. It can be accessed with the ``badge.show()`` function and
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
36 its brightness can be adjusted with the ``badge.brightness()`` function. It's
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
37 capable of displaying 256 shades of red, however, since most of those shades
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
38 are very similar, the library selects only 16 distinct shades that you can use.
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
39
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
40
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
41 Accelerometer
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
42 =============
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
43
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
44 There is a LIS3DH accelerometer in the middle of the board, under the display,
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
45 which can be used to read the position and movement of the device. It is also
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
46 connected over an I²C protocol to the ``board.SDA0`` and ``board.SCL0`` pins.
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
47 It can be accessed with the ``badge.accel()`` function.
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
48
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
49
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
50 Radio
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
51 =====
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
52
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
53 There is an NRF24L01+ radio module on board, connected to the ``board.RADIO*``
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
54 pins. The connections are as follows:
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
55
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
56 * ``RADIO0`` — ``CE``
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
57 * ``RADIO1`` — ``CSN``
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
58 * ``RADIO3`` — ``SCK``
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
59 * ``RADIO4`` — ``MOSI``
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
60 * ``RADIO5`` — ``MISO``
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
61
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
62 There are currently no built-in functions or libraries for handling the
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
63 communication with this module. And external library needs to be used.
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
64
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
65
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
66 Power
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
67 =====
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
68
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
69 The device is powered with three 1.5V AAA alkaline batteries or the USB port.
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
70 The source of power is switched with the power switch. In the "ON" position,
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
71 the power comes from the batteries, while in the "OFF" position, it's powered
eff707b7a302 Initial docs
Radomir Dopieralski <sheep-devel@sheep.art.pl>
parents:
diff changeset
72 from the USB port (if it's connected).