Skip to content

Commit b710da7

Browse files
committed
updates README.md
1 parent 5cc426f commit b710da7

File tree

2 files changed

+42
-56
lines changed

2 files changed

+42
-56
lines changed

README.md

Lines changed: 42 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -17,69 +17,57 @@ for the binding.
1717
___________________________
1818

1919
ESP32-ALL
20+
* `--optimize-size`: If you are having an issue with getting the firmware to fit into your esp32
21+
or if space is more of a concern than speed you can set this command line option. This will tell the compiler that the
22+
firmware size is more important than performance and the compiled binary will be smaller as a result.
2023

24+
* `--flash-size={size}`: Flash sizes that are able to be used are 4, 8, 16, 32, 64 and 128 across all
25+
variants of the ESP32. It is up to the user to know what their board is using.
2126

22-
If you are having an issue with getting the firmware to fit into your esp32
23-
or if space is more of a concern than speed you can set the
24-
`--optimize-size` command line option. This will tell the compiler that the
25-
firmware size is more important than performance and the compiled binary will
26-
be smaller as a result.
27+
* `--ota`: If you want to set the partitions so you can do an over the air update of
28+
the firmware. I do want to note that this does take up twice as much application
29+
storage space. This feature applies to any board.
2730

31+
* `CONFIG_*={value}`: You can alter the config settings of the esp-idf by using these settings. Refer to the ESP-IDF documentation
32+
for further information
2833

29-
Flash sizes that are able to be used are 4, 8, 16, 32, 64 and 128 across all
30-
variants of the ESP32. It is up to the user to know what their board is using.
31-
32-
--ota if you want to set the partitions so you can do an over the air update of
33-
the firmware. I do want to note that this does take up twice as much application
34-
storage space. This feature applies to any board.
35-
36-
37-
ESP32-S3
38-
2 new command line arguments.
39-
--onboard-mem-speed: allowed values = 120 or 80
40-
--flash-mode: allowed values = QIO, QOUT, DIO, DOUT, OPI, DTR, STR
41-
42-
43-
OK so this is how this works is wanting to use 120,hz speed
44-
* octal spi FLASH, octal spi PSRAM: `--onboard-mem-speed=120 --flash-mode=DTR`
45-
* quad spi FLASH, octal spi PSRAM: `--onboard-mem-speed=120 --flash-mode=STR`
46-
* quad spi FLASH, quad spi PSRAM: `--onboard-mem-speed=120`
47-
48-
There is one other use case. If you have 32mb worth of flash storage you will
49-
need to set `--flash-mode=DOUT` as well as `--flash-size=32`
50-
34+
* `SPI`: The `machine.SPI` class has undergone a HUGE change. It is now split into 2 pieces. `machine.SPI.Bus` and `machine.SPI.Device`
35+
They exactly what they seem. It is easier to show a code example then it is to explain it.
36+
5137

52-
ESP32
53-
MicroPython SPI class has been modified
54-
The SPI implimentation in MicroPython for the ESP32 was written so it would fail
55-
if the SPI bus had already been initialized. This would cause an issue due to the
56-
creation order of the display and touch drivers. The display driver needs to be
57-
initilized before the touch driver does and if the display bus uses SPI the creation
58-
of the touch driver would fail because the bus would already be started. Another
59-
issue was the MicroPython SPI driver didn't handle the CS line. This was added for
60-
ease of use.
38+
import machine
39+
40+
spi_bus = machine.SPI.Bus(
41+
host=1,
42+
mosi=15,
43+
miso=16,
44+
sck=10
45+
)
6146

62-
The MicroPython SDCard class has been modified
63-
There were limitations placed on using SPI for an SDCard. This was due to the original
64-
SPI not hanmdling the CS line. Since this has now taken place we needed to modify the SDCard class
65-
to allow for the SPI bus to be shared. The constructor has been modified, the miso, mosi and sclk
66-
parameters have been removed. A new parameter has been added which is `spi_bus` and this parameter
67-
takes a `machine.SPI` instance. If you want to share the bus you need to also supply a CS pin using
68-
the `cs` parameter. All parameters that are used for setting pins now only take integer values,
69-
`machine.Pin` instances are no longer allowed.
47+
spi_device = machine.SPI.Device(
48+
spi_bus=spi_bus,
49+
freq=10000000,
50+
cs=3,
51+
polarity=0,
52+
phase=0,
53+
bits=8,
54+
first_bit=machine.SPI.MSB
55+
)
7056

71-
The `lcd_bus.SPIBus` constructor has changed. The miso, mosi, wp, hd and sclk parameters have been removed.
72-
A new parameter has been added which is `spi_bus` and this parameter takes a `machine.SPI` instance.
73-
This was done to allow for sharing the SPI bus with other devices like touch panels and SDCard readers.
74-
You must supply a CS pin in order to share the bus.
57+
# if you want to delete a device from being used you have to deinit it first
58+
# and then you can delete it
59+
spi_device.deinit()
60+
del spi_device
61+
62+
# if you want to stop using a bus and all devices attached to it
63+
del spi_bus
64+
del spi_device
7565

76-
The cmd_buts and param_bits paramaters have been removed from all lcd_bus classes. This is now handled
77-
internally by the display driver.
66+
# The SPI.Bus instance you need to pass to machine.SDCard, lcd_bus.SPIBus
67+
# and any of the touch drivers that use SPI.
7868

79-
All touch drivers that are SPI must now be initilized by passing a `machine.SPI` instance. If the touch panel
80-
is sharing the bus with any other devices then a new `machine.SPI` instance MUST be created with the CS pin given
81-
for the touch panel. All other pins MUST remain the same across the `machine.SPI` instances. You are allowed to have
82-
different frequencies for each device.
69+
All methods that existed for the original `machine.SPI` are available in
70+
the `machine.SPI.Device` class. They work exactly how they did before.
8371

8472
<br>
8573

micropy_updates/esp32/machine_hw_spi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ void machine_hw_spi_bus_remove_device(machine_hw_spi_device_obj_t *device)
170170
}
171171

172172

173-
174-
175173
static void machine_hw_spi_device_deinit_callback(machine_hw_spi_device_obj_t *self)
176174
{
177175
if (!self->active) return;

0 commit comments

Comments
 (0)