Browse Source

Implement P command

The new prepare_write method provides a Python interface to the P
command.  If only one sector needs to be prepared, the end sector number
can be omitted.
Clara Hobbs 6 years ago
parent
commit
5b7e326ee0
1 changed files with 9 additions and 0 deletions
  1. 9
    0
      alpaca_isp/__init__.py

+ 9
- 0
alpaca_isp/__init__.py View File

190
         self._send_command("R {} {}\r\n".format(start, count).encode("utf-8"))
190
         self._send_command("R {} {}\r\n".format(start, count).encode("utf-8"))
191
         return self._uart.read(count)
191
         return self._uart.read(count)
192
 
192
 
193
+    def prepare_write(self, start, end=None):
194
+        """Prepare the the given flash sector(s) for write operations
195
+
196
+        If end is not specified, only the start sector is prepared.
197
+        """
198
+        if end is None:
199
+            end = start
200
+        self._send_command("P {} {}\r\n".format(start, end).encode("utf-8"))
201
+
193
 
202
 
194
 class ReturnCode(Enum):
203
 class ReturnCode(Enum):
195
     """LPC ISP return codes
204
     """LPC ISP return codes

Loading…
Cancel
Save