; ---------------------------------------------------------------------------
; dataflash_erase.cmm
;
; this script
; - must be executed from the CYT2B Master-GUI (CM0+ Core)
; - is erasing the complete dataflash contents
; ---------------------------------------------------------------------------
  PMACRO.EXPLICIT

  ; show path and name of this script (present practice file)
  ECHO ""
  ECHO %COLOR.BLUE "### " OS.PPF() " ###"

; ---------------------------------------------------------------------------

  PRIVATE &result

; ---------------------------------------------------------------------------
; dialog to select the filename
  DIALOG.YESNO "Do really want to ERASE the complete dataflash?"
  ENTRY &result

  IF &result==TRUE()
  (
    ECHO %COLOR.GREEN "DataFlash ERASE started..."

    SYStem.Up

    FLASH.AUTO 2.
    FLASH.Erase 2.
    FLASH.AUTO off

    ECHO %COLOR.GREEN "DataFlash ERASE finished!"
  )
  else
  (
    ECHO %COLOR.GREEN "DataFlash ERASE aborted"
  )


  ENDDO

