Added SPDX to 30 more files - spdx-19

This commit is contained in:
dherrada 2022-02-22 15:24:56 -05:00
parent a9b2066f11
commit cb7d13281a
30 changed files with 1161 additions and 1040 deletions

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""CircuitPython Digital Input Example for ItsyBitsy RP2040"""
import board
import digitalio

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Dave Astels for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Dice roller for CLUE

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2021 Jeff Epler for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import usb_hid
REPORT_ID = 0x4

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2021 Jeff Epler for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import keypad
import board
import usb_hid

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Liz Clark for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import board
import displayio

View file

@ -1,3 +1,8 @@
// SPDX-FileCopyrightText: 2019 Becky Stern for Adafruit Industries
// SPDX-FileCopyrightText: 2019 Justin Cooper for Adafruit Industries
//
// SPDX-License-Identifier: MIT
// Code for the Adafruit FLora Citi Bike Helmet Tutorial
// https://learn.adafruit.com/citi-bike-helmet
// Becky Stern and Justin Cooper, Adafruit.com

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2018 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Circuit Playground Express Light Paintbrush"""
# Single images only. Filename is set in code,
# CPX buttons A&B are used to increase and decrease playback speed

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2018 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""HalloWing Light Paintbrush"""
# Single images only. Filename is set in code,
# potentiometer is used to tune playback SPEED

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Phillip Burgess for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Seasonal produce finder for Adafruit MagTag w/CircuitPython 6.1 or later.
Lists in-season fruits and vegetables for a user's location and season.

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Phillip Burgess for Adafruit Industries
#
# SPDX-License-Identifier: MIT
""" Produce class -- handles server queries and generates seasonal produce
lists for a time and place. See notes at end of file regarding data
format and some design decisions.

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Carter Nelson for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import terminalio
import displayio

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Collin Cunningham for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Circuit Playground Express CircuitPython Morse Code Flasher
# This is meant to work with the Circuit Playground Express board:
# https://www.adafruit.com/product/3333

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import adafruit_motor.servo

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2018 Dave Astels for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import board
import busio

View file

@ -1,207 +1,211 @@
// This program does a test of all the hardware so you can get an example of how to read
// sensors, touchscreen, and display stuff!
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <Adafruit_SPIFlash.h>
#include "Adafruit_ADT7410.h"
#include "TouchScreen.h"
#include <SdFat.h>
#include <WiFiNINA.h>
#include "coin.h"
#define RED_LED 13
#define TFT_RESET 24
#define TFT_BACKLIGHT 25
#define LIGHT_SENSOR A2
#define SD_CS 32
#define SPKR_SHUTDOWN 50
#define TFT_D0 34 // Data bit 0 pin (MUST be on PORT byte boundary)
#define TFT_WR 26 // Write-strobe pin (CCL-inverted timer output)
#define TFT_DC 10 // Data/command pin
#define TFT_CS 11 // Chip-select pin
#define TFT_RST 24 // Reset pin
#define TFT_RD 9 // Read-strobe pin
#define TFT_BACKLIGHT 25
// ILI9341 with 8-bit parallel interface:
Adafruit_ILI9341 tft = Adafruit_ILI9341(tft8bitbus, TFT_D0, TFT_WR, TFT_DC, TFT_CS, TFT_RST, TFT_RD);
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS, PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
Adafruit_SPIFlash flash(&flashTransport);
Adafruit_ADT7410 tempsensor = Adafruit_ADT7410();
#define YP A4 // must be an analog pin, use "An" notation!
#define XM A7 // must be an analog pin, use "An" notation!
#define YM A6 // can be a digital pin
#define XP A5 // can be a digital pin
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
#define X_MIN 750
#define X_MAX 325
#define Y_MIN 840
#define Y_MAX 240
Adafruit_GFX_Button coin = Adafruit_GFX_Button();
SdFat SD;
void setup() {
Serial.begin(115200);
//while (!Serial);
Serial.println("All Test!");
pinMode(RED_LED, OUTPUT);
pinMode(TFT_BACKLIGHT, OUTPUT);
digitalWrite(TFT_BACKLIGHT, HIGH);
pinMode(TFT_RESET, OUTPUT);
digitalWrite(TFT_RESET, HIGH);
delay(10);
digitalWrite(TFT_RESET, LOW);
delay(10);
digitalWrite(TFT_RESET, HIGH);
delay(10);
tft.begin();
tft.fillScreen(ILI9341_BLACK);
tft.setTextSize(2);
tft.setTextColor(ILI9341_GREEN);
tft.setTextWrap(true);
tft.setCursor(0, 0);
tft.print("QSPI Flash...");
if (!flash.begin()){
Serial.println("Could not find flash on QSPI bus!");
tft.setTextColor(ILI9341_RED);
tft.println("FAILED");
while (1);
}
Serial.println("Reading QSPI ID");
Serial.print("JEDEC ID: 0x"); Serial.println(flash.getJEDECID(), HEX);
tft.setTextColor(ILI9341_GREEN);
tft.print("QSPI Flash JEDEC 0x"); tft.println(flash.getJEDECID(), HEX);
/*************** SD CARD */
tft.setCursor(0, 48);
tft.print("SD Card...");
if (!SD.begin(SD_CS)) {
Serial.println("Card init. failed!");
tft.setTextColor(ILI9341_RED);
tft.println("FAILED");
tft.setTextColor(ILI9341_GREEN);
} else {
tft.println("OK!");
}
/*************** WiFi Module */
tft.setCursor(0, 64);
tft.print("WiFi Module...");
WiFi.status();
delay(100);
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("ESP32 SPI not found");
tft.setTextColor(ILI9341_RED);
tft.println("FAILED");
tft.setTextColor(ILI9341_GREEN);
} else {
Serial.println("ESP32 SPI mode found");
tft.println("OK!");
}
/*************** Temperature sensor */
tft.setCursor(0, 80);
tft.print("ADT7410...");
if (!tempsensor.begin()) {
Serial.println("Couldn't find ADT7410!");
tft.setTextColor(ILI9341_RED);
tft.println("FAILED");
tft.setTextColor(ILI9341_GREEN);
} else {
Serial.println("ADT7410 found");
tft.println("OK!");
}
coin.initButton(&tft, 120, 280, 100, 50, ILI9341_WHITE, ILI9341_YELLOW, ILI9341_BLACK, "Sound", 2);
coin.drawButton();
analogWriteResolution(12);
analogWrite(A0, 128);
pinMode(SPKR_SHUTDOWN, OUTPUT);
digitalWrite(SPKR_SHUTDOWN, LOW);
}
void loop() {
digitalWrite(RED_LED, HIGH);
tft.setTextColor(ILI9341_WHITE);
// read light sensor
tft.fillRect(160, 100, 240, 16, ILI9341_BLACK);
tft.setCursor(0, 100);
uint16_t light = analogRead(LIGHT_SENSOR);
Serial.print("light sensor: "); Serial.println(light);
tft.print("Light sensor: "); tft.println(light);
// read temp sensor
tft.fillRect(150, 116, 240, 16, ILI9341_BLACK);
tft.setCursor(0, 116);
float temp = tempsensor.readTempC();
Serial.print("temp sensor: "); Serial.println(temp, 2);
tft.print("Temp sensor: "); tft.println(temp, 2);
// externals
tft.fillRect(0, 132, 240, 32, ILI9341_BLACK);
tft.setCursor(0, 132);
float d3 = (float)analogRead(A1) * 3.3 / 1024;
float d4 = (float)analogRead(A3) * 3.3 / 1024;
Serial.print("STEMMA: ");
Serial.print(d3,1); Serial.print(", ");
Serial.print(d4,1); Serial.println();
tft.print("D3: "); tft.println(d3,1);
tft.print("D4: "); tft.println(d4,1);
tft.fillRect(80, 164, 240, 16, ILI9341_BLACK);
tft.setCursor(0, 164);
tft.print("Touch: ");
TSPoint p = ts.getPoint();
// we have some minimum pressure we consider 'valid'
// pressure of 0 means no pressing!
if (p.z > ts.pressureThreshhold) {
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);
int16_t x = map(p.x, X_MIN, X_MAX, 0, 240);
int16_t y = map(p.y, Y_MIN, Y_MAX, 0, 320);
tft.print("("); tft.print(x); tft.print(", "); tft.print(y); tft.println(")");
if (coin.contains(x, y)) {
Serial.println("Ding!");
coin.press(true);
} else {
coin.press(false);
}
} else {
coin.press(false);
}
if (coin.justPressed()) {
coin.drawButton(true);
digitalWrite(SPKR_SHUTDOWN, HIGH);
uint32_t i, prior, usec = 1000000L / SAMPLE_RATE;
prior = micros();
for (uint32_t i=0; i<sizeof(coinaudio); i++) {
uint32_t t;
while((t = micros()) - prior < usec);
analogWrite(A0, (uint16_t)coinaudio[i]);
prior = t;
}
digitalWrite(SPKR_SHUTDOWN, LOW);
}
if (coin.justReleased()) {
coin.drawButton(false);
}
digitalWrite(RED_LED, LOW);
delay(20);
}
// SPDX-FileCopyrightText: 2019 Limor Fried for Adafruit Industries
//
// SPDX-License-Identifier: MIT
// This program does a test of all the hardware so you can get an example of how to read
// sensors, touchscreen, and display stuff!
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <Adafruit_SPIFlash.h>
#include "Adafruit_ADT7410.h"
#include "TouchScreen.h"
#include <SdFat.h>
#include <WiFiNINA.h>
#include "coin.h"
#define RED_LED 13
#define TFT_RESET 24
#define TFT_BACKLIGHT 25
#define LIGHT_SENSOR A2
#define SD_CS 32
#define SPKR_SHUTDOWN 50
#define TFT_D0 34 // Data bit 0 pin (MUST be on PORT byte boundary)
#define TFT_WR 26 // Write-strobe pin (CCL-inverted timer output)
#define TFT_DC 10 // Data/command pin
#define TFT_CS 11 // Chip-select pin
#define TFT_RST 24 // Reset pin
#define TFT_RD 9 // Read-strobe pin
#define TFT_BACKLIGHT 25
// ILI9341 with 8-bit parallel interface:
Adafruit_ILI9341 tft = Adafruit_ILI9341(tft8bitbus, TFT_D0, TFT_WR, TFT_DC, TFT_CS, TFT_RST, TFT_RD);
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS, PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
Adafruit_SPIFlash flash(&flashTransport);
Adafruit_ADT7410 tempsensor = Adafruit_ADT7410();
#define YP A4 // must be an analog pin, use "An" notation!
#define XM A7 // must be an analog pin, use "An" notation!
#define YM A6 // can be a digital pin
#define XP A5 // can be a digital pin
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
#define X_MIN 750
#define X_MAX 325
#define Y_MIN 840
#define Y_MAX 240
Adafruit_GFX_Button coin = Adafruit_GFX_Button();
SdFat SD;
void setup() {
Serial.begin(115200);
//while (!Serial);
Serial.println("All Test!");
pinMode(RED_LED, OUTPUT);
pinMode(TFT_BACKLIGHT, OUTPUT);
digitalWrite(TFT_BACKLIGHT, HIGH);
pinMode(TFT_RESET, OUTPUT);
digitalWrite(TFT_RESET, HIGH);
delay(10);
digitalWrite(TFT_RESET, LOW);
delay(10);
digitalWrite(TFT_RESET, HIGH);
delay(10);
tft.begin();
tft.fillScreen(ILI9341_BLACK);
tft.setTextSize(2);
tft.setTextColor(ILI9341_GREEN);
tft.setTextWrap(true);
tft.setCursor(0, 0);
tft.print("QSPI Flash...");
if (!flash.begin()){
Serial.println("Could not find flash on QSPI bus!");
tft.setTextColor(ILI9341_RED);
tft.println("FAILED");
while (1);
}
Serial.println("Reading QSPI ID");
Serial.print("JEDEC ID: 0x"); Serial.println(flash.getJEDECID(), HEX);
tft.setTextColor(ILI9341_GREEN);
tft.print("QSPI Flash JEDEC 0x"); tft.println(flash.getJEDECID(), HEX);
/*************** SD CARD */
tft.setCursor(0, 48);
tft.print("SD Card...");
if (!SD.begin(SD_CS)) {
Serial.println("Card init. failed!");
tft.setTextColor(ILI9341_RED);
tft.println("FAILED");
tft.setTextColor(ILI9341_GREEN);
} else {
tft.println("OK!");
}
/*************** WiFi Module */
tft.setCursor(0, 64);
tft.print("WiFi Module...");
WiFi.status();
delay(100);
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("ESP32 SPI not found");
tft.setTextColor(ILI9341_RED);
tft.println("FAILED");
tft.setTextColor(ILI9341_GREEN);
} else {
Serial.println("ESP32 SPI mode found");
tft.println("OK!");
}
/*************** Temperature sensor */
tft.setCursor(0, 80);
tft.print("ADT7410...");
if (!tempsensor.begin()) {
Serial.println("Couldn't find ADT7410!");
tft.setTextColor(ILI9341_RED);
tft.println("FAILED");
tft.setTextColor(ILI9341_GREEN);
} else {
Serial.println("ADT7410 found");
tft.println("OK!");
}
coin.initButton(&tft, 120, 280, 100, 50, ILI9341_WHITE, ILI9341_YELLOW, ILI9341_BLACK, "Sound", 2);
coin.drawButton();
analogWriteResolution(12);
analogWrite(A0, 128);
pinMode(SPKR_SHUTDOWN, OUTPUT);
digitalWrite(SPKR_SHUTDOWN, LOW);
}
void loop() {
digitalWrite(RED_LED, HIGH);
tft.setTextColor(ILI9341_WHITE);
// read light sensor
tft.fillRect(160, 100, 240, 16, ILI9341_BLACK);
tft.setCursor(0, 100);
uint16_t light = analogRead(LIGHT_SENSOR);
Serial.print("light sensor: "); Serial.println(light);
tft.print("Light sensor: "); tft.println(light);
// read temp sensor
tft.fillRect(150, 116, 240, 16, ILI9341_BLACK);
tft.setCursor(0, 116);
float temp = tempsensor.readTempC();
Serial.print("temp sensor: "); Serial.println(temp, 2);
tft.print("Temp sensor: "); tft.println(temp, 2);
// externals
tft.fillRect(0, 132, 240, 32, ILI9341_BLACK);
tft.setCursor(0, 132);
float d3 = (float)analogRead(A1) * 3.3 / 1024;
float d4 = (float)analogRead(A3) * 3.3 / 1024;
Serial.print("STEMMA: ");
Serial.print(d3,1); Serial.print(", ");
Serial.print(d4,1); Serial.println();
tft.print("D3: "); tft.println(d3,1);
tft.print("D4: "); tft.println(d4,1);
tft.fillRect(80, 164, 240, 16, ILI9341_BLACK);
tft.setCursor(0, 164);
tft.print("Touch: ");
TSPoint p = ts.getPoint();
// we have some minimum pressure we consider 'valid'
// pressure of 0 means no pressing!
if (p.z > ts.pressureThreshhold) {
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);
int16_t x = map(p.x, X_MIN, X_MAX, 0, 240);
int16_t y = map(p.y, Y_MIN, Y_MAX, 0, 320);
tft.print("("); tft.print(x); tft.print(", "); tft.print(y); tft.println(")");
if (coin.contains(x, y)) {
Serial.println("Ding!");
coin.press(true);
} else {
coin.press(false);
}
} else {
coin.press(false);
}
if (coin.justPressed()) {
coin.drawButton(true);
digitalWrite(SPKR_SHUTDOWN, HIGH);
uint32_t i, prior, usec = 1000000L / SAMPLE_RATE;
prior = micros();
for (uint32_t i=0; i<sizeof(coinaudio); i++) {
uint32_t t;
while((t = micros()) - prior < usec);
analogWrite(A0, (uint16_t)coinaudio[i]);
prior = t;
}
digitalWrite(SPKR_SHUTDOWN, LOW);
}
if (coin.justReleased()) {
coin.drawButton(false);
}
digitalWrite(RED_LED, LOW);
delay(20);
}

View file

@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2019 Limor Fried for Adafruit Industries
//
// SPDX-License-Identifier: MIT
#define SAMPLE_RATE 16000
const uint8_t coinaudio[] = {

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Brent Rubell for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import board
import busio

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2020 Brent Rubell for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import board
import busio

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2019 Isaac Wellish for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
This example uses the Open Trivia Database API to display multiple choice trivia questions.
Tap the screen to start, then a question will appear and a 30 second timer will start.

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2018 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Plays the 007 theme song
Gemma M0 with Piezo on D0 and GND

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2018 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Plays the Carmen Sandiego theme song
Gemma M0 with Piezo on D0 and GND

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2019 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
#Turtle Gizmo Asterix
#==| Turtle Gizmo Setup start |========================================
import board

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2019 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Turtle Gizmo Rainbow Benzene
#==| Turtle Gizmo Setup start |========================================
import board

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2019 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Turtle Gizmo Christmas Tree
#==| Turtle Gizmo Setup start |========================================
import board

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2019 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Turtle Circle Petals
#==| Turtle Gizmo Setup start |========================================
import board

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2019 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Turtle Gizmo Hilbert
#==| Turtle Gizmo Setup start |========================================
import board

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2019 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Turtle Gizmo Koch Snowflake
#==| Turtle Gizmo Setup start |========================================
import board

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2019 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Turtle Gizmo Sierpinski Triangle
#==| Turtle Gizmo Setup start |========================================
import board

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2019 John Edgar Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
#Turtle Gizmo Square Loop
#==| Turtle Gizmo Setup start |========================================
import board