Limedrv

Democratising Wireless Innovation
Revision as of 02:45, 3 January 2019 by LucasTeske (talk | contribs)
Jump to navigation Jump to search

What is Limedrv

Limedrv is a libLimeSuite Golang wrapper. It is designed to be easy of use and to be very easily integrated with any type of DSP inside go.


Getting Started

From now on, this article assumes that you know how to setup your golang environment and can build simple hello world programs. If you don't know or never played with GoLang, please refer to: https://golang.org/doc/install


Enumerating Devices

The first thing we need to be able to enumerate all devices that are plugged in. For that, let's create simple program that prints out every lime device that it finds.

package main

import (
	"github.com/myriadrf/limedrv"
	"log"
)

func main() {
	devices := limedrv.GetDevices()
	log.Printf("Found %d devices\n", len(devices))

	for i, v := range devices {
		log.Printf("%d: %s\n", i, v.DeviceName)
	}
}

Now we can try to open the device and list its capabilities:

package main

import (
	"github.com/myriadrf/limedrv"
	"log"
)

func main() {
	devices := limedrv.GetDevices()
	log.Printf("Found %d devices\n", len(devices))

	if len(devices) == 0 {
		log.Fatal("No devices found!")
	}

	d := devices[0]

	log.Printf("Opening %s\n", d.DeviceName)
	dev := limedrv.Open(d) // Open the selected device
	defer dev.Close()      // Defer the close of the device

	log.Println(dev)
}