Add drivers for Manchester coding, SYN115 and SYN480R OOK radio modules

Aperta
#946 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
go
Ambito
embedded-iot

Direzione di ricerca

The proposal names the manchester, syn115, syn480r, and examples/manchester packages, plus CONTRIBUTING.md; read the contribution guidance and review PR #947, which is already linked. The issue says a local implementation exists and requests feedback on package layout and interfaces, so the work is already underway and its next steps depend on that review.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I want to add drivers for Manchester coding, SYN115 and SYN480R OOK radio modules

Following the "Some specific hardware you want to use does not appear to be in the TinyGo drivers" section of CONTRIBUTING.md, I want to check that nobody is already working on this, and then add support for cheap 433 MHz OOK/ASK radio modules.

Motivation

The SYN115 transmitter and SYN480R receiver are widely available 433 MHz modules. They have no protocol of their own: the MCU keys the transmitter carrier and reads the demodulated level from the receiver. That makes them useful, but also means every project has to write the same timing code again.

Manchester coding solves the DC balance problem of raw OOK links and gives a simple way to detect invalid symbols, so it makes sense to ship it together with the two pin drivers.

Hardware

Proposed packages

  • manchester: line coding plus Encoder and Decoder built on small Transmitter and Receiver interfaces, so other OOK modules can reuse it.
  • syn115: transmitter driver, Set(high bool) keys the carrier.
  • syn480r: receiver driver, Get() bool returns the demodulated level, with an Invert option for modules with inverted output.
  • examples/manchester: a send and receive example.

API sketch

tx := syn115.New(machine.GP4)
tx.Configure()

rx := syn480r.New(machine.GP5)
rx.Configure()

enc := manchester.NewEncoder(tx, manchester.Config{BitRate: 2000})
dec := manchester.NewDecoder(rx, manchester.Config{
	BitRate: 2000,
	Timeout: 500 * time.Millisecond,
})

enc.Write([]byte("hello"))
n, err := dec.Read(buf)

Config also has a Preamble field. Each frame is prefixed with zero bytes so the receiver can settle and find the first rising edge. The default is 2 kbps and a 4 byte preamble.
Limitations

  • The decoder samples half-bits in a busy loop, so the bit rate is limited by the target. 2 kbps is a safe default for the SYN480R.
  • No hardware timer or interrupt support yet. That could be a follow-up if there is interest.

Status

I have a working local implementation of all three packages and the example. Before opening a pull request against dev, I would like to confirm there is no duplicate effort, and get feedback on the package layout and the interfaces.
I am happy to adjust the API if the maintainers prefer a different split between the coding layer and the pin drivers. Tests and a smoketest.sh entry can be included in the PR.

PR #947

Lingua principale
Go
Stelle
756
Fork
251
Merge medio
7g 12h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tinygo-org/drivers

Tutte le issue di tinygo-org/drivers

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.