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

Abierto
#946 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
go
Área
embedded-iot

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Go
Estrellas
756
Forks
251
Merge medio
7 d 12 h
PR fusionados (30 d)
8

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de tinygo-org/drivers

Todos los issues de tinygo-org/drivers

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.