# eric7.MicroPython.CircuitPythonDevices

Module implementing the device interface class for CircuitPython boards.

### Global Attributes

None

### Classes

CircuitPythonDevice | Class implementing the device for CircuitPython boards.

### Functions

None

## CircuitPythonDevice

Class implementing the device for CircuitPython boards.

### Derived from

MicroPythonDevice

### Class Attributes

DeviceVolumeName

### Class Methods

None

### Methods

CircuitPythonDevice | Constructor
__deviceVolumeMounted | Private method to check, if the device volume is mounted.
__findWorkspace | Private method to find the workspace directory.
__flashCircuitPython | Private slot to flash a CircuitPython firmware to the device.
__flashTeensy | Private method to show a message box because Teens does not support the UF2 bootloader yet.
__installLibraryFiles | Private slot to install Python files into the onboard library.
addDeviceMenuEntries | Public method to add device specific entries to the given menu.
canRunScript | Public method to determine, if a script can be executed.
canStartFileManager | Public method to determine, if a File Manager can be started.
canStartPlotter | Public method to determine, if a Plotter can be started.
canStartRepl | Public method to determine, if a REPL can be started.
deviceName | Public method to get the name of the device.
forceInterrupt | Public method to determine the need for an interrupt when opening the serial connection.
getDocumentationUrl | Public method to get the device documentation URL.
getDownloadMenuEntries | Public method to retrieve the entries for the downloads menu.
getWorkspace | Public method to get the workspace directory.
hasFlashMenuEntry | Public method to check, if the device has its own flash menu entry.
runScript | Public method to run the given Python script.
setButtons | Public method to enable the supported action buttons.
supportsLocalFileAccess | Public method to indicate file access via a local directory.

### Static Methods

None

#### CircuitPythonDevice (Constructor)

CircuitPythonDevice(microPythonWidget, deviceType, parent=None)

Constructor

microPythonWidget (MicroPythonWidget)
  reference to the main MicroPython widget
deviceType (str)
  device type assigned to this device interface
parent (QObject)
  reference to the parent object

#### CircuitPythonDevice.__deviceVolumeMounted

__deviceVolumeMounted()

Private method to check, if the device volume is mounted.

Return:
  flag indicated a mounted device

Return Type:
  bool

#### CircuitPythonDevice.__findWorkspace

__findWorkspace(silent=False)

Private method to find the workspace directory.

silent (bool)
  flag indicating silent operations

Return:
  workspace directory used for saving files

Return Type:
  str

#### CircuitPythonDevice.__flashCircuitPython

__flashCircuitPython()

Private slot to flash a CircuitPython firmware to the device.

#### CircuitPythonDevice.__flashTeensy

__flashTeensy()

Private method to show a message box because Teens does not support the UF2 bootloader yet.

#### CircuitPythonDevice.__installLibraryFiles

__installLibraryFiles()

Private slot to install Python files into the onboard library.

#### CircuitPythonDevice.addDeviceMenuEntries

addDeviceMenuEntries(menu)

Public method to add device specific entries to the given menu.

menu (QMenu)
  reference to the context menu

#### CircuitPythonDevice.canRunScript

canRunScript()

Public method to determine, if a script can be executed.

Return:
  tuple containing a flag indicating it is safe to start a Plotter and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### CircuitPythonDevice.canStartFileManager

canStartFileManager()

Public method to determine, if a File Manager can be started.

Return:
  tuple containing a flag indicating it is safe to start a File Manager and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### CircuitPythonDevice.canStartPlotter

canStartPlotter()

Public method to determine, if a Plotter can be started.

Return:
  tuple containing a flag indicating it is safe to start a Plotter and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### CircuitPythonDevice.canStartRepl

canStartRepl()

Public method to determine, if a REPL can be started.

Return:
  tuple containing a flag indicating it is safe to start a REPL and a reason why it cannot.

Return Type:
  tuple of (bool, str)

#### CircuitPythonDevice.deviceName

deviceName()

Public method to get the name of the device.

Return:
  name of the device

Return Type:
  str

#### CircuitPythonDevice.forceInterrupt

forceInterrupt()

Public method to determine the need for an interrupt when opening the serial connection.

Return:
  flag indicating an interrupt is needed

Return Type:
  bool

#### CircuitPythonDevice.getDocumentationUrl

getDocumentationUrl()

Public method to get the device documentation URL.

Return:
  documentation URL of the device

Return Type:
  str

#### CircuitPythonDevice.getDownloadMenuEntries

getDownloadMenuEntries()

Public method to retrieve the entries for the downloads menu.

Return:
  list of tuples with menu text and URL to be opened for each entry

Return Type:
  list of tuple of (str, str)

#### CircuitPythonDevice.getWorkspace

getWorkspace(silent=False)

Public method to get the workspace directory.

silent (bool)
  flag indicating silent operations

Return:
  workspace directory used for saving files

Return Type:
  str

#### CircuitPythonDevice.hasFlashMenuEntry

hasFlashMenuEntry()

Public method to check, if the device has its own flash menu entry.

Return:
  flag indicating a specific flash menu entry

Return Type:
  bool

#### CircuitPythonDevice.runScript

runScript(script)

Public method to run the given Python script.

script (str)
  script to be executed

#### CircuitPythonDevice.setButtons

setButtons()

Public method to enable the supported action buttons.

#### CircuitPythonDevice.supportsLocalFileAccess

supportsLocalFileAccess()

Public method to indicate file access via a local directory.

Return:
  flag indicating file access via local directory

Return Type:
  bool

Up