Bblog

LoRa, GPS, and a trackball that feels like a TrackPoint

A new LoRa package for the SX1262, a GPS package that works out its receiver's speed, and input for the trackballs and keyboards small devices come with.

posted
by
DevKirbyrawr
read
3 min
Two radios with a chirp of rising frequency between them.

Small devices are more than a screen. Plenty of them carry a radio, a GPS, a trackball or a little keyboard, and a game or an app should be able to use them the way it uses touch. This release adds a package and brings two more a long way.

deki-lora

deki-lora sends and receives LoRa packets through a Semtech SX1262, the radio in most current LoRa modules and boards. Your code gets the radio, calls Send(), and takes what arrived from Receive() with its signal strength and SNR. The radio listens whenever it is not sending.

Two things it handles so you don’t have to:

  • Sharing a bus. On many boards the radio sits on the same SPI bus as the display. With its interrupt line wired, the driver only touches the bus when the radio has something to report, so a frame on its way to the screen is never held up.
  • The duty cycle. In Europe a device may only transmit 1% of the time on 868 MHz. The driver works it out from each packet’s time on air and refuses a send that would break it, saying how long to wait. Other regions set their own frequency and limit.

The demo has a LoRa screen: press Ping on one device and every other device running it shows the message, with its signal strength.

deki-gps

A satellite, and the fix it gives on the ground

deki-gps reads any receiver that speaks NMEA, and it now reads more of it: the position and time, the altitude, and how many satellites it can see and is using, from GPS, GLONASS, Galileo and BeiDou alike.

Set its speed to 0 and it finds the right one itself, trying the usual rates until a sentence comes through with a valid checksum. That matters for boards that ship with more than one kind of module, which do not all talk at the same speed. And because indoors there may never be a fix, it reports how far it got: bytes in, valid sentences, satellites. “No fix” stops being a mystery.

Trackballs and keyboards

A pad, and the overlap it is tested against

deki-input now makes a trackball a proper pointer, tuned to feel like a ThinkPad TrackPoint: roll it slowly and it is precise, spin it and it crosses the screen, and the cursor glides to a stop instead of stepping. Its click is a mouse click, so a screen designed for touch works with it unchanged.

I2C keyboards arrive as ordinary key presses, so a game reads the arrow keys the same way on a handheld as on a PC. Where the keyboard has a backlight, the game can set it.

Buttons for the hardware you have

The demo runs on very different hardware, so its menu greys out what the device does not have. On a PC the LoRa and trackball screens are disabled; on a handheld with both, everything is live. A project can do the same by asking which providers the board brought up.

All of it is in the 0.18.2 packages, and the LilyGO board package brings it up on the T-Deck Plus out of the box.

← all posts