https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&feed=atom&action=history
ENG-CANSAT-FEATHER-M0-SPI - Historique des versions
2024-03-29T13:47:33Z
Historique des révisions pour cette page sur le wiki
MediaWiki 1.35.0
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27052&oldid=prev
Admin : /* Forewords */
2018-09-23T19:47:06Z
<p><span dir="auto"><span class="autocomment">Forewords</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 19:47</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l2" >Ligne 2 :</td>
<td colspan="2" class="diff-lineno">Ligne 2 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Forewords == </div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Forewords == </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">{{traduction}}</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>One of the most exciting feature of the M0 Express board is this small FLASH chip wired on the SPI bus. That memory could be used to provide lot of services like storing files, python script and many more.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>One of the most exciting feature of the M0 Express board is this small FLASH chip wired on the SPI bus. That memory could be used to provide lot of services like storing files, python script and many more.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27051&oldid=prev
Admin : /* Access to the SPI Flash */
2018-09-23T19:46:53Z
<p><span dir="auto"><span class="autocomment">Access to the SPI Flash</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 19:46</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l219" >Ligne 219 :</td>
<td colspan="2" class="diff-lineno">Ligne 219 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ADFImage|FEATHER-M0-ArduinoIDE-SPI-Flash-03.png}}</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ADFImage|FEATHER-M0-ArduinoIDE-SPI-Flash-03.png}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Une fois que votre croquis de </del>datalogging <del class="diffchange diffchange-inline">Arduino fonctionne comme attendu</del>, <del class="diffchange diffchange-inline">vous pouvez simplifier la procédure en copiant </del>'''CURRENT.UF2''' <del class="diffchange diffchange-inline">depuis le lecteur </del>'''BOOT''' <del class="diffchange diffchange-inline">pour faire une copie de sauvegarde de votre programme Arduino</del>. <del class="diffchange diffchange-inline">Vous pourrez ensuite charger </del>CircuitPython <del class="diffchange diffchange-inline">pour accéder au système de fichier de la Flash SPI et enfin recopier votre </del>'''CURRENT.UF2''' <del class="diffchange diffchange-inline">sur le lecteur '''BOOT''' de la carte </del>Express <del class="diffchange diffchange-inline">pour réactiver votre croquis Arduino</del>!</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Once your </ins>datalogging <ins class="diffchange diffchange-inline">sketch finish</ins>, <ins class="diffchange diffchange-inline">you can simplify the procedure by copying the </ins>'''CURRENT.UF2''' <ins class="diffchange diffchange-inline">from the </ins>'''BOOT''' <ins class="diffchange diffchange-inline">drive to make "ready to use copy" of your sketch</ins>. <ins class="diffchange diffchange-inline">You could now load the CircuitPython to access the </ins>CircuitPython <ins class="diffchange diffchange-inline">file system and then switch back to you Arduino sketch by restoring the </ins>'''CURRENT.UF2''' <ins class="diffchange diffchange-inline">on the </ins>Express <ins class="diffchange diffchange-inline">Board</ins>!</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ENG-CANSAT-TRAILER}}</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ENG-CANSAT-TRAILER}}</div></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27050&oldid=prev
Admin : /* Access to the SPI Flash */
2018-09-23T19:41:56Z
<p><span dir="auto"><span class="autocomment">Access to the SPI Flash</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 19:41</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l207" >Ligne 207 :</td>
<td colspan="2" class="diff-lineno">Ligne 207 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* After a while, you should see a '''CIRCUITPY''' drive containing the file '''boot_out.txt'''. Great, the Circuit Python filesystem is initialized on the SPI Flash.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* After a while, you should see a '''CIRCUITPY''' drive containing the file '''boot_out.txt'''. Great, the Circuit Python filesystem is initialized on the SPI Flash.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* Open the Arduino IDE and upload the '''fatfs_circuitpython''' sketch available in the Adafruit's SPI FLASH library. Open the serial console and start the sketch. Voila! the CircuitPython file system is properly mounted and the file '''data.txt''' created and initialized.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* Open the Arduino IDE and upload the '''fatfs_circuitpython''' sketch available in the Adafruit's SPI FLASH library. Open the serial console and start the sketch. Voila! the CircuitPython file system is properly mounted and the file '''data.txt''' created and initialized.</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">{{ambox|text=So, the Arduino Sketch did manipulated a file onto the SPI Flash owning the CircuitPython filesystem!}} </ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ADFImage|FEATHER-M0-ArduinoIDE-SPI-Flash-02.png}}</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ADFImage|FEATHER-M0-ArduinoIDE-SPI-Flash-02.png}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* <del class="diffchange diffchange-inline">Revenons sur notre ordinateur</del>, <del class="diffchange diffchange-inline">redémarrez le </del>bootloader <del class="diffchange diffchange-inline">de la carte </del>Express --<del class="diffchange diffchange-inline">ET</del>-- <del class="diffchange diffchange-inline">re-glissez</del>/<del class="diffchange diffchange-inline">re-déposez </del>'''circuitpython.uf2''' <del class="diffchange diffchange-inline">sur le lecteur </del>'''BOOT''' <del class="diffchange diffchange-inline">rendu </del>accessible <del class="diffchange diffchange-inline">par le </del>bootloader. <del class="diffchange diffchange-inline">Voilà</del>, CircuitPython <del class="diffchange diffchange-inline">est résintallé sur la carte Express</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">This time, we will open the file created by the Arduino sketch.</ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* <del class="diffchange diffchange-inline">Au bout d'un moment</del>, <del class="diffchange diffchange-inline">le lecteur </del>'''CIRCUITPY''' <del class="diffchange diffchange-inline">redevient accessible</del>. <del class="diffchange diffchange-inline">Celui-ci </del>expose a <del class="diffchange diffchange-inline">nouveau le système de fichier MicroPython de la Flash SPI</del>. <del class="diffchange diffchange-inline">Vous pouvez maintenant voir le fichier </del>'''data.txt''', <del class="diffchange diffchange-inline">l</del>'<del class="diffchange diffchange-inline">ouvrir et en consulté le contenu</del>!</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* <ins class="diffchange diffchange-inline">Let plug again the board on the computer</ins>, <ins class="diffchange diffchange-inline">restart the </ins>bootloader <ins class="diffchange diffchange-inline">on the </ins>Express <ins class="diffchange diffchange-inline">board </ins>--<ins class="diffchange diffchange-inline">AND</ins>-- <ins class="diffchange diffchange-inline">drag</ins>/<ins class="diffchange diffchange-inline">drop the </ins>'''circuitpython.uf2''' <ins class="diffchange diffchange-inline">on the drive </ins>'''BOOT''' <ins class="diffchange diffchange-inline">made </ins>accessible <ins class="diffchange diffchange-inline">by the </ins>bootloader. <ins class="diffchange diffchange-inline">Great</ins>, CircuitPython <ins class="diffchange diffchange-inline">is now installed (again) on the board</ins>.</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* <ins class="diffchange diffchange-inline">After a a while</ins>, <ins class="diffchange diffchange-inline">the </ins>'''CIRCUITPY''' <ins class="diffchange diffchange-inline">drive is made available by CircuitPyhton</ins>. <ins class="diffchange diffchange-inline">This would </ins>expose <ins class="diffchange diffchange-inline">the SPI Flash content as </ins>a <ins class="diffchange diffchange-inline">Mass Storage device</ins>. <ins class="diffchange diffchange-inline">You can now see the file </ins>'''data.txt''' <ins class="diffchange diffchange-inline">created by our Arduino Sketch</ins>, <ins class="diffchange diffchange-inline">Open it and read it</ins>'<ins class="diffchange diffchange-inline">s content :-) </ins>!</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ADFImage|FEATHER-M0-ArduinoIDE-SPI-Flash-03.png}}</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ADFImage|FEATHER-M0-ArduinoIDE-SPI-Flash-03.png}}</div></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27049&oldid=prev
Admin : /* Access to the SPI Flash */
2018-09-23T19:24:39Z
<p><span dir="auto"><span class="autocomment">Access to the SPI Flash</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 19:24</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l203" >Ligne 203 :</td>
<td colspan="2" class="diff-lineno">Ligne 203 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Access to the SPI Flash ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Access to the SPI Flash ==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Arduino <del class="diffchange diffchange-inline">n'est malheureusement pas capable d'exposer un périphérique de stockage </del>(<del class="diffchange diffchange-inline">dit </del>"''mass storage''" <del class="diffchange diffchange-inline">en anglais</del>). <del class="diffchange diffchange-inline">Par conséquent, il faut utiliser </del>CircuitPython <del class="diffchange diffchange-inline">qui, lui, est capable de faire cela pour nous. Voici la technique à utiliser</del>.Here<del class="diffchange diffchange-inline">'s </del>the <del class="diffchange diffchange-inline">full </del>technique:</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Arduino <ins class="diffchange diffchange-inline">is not able to expose himself as a storage device </ins>(<ins class="diffchange diffchange-inline">a </ins>"''mass storage''" <ins class="diffchange diffchange-inline">device</ins>). <ins class="diffchange diffchange-inline">Instead you will have to switch to </ins>CircuitPython <ins class="diffchange diffchange-inline">to expose the SPI Flash as storage device</ins>. Here <ins class="diffchange diffchange-inline">is </ins>the technique <ins class="diffchange diffchange-inline">to use</ins>:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* <del class="diffchange diffchange-inline">Démarrer le </del>bootloader <del class="diffchange diffchange-inline">de votre carte </del>Express. <del class="diffchange diffchange-inline">Faites un glisser/déposer de la dernière </del>version <del class="diffchange diffchange-inline">du fichier uf2 </del>'''circuitpython'''.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* <ins class="diffchange diffchange-inline">Start the </ins>bootloader <ins class="diffchange diffchange-inline">of the </ins>Express <ins class="diffchange diffchange-inline">board</ins>. <ins class="diffchange diffchange-inline">Drag and drop the last </ins>version <ins class="diffchange diffchange-inline">of the </ins>'''circuitpython''' <ins class="diffchange diffchange-inline">(the UF2 file)</ins>.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* <del class="diffchange diffchange-inline">Après un moment</del>, <del class="diffchange diffchange-inline">vous devriez voir apparaître le lecteur </del>'''CIRCUITPY''' <del class="diffchange diffchange-inline">contenant un fichier </del>'''boot_out.txt'''. <del class="diffchange diffchange-inline">Voilà</del>, <del class="diffchange diffchange-inline">le système de fichier est initialisé sur la </del>Flash <del class="diffchange diffchange-inline">SPI</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* <ins class="diffchange diffchange-inline">After a while</ins>, <ins class="diffchange diffchange-inline">you should see a </ins>'''CIRCUITPY''' <ins class="diffchange diffchange-inline">drive containing the file </ins>'''boot_out.txt'''. <ins class="diffchange diffchange-inline">Great</ins>, <ins class="diffchange diffchange-inline">the Circuit Python filesystem is initialized on the SPI </ins>Flash.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* <del class="diffchange diffchange-inline">Ouvrez maintenant </del>Arduino IDE <del class="diffchange diffchange-inline">et téléversez l</del>'<del class="diffchange diffchange-inline">exemple </del>'''<del class="diffchange diffchange-inline">fatfs_circuitpython</del>''' <del class="diffchange diffchange-inline">disponible dans la bibliothèque </del>SPI <del class="diffchange diffchange-inline">d'Adafruit</del>. <del class="diffchange diffchange-inline">Ouvrez la </del>console <del class="diffchange diffchange-inline">série pour démarrer le croquis</del>. <del class="diffchange diffchange-inline">Voilà, le système de fichier </del>CircuitPython <del class="diffchange diffchange-inline">sera correctement monté et le fichier </del>'''data.txt''' <del class="diffchange diffchange-inline">créé et initialisé</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* <ins class="diffchange diffchange-inline">Open the </ins>Arduino IDE <ins class="diffchange diffchange-inline">and upload the </ins>'''<ins class="diffchange diffchange-inline">fatfs_circuitpython</ins>''' <ins class="diffchange diffchange-inline">sketch available in the Adafruit</ins>'<ins class="diffchange diffchange-inline">s </ins>SPI <ins class="diffchange diffchange-inline">FLASH library</ins>. <ins class="diffchange diffchange-inline">Open the serial </ins>console <ins class="diffchange diffchange-inline">and start the sketch</ins>. <ins class="diffchange diffchange-inline">Voila! the </ins>CircuitPython <ins class="diffchange diffchange-inline">file system is properly mounted and the file </ins>'''data.txt''' <ins class="diffchange diffchange-inline">created and initialized</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ADFImage|FEATHER-M0-ArduinoIDE-SPI-Flash-02.png}}</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{ADFImage|FEATHER-M0-ArduinoIDE-SPI-Flash-02.png}}</div></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27048&oldid=prev
Admin : /* Accéder à la Flash SPI */
2018-09-23T19:09:16Z
<p><span dir="auto"><span class="autocomment">Accéder à la Flash SPI</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 19:09</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l202" >Ligne 202 :</td>
<td colspan="2" class="diff-lineno">Ligne 202 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>== <del class="diffchange diffchange-inline">Accéder à la </del>Flash <del class="diffchange diffchange-inline">SPI </del>==</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>== <ins class="diffchange diffchange-inline">Access to the SPI </ins>Flash ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Arduino n'est malheureusement pas capable d'exposer un périphérique de stockage (dit "''mass storage''" en anglais). Par conséquent, il faut utiliser CircuitPython qui, lui, est capable de faire cela pour nous. Voici la technique à utiliser.Here's the full technique:</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Arduino n'est malheureusement pas capable d'exposer un périphérique de stockage (dit "''mass storage''" en anglais). Par conséquent, il faut utiliser CircuitPython qui, lui, est capable de faire cela pour nous. Voici la technique à utiliser.Here's the full technique:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* Démarrer le bootloader de votre carte Express. Faites un glisser/déposer de la dernière version du fichier uf2 '''circuitpython'''.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* Démarrer le bootloader de votre carte Express. Faites un glisser/déposer de la dernière version du fichier uf2 '''circuitpython'''.</div></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27047&oldid=prev
Admin : /* Read and Write CircuitPython files */
2018-09-23T19:08:47Z
<p><span dir="auto"><span class="autocomment">Read and Write CircuitPython files</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 19:08</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l201" >Ligne 201 :</td>
<td colspan="2" class="diff-lineno">Ligne 201 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">Cette fois encore, la fonction '''open''' est utilisée pour ouvrir le fichier si ce n'est que cette fois, le fichier est ouvert en lecture (''write'' en anglais). Dans ce mode, le fichier est ouvert en ajout (les données sont ajoutées en fin de fichier) si ce dernier existe. A noter le mode écriture crée le fichier si celui-ci n'existe pas. Une fois le fichier ouvert, les fonctions tels que '''print''' et '''println''' peuvent être utilisées pour écrire des données dans le fichier (juste comme envoi des données vers le moniteur série). Une fois le traitement terminé, la fonction '''close''' ferme le fichier!</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">Voilà, nous en avons terminé avec les opérations fondamentales de lecture et d'écriture. Voyez l'exemple '''fatfs_full_usage''' pour un apercu des fonctionnalités avancées tels que la création de répertoire, effacement de fichiers et répertoires, obtention de la taille d'un fichier, etc! Rappelez vous que pour interagir avec les fichiers CircuitPython, il faudra utiliser la classe '''Adafruit_Feather_M0_CircuitPython''' comme indiqué dans l'exemple ci-dessus!</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Accéder à la Flash SPI ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Accéder à la Flash SPI ==</div></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27046&oldid=prev
Admin : /* Read and Write CircuitPython files */
2018-09-23T19:07:34Z
<p><span dir="auto"><span class="autocomment">Read and Write CircuitPython files</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 19:07</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l168" >Ligne 168 :</td>
<td colspan="2" class="diff-lineno">Ligne 168 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if (pythonfs.exists("boot.py")) {</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if (pythonfs.exists("boot.py")) {</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> File bootPy = pythonfs.open("boot.py", FILE_READ);</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> File bootPy = pythonfs.open("boot.py", FILE_READ);</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> Serial.println("<del class="diffchange diffchange-inline">Afficher </del>boot.py...");</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> Serial.println("<ins class="diffchange diffchange-inline">Display </ins>boot.py...");</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> while (bootPy.available()) {</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> while (bootPy.available()) {</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> char c = bootPy.read();</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> char c = bootPy.read();</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l180" >Ligne 180 :</td>
<td colspan="2" class="diff-lineno">Ligne 180 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Notez l'appel de la fonction '''exists''' qui vérifie la présence du fichier boot.py, puis l'utilisation de la fonction '''open''' pour ouvrir celui-ci en mode lecture (''read'' en anglais''). Une fois fichier ouvert vous obtenez une référence vers un objet de la classe File qui permet de lire et écrire dans le fichier comme s'il s'agissait d'un périphérique Serial (encore une fois, [https://www.arduino.cc/en/Reference/SD toutes les fonctions de la classe File] sont identiques à celle de la classe carte SD). </del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Le file write operation is also very </ins>simple, <ins class="diffchange diffchange-inline">the following sketch will add data to the </ins>'''data.txt''' <ins class="diffchange diffchange-inline">file</ins>:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> </div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Dans ce cas, la fonction '''available''' retournera le nombre d'octets (''bytes'') restant à lire jusqu'à la fin du fichier -et- la fonction '''read''' lit un caractère à la fois (pour l'afficher sur le moniteur série).</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> </div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">L'écriture d'un fichier est tout aussi </del>simple, <del class="diffchange diffchange-inline">voici comment le croquis ajoute des données dans le fichier </del>'''data.txt''':</div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="c"></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="c"></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> // <del class="diffchange diffchange-inline">Créer et ajouter des données dans le fichier </del>data.txt </div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> // <ins class="diffchange diffchange-inline">Create and add data in the file </ins>data.txt </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> // <del class="diffchange diffchange-inline">puis ajouter un retour à la ligne</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> // <ins class="diffchange diffchange-inline">then append a carriage return</ins>.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> // <del class="diffchange diffchange-inline">Le code </del>CircuitPython <del class="diffchange diffchange-inline">pourra, plus tard, ou consulter</del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> // <ins class="diffchange diffchange-inline">Later, the </ins>CircuitPython <ins class="diffchange diffchange-inline">script will be able to </ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> // <del class="diffchange diffchange-inline">le contenu de ce fichier</del>!</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> // <ins class="diffchange diffchange-inline">read the file content</ins>!</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> File data = pythonfs.open("data.txt", FILE_WRITE);</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> File data = pythonfs.open("data.txt", FILE_WRITE);</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if (data) {</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if (data) {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> // <del class="diffchange diffchange-inline">Ajouter une nouvelle ligne de donnée</del>:</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> // <ins class="diffchange diffchange-inline">Add a new line of data</ins>:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> data.println("<del class="diffchange diffchange-inline">Un bonjour a </del>CircuitPython <del class="diffchange diffchange-inline">de la part d </del>Arduino!");</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> data.println("<ins class="diffchange diffchange-inline">A great day to </ins>CircuitPython <ins class="diffchange diffchange-inline">from our beloved </ins>Arduino <ins class="diffchange diffchange-inline">sketch</ins>!");</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> data.close();</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> data.close();</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> // <del class="diffchange diffchange-inline">Voir les autre exemples fatfs comme </del>fatfs_full_usage </div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> // <ins class="diffchange diffchange-inline">See also the examples from the </ins>fatfs_full_usage </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> // <del class="diffchange diffchange-inline">et </del>fatfs_datalogging <del class="diffchange diffchange-inline">pour plus d'exemples concernant </del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> // <ins class="diffchange diffchange-inline">and </ins>fatfs_datalogging <ins class="diffchange diffchange-inline">for mode information about </ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> // <del class="diffchange diffchange-inline">les interactions avec les fichiers</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> // <ins class="diffchange diffchange-inline">interaction with files</ins>.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> Serial.println("<del class="diffchange diffchange-inline">Nouvelle ligne ajoutée au fichier </del>data.txt!");</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> Serial.println("<ins class="diffchange diffchange-inline">A new line was added to the </ins>data.txt <ins class="diffchange diffchange-inline">file</ins>!");</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else {</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else {</div></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27045&oldid=prev
Admin : /* Read and Write CircuitPython files */
2018-09-23T18:57:32Z
<p><span dir="auto"><span class="autocomment">Read and Write CircuitPython files</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 18:57</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l158" >Ligne 158 :</td>
<td colspan="2" class="diff-lineno">Ligne 158 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">En utilisant la classe </del>'''Adafruit_M0_Express_CircuitPython''' <del class="diffchange diffchange-inline">vous obtenez un </del>objet <del class="diffchange diffchange-inline">de </del>type <del class="diffchange diffchange-inline">''système de fichier'' </del>compatible <del class="diffchange diffchange-inline">avec en lecture et écriture avec le formattage de la mémoire Flash de </del>CircuitPython. <del class="diffchange diffchange-inline">C'est très </del>important <del class="diffchange diffchange-inline">pour l'interopérabilité entre CircuitPython et </del>Arduino <del class="diffchange diffchange-inline">étant donné que </del>CircuitPython <del class="diffchange diffchange-inline">dispose d'un partitionnement spécifique et d'un agencement particulier de la mémoire flash qui n'est pas </del>compatible <del class="diffchange diffchange-inline">avec des bibliothèque plus "simple" </del>(<del class="diffchange diffchange-inline">que vous pourriez rencontrer dans les autres exemples</del>).</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">By using the </ins>'''Adafruit_M0_Express_CircuitPython''' <ins class="diffchange diffchange-inline">class, you get a "File System" </ins>objet type compatible <ins class="diffchange diffchange-inline">with read/write operations over a </ins>CircuitPython <ins class="diffchange diffchange-inline">file system</ins>. <ins class="diffchange diffchange-inline"> This point is </ins>important <ins class="diffchange diffchange-inline">for the interoperability between CirctuitPython and </ins>Arduino<ins class="diffchange diffchange-inline">. </ins>CircuitPython <ins class="diffchange diffchange-inline">use a particular partitioning of the Flash which is not </ins>compatible <ins class="diffchange diffchange-inline">simpler library </ins>(<ins class="diffchange diffchange-inline">like those mentionned in another examples</ins>).</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Une fois l'instance de la classe </del>'''Adafruit_M0_Express_CircuitPython''' <del class="diffchange diffchange-inline">créée </del>(instance <del class="diffchange diffchange-inline">appelée </del>'''pythonfs''' <del class="diffchange diffchange-inline">dans le croquis</del>) <del class="diffchange diffchange-inline">vous pouvez interagir avec elle comme s'il s'agissait de la </del>[https://www.arduino.cc/en/Reference/SD <del class="diffchange diffchange-inline">bibliothèque carte </del>SD <del class="diffchange diffchange-inline">d'Arduino</del>]. <del class="diffchange diffchange-inline"> Vous pouvez ouvrir des fichiers en lecture ou écriture</del>, <del class="diffchange diffchange-inline">créer des répertoires</del>, <del class="diffchange diffchange-inline">effacer des fichiers et répertoires et plus encore</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">One the </ins>'''Adafruit_M0_Express_CircuitPython''' <ins class="diffchange diffchange-inline">class instance created </ins>(instance <ins class="diffchange diffchange-inline">named </ins>'''pythonfs''' <ins class="diffchange diffchange-inline">in the sketch</ins>) <ins class="diffchange diffchange-inline">you can interact with the file system like </ins>[https://www.arduino.cc/en/Reference/SD <ins class="diffchange diffchange-inline">an Arduino's </ins>SD <ins class="diffchange diffchange-inline">library</ins>]. <ins class="diffchange diffchange-inline">You can open files in read/write mode</ins>, <ins class="diffchange diffchange-inline">create folder</ins>, <ins class="diffchange diffchange-inline">drop files and folders (and even more)</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Voici un croquis qui vérifie la présence du fichier </del>'''boot.py''' <del class="diffchange diffchange-inline">et affiche sont contenu </del>(<del class="diffchange diffchange-inline">un caractère à la fois</del>):</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Here a sketch looking for the </ins>'''boot.py''' <ins class="diffchange diffchange-inline">file and displaying its content on the screen </ins>(<ins class="diffchange diffchange-inline">char by char</ins>):</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="c"></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="c"></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> // <del class="diffchange diffchange-inline">Vérifie si le fichier </del>boot.py <del class="diffchange diffchange-inline">existe puis affiche le contenu.</del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> // <ins class="diffchange diffchange-inline">Check the </ins>boot.py <ins class="diffchange diffchange-inline">file existence THEN display it on the screen</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if (pythonfs.exists("boot.py")) {</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if (pythonfs.exists("boot.py")) {</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> File bootPy = pythonfs.open("boot.py", FILE_READ);</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> File bootPy = pythonfs.open("boot.py", FILE_READ);</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l176" >Ligne 176 :</td>
<td colspan="2" class="diff-lineno">Ligne 176 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else {</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> Serial.println("<del class="diffchange diffchange-inline">Pas de fichier </del>boot.py...");</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> Serial.println("<ins class="diffchange diffchange-inline">No </ins>boot.py <ins class="diffchange diffchange-inline">file</ins>...");</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27044&oldid=prev
Admin : /* Lire et écrire des fichiers CircuitPython */
2018-09-23T18:40:19Z
<p><span dir="auto"><span class="autocomment">Lire et écrire des fichiers CircuitPython</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 18:40</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l130" >Ligne 130 :</td>
<td colspan="2" class="diff-lineno">Ligne 130 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Remember that SPI Flash library is designed to expose the same interface than [https://www.arduino.cc/en/reference/SD Arduino's SD library]. So the codes and samples storing data on SD card would would be easy to adapt to the SPI Flash library. Just create a {{fname|fatfs}} object like the examples here upper. You will also have to use the {{fname|open}} method on the object (instead of the global open function). Once the reference to the file object, all the functions and usages would be identifcal between the SPI Flash and Arduino's SD library!</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Remember that SPI Flash library is designed to expose the same interface than [https://www.arduino.cc/en/reference/SD Arduino's SD library]. So the codes and samples storing data on SD card would would be easy to adapt to the SPI Flash library. Just create a {{fname|fatfs}} object like the examples here upper. You will also have to use the {{fname|open}} method on the object (instead of the global open function). Once the reference to the file object, all the functions and usages would be identifcal between the SPI Flash and Arduino's SD library!</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>== <del class="diffchange diffchange-inline">Lire et écrire des fichiers </del>CircuitPython ==</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>== <ins class="diffchange diffchange-inline">Read and Write </ins>CircuitPython <ins class="diffchange diffchange-inline">files </ins>==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">L'exemple </del>'''fatfs_circuitpython''' <del class="diffchange diffchange-inline">montre comment lire et écrire des fichiers sur la mémoire flash de sorte qu'ils puissent être accéssible depuis </del>CircuitPython<del class="diffchange diffchange-inline">/MicroPython</del>. <del class="diffchange diffchange-inline">Cela signifie que vous pouvez exécuter un programme </del>CircuitPython <del class="diffchange diffchange-inline">sur votre carte pour y stocker des données</del>, <del class="diffchange diffchange-inline">puis utiliser un croquis </del>Arduino <del class="diffchange diffchange-inline">qui utilise cette bibliothèque pour interagir avec ces mêmes données</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">The example </ins>'''fatfs_circuitpython''' <ins class="diffchange diffchange-inline">demonstrate how to read and write the files from the SPI Flash from </ins>CircuitPython <ins class="diffchange diffchange-inline">file system</ins>. <ins class="diffchange diffchange-inline">This means that you can execute CircuitPython script to store data in the </ins>CircuitPython <ins class="diffchange diffchange-inline">file system</ins>, <ins class="diffchange diffchange-inline">then use an </ins>Arduino <ins class="diffchange diffchange-inline">sketch using this library to interact with those data</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Notez qu'avant d'utiliser l'</del>exemple '''fatfs_circuitpython''' <del class="diffchange diffchange-inline">vous </del>'''<del class="diffchange diffchange-inline">devez</del>''' <del class="diffchange diffchange-inline">avoir chargé </del>CircuitPython <del class="diffchange diffchange-inline">sur votre carte</del>. [<del class="diffchange diffchange-inline">[FEATHER</del>-<del class="diffchange diffchange-inline">M0</del>-<del class="diffchange diffchange-inline">MicroPython</del>|<del class="diffchange diffchange-inline">Voyez ce </del>guide <del class="diffchange diffchange-inline">pour charger la dernière version de CircuitPython]</del>] <del class="diffchange diffchange-inline">afin que le système de fichier </del>CircuitPython <del class="diffchange diffchange-inline">soit écrit et initialisé sur la puce </del>Flash. <del class="diffchange diffchange-inline">Une fois </del>CircuitPython <del class="diffchange diffchange-inline">chargé sur la carte</del>, <del class="diffchange diffchange-inline">vous pouvez exécuter le croquis </del>'''fatfs_circuitpython'''.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Note: before running the </ins>exemple '''fatfs_circuitpython''' <ins class="diffchange diffchange-inline">you </ins>'''<ins class="diffchange diffchange-inline">must</ins>''' <ins class="diffchange diffchange-inline">have loaded the </ins>CircuitPython <ins class="diffchange diffchange-inline">on the board</ins>. [<ins class="diffchange diffchange-inline">https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/what</ins>-<ins class="diffchange diffchange-inline">is</ins>-<ins class="diffchange diffchange-inline">circuitpython</ins>|<ins class="diffchange diffchange-inline">Please, see the Adafruit's M0 Express </ins>guide] <ins class="diffchange diffchange-inline">to initialize the </ins>CircuitPython <ins class="diffchange diffchange-inline">file system in the SPI </ins>Flash. <ins class="diffchange diffchange-inline">Once the </ins>CircuitPython <ins class="diffchange diffchange-inline">loaded on the board</ins>, <ins class="diffchange diffchange-inline">you can execute the sketch </ins>'''fatfs_circuitpython'''.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Pour exécuter le croquis</del>, <del class="diffchange diffchange-inline">il faut le charger dans </del>Arduino IDE <del class="diffchange diffchange-inline">et le téléverser sur la carte </del>Feather M0. <del class="diffchange diffchange-inline">Ensuite</del>, <del class="diffchange diffchange-inline">il faut ouvrir le moniteur série à </del>115200 baud. <del class="diffchange diffchange-inline">Vous devriez voir des </del>messages <del class="diffchange diffchange-inline">s'afficher lorsqu'il essaye de lire et écrire des fichiers sur la mémoire Flash</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">To execute the sketch</ins>, <ins class="diffchange diffchange-inline">you have to load it inside </ins>Arduino IDE <ins class="diffchange diffchange-inline">then upload it to the </ins>Feather M0 <ins class="diffchange diffchange-inline">board</ins>. <ins class="diffchange diffchange-inline">Then</ins>, <ins class="diffchange diffchange-inline">you have to open a serial monitor a </ins>115200 baud. <ins class="diffchange diffchange-inline">You should see </ins>messages <ins class="diffchange diffchange-inline">displayed when the sketch tries to read and write files on the Flask memory</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Plus spécifiquement</del>, <del class="diffchange diffchange-inline">l'exemple cherche les fichiers </del>'''boot.py''' <del class="diffchange diffchange-inline">et </del>'''main.py''' (<del class="diffchange diffchange-inline">puisque </del>CircuitPython <del class="diffchange diffchange-inline">exécute ces fichiers au démarrage</del>) <del class="diffchange diffchange-inline">et affiche leur contenu</del>. <del class="diffchange diffchange-inline">Puis il ajoute une ligne à la fin du fichier </del>'''data.txt''' <del class="diffchange diffchange-inline">présent sur la carte </del>(<del class="diffchange diffchange-inline">le fichier est créé s'il n'existe pas encore</del>). <del class="diffchange diffchange-inline">Après avoir exécuté le croquis, vous pouvez recharger CircuitPython sur la carte et charger et lire le fichier '''data.txt''' depuis CircuitPython!</del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Specifically</ins>, <ins class="diffchange diffchange-inline">the example looks for the files </ins>'''boot.py''' <ins class="diffchange diffchange-inline">and </ins>'''main.py''' (<ins class="diffchange diffchange-inline">since </ins>CircuitPython <ins class="diffchange diffchange-inline">execute thos file when starting the board</ins>) <ins class="diffchange diffchange-inline">to display their content</ins>. <ins class="diffchange diffchange-inline">After, the sketch add a line at the end of the </ins>'''data.txt''' <ins class="diffchange diffchange-inline">file available in the CircuitPython file system </ins>(<ins class="diffchange diffchange-inline">the file is created if not yet existing</ins>). </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Voyons un peu </del>le <del class="diffchange diffchange-inline">code du </del>croquis pour <del class="diffchange diffchange-inline">comprendre comment </del>lire <del class="diffchange diffchange-inline">et écrire des fichiers </del>CircuitPython. <del class="diffchange diffchange-inline">Pour commencer une </del>instance <del class="diffchange diffchange-inline">de la classe </del>'''Adafruit_M0_Express_CircuitPython''' <del class="diffchange diffchange-inline">est crée en lui passant un </del>instance <del class="diffchange diffchange-inline">de la classe </del>SPIFlash (<del class="diffchange diffchange-inline">permettant d'accéder à la mémoire </del>Flash):</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">When done, you can reload CircuitPython on the board to load and read the exécuté </ins>le croquis<ins class="diffchange diffchange-inline">, vous pouvez recharger CircuitPython sur la carte </ins>pour lire <ins class="diffchange diffchange-inline">le fichier '''data.txt''' directement depuis CircuitPython!</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Let's have a loot to the sketch code to understant how to read and write files in </ins>CircuitPython. <ins class="diffchange diffchange-inline">First, an </ins>instance <ins class="diffchange diffchange-inline">of the </ins>'''Adafruit_M0_Express_CircuitPython''' <ins class="diffchange diffchange-inline">class is created with the </ins>instance <ins class="diffchange diffchange-inline">of the </ins>SPIFlash <ins class="diffchange diffchange-inline">class </ins>(<ins class="diffchange diffchange-inline">SPIFlash is used to access the </ins>Flash <ins class="diffchange diffchange-inline">content</ins>):</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="c"></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="c"></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>#define FLASH_SS SS1 // <del class="diffchange diffchange-inline">broche </del>SSP <del class="diffchange diffchange-inline">de la </del>Flash</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>#define FLASH_SS SS1 // SSP <ins class="diffchange diffchange-inline">pin from </ins>Flash</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>#define FLASH_SPI_PORT SPI1 // port <del class="diffchange diffchange-inline">SPI surlequel est branché la mémoire </del>Flash</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>#define FLASH_SPI_PORT SPI1 // <ins class="diffchange diffchange-inline">SPI </ins>port <ins class="diffchange diffchange-inline">where the </ins>Flash <ins class="diffchange diffchange-inline">is wired</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Adafruit_SPIFlash flash(FLASH_SS, &FLASH_SPI_PORT); // <del class="diffchange diffchange-inline">Utiliser le </del>bus <del class="diffchange diffchange-inline">SPI matériel </del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Adafruit_SPIFlash flash(FLASH_SS, &FLASH_SPI_PORT); // <ins class="diffchange diffchange-inline">Use the hardware SPI </ins>bus </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>// <del class="diffchange diffchange-inline">Il est possible d'utiliser d'autres broches comme </del>bus <del class="diffchange diffchange-inline">SPI </del>(SPI <del class="diffchange diffchange-inline">logiciel</del>)!</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>// <ins class="diffchange diffchange-inline">Other pins can also be used for the SPI </ins>bus (<ins class="diffchange diffchange-inline">software </ins>SPI)!</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>//Adafruit_SPIFlash flash(SCK1, MISO1, MOSI1, FLASH_SS);</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>//Adafruit_SPIFlash flash(SCK1, MISO1, MOSI1, FLASH_SS);</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>// <del class="diffchange diffchange-inline">Pour finir</del>, <del class="diffchange diffchange-inline">créer un objet </del>Adafruit_M0_Express_CircuitPython <del class="diffchange diffchange-inline">qui offre un accès</del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>// <ins class="diffchange diffchange-inline">Finally</ins>, <ins class="diffchange diffchange-inline">create an </ins>Adafruit_M0_Express_CircuitPython <ins class="diffchange diffchange-inline">object to gain access</ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>// <del class="diffchange diffchange-inline">à une </del>interface <del class="diffchange diffchange-inline">de type Carte SD pour interagir avec les fichiers stockés dans </del></div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>// <ins class="diffchange diffchange-inline">to a SD alike </ins>interface<ins class="diffchange diffchange-inline">. The Adafruit_M0_Express_CircuitPython would allow</ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>// <del class="diffchange diffchange-inline">le système de fichier </del>Flash <del class="diffchange diffchange-inline">de CircuitPython</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>// <ins class="diffchange diffchange-inline">the sketch to access the CircuitPython file system stored inside the </ins>Flash.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Adafruit_M0_Express_CircuitPython pythonfs(flash);</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Adafruit_M0_Express_CircuitPython pythonfs(flash);</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=ENG-CANSAT-FEATHER-M0-SPI&diff=27043&oldid=prev
Admin : /* Exemple complet d'utilisation de la Flash */
2018-09-23T18:15:28Z
<p><span dir="auto"><span class="autocomment">Exemple complet d'utilisation de la Flash</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 23 septembre 2018 à 18:15</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l125" >Ligne 125 :</td>
<td colspan="2" class="diff-lineno">Ligne 125 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>It also exists advanced read functions like those used in the '''fatfs_full_usage''' and explained indide the [https://www.arduino.cc/en/reference/SD Arduino SD class documentation] (the Flash SPI library implements the same functions).</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>It also exists advanced read functions like those used in the '''fatfs_full_usage''' and explained indide the [https://www.arduino.cc/en/reference/SD Arduino SD class documentation] (the Flash SPI library implements the same functions).</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>== <del class="diffchange diffchange-inline">Exemple complet d'utilisation de la </del>Flash ==</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>== <ins class="diffchange diffchange-inline">Full </ins>Flash <ins class="diffchange diffchange-inline">example </ins>==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Vous pouvez vous référer à l'exemple </del>'''fatfs_full_usage''' <del class="diffchange diffchange-inline">pour une démonstration complète concernant la lecture et l'écriture de fichiers</del>. <del class="diffchange diffchange-inline">Cet exemple utilise toutes les fonction de la bibliothèque et démontre des opérations tels que le test d'</del>existence <del class="diffchange diffchange-inline">d'un fichier, la création de répertoire</del>, <del class="diffchange diffchange-inline">effacement de fichier</del>, <del class="diffchange diffchange-inline">effacement de fichier</del>, etc.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">The </ins>'''fatfs_full_usage''' <ins class="diffchange diffchange-inline">is a complete example demonstrating reading and writing operations on files</ins>. <ins class="diffchange diffchange-inline">This example use all the library functions and advanced feature like file </ins>existence, <ins class="diffchange diffchange-inline">folder creation</ins>, <ins class="diffchange diffchange-inline">file wiping</ins>, etc.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Rappelez vous que la bibliothèque </del>SPI <del class="diffchange diffchange-inline">flash est conçue pour exposer les mêmes fonctions et mêmes interfaces que la </del>[https://www.arduino.cc/en/reference/SD <del class="diffchange diffchange-inline">la bibliothèque </del>SD <del class="diffchange diffchange-inline">d'Arduino</del>]. <del class="diffchange diffchange-inline">Par conséquent, les code et exemples stockant des données sur une carte </del>SD <del class="diffchange diffchange-inline">seront très facile à adapter pour fonctionner avec la bibliothèque </del>SPI <del class="diffchange diffchange-inline">flash</del>. <del class="diffchange diffchange-inline">Créez simplement un objet </del>fatfs <del class="diffchange diffchange-inline">comme dans les exemples ci-dessus et utilisez la fonction </del>open <del class="diffchange diffchange-inline">sur cet objet </del>(<del class="diffchange diffchange-inline">en lieu et place de la fonction globale</del>). <del class="diffchange diffchange-inline">Une fois que vous avez obtenu une référence sur un fichier</del>, <del class="diffchange diffchange-inline">toutes les fonctions et utilisations sont identiques entre la bibliothèque </del>SPI <del class="diffchange diffchange-inline">flash et la bibliothèque </del>SD <del class="diffchange diffchange-inline">d'Arduino</del>!</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Remember that </ins>SPI <ins class="diffchange diffchange-inline">Flash library is designed to expose the same interface than </ins>[https://www.arduino.cc/en/reference/SD <ins class="diffchange diffchange-inline">Arduino's </ins>SD <ins class="diffchange diffchange-inline">library</ins>]. <ins class="diffchange diffchange-inline">So the codes and samples storing data on </ins>SD <ins class="diffchange diffchange-inline">card would would be easy to adapt to the </ins>SPI <ins class="diffchange diffchange-inline">Flash library</ins>. <ins class="diffchange diffchange-inline">Just create a {{fname|</ins>fatfs<ins class="diffchange diffchange-inline">}} object like the examples here upper. You will also have to use the {{fname|</ins>open<ins class="diffchange diffchange-inline">}} method on the object </ins>(<ins class="diffchange diffchange-inline">instead of the global open function</ins>). <ins class="diffchange diffchange-inline">Once the reference to the file object</ins>, <ins class="diffchange diffchange-inline">all the functions and usages would be identifcal between the </ins>SPI <ins class="diffchange diffchange-inline">Flash and Arduino's </ins>SD <ins class="diffchange diffchange-inline">library</ins>!</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Lire et écrire des fichiers CircuitPython ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Lire et écrire des fichiers CircuitPython ==</div></td></tr>
</table>
Admin