all: correct go fmt

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2022-09-25 10:16:18 +02:00
committed by Ron Evans
parent 98ba5a231a
commit 1bb1b621c6
85 changed files with 153 additions and 197 deletions
-1
View File
@@ -1,7 +1,6 @@
// Package adt7410 provides a driver for the adt7410 I2C Temperature Sensor.
//
// Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADT7410.pdf
//
package adt7410 // import "tinygo.org/x/drivers/adt7410"
import (
-1
View File
@@ -3,7 +3,6 @@
// Datasheet EN: http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
//
// Datasheet JP: http://www.analog.com/media/jp/technical-documentation/data-sheets/ADXL345_jp.pdf
//
package adxl345 // import "tinygo.org/x/drivers/adxl345"
import "tinygo.org/x/drivers"
-1
View File
@@ -2,7 +2,6 @@
// a digital proximity, ambient light, RGB and gesture sensor.
//
// Datasheet: https://cdn.sparkfun.com/assets/learn_tutorials/3/2/1/Avago-APDS-9960-datasheet.pdf
//
package apds9960
import (
-1
View File
@@ -3,7 +3,6 @@
//
// http://www.x-powers.com/en.php/Info/product_detail/article_id/29
// Datasheet: https://github.com/m5stack/M5-Schematic/blob/master/Core/AXP192%20Datasheet_v1.1_en_draft_2211.pdf
//
package axp192 // import "tinygo.org/x/drivers/axp192"
import (
-1
View File
@@ -2,7 +2,6 @@
//
// Datasheet:
// https://www.mouser.com/ds/2/348/bh1750fvi-e-186247.pdf
//
package bh1750 // import "tinygo.org/x/drivers/bh1750"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package blinkm implements a driver for the BlinkM I2C RGB LED.
//
// Datasheet: http://thingm.com/fileadmin/thingm/downloads/BlinkM_datasheet.pdf
//
package blinkm // import "tinygo.org/x/drivers/blinkm"
import "tinygo.org/x/drivers"
+2 -2
View File
@@ -3,7 +3,6 @@
//
// Datasheet:
// https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf
//
package bme280
import (
@@ -149,7 +148,8 @@ func (d *Device) ReadHumidity() (int32, error) {
// ReadAltitude returns the current altitude in meters based on the
// current barometric pressure and estimated pressure at sea level.
// Calculation is based on code from Adafruit BME280 library
// https://github.com/adafruit/Adafruit_BME280_Library
//
// https://github.com/adafruit/Adafruit_BME280_Library
func (d *Device) ReadAltitude() (alt int32, err error) {
mPa, _ := d.ReadPressure()
atmP := float32(mPa) / 100000
-1
View File
@@ -3,7 +3,6 @@
//
// Datasheet:
// https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
//
package bmp180 // import "tinygo.org/x/drivers/bmp180"
import (
-1
View File
@@ -1,5 +1,4 @@
// Package buzzer provides a very simplistic driver for a connected buzzer or low-fidelity speaker.
//
package buzzer // import "tinygo.org/x/drivers/buzzer"
import (
+7 -8
View File
@@ -3,22 +3,22 @@
//
// Here is an example in TinyGo that uses the BMP180 digital barometer:
//
// package main
// package main
//
// import (
// import (
// "time"
// "machine"
//
// "tinygo.org/x/drivers/bmp180"
// )
// "tinygo.org/x/drivers/bmp180"
// )
//
// func main() {
// func main() {
// machine.I2C0.Configure(machine.I2CConfig{})
// sensor := bmp180.New(machine.I2C0)
// sensor.Configure()
//
// connected := sensor.Connected()
// if !connected {
// connected := sensor.Connected()
// if !connected {
// println("BMP180 not detected")
// return
// }
@@ -38,5 +38,4 @@
// Each individual driver is contained within its own sub-package within this package and
// there are no interdependencies in order to minimize the final size of compiled code that
// uses any of these drivers.
//
package drivers // import "tinygo.org/x/drivers"
-1
View File
@@ -2,7 +2,6 @@
//
// Datasheet:
// https://datasheets.maximintegrated.com/en/ds/DS1307.pdf
//
package ds1307 // import "tinygo.org/x/drivers/ds1307"
import (
-1
View File
@@ -15,7 +15,6 @@
//
// AT command set:
// https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
//
package espat // import "tinygo.org/x/drivers/espat"
import (
-2
View File
@@ -9,8 +9,6 @@ import (
"tinygo.org/x/drivers/ili9341"
)
var ()
func InitDisplay() *ili9341.Device {
machine.SPI0.Configure(machine.SPIConfig{
SCK: machine.SPI0_SCK_PIN,
-1
View File
@@ -2,7 +2,6 @@
// to read data from the onboard MEMS microphone.
//
// Uses ideas from the https://github.com/adafruit/Adafruit_CircuitPlayground repo.
//
package main
import (
+6 -6
View File
@@ -2,13 +2,13 @@
// +build gnse
/*
Generic Node Sensor Edition
RFSwitch
Generic Node Sensor Edition
RFSwitch
Disable Switch : PB8=OFF PA0=OFF PA1=OFF
Enable RX : PB8=ON PA0=ON PA1=OFF
Enable TX RFO LP : PB8=ON PA0=ON PA1=ON
Enable TX RFO HP : PB8=ON PA0=OFF PA1=ON
Disable Switch : PB8=OFF PA0=OFF PA1=OFF
Enable RX : PB8=ON PA0=ON PA1=OFF
Enable TX RFO LP : PB8=ON PA0=ON PA1=ON
Enable TX RFO HP : PB8=ON PA0=OFF PA1=ON
*/
package rfswitch
+2 -2
View File
@@ -2,8 +2,8 @@
// +build nucleowl55jc
/*
Nucleo WL55JC1
RFSwitch
Nucleo WL55JC1
RFSwitch
+-----------+---------+------------+------------+
| | FE_CTRL1 | FE_CTRL2 | FE_CTRL3 |
+3 -3
View File
@@ -2,7 +2,6 @@
// panel controller.
//
// Datasheet: https://focuslcds.com/content/FT6236.pdf
//
package ft6336
import (
@@ -42,8 +41,9 @@ func (d *Device) Configure(config Config) error {
}
// SetGMode sets interrupt mode.
// 0x00 : Interrupt Polling mode
// 0x01 : Interrupt Trigger mode (default)
//
// 0x00 : Interrupt Polling mode
// 0x01 : Interrupt Trigger mode (default)
func (d *Device) SetGMode(v uint8) {
d.write1Byte(RegGMode, v)
}
-1
View File
@@ -1,7 +1,6 @@
// Package gc9a01 implements a driver for the gc9a01 LCD round display
//
// Datasheet: https://www.waveshare.com/w/upload/5/5e/GC9A01A.pdf
//
package gc9a01 // import "tinygo.org/x/drivers/gc9a01"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package hd44780 provides a driver for the HD44780 LCD controller.
//
// Datasheet: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf
//
package hd44780 // import "tinygo.org/x/drivers/hd44780"
import (
-1
View File
@@ -2,7 +2,6 @@
// with an I2C adapter.
//
// Datasheet: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf
//
package hd44780i2c
import (
-2
View File
@@ -2,7 +2,6 @@
// a capacitive digital sensor for relative humidity and temperature.
//
// Datasheet: https://www.st.com/resource/en/datasheet/hts221.pdf
//
package hts221
import (
@@ -85,7 +84,6 @@ func (d *Device) ReadTemperature() (temperature int32, err error) {
// Resolution sets the HTS221's resolution mode.
// The higher resolutions are more accurate but comsume more power (see datasheet).
// The number of averaged samples will be (h + 2) ^ 2, (t + 1) ^ 2
//
func (d *Device) Resolution(h uint8, t uint8) {
if h > 7 {
h = 3 // default
-1
View File
@@ -2,7 +2,6 @@
//
// Guide: https://cdn-learn.adafruit.com/downloads/pdf/32x16-32x32-rgb-led-matrix.pdf
// This driver was inspired by https://github.com/2dom/PxMatrix
//
package hub75 // import "tinygo.org/x/drivers/hub75"
import (
+12 -12
View File
@@ -7,19 +7,19 @@ package flate
// dictDecoder implements the LZ77 sliding dictionary as used in decompression.
// LZ77 decompresses data through sequences of two forms of commands:
//
// * Literal insertions: Runs of one or more symbols are inserted into the data
// stream as is. This is accomplished through the writeByte method for a
// single symbol, or combinations of writeSlice/writeMark for multiple symbols.
// Any valid stream must start with a literal insertion if no preset dictionary
// is used.
// - Literal insertions: Runs of one or more symbols are inserted into the data
// stream as is. This is accomplished through the writeByte method for a
// single symbol, or combinations of writeSlice/writeMark for multiple symbols.
// Any valid stream must start with a literal insertion if no preset dictionary
// is used.
//
// * Backward copies: Runs of one or more symbols are copied from previously
// emitted data. Backward copies come as the tuple (dist, length) where dist
// determines how far back in the stream to copy from and length determines how
// many bytes to copy. Note that it is valid for the length to be greater than
// the distance. Since LZ77 uses forward copies, that situation is used to
// perform a form of run-length encoding on repeated runs of symbols.
// The writeCopy and tryWriteCopy are used to implement this command.
// - Backward copies: Runs of one or more symbols are copied from previously
// emitted data. Backward copies come as the tuple (dist, length) where dist
// determines how far back in the stream to copy from and length determines how
// many bytes to copy. Note that it is valid for the length to be greater than
// the distance. Since LZ77 uses forward copies, that situation is used to
// perform a form of run-length encoding on repeated runs of symbols.
// The writeCopy and tryWriteCopy are used to implement this command.
//
// For performance reasons, this implementation performs little to no sanity
// checks about the arguments. As such, the invariants documented for each
@@ -194,9 +194,9 @@ func (w *huffmanBitWriter) writeBytes(bytes []byte) {
// Codes 0-15 are single byte codes. Codes 16-18 are followed by additional
// information. Code badCode is an end marker
//
// numLiterals The number of literals in literalEncoding
// numOffsets The number of offsets in offsetEncoding
// litenc, offenc The literal and offset encoder to use
// numLiterals The number of literals in literalEncoding
// numOffsets The number of offsets in offsetEncoding
// litenc, offenc The literal and offset encoder to use
func (w *huffmanBitWriter) generateCodegen(numLiterals int, numOffsets int, litEnc, offEnc *huffmanEncoder) {
for i := range w.codegenFreq {
w.codegenFreq[i] = 0
@@ -353,9 +353,9 @@ func (w *huffmanBitWriter) writeCode(c hcode) {
// Write the header of a dynamic Huffman block to the output stream.
//
// numLiterals The number of literals specified in codegen
// numOffsets The number of offsets specified in codegen
// numCodegens The number of codegens used in codegen
// numLiterals The number of literals specified in codegen
// numOffsets The number of offsets specified in codegen
// numCodegens The number of codegens used in codegen
func (w *huffmanBitWriter) writeDynamicHeader(numLiterals int, numOffsets int, numCodegens int, isEof bool) {
if w.err != nil {
return
+10 -5
View File
@@ -124,13 +124,18 @@ const maxBitsLimit = 16
// The cases of 0, 1, and 2 literals are handled by special case code.
//
// list An array of the literals with non-zero frequencies
// and their associated frequencies. The array is in order of increasing
// frequency, and has as its last element a special element with frequency
// MaxInt32
//
// and their associated frequencies. The array is in order of increasing
// frequency, and has as its last element a special element with frequency
// MaxInt32
//
// maxBits The maximum number of bits that should be used to encode any literal.
// Must be less than 16.
//
// Must be less than 16.
//
// return An integer array in which array[i] indicates the number of literals
// that should be encoded in i bits.
//
// that should be encoded in i bits.
func (h *huffmanEncoder) bitCounts(list []literalNode, maxBits int32) []int32 {
if maxBits >= maxBitsLimit {
panic("flate: maxBits too large")
+14 -14
View File
@@ -481,25 +481,25 @@ func scale(dst *block, src *[4]block) {
}
// sosHeaderY is the SOS marker "\xff\xda" followed by 8 bytes:
// - the marker length "\x00\x08",
// - the number of components "\x01",
// - component 1 uses DC table 0 and AC table 0 "\x01\x00",
// - the bytes "\x00\x3f\x00". Section B.2.3 of the spec says that for
// sequential DCTs, those bytes (8-bit Ss, 8-bit Se, 4-bit Ah, 4-bit Al)
// should be 0x00, 0x3f, 0x00<<4 | 0x00.
// - the marker length "\x00\x08",
// - the number of components "\x01",
// - component 1 uses DC table 0 and AC table 0 "\x01\x00",
// - the bytes "\x00\x3f\x00". Section B.2.3 of the spec says that for
// sequential DCTs, those bytes (8-bit Ss, 8-bit Se, 4-bit Ah, 4-bit Al)
// should be 0x00, 0x3f, 0x00<<4 | 0x00.
var sosHeaderY = []byte{
0xff, 0xda, 0x00, 0x08, 0x01, 0x01, 0x00, 0x00, 0x3f, 0x00,
}
// sosHeaderYCbCr is the SOS marker "\xff\xda" followed by 12 bytes:
// - the marker length "\x00\x0c",
// - the number of components "\x03",
// - component 1 uses DC table 0 and AC table 0 "\x01\x00",
// - component 2 uses DC table 1 and AC table 1 "\x02\x11",
// - component 3 uses DC table 1 and AC table 1 "\x03\x11",
// - the bytes "\x00\x3f\x00". Section B.2.3 of the spec says that for
// sequential DCTs, those bytes (8-bit Ss, 8-bit Se, 4-bit Ah, 4-bit Al)
// should be 0x00, 0x3f, 0x00<<4 | 0x00.
// - the marker length "\x00\x0c",
// - the number of components "\x03",
// - component 1 uses DC table 0 and AC table 0 "\x01\x00",
// - component 2 uses DC table 1 and AC table 1 "\x02\x11",
// - component 3 uses DC table 1 and AC table 1 "\x03\x11",
// - the bytes "\x00\x3f\x00". Section B.2.3 of the spec says that for
// sequential DCTs, those bytes (8-bit Ss, 8-bit Se, 4-bit Ah, 4-bit Al)
// should be 0x00, 0x3f, 0x00<<4 | 0x00.
var sosHeaderYCbCr = []byte{
0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02,
0x11, 0x03, 0x11, 0x00, 0x3f, 0x00,
+3 -1
View File
@@ -326,7 +326,9 @@ func (d *decoder) parsetRNS(length uint32) error {
// Read presents one or more IDAT chunks as one continuous stream (minus the
// intermediate chunk headers and footers). If the PNG data looked like:
// ... len0 IDAT xxx crc0 len1 IDAT yy crc1 len2 IEND crc2
//
// ... len0 IDAT xxx crc0 len1 IDAT yy crc1 len2 IEND crc2
//
// then this reader presents xxxyy. For well-formed PNG data, the decoder state
// immediately before the first Read call is that d.r is positioned between the
// first IDAT and xxx, and the decoder state immediately after the last Read
-1
View File
@@ -43,7 +43,6 @@ func New(bus drivers.I2C) Device {
// * VoltConvTime = CONVTIME_1100USEC
// * CurrentConvTime = CONVTIME_1100USEC
// * Mode = MODE_CONTINUOUS | MODE_VOLTAGE | MODE_CURRENT
//
func (d *Device) Configure(cfg Config) {
var val uint16
+3 -2
View File
@@ -7,11 +7,12 @@
// https://www.adafruit.com/product/3163
//
// Datasheet:
// https://www.lumissil.com/assets/pdf/core/IS31FL3731_DS.pdf
//
// https://www.lumissil.com/assets/pdf/core/IS31FL3731_DS.pdf
//
// This driver inspired by Adafruit Python driver:
// https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731
//
// https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731
package is31fl3731
import (
+21 -22
View File
@@ -16,29 +16,28 @@ type DeviceAdafruitCharlieWing15x7 struct {
// enableLEDs enables only LEDs that are soldered on the Adafruit CharlieWing
// board. The board has following LEDs matrix layout:
//
// "o" - connected (soldered) LEDs
// "x" - not connected LEDs
//
// + - - - - - - - - - - - - - - +
// | + - - - - - - - - - - - - + |
// | | | |
// | | v v
// +---------------------------------+
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | x x x x x x x x x x x x x x x x |
// +---------------------------------+
// ^ ^ | |
// | | ... - - + |
// | + - - - - - - - - - - - - - +
// |
// start (address 0x00)
// "o" - connected (soldered) LEDs
// "x" - not connected LEDs
//
// + - - - - - - - - - - - - - - +
// | + - - - - - - - - - - - - + |
// | | | |
// | | v v
// +---------------------------------+
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | o o o o o o o o o o o o o o o x |
// | x x x x x x x x x x x x x x x x |
// +---------------------------------+
// ^ ^ | |
// | | ... - - + |
// | + - - - - - - - - - - - - - +
// |
// start (address 0x00)
func (d *DeviceAdafruitCharlieWing15x7) enableLEDs() (err error) {
for frame := FRAME_0; frame <= FRAME_7; frame++ {
err = d.selectCommand(frame)
-1
View File
@@ -2,7 +2,6 @@
// typically used to control DC motors.
//
// Datasheet: https://www.ti.com/lit/ds/symlink/l293d.pdf
//
package l293x // import "tinygo.org/x/drivers/l293x"
import (
-1
View File
@@ -2,7 +2,6 @@
// typically used to control DC motors.
//
// Datasheet: https://www.elecrow.com/download/datasheet-l9110.pdf
//
package l9110x // import "tinygo.org/x/drivers/l9110x"
import (
-1
View File
@@ -2,7 +2,6 @@
// a magnetic sensor which is included on BBC micro:bit v1.5.
//
// Datasheet: https://www.st.com/resource/en/datasheet/lis2mdl.pdf
//
package lis2mdl // import "tinygo.org/x/drivers/lis2mdl"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package lis3dh provides a driver for the LIS3DH digital accelerometer.
//
// Datasheet: https://www.st.com/resource/en/datasheet/lis3dh.pdf
//
package lis3dh // import "tinygo.org/x/drivers/lis3dh"
import "tinygo.org/x/drivers"
-1
View File
@@ -1,7 +1,6 @@
// Package lps22hb implements a driver for LPS22HB, a MEMS nano pressure sensor.
//
// Datasheet: https://www.st.com/resource/en/datasheet/dm00140895.pdf
//
package lps22hb
import (
-1
View File
@@ -2,7 +2,6 @@
// a 3 axis accelerometer/magnetic sensor which is included on BBC micro:bits v1.5.
//
// Datasheet: https://www.st.com/resource/en/datasheet/lsm303agr.pdf
//
package lsm303agr // import "tinygo.org/x/drivers/lsm303agr"
import (
-1
View File
@@ -2,7 +2,6 @@
// Measurement Unit (IMU)
//
// Datasheet: https://www.st.com/resource/en/datasheet/lsm6ds3.pdf
//
package lsm6ds3 // import "tinygo.org/x/drivers/lsm6ds3"
import (
-1
View File
@@ -2,7 +2,6 @@
// a 6 axis Inertial Measurement Unit (IMU)
//
// Datasheet: https://www.st.com/resource/en/datasheet/lsm6ds3tr.pdf
//
package lsm6ds3tr // import "tinygo.org/x/drivers/lsm6ds3tr"
import (
-1
View File
@@ -2,7 +2,6 @@
// a 6 axis Inertial Measurement Unit (IMU)
//
// Datasheet: https://www.st.com/resource/en/datasheet/lsm6dsox.pdf
//
package lsm6dsox // import "tinygo.org/x/drivers/lsm6dsox"
import (
-1
View File
@@ -1,7 +1,6 @@
// LSM9DS1, 9 axis Inertial Measurement Unit (IMU)
//
// Datasheet: https://www.st.com/resource/en/datasheet/lsm6ds3.pdf
//
package lsm9ds1 // import "tinygo.org/x/drivers/lsm9ds1"
import (
-1
View File
@@ -2,7 +2,6 @@
// Freescale/NXP.
//
// Datasheet: https://www.nxp.com/docs/en/data-sheet/MAG3110.pdf
//
package mag3110 // import "tinygo.org/x/drivers/mag3110"
import "tinygo.org/x/drivers"
+1 -1
View File
@@ -133,7 +133,7 @@ func (d *Device) GetPins() (Pins, error) {
//
// That is, it does the equivalent of:
//
// for i := 0; i < PinCount; i++ {
// for i := 0; i < PinCount; i++ {
// if mask.Get(i) {
// d.Pin(i).Set(pins.Get(i))
// }
+1 -1
View File
@@ -93,7 +93,7 @@ func (devs Devices) GetPins(pins PinSlice) error {
//
// That is, it does the equivalent of:
//
// for i := 0; i < PinCount*len(devs); i++ {
// for i := 0; i < PinCount*len(devs); i++ {
// if mask.Get(i) {
// d.Pin(i).Set(pins.Get(i))
// }
-1
View File
@@ -1,7 +1,6 @@
// Package mcp2515 implements a driver for the MCP2515 CAN Controller.
//
// Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/MCP2515-Stand-Alone-CAN-Controller-with-SPI-20001801J.pdf
//
package mcp2515 // import "tinygo.org/x/drivers/mcp2515"
const DebugEn = 0
-1
View File
@@ -1,7 +1,6 @@
// Package mcp3008 implements a driver for the MCP3008 Analog to Digital Converter.
//
// Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21295d.pdf
//
package mcp3008 // import "tinygo.org/x/drivers/mcp3008"
import (
-1
View File
@@ -4,7 +4,6 @@
// Package microbitmatrix implements a driver for the BBC micro:bit's LED matrix.
//
// Schematic: https://github.com/bbcmicrobit/hardware/blob/master/SCH_BBC-Microbit_V1.3B.pdf
//
package microbitmatrix // import "tinygo.org/x/drivers/microbitmatrix"
import (
-1
View File
@@ -4,7 +4,6 @@
// Package microbitmatrix implements a driver for the BBC micro:bit version 2 LED matrix.
//
// Schematic:
//
package microbitmatrix // import "tinygo.org/x/drivers/microbitmatrix"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package microbitmatrix implements a driver for the BBC micro:bit's LED matrix.
//
// Schematic: https://github.com/bbcmicrobit/hardware/blob/master/SCH_BBC-Microbit_V1.3B.pdf
//
package microbitmatrix // import "tinygo.org/x/drivers/microbitmatrix"
import (
-2
View File
@@ -2,7 +2,6 @@
// For example, the Adafruit PDM MEMS breakout board (https://www.adafruit.com/product/3492)
//
// Datasheet: https://cdn-learn.adafruit.com/assets/assets/000/049/977/original/MP34DT01-M.pdf
//
package microphone // import "tinygo.org/x/drivers/microphone"
import (
@@ -141,7 +140,6 @@ func (d *Device) GetSoundPressure() (int32, int32) {
// for that sample.
//
// For more information: https://en.wikipedia.org/wiki/Sinc_filter
//
var sincfilter = [quantizeSteps]uint16{
0, 2, 9, 21, 39, 63, 94, 132,
179, 236, 302, 379, 467, 565, 674, 792,
-1
View File
@@ -3,7 +3,6 @@
//
// Datasheet:
// https://www.nxp.com/docs/en/data-sheet/MMA8653FC.pdf
//
package mma8653 // import "tinygo.org/x/drivers/mma8653"
import "tinygo.org/x/drivers"
-1
View File
@@ -4,7 +4,6 @@
// Datasheets:
// https://store.invensense.com/datasheets/invensense/MPU-6050_DataSheet_V3%204.pdf
// https://www.invensense.com/wp-content/uploads/2015/02/MPU-6000-Register-Map1.pdf
//
package mpu6050 // import "tinygo.org/x/drivers/mpu6050"
import "tinygo.org/x/drivers"
+10 -11
View File
@@ -33,7 +33,6 @@ import (
// with the expectation that the Jar will insert those mutated cookies
// with the updated values (assuming the origin matches).
// If Jar is nil, the initial cookies are forwarded without change.
//
type Client struct {
// Transport specifies the mechanism by which individual
// HTTP requests are made.
@@ -125,11 +124,11 @@ type RoundTripper interface {
// the following redirect codes, Get follows the redirect, up to a
// maximum of 10 redirects:
//
// 301 (Moved Permanently)
// 302 (Found)
// 303 (See Other)
// 307 (Temporary Redirect)
// 308 (Permanent Redirect)
// 301 (Moved Permanently)
// 302 (Found)
// 303 (See Other)
// 307 (Temporary Redirect)
// 308 (Permanent Redirect)
//
// An error is returned if there were too many redirects or if there
// was an HTTP protocol error. A non-2xx response doesn't cause an
@@ -152,11 +151,11 @@ func Get(url string) (resp *Response, err error) {
// following redirect codes, Get follows the redirect after calling the
// Client's CheckRedirect function:
//
// 301 (Moved Permanently)
// 302 (Found)
// 303 (See Other)
// 307 (Temporary Redirect)
// 308 (Permanent Redirect)
// 301 (Moved Permanently)
// 302 (Found)
// 303 (See Other)
// 307 (Temporary Redirect)
// 308 (Permanent Redirect)
//
// An error is returned if the Client's CheckRedirect function fails
// or if there was an HTTP protocol error. A non-2xx response doesn't
+5 -3
View File
@@ -358,9 +358,11 @@ func sanitizeCookieName(n string) string {
// https://tools.ietf.org/html/rfc6265#section-4.1.1
// cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
// cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
// ; US-ASCII characters excluding CTLs,
// ; whitespace DQUOTE, comma, semicolon,
// ; and backslash
//
// ; US-ASCII characters excluding CTLs,
// ; whitespace DQUOTE, comma, semicolon,
// ; and backslash
//
// We loosen this as spaces and commas are common in cookie values
// but we produce a quoted cookie-value if and only if v contains
// commas or spaces.
+3 -3
View File
@@ -19,9 +19,9 @@ import (
)
// PublicSuffixList provides the public suffix of a domain. For example:
// - the public suffix of "example.com" is "com",
// - the public suffix of "foo1.foo2.foo3.co.uk" is "co.uk", and
// - the public suffix of "bar.pvt.k12.ma.us" is "pvt.k12.ma.us".
// - the public suffix of "example.com" is "com",
// - the public suffix of "foo1.foo2.foo3.co.uk" is "co.uk", and
// - the public suffix of "bar.pvt.k12.ma.us" is "pvt.k12.ma.us".
//
// Implementations of PublicSuffixList must be safe for concurrent use by
// multiple goroutines.
+3
View File
@@ -105,8 +105,11 @@ func (r *Response) Cookies() []*Cookie {
}
// RFC 7234, section 5.4: Should treat
//
// Pragma: no-cache
//
// like
//
// Cache-Control: no-cache
func fixPragmaCacheControl(header Header) {
if hp, ok := header["Pragma"]; ok && len(hp) > 0 && hp[0] == "no-cache" {
+2 -2
View File
@@ -142,7 +142,7 @@ func Error(w ResponseWriter, error string, code int) {
func NotFound(w ResponseWriter, r *Request) { Error(w, "404 page not found", StatusNotFound) }
// NotFoundHandler returns a simple request handler
// that replies to each request with a ``404 page not found'' reply.
// that replies to each request with a 404 page not found reply.
func NotFoundHandler() Handler { return HandlerFunc(NotFound) }
// StripPrefix returns a handler that serves HTTP requests by removing the
@@ -435,7 +435,7 @@ func (mux *ServeMux) shouldRedirectRLocked(host, path string) bool {
// the pattern that will match after following the redirect.
//
// If there is no registered handler that applies to the request,
// Handler returns a ``page not found'' handler and an empty pattern.
// Handler returns a page not found handler and an empty pattern.
func (mux *ServeMux) Handler(r *Request) (h Handler, pattern string) {
// CONNECT requests are not canonicalized.
+5 -3
View File
@@ -42,9 +42,11 @@ const (
// with an MQTT server using non-blocking methods that allow work
// to be done in the background.
// An application may connect to an MQTT server using:
// A plain TCP socket
// A secure SSL/TLS socket
// A websocket
//
// A plain TCP socket
// A secure SSL/TLS socket
// A websocket
//
// To enable ensured message delivery at Quality of Service (QoS) levels
// described in the MQTT spec, a message persistence mechanism must be
// used. This is done by providing a type which implements the Store
-2
View File
@@ -234,7 +234,6 @@ func (c *SerialConn) SetWriteDeadline(t time.Time) error {
// ResolveTCPAddr returns an address of TCP end point.
//
// The network must be a TCP network name.
//
func ResolveTCPAddr(network, address string) (*TCPAddr, error) {
// TODO: make sure network is 'tcp'
// separate domain from port, if any
@@ -257,7 +256,6 @@ func ResolveTCPAddr(network, address string) (*TCPAddr, error) {
// ResolveUDPAddr returns an address of UDP end point.
//
// The network must be a UDP network name.
//
func ResolveUDPAddr(network, address string) (*UDPAddr, error) {
// TODO: make sure network is 'udp'
// separate domain from port, if any
+14 -9
View File
@@ -51,7 +51,7 @@ func (d Dev) Configure(cfg PWMConfig) error {
// SetPeriod updates the period of this PWM integrated circuit in nanoseconds.
// To set a particular frequency, use the following formula:
//
// period = 1e9 / frequency
// period = 1e9 / frequency
//
// In the equation above frequency is in Hertz.
//
@@ -91,7 +91,9 @@ func (d Dev) Top() uint32 {
// Set sets the `on` value of a PWM channel in the range [0..15].
// Max value `on` can take is 4095.
// Example:
// d.Set(1, d.Top()/4)
//
// d.Set(1, d.Top()/4)
//
// sets the dutycycle of second (LED1) channel to 25%.
func (d Dev) Set(channel uint8, on uint32) {
if on > maxtop {
@@ -101,7 +103,8 @@ func (d Dev) Set(channel uint8, on uint32) {
}
// SetAll sets all PWM signals to a ON value. Equivalent of calling
// Dev.Set(pca9685.ALLLED, value)
//
// Dev.Set(pca9685.ALLLED, value)
func (d Dev) SetAll(on uint32) {
d.Set(ALLLED, on)
}
@@ -140,8 +143,9 @@ func (d Dev) SetAI(ai bool) error {
}
// SetDrive configures PWM output connection in MODE2 register.
// false: The 16 LEDn outputs are configured with an open-drain structure.
// true: The 16 LEDn outputs are configured with a totem pole structure.
//
// false: The 16 LEDn outputs are configured with an open-drain structure.
// true: The 16 LEDn outputs are configured with a totem pole structure.
func (d Dev) SetDrive(outdrv bool) error {
err := d.readReg(MODE2, d.buf[:1])
if err != nil {
@@ -156,10 +160,11 @@ func (d Dev) SetDrive(outdrv bool) error {
}
// Sleep sets/unsets SLEEP bit in MODE1.
// if sleepEnabled
// Stops PWM. Allows writing to PRE_SCALE register.
// else
// wakes PCA9685. Resumes PWM.
//
// if sleepEnabled
// Stops PWM. Allows writing to PRE_SCALE register.
// else
// wakes PCA9685. Resumes PWM.
func (d Dev) Sleep(sleepEnabled bool) error {
err := d.readReg(MODE1, d.buf[:1])
if err != nil {
-1
View File
@@ -1,7 +1,6 @@
// Package pcd8544 implements a driver for the PCD8544 48x84 pixels matrix LCD, used in Nokia's 5110 and 3310 phones.
//
// Datasheet: http://eia.udg.edu/~forest/PCD8544_1.pdf
//
package pcd8544 // import "tinygo.org/x/drivers/pcd8544"
import (
-1
View File
@@ -5,7 +5,6 @@
// This driver is heavily influenced by the scd4x code from Adafruit for CircuitPython:
// https://github.com/adafruit/Adafruit_CircuitPython_SCD4X
// Thank you!
//
package scd4x // import "tinygo.org/x/drivers/scd4x"
import (
+1 -1
View File
@@ -4,7 +4,7 @@
// If you want to use it in OpenOCD, you have to enable it first with the
// following command:
//
// arm semihosting enable
// arm semihosting enable
package semihosting
import (
-1
View File
@@ -3,7 +3,6 @@
//
// Datasheet:
// https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/2_Humidity_Sensors/Datasheets/Sensirion_Humidity_Sensors_SHT3x_Datasheet_digital.pdf
//
package sht3x // import "tinygo.org/x/drivers/sht3x"
import (
-1
View File
@@ -3,7 +3,6 @@
//
// Datasheet:
// https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/2_Humidity_Sensors/Datasheets/Sensirion_Humidity_Sensors_SHTC3_Datasheet.pdf
//
package shtc3 // import "tinygo.org/x/drivers/shtc3"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package ssd1289 implements a driver for the SSD1289 led matrix controller as packaged on the TFT_320QVT board
//
// Datasheet: http://aitendo3.sakura.ne.jp/aitendo_data/product_img/lcd/tft2/M032C1289TP/3.2-SSD1289.pdf
//
package ssd1289
import (
-1
View File
@@ -1,7 +1,6 @@
// Package ssd1306 implements a driver for the SSD1306 led matrix controller, it comes in various colors and screen sizes.
//
// Datasheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf
//
package ssd1306 // import "tinygo.org/x/drivers/ssd1306"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package ssd1331 implements a driver for the SSD1331 TFT color displays.
//
// Datasheet: https://www.crystalfontz.com/controllers/SolomonSystech/SSD1331/381/
//
package ssd1331 // import "tinygo.org/x/drivers/ssd1331"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package ssd1351 implements a driver for the SSD1351 OLED color displays.
//
// Datasheet: https://download.mikroe.com/documents/datasheets/ssd1351-revision-1.3.pdf
//
package ssd1351 // import "tinygo.org/x/drivers/ssd1351"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package st7735 implements a driver for the ST7735 TFT displays, it comes in various screen sizes.
//
// Datasheet: https://www.crystalfontz.com/controllers/Sitronix/ST7735R/319/
//
package st7735 // import "tinygo.org/x/drivers/st7735"
import (
+1 -2
View File
@@ -1,8 +1,8 @@
// Package st7789 implements a driver for the ST7789 TFT displays, it comes in various screen sizes.
//
// Datasheets: https://cdn-shop.adafruit.com/product-files/3787/3787_tft_QT154H2201__________20190228182902.pdf
// http://www.newhavendisplay.com/appnotes/datasheets/LCDs/ST7789V.pdf
//
// http://www.newhavendisplay.com/appnotes/datasheets/LCDs/ST7789V.pdf
package st7789 // import "tinygo.org/x/drivers/st7789"
import (
@@ -176,7 +176,6 @@ func (d *Device) Sync() {
// NOTE: Use GetHighestScanLine and GetLowestScanLine to obtain the highest
// and lowest useful values. Values are affected by front and back porch
// vsync settings (derived from VSyncLines configuration option).
//
func (d *Device) SyncToScanLine(scanline uint16) {
scan := d.GetScanLine()
+1 -1
View File
@@ -26,7 +26,7 @@ func New(spi drivers.SPI) *Device {
return &d
}
//SpiSetNss Sets the NSS line
// SpiSetNss Sets the NSS line
func (d *Device) SpiSetNss(state bool) {
if state {
stm32.PWR.SUBGHZSPICR.SetBits(stm32.PWR_SUBGHZSPICR_NSS)
+5 -3
View File
@@ -96,9 +96,11 @@ func timeoutMsToRtcSteps(timeoutMs uint32) uint32 {
}
// --------------------------------------------------
// Channel and events
//
// Channel and events
//
// --------------------------------------------------
//NewRadioEvent() returns a new RadioEvent that can be used in the RadioChannel
// NewRadioEvent() returns a new RadioEvent that can be used in the RadioChannel
func NewRadioEvent(eType int, irqStatus uint16, eData []byte) RadioEvent {
r := RadioEvent{EventType: eType, IRQStatus: irqStatus, EventData: eData}
return r
@@ -573,7 +575,7 @@ func (d *Device) SetLoraCrc(enable bool) {
}
}
//SetLoraSpreadingFactor setc surrent Lora Spreading Factor
// SetLoraSpreadingFactor setc surrent Lora Spreading Factor
// NB: Change will be applied at next RX / TX
func (d *Device) SetLoraSpreadingFactor(sf uint8) {
d.loraConf.Sf = sf
-1
View File
@@ -1,7 +1,6 @@
// Package tester contains mock structs to make it easier to test I2C devices.
//
// TODO: info on how to use this.
//
package tester // import "tinygo.org/x/drivers/tester"
// Failer is used by the I2CDevice type to abort when it's used in
+5 -6
View File
@@ -13,17 +13,16 @@
// To use with other thermistors adjust the BCoefficient and NominalTemperature
// values to match the specific thermistor you wish to use.
//
// sensor.NominalTemperature = 25
// sensor.BCoefficient = 3950
// sensor.NominalTemperature = 25
// sensor.BCoefficient = 3950
//
// Set the SeriesResistor and NominalResistance based on the microcontroller voltage and
// circuit that you have in use. Set HighSide based on if the thermistor is connected from
// the ADC pin to the powered side (true) or to ground (false).
//
// sensor.SeriesResistor = 10000
// sensor.NominalResistance = 10000
// sensor.HighSide = true
//
// sensor.SeriesResistor = 10000
// sensor.NominalResistance = 10000
// sensor.HighSide = true
package thermistor // import "tinygo.org/x/drivers/thermistor"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package tm1637 provides a driver for the TM1637 4-digit 7-segment LED display.
//
// Datasheet: https://www.mcielectronics.cl/website_MCI/static/documents/Datasheet_TM1637.pdf
//
package tm1637
import (
+1 -1
View File
@@ -45,7 +45,7 @@ func (s Speaker) Stop() {
// SetPeriod sets the period for the signal in nanoseconds. Use the following
// formula to convert frequency to period:
//
// period = 1e9 / frequency
// period = 1e9 / frequency
//
// You can also use s.SetNote() instead for MIDI note numbers.
func (s Speaker) SetPeriod(period uint64) {
-1
View File
@@ -2,7 +2,6 @@
//
// Inspired by https://github.com/pimoroni/pimoroni-pico/blob/main/drivers/uc8151/uc8151.cpp
// Datasheet: https://www.buydisplay.com/download/ic/UC8151C.pdf
//
package uc8151 // import "tinygo.org/x/drivers/uc8151"
import (
-1
View File
@@ -5,7 +5,6 @@
// https://www.vishay.com/docs/84277/veml6070.pdf
// Application Notes:
// https://www.vishay.com/docs/84310/designingveml6070.pdf
//
package veml6070 // import "tinygo.org/x/drivers/veml6070"
import (
-1
View File
@@ -6,7 +6,6 @@
// This driver was based on the library https://github.com/pololu/vl53l1x-arduino
// and ST's VL53L1X API (STSW-IMG007)
// https://www.st.com/content/st_com/en/products/embedded-software/proximity-sensors-software/stsw-img007.html
//
package vl53l1x // import "tinygo.org/x/drivers/vl53l1x"
import (
-1
View File
@@ -5,7 +5,6 @@
// This driver was based on the library https://github.com/adafruit/Adafruit_VL6180X
// and document 'AN4545 VL6180X basic ranging application note':
// https://www.st.com/resource/en/application_note/an4545-vl6180x-basic-ranging-application-note-stmicroelectronics.pdf
//
package vl6180x // import "tinygo.org/x/drivers/vl6180x"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package epd2in13 implements a driver for Waveshare 2.13in black and white e-paper device.
//
// Datasheet: https://www.waveshare.com/w/upload/e/e6/2.13inch_e-Paper_Datasheet.pdf
//
package epd2in13 // import "tinygo.org/x/drivers/waveshare-epd/epd2in13"
import (
-1
View File
@@ -1,7 +1,6 @@
// Package epd2in13x implements a driver for Waveshare 2.13in (B & C versions) tri-color e-paper device.
//
// Datasheet: https://www.waveshare.com/w/upload/d/d3/2.13inch-e-paper-b-Specification.pdf
//
package epd2in13x // import "tinygo.org/x/drivers/waveshare-epd/epd2in13x"
import (
+3 -3
View File
@@ -3,12 +3,12 @@
// Note: this is for the V1 device (using IL3820), the V2 device uses a different chipset.
//
// Datasheets:
// https://www.waveshare.com/w/upload/e/e6/2.9inch_e-Paper_Datasheet.pdf
// https://www.smart-prototyping.com/image/data/9_Modules/EinkDisplay/GDE029A1/IL3820.pdf
//
// https://www.waveshare.com/w/upload/e/e6/2.9inch_e-Paper_Datasheet.pdf
// https://www.smart-prototyping.com/image/data/9_Modules/EinkDisplay/GDE029A1/IL3820.pdf
//
// This implementation is essentially a copy of the 2in13 driver with the correct LUTs and
// default size for the 2.9in device.
//
package epd2in9 // import "tinygo.org/x/drivers/waveshare-epd/epd2in9"
import (
+3 -3
View File
@@ -1,11 +1,11 @@
// Package epd4in2 implements a driver for Waveshare 4.2in black and white e-paper device.
//
// Derived from:
// https://github.com/tinygo-org/drivers/tree/master/waveshare-epd
// https://github.com/waveshare/e-Paper/blob/master/Arduino/epd4in2/epd4in2.cpp
//
// https://github.com/tinygo-org/drivers/tree/master/waveshare-epd
// https://github.com/waveshare/e-Paper/blob/master/Arduino/epd4in2/epd4in2.cpp
//
// Datasheet: https://www.waveshare.com/wiki/4.2inch_e-Paper_Module
//
package epd4in2
import (
-2
View File
@@ -3,7 +3,6 @@
//
// In order to use this driver, the ESP32 must be flashed with specific firmware from Arduino.
// For more information: https://github.com/arduino/nina-fw
//
package wifinina // import "tinygo.org/x/drivers/wifinina"
import (
@@ -265,7 +264,6 @@ func (err Error) Error() string {
// |___________|______|______|_________|___________|________|____|_________|
// | 8 bit | 1bit | 7bit | 8bit | 8bit | nbytes | .. | 8bit |
// |___________|______|______|_________|___________|________|____|_________|
//
type command struct {
cmd uint8
reply bool