We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 767483d commit d21737aCopy full SHA for d21737a
1 file changed
lib/daplink_flash/examples/erase_flash.py
@@ -0,0 +1,18 @@
1
+"""Erase all data from the flash memory."""
2
+
3
+from machine import I2C
4
+from time import sleep_ms
5
+from daplink_flash import DaplinkFlash
6
7
+i2c = I2C(1)
8
+flash = DaplinkFlash(i2c)
9
10
+name, ext = flash.get_filename()
11
+print("Current file: {}.{}".format(name, ext))
12
13
+print("Erasing flash...")
14
+flash.clear_flash()
15
+sleep_ms(1000)
16
17
+print("Done. Flash is empty.")
18
+print("ERROR: 0x{:02X}".format(flash._error()))
0 commit comments