296 Commits

Author SHA1 Message Date
deadprogram 1d695a231a ws2812: add support for the ESP32-C3 processor
This adds support to the WS2812 for the ESP32-C3 processor
which is a RISC-V processor from Espressif.

Signed-off-by: deadprogram <ron@hybridgroup.com>
2026-06-04 19:49:50 +02:00
Joel Wetzell 62663c1832 add SPI driver for semtech sx128x chips (#864)
* add SPI driver for semtech sx128x chips

Co-authored-by: Copilot <copilot@github.com>

* handle busy loop better

* switch to time based busy timeout

Co-authored-by: Copilot <copilot@github.com>

* comment functions

* start on using types for function inputs

* use types where applicable and align with datasheet more

Co-authored-by: Copilot <copilot@github.com>

* work on exporting less constants

* only export "actionable" errors

* combine identical constants

* add crude lora rx and tx examples

* change from type aliases to local types

---------

Co-authored-by: Copilot <copilot@github.com>
2026-05-04 09:42:03 -03:00
deadprogram 9fc1c0aedc examples/ws2812: update to accomodate Arduino Uno rename for TinyGo 0.41.0 release
Signed-off-by: deadprogram <ron@hybridgroup.com>
2026-04-21 09:44:44 +01:00
nobonobo 1c10dea443 add support extended id for mcp2515 (#857)
* add support extended id for mcp2515
* fix mcp2512 example code
* revert Pin control
2026-04-20 11:51:56 +02:00
deadprogram a0c5da601f unoqmatrix: LED matrix on the Arduino Uno Q
Signed-off-by: deadprogram <ron@hybridgroup.com>
2026-04-11 17:07:17 +01:00
Avinal Kumar e232a4f136 waveshare(ssd1680): Add driver for waveshare 2.9 inch v2 epaper
- Waveshare 2.9in v2 epaper uses a different IC (SSD1680) than the v1. This commit
takes the code from v1 and modifies them for v2.
- Datasheets:
    - https://files.waveshare.com/upload/7/79/2.9inch-e-paper-v2-specification.pdf
    - https://cdn-learn.adafruit.com/assets/assets/000/097/631/original/SSD1680_Datasheet.pdf?1607625960
- Code reference: https://github.com/waveshareteam/e-Paper/raw/refs/heads/master/RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in9_V2.c
- Fixes #627

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Assisted-by: Claude Code
2026-04-11 16:41:34 +01:00
deadprogram 0e2fb829ef gps: improvements and corrections for config commands
This contains some improvements and corrections for the gps driver
It adds some additional functions for different modes (automobile, bike, etc)
and also ignores the return results from any config commands.

Basically due to the fact that there is a constant stream of updates
coming from NMEA messages, the results from sending any UBX commands
are getting lost. Better to just ignore them for now.

Signed-off-by: deadprogram <ron@hybridgroup.com>
2026-01-14 19:55:43 +00:00
deadprogram 892265b733 gps: export some errors for checking/supression from client
Signed-off-by: deadprogram <ron@hybridgroup.com>
2026-01-08 13:05:41 +00:00
deadprogram c21cd39813 si5351: complete refactor for more complete interface
This completely refactors the interface and implementation
for the si5351 clock generator. The interface based on the
Arduino implementation was both somewhat hard to work with
and also missing a number of important features that are
needed to use this chip for RF communication.

Instead this new implementation draws inspiration from the
efforts of the Traquino community mostly using the rp2040
processor.

The TinyGo implementation is based on the patterns and code
in the drivers repo for other i2c devices. It also includes
some basic unit tests which are not comprehensive but at
least provide some coverage.

Signed-off-by: deadprogram <ron@hybridgroup.com>
2026-01-07 19:58:27 +00:00
deadprogram 50778af656 si5351: add many missing functions needed for convenient use.
This adds many missing functions needed for convenient use that are
reinterpreted from the C code in https://github.com/dmalnati/picoinf

Thank you!

Signed-off-by: deadprogram <ron@hybridgroup.com>
2025-12-11 17:59:07 +00:00
Mike Hughes 936a255df9 Add support for CEVA BNO08x 9DoF sensor (#809)
* Add support for CEVA BNO08x 9DoF sensor. Also includes implementation of CEVA SH-2 and SHTP protocols.

* Replace machine.I2C with drivers.I2C interface to remove dependency on machine package

* Replace Pin functionality with that provided by tinygo.org/x/drivers/internal/pin

* Unexport fields on SensorValue and replace with accessor methods. Add check for correct SensorID validation

* Add example to smoketest.sh

* Change build target for smoketest to match development environment.. Probably not important, but matches reality.

* Fix decoding of some sensor data: Step Counter, Tap Detector, Flip Detector. These are experimental.

* Refactor to allow SPI/UART etc. SPI is currently under development, but is omitted from this commit.

Example code has been moved to i2c subdirectory.

This commit introduces some major refactoring changes. It introduces a "Buser" interface and tries to remove any I2C specific code from the core. It still retains a couple of I2C specific fields in the "Config" struct ("Address" and "ReadChunk") but they are ignored in the as yet uncommited SPI code.

* Fix CRLF -> LF for gofmt

* Update smoketest to point to new example file
2025-12-10 19:07:04 +01:00
Yurii Soldak c710cc8236 ssd1xxx: break dependency from machine package (#812)
* ssd1xxx: break dependency from machine package
* fix ssd1289 example
* simplify
2025-11-12 09:40:34 +01:00
Nicholas Wiersma 4b831af52b w5500: initial version the driver (#788)
Thank you, @nrwiersma for working on this and @soypat for review. Now merging.
2025-11-12 09:00:21 +01:00
gkits 23833e69c7 DS3231 Alarm features (#805)
* Added alarm features
* more functions
* chore: fix typo
* feat(ds3231): add Alarm2Mode type and mode consts
* docs(ds3231): add docstrings for SQW functions
* feat(ds3231): add methods for Alarm2
* fix(ds3231): use Alarm2Mode for SetAlarm2 method
* docs(ds3231): add example for alarms
* docs(ds3231): refactor alarms example
* make main function more concise to avoid llvm error for pico
* ci(ds3231): split basic and alarm tests
* style(ds3231): reorder private funcs to the bottom
* docs(ds3231): add docstring for alarm modes
* docs(ds3231): make alarm docstrings more descriptive
* chore(ds3231): fix typo in docstring
* style(ds3231): reorder public functions
* style(ds3231): reorder private methods
* chore(ds3231): add missing error handling
* feat(ds3231): use setter funcs for en/disabling instead of separate funcs
* fix(ds3231): correctly enable alarms in example
* style(ds3231): rename SetEnable32K to SetEnabled32K for consistency
* refactor(ds3231): replace legacy with regmap package
* refactor(ds3231): use Write32 instead of Tx for SetAlarm1
* chore(ds3231): remove fmt deps and and use println in examples
* refactor(ds3231): read temperature as uint16

---------

Co-authored-by: Matthias Fulz <mfulz@olznet.de>
2025-11-11 10:22:28 +01:00
Ron Evans 408851a9f5 si5351: add support for si5351 (#810)
* si5351: add support for si5351

Adds support for the si5351 I2C programmable clock generator using code
from @chiefMarlin which used code from @conotto which somehow never got merged.

Thank you everyone!

Signed-off-by: deadprogram <ron@hybridgroup.com>

* refactor: use regmap instead of legacy package to avoid heap allocations

Signed-off-by: deadprogram <ron@hybridgroup.com>

---------

Signed-off-by: deadprogram <ron@hybridgroup.com>
2025-11-10 08:04:25 -03:00
Pat Whittingslow 5cb360a4bf Add Honeywell HSC TruStability SPI+I2C pressure sensor driver (#799)
* add honeywell pressure sensor
* apply @aykevl suggestions
2025-11-08 10:45:18 +01:00
Ayke van Laethem ec680be784 lis3dh: use correct error handling and make configurable
Instead of printing an error, this driver really should be returning
errors instead. Also, `Configure` didn't have a way to actually
configure the driver. This is now added, and can be expanded in the
future.

This is a breaking change.
2025-11-08 10:34:37 +01:00
JP Hastings-Spital 857ab80ae6 feat: add support for seesaw encoders
Adds the necessary function addresses for reading and writing encoders on a seesaw.
Also provides two helper functions to make this easier.
2025-08-18 14:15:48 +02:00
Bryan Souza 303ec94529 added support for LSM303DLHC e-Compass; (#783)
fixed the spelling in the Connection error message; Initial support for LSM303DLHC added;
Added LSM303DLHC to smoketest and added an example;
Removed unnecessary comments;
fixed format error;
squashed and ready for merge;
2025-08-11 08:47:22 +02:00
Artur Nasyrov 833990f44d Add ens160 i2c driver
Driver for ENS160 sensor:
https://www.sciosense.com/wp-content/uploads/2023/12/ENS160-Datasheet.pdf
2025-08-10 10:05:18 +02:00
Yurii Soldak ae9e8f915e ssd1306: avoid unnecessary heap allocations (#767)
* ssd1306: avoid unnecessary heap allocations

* ssd1306: extract i2c and spi bus implementations

* ssd1306: refactor tests -- show fps and heap usage

* ssd1306: bring back the lost exported methods

* Adjust examples

* Fix smoketests for ssd1306
2025-08-10 10:05:18 +02:00
JP Hastings-Spital 45fad80c3e feat: allow gps init with address
Adafruit's Mini GPS PA1010D Module works with this device driver, but requires 0x10 as the address, rather than 0x42.

This change allows the device to be initialised with whatever i2c address is needed, while maintaining backward compatibility.

Adds new constants to allow easy configuration of both the ublox device and the PA1010D.
2025-08-10 10:05:18 +02:00
deadprogram 156d6e7c9c chore: update all SPI usage to use either *machine.SPI or drivers.SPI to accomodate recent switch in machine package
Signed-off-by: deadprogram <ron@hybridgroup.com>
2025-03-11 12:43:28 -07:00
Scott Feldman 06dd60fba2 Add wifi driver comboat for Elecrow W5 rp2040 and rp2350 devices (#741)
* Add wifi driver comboat for Elecrow W5 rp2040 and rp2350 devices

Combo-AT driver uses AT command set to talk to onboard rtl8720d wifi
device.  The driver supports UDP/TCP/TLS clients in Wifi STA mode.
Support for UDP/TCP servers is not supported, currently.

https://aithinker-combo-guide.readthedocs.io/en/latest/docs/instruction/index.html
https://aithinker-combo-guide.readthedocs.io/en/latest/docs/command-set/index.html
https://aithinker-combo-guide.readthedocs.io/en/latest/docs/command-examples/index.html

* Add wifi driver comboat for Elecrow W5 rp2040 and rp2350 devices

Combo-AT driver uses AT command set to talk to onboard rtl8720d wifi
device.  The driver supports UDP/TCP/TLS clients in Wifi STA mode.
Support for UDP/TCP servers is not supported, currently.

https://aithinker-combo-guide.readthedocs.io/en/latest/docs/instruction/index.html
https://aithinker-combo-guide.readthedocs.io/en/latest/docs/command-set/index.html
https://aithinker-combo-guide.readthedocs.io/en/latest/docs/command-examples/index.html

* switch to comboat_fw build tag for examples/net's that work with comboat driver
2025-02-21 11:24:15 +01:00
John Hobbs 6281f36662 MAX6675 example & smoke test 2025-02-13 18:26:26 +01:00
Amken USA 87c205fd65 Added TMC2209 support (#727)
TMC2209: Added TMC2209 support
2025-01-28 12:42:18 +01:00
Anastasios Papalyras f57b5ecee9 Add sharpmem (#724)
sharpmem: add implementation of sharpmem display driver

* Implement Configure, Clear and ClearBuffer, add some tests, add documentation/comments
* Reverse white
* Inverted bits, fix and improve ClearBuffer, cleanup
* Refine doc comment
* Driver refactor, optimizations toggle, additional tests & support for all SKUs
* Fix address overflow padding, add wire-level tests for assumed address encoding
* Minor rename
* Cleanup and doc fixes
* Add device configs
* Bounds check
* Add example and smoketest entry
* Use uf2 output file format
* Refine example
2025-01-28 12:17:12 +01:00
Amken USA 486949686c Added TMC5160 support (#725)
TMC5160: Added TMC5160 support

* Added example code for tmc5160 and smoke test
* Update go.mod
* Updated mod file
* Cleaned up commented out code and updated readme.
* ran go fmt
* Fixed setrampspeed func
* Removed spi1 pin setup in example.go. Renamed SPIComm to spicomm.go
* Removed unused test file
* Removed commented line
2025-01-18 07:49:00 +01:00
Ayke van Laethem 30f540c29f touch: add capacitive touch sensing on normal GPIO pins
Tested on the following chips/boards:

  * RP2040 (Raspberry Pi Pico)
  * ATSAMD21 (Adafruit PyBadge)
  * NRF52840 (PCA10056 developer board)
  * ESP8266 (NodeMCU)
  * ATmega328p (Arduino Uno)
  * ESP32C3 (WaveShare ESP-C3-32S-Kit)
  * FE310 (SiFive HiFive1 rev B)

The sensitivity threshold in the example may need to be adjusted per
board though, the default value of 100 typically recognizes when a cable
is being touched but the RP2040 for example is capable of doing much
more precise measurements if the power supply is sufficiently
noise-free.
2024-10-25 06:28:03 +01:00
Warren Guy 6d431e0726 Add I2C INA219 driver (#705)
INA219: add INA219 driver
2024-10-24 07:45:33 +02:00
Marcin Białoń ce80e7582f epd1in54: add Waveshare 1.54inch B/W e-Paper display (#704)
epd1in54: add Waveshare 1.54inch B/W e-Paper display
2024-10-23 13:43:30 +02:00
Ron Evans ee3842f639 pcf8591: add ADC only implementation for I2C ADC/DAC (#690)
Signed-off-by: deadprogram <ron@hybridgroup.com>
2024-07-01 22:06:25 +09:00
Thomas 4a0bcba87c epd2in66b: Waveshare 2.66inch E-Paper Display Module (B) for Raspberry Pi Pico (#673)
epd2in66b: add working driver

Co-authored-by: Thomas Richner <thomas.richner@oviva.com>
2024-06-10 13:16:45 +02:00
deadprogram 831982ad33 servo: add function SetAngle() to simplify API for most common use case
Signed-off-by: deadprogram <ron@hybridgroup.com>
2024-05-25 08:34:52 +02:00
deadprogram 9063f46313 uc8151: improvements to speed and also add flicker-free mode based on @antirez code example
Signed-off-by: deadprogram <ron@hybridgroup.com>
2024-05-13 22:45:37 +02:00
gmsec 2a621dc3b1 Add driver for MCP9808 i2c temperature sensor (#676)
mcp9808: add support for temperature sensor
2024-05-12 10:42:03 +02:00
deadprogram 50b6f18cc2 uc8151: update to support all functions needed by tinygl and board package Displayer interface
Signed-off-by: deadprogram <ron@hybridgroup.com>
2024-05-08 16:35:21 +02:00
sago35 bb0e6b8ba8 Fix typo and move initialization of neo to init() 2024-05-06 11:19:19 +02:00
sago35 5eeba138a4 Simplify examples/ws2812 2024-05-06 11:19:19 +02:00
deadprogram c344e5d879 ssd1306: improvements needed for Thumby SPI display
Signed-off-by: deadprogram <ron@hybridgroup.com>
2024-02-23 20:07:40 -05:00
BCG 308763f500 Adding driver for rotary encoder support 2024-02-15 16:55:54 +01:00
Scott Feldman aa7bd47c68 examples: add classic network snake test example
Adding this example to test multiple concurrent socket connections.
2024-01-24 08:25:20 +01:00
deadprogram 3c5e17423a netlink, examples: use 'ninafw' tag instead of individual board tags to simplify maintenence. Also see PR #4085 in the main TinyGo repo
Signed-off-by: deadprogram <ron@hybridgroup.com>
2024-01-17 08:47:00 +01:00
Scott Feldman 8642886f73 correct netdever Accept() prototype
According to man page accept(2), accept returns new client sockfd and
remote peer ip:port.  This patch corrects the Accept() prototype in the
netdever interface to not take in an ip:port arg, but rather return an
ip:port for remote peer.

Tested with examples/net/tcpecho on wioterminal and nano-rp2040.  Here's
a run with wioterminal:

SERVER
============
sfeldma@nuc:~/work/drivers$ tinygo flash -monitor -target wioterminal -size short -stack-size=8kb ./examples/net/tcpecho
code    data     bss |   flash     ram
110876    2552   11212 |  113428   13764
Connected to /dev/ttyACM2. Press Ctrl-C to exit.

Realtek rtl8720dn Wifi network device driver (rtl8720dn)

Driver version           : 0.0.1
RTL8720 firmware version : 2.1.2
MAC address              : 2c:f7:f1:1c:9b:2f

Connecting to Wifi SSID 'test'...CONNECTED

DHCP-assigned IP         : 10.0.0.140
DHCP-assigned subnet     : 255.255.255.0
DHCP-assigned gateway    : 10.0.0.1

Starting TCP server listening on :8080
Client 10.0.0.190:50000 connected
Client 10.0.0.190:50000 closed

CLIENT
=============
nc -p 50000 10.0.0.140 8080
2023-12-19 09:33:54 +01:00
Scott Feldman 709fc77960 fix examples/net/socket to work with netip API 2023-12-06 20:09:39 +01:00
Scott Feldman 3089bf8b1b net: updates/cleanup/docs for net, netdev, and netlink 2023-12-06 20:09:39 +01:00
Scott Feldman 8238f96319 move netdev and netlink into their own packages and out of drivers
This moves the netdev/netlink namespace out of drivers and into their
own packages.  Also, defines netdev and netlink as L3/L4 and L2 OSI
layers, respectively.  Move some L3 functionality from netlink to
netdev (GetIPAddr).

For netlink, add ConnectParams for NetConnect to pass in L2 connection
parameters (ssid, pass, auth_type, etc).  Also adds connection mode
(STA, AP, etc).

For netlink, add SendEth and RecvEthFunc funcs to handle L2 send/recv of
Ethernet pkts.
2023-12-06 20:09:39 +01:00
Scott Feldman e7d51d3c73 Add new MQTT client example using natiu-mqtt
Add new MQTT client example using natiu-mqtt
2023-12-06 20:09:39 +01:00
Scott Feldman 4bf631a7e3 s/ConnectTimeo/ConnectTimeout, s/WatchdogTimeo/WatchdogTimeout/ 2023-12-06 20:09:39 +01:00
Scott Feldman 276feecc20 Add network device driver model, netdev 2023-12-06 20:09:39 +01:00