Linting updates
This commit is contained in:
parent
60ba1f4b0c
commit
56239b0f5f
19 changed files with 3 additions and 236 deletions
|
|
@ -1,39 +0,0 @@
|
|||
Welcome to CircuitPython!
|
||||
#############################
|
||||
|
||||
Visit the Gemma M0 product page here for more info:
|
||||
https://adafruit.com/product/3501
|
||||
|
||||
#############################
|
||||
|
||||
The Gemma has a very tiny disk drive so we have disabled Mac OS X indexing
|
||||
which could take up that valuable space.
|
||||
|
||||
So *please* do not remove the empty .fseventsd/no_log, .metadata_never_index
|
||||
or .Trashes files!
|
||||
|
||||
#############################
|
||||
|
||||
The pre-loaded demo shows off what your Gemma M0 can do with CircuitPython:
|
||||
* The built in DotStar LED can show any color, it will swirl through the rainbow
|
||||
* Pin A0 is a true analog output, you will see the voltage slowly rise
|
||||
* Pin A1 is an analog input, the REPL will display the voltage on this pin
|
||||
(0-3.3V is the max range)
|
||||
* Pin A2 is a capacitive input, when touched, it will turn on the red LED.
|
||||
If you update main.py to uncomment the relevant lines, it will act as a
|
||||
mini keyboard and emulate an 'a' key-press whenever A2 is touched.
|
||||
|
||||
For more details on how to use CircuitPython, visit
|
||||
https://adafruit.com/product/3501 and check out all the tutorials we have!
|
||||
|
||||
#############################
|
||||
CircuitPython Quick Start:
|
||||
|
||||
Changing the code is as easy as editing main.py in your favorite text editor.
|
||||
We recommend Atom, Notepad++, or Visual Studio Code. After the file is saved,
|
||||
CircuitPython will automatically reload the latest code. Try enabling the
|
||||
capacitive keyboard (HINT: look for the "# optional! uncomment below..." text)
|
||||
|
||||
Connecting to the serial port will give you access to better error messages and
|
||||
interactive CircuitPython (known as the REPL). On Windows we recommend Tera Term
|
||||
or PuTTY. On Mac OSX and Linux, 'screen' can be used from a terminal.
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
;************************************************************
|
||||
; Windows USB CDC ACM Setup File
|
||||
; Copyright (c) 2000 Microsoft Corporation
|
||||
|
||||
|
||||
[Version]
|
||||
Signature="$Windows NT$"
|
||||
Class=Ports
|
||||
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
|
||||
Provider=%MFGNAME%
|
||||
LayoutFile=layout.inf
|
||||
CatalogFile=%MFGFILENAME%.cat
|
||||
DriverVer=11/15/2007,5.1.2600.0
|
||||
|
||||
[Manufacturer]
|
||||
%MFGNAME%=DeviceList, NTamd64
|
||||
|
||||
[DestinationDirs]
|
||||
DefaultDestDir=12
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Windows 2000/XP/Vista-32bit Sections
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
[DriverInstall.nt]
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=DriverCopyFiles.nt
|
||||
AddReg=DriverInstall.nt.AddReg
|
||||
|
||||
[DriverCopyFiles.nt]
|
||||
usbser.sys,,,0x20
|
||||
|
||||
[DriverInstall.nt.AddReg]
|
||||
HKR,,DevLoader,,*ntkern
|
||||
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[DriverInstall.nt.Services]
|
||||
AddService=usbser, 0x00000002, DriverService.nt
|
||||
|
||||
[DriverService.nt]
|
||||
DisplayName=%SERVICE%
|
||||
ServiceType=1
|
||||
StartType=3
|
||||
ErrorControl=1
|
||||
ServiceBinary=%12%\%DRIVERFILENAME%.sys
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Vista-64bit Sections
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
[DriverInstall.NTamd64]
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=DriverCopyFiles.NTamd64
|
||||
AddReg=DriverInstall.NTamd64.AddReg
|
||||
|
||||
[DriverCopyFiles.NTamd64]
|
||||
%DRIVERFILENAME%.sys,,,0x20
|
||||
|
||||
[DriverInstall.NTamd64.AddReg]
|
||||
HKR,,DevLoader,,*ntkern
|
||||
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[DriverInstall.NTamd64.Services]
|
||||
AddService=usbser, 0x00000002, DriverService.NTamd64
|
||||
|
||||
[DriverService.NTamd64]
|
||||
DisplayName=%SERVICE%
|
||||
ServiceType=1
|
||||
StartType=3
|
||||
ErrorControl=1
|
||||
ServiceBinary=%12%\%DRIVERFILENAME%.sys
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Vendor and Product ID Definitions
|
||||
;------------------------------------------------------------------------------
|
||||
; When developing your USB device, the VID and PID used in the PC side
|
||||
; application program and the firmware on the microcontroller must match.
|
||||
; Modify the below line to use your VID and PID. Use the format as shown below.
|
||||
; Note: One INF file can be used for multiple devices with different VID and PIDs.
|
||||
; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
|
||||
;------------------------------------------------------------------------------
|
||||
[SourceDisksFiles]
|
||||
[SourceDisksNames]
|
||||
[DeviceList]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_001C
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801C
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801D
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_001C&MI_00
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801C&MI_00
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801D&MI_00
|
||||
|
||||
[DeviceList.NTamd64]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_001C
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801C
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801D
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_001C&MI_00
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801C&MI_00
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801D&MI_00
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; String Definitions
|
||||
;------------------------------------------------------------------------------
|
||||
;Modify these strings to customize your device
|
||||
;------------------------------------------------------------------------------
|
||||
[Strings]
|
||||
MFGFILENAME="CDC_vista"
|
||||
DRIVERFILENAME ="usbser"
|
||||
MFGNAME="Adafruit Industries LLC"
|
||||
INSTDISK="Gemma M0 Driver Installer"
|
||||
DESCRIPTION="Adafruit Gemma M0"
|
||||
SERVICE="USB RS-232 Emulation Driver"
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
This driver is required on Windows 7 only, to create the Serial Port.
|
||||
Do not install on Windows 10!
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,78 +0,0 @@
|
|||
# Gemma IO demo
|
||||
# Welcome to CircuitPython 2.0.0 :)
|
||||
|
||||
import adafruit_dotstar as dotstar
|
||||
import board
|
||||
from adafruit_hid.keyboard import Keyboard
|
||||
from analogio import AnalogIn, AnalogOut
|
||||
from digitalio import DigitalInOut, Direction
|
||||
from touchio import TouchIn
|
||||
|
||||
# One pixel connected internally!
|
||||
dot = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
|
||||
|
||||
# Built in red LED
|
||||
led = DigitalInOut(board.D13)
|
||||
led.direction = Direction.OUTPUT
|
||||
|
||||
# Analog output on A0
|
||||
aout = AnalogOut(board.A0)
|
||||
|
||||
# Analog input on A1
|
||||
analog1in = AnalogIn(board.A1)
|
||||
|
||||
# Capacitive touch on A2
|
||||
touch2 = TouchIn(board.A2)
|
||||
|
||||
# Used if we do HID output, see below
|
||||
kbd = Keyboard()
|
||||
|
||||
|
||||
# Helpers
|
||||
|
||||
# Helper to convert analog input to voltage
|
||||
def getVoltage(pin):
|
||||
return (pin.value * 3.3) / 65536
|
||||
|
||||
|
||||
# Helper to give us a nice color swirl
|
||||
def wheel(pos):
|
||||
# Input a value 0 to 255 to get a color value.
|
||||
# The colours are a transition r - g - b - back to r.
|
||||
if pos < 0:
|
||||
return [0, 0, 0]
|
||||
if pos > 255:
|
||||
return [0, 0, 0]
|
||||
if pos < 85:
|
||||
return [int(pos * 3), int(255 - (pos * 3)), 0]
|
||||
elif pos < 170:
|
||||
pos -= 85
|
||||
return [int(255 - pos * 3), 0, int(pos * 3)]
|
||||
else:
|
||||
pos -= 170
|
||||
return [0, int(pos * 3), int(255 - pos * 3)]
|
||||
|
||||
|
||||
# Main Loop
|
||||
|
||||
i = 0
|
||||
while True:
|
||||
# spin internal LED around!
|
||||
dot[0] = wheel(i)
|
||||
dot.show()
|
||||
|
||||
# set analog output to 0-3.3V (0-65535 in increments)
|
||||
aout.value = i * 256
|
||||
|
||||
# Read analog voltage on A1
|
||||
print("A1: %0.2f" % getVoltage(analog1in))
|
||||
|
||||
# use A2 as capacitive touch to turn on internal LED
|
||||
if touch2.value:
|
||||
print("A2 touched!")
|
||||
# optional! uncomment below & save to have it sent a keypress
|
||||
# kbd.press(Keycode.A)
|
||||
# kbd.release_all()
|
||||
led.value = touch2.value
|
||||
|
||||
i = (i + 1) % 256 # run from 0 to 255
|
||||
BIN
Introducing_Gemma_M0/defaultfiles.zip
Normal file
BIN
Introducing_Gemma_M0/defaultfiles.zip
Normal file
Binary file not shown.
|
|
@ -41,6 +41,7 @@ def fade_pixels(fade_color):
|
|||
fade_pixels(GREEN)
|
||||
|
||||
|
||||
# pylint: disable=too-many-locals
|
||||
def play_song(song_number):
|
||||
# 1: Jingle bells
|
||||
# 2: Let It Snow
|
||||
|
|
@ -53,7 +54,7 @@ def play_song(song_number):
|
|||
dotted_quarter_note = quarter_note * 1.5
|
||||
eighth_note = whole_note / 8
|
||||
|
||||
# pylint: disable=unused-variables
|
||||
# pylint: disable=unused-variable
|
||||
# set up note values
|
||||
A3 = 220
|
||||
Bb3 = 233
|
||||
|
|
@ -86,7 +87,7 @@ def play_song(song_number):
|
|||
[D4, eighth_note],
|
||||
[E4, whole_note],
|
||||
]
|
||||
|
||||
# pylint: disable=consider-using-enumerate
|
||||
for n in range(len(jingle_bells_song)):
|
||||
cpx.start_tone(jingle_bells_song[n][0])
|
||||
time.sleep(jingle_bells_song[n][1])
|
||||
|
|
|
|||
Loading…
Reference in a new issue