Limedrv: Difference between revisions

Democratising Wireless Innovation
Jump to navigation Jump to search
(Created page with "''This page is a stub'' {{Community}}")
 
No edit summary
Line 1: Line 1:
''This page is a stub''
 
== 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.
 
<pre>
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)
}
}
</pre>
 
[[File:Limedrv-Sample-0.png]]
 
Now we can try to open the device and list its capabilities:
 
<pre>
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)
}
</pre>
 
[[File:Limedrv-deviceopen-print.png]]


{{Community}}
{{Community}}

Revision as of 02:45, 3 January 2019

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)
}