gorf24

package module
v0.0.0-...-15e907d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 2 Imported by: 0

README

***************************
      HOW TO INSTALL
***************************
TODO! More detail (on the way)

The gist of it:

1) install and set up basic developer tools, git as well as golang on your RPi
   e.g. on Arch ARM:
   $> sudo pacman -S base-devel git go
   
   be sure to export GOPATH and add $GOPATH/bin to your PATH; e.g.
     $> mkdir ~/mygo
     $> echo "export GOPATH=~/mygo" >> ~/.bashrc
     $> echo "export PATH=$PATH:$GOPATH/bin" >> ~/.bashrc
   
   log off and on again for GOPATH changes to take effect
   
2) fetch gorf24 using 
   $> go get github.com/galaktor/gorf24 (you will get an "ld" type error; ignore!)
3) $> cd $GOPATH/src/github.com/galaktor/gorf24
4) $> chmod +x build.sh
5) $> sudo ./build.sh
6) you might have to add /usr/local/lib to your /etc/ld.so.conf file (see below)
7) include gorf24 in your golang source code as usual, i.e. 'import "github.com/galaktor/gorf24"'
8) Accessing GPIO on Rpi requies elevated permissions, so it makes sense to build normally ("go build")
   then run the executable as sudo, i.e.
   $> go build mycode.go
   $> sudo ./mycode
   If you do not use sudo, you will get segfaults and panics

(Tested on an overclocked (900 MHz) Model A RPi running Arch Linux for Rpi/ARM.)

Note that this is project is in progress, and the golang or ansi C wrapper haven't been fully tested yet.
Basic send/receive testing has occured, but many functions might have bugs.
Please log any issue you might find and I will try to address it when I get a chance!
Or even better, fork and contribute, that would be much appreciated.

***************************
ADD /USR/LOCAL/LIB LDCONFIG
***************************

On Arch ARM for RPi, /usr/local/lib had to be added to ld.so.conf in order for golang to find the librf24*.so files at runtime.
you can check if the librf shared objects are detected by running:

$> ldconfig -v | grep librf

If the result is empty, then you need to add /usr/local/lib to /etc/ld.so.conf so that the golang runtime will detect the librf libraries.
NOTE: despite the "include ld.so.conf.d/*.conf" line in /etc/ld.so.conf, adding such a file had no effect. Needed to add directly to
ld.so.conf!

### 1. Open /etc/ld.so.conf with a text editor:
$> sudo nano /etc/ld.so.conf

### 2. Add the line "/usr/local/lib" and save (in nano, "Ctrl+X", "Y" then "Return")

### 3. Run ldconfig to update
$> sudo ldconfig

### 4. Verify detection of librf* shared objects using ldconfig
$> ldconfig -v | grep rf
   	    librf24.so.1 -> librf24.so.1.0
	    librf24_c.so -> librf24_c.so



***************************
         TODOS
***************************
* Makefiles instead of shell scripts
* maybe better way of installing via go get?
* more testing of correct wrapping, data types etc
* branch that includes verified-working snap of RF24-rpi
* download with RPi binaries for armv6?



***************************
  COPYRIGHT AND LICENSE
***************************

Copyright 2013, Raphael Estrada

gorf24 is licensed under the MIT license.
You should have received a copy of the MIT License along
with gorf24 (file "LICENSE"). If not, see 

<http://opensource.org/licenses/MIT>


**************************
  THE GIANTS' SHOULDERS
**************************

NOTE: gorf24 dynamiclly links to the C++ RF24 library for Raspberry
Pi by Stanley Seow. At the time gorf24 was created, Seow's software
had no apparent license included. The license for gorf24 described
here applies exclusively to the software provided as part of gorf24,
but does not extend to Seow's RF24 software.

https://github.com/stanleyseow/RF24

Seow's work is stronly derived from maniacbug's original RF24 library.
Much kudos to maniacbug for the great work.
https://github.com/maniacbug/RF24
http://maniacbug.wordpress.com/


Documentation

Index

Constants

View Source
const (
	CRC_DISABLED = iota
	CRC_8BIT
	CRC_16BIT
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CRCLENGTH

type CRCLENGTH byte

type DATARATE

type DATARATE byte
const (
	RATE_1MBPS DATARATE = iota
	RATE_2MBPS
	RATE_250KBPS
)

type PA_DBM

type PA_DBM byte

TODO: move to named package

const (
	PA_MIN PA_DBM = iota
	PA_LOW
	PA_HIGH
	PA_MAX
	PA_ERROR // what is this for?
)

type R

type R struct {
	// contains filtered or unexported fields
}

func New

func New(cepin uint16, cspin uint16, spispee uint32) R

func (*R) Available

func (r *R) Available() bool

func (*R) AvailablePipe

func (r *R) AvailablePipe() (bool, uint8)

TODO: create Pipe type, make this a func on Pipe

func (*R) Begin

func (r *R) Begin()

func (*R) Delete

func (r *R) Delete()

func (*R) DisableCRC

func (r *R) DisableCRC()

func (*R) EnableAckPayload

func (r *R) EnableAckPayload()

func (*R) EnableDynamicPayloads

func (r *R) EnableDynamicPayloads()

func (*R) GetCRCLength

func (r *R) GetCRCLength() CRCLENGTH

func (*R) GetDataRate

func (r *R) GetDataRate() DATARATE

func (*R) GetDynamicPayloadSize

func (r *R) GetDynamicPayloadSize() uint8

func (*R) GetPALevel

func (r *R) GetPALevel() PA_DBM

func (*R) GetPayloadSize

func (r *R) GetPayloadSize() uint8

func (*R) IsAckPayloadAvailable

func (r *R) IsAckPayloadAvailable() bool

func (*R) IsPVariant

func (r *R) IsPVariant() bool

func (*R) OpenReadingPipe

func (r *R) OpenReadingPipe(pipe uint8, address uint64)

func (*R) OpenWritingPipe

func (r *R) OpenWritingPipe(address uint64)

func (*R) PowerDown

func (r *R) PowerDown()

func (*R) PowerUp

func (r *R) PowerUp()

func (*R) PrintDetails

func (r *R) PrintDetails()

TODO: String() method would be great

func (*R) Read

func (r *R) Read(length uint8) []byte

func (*R) ResetCfg

func (r *R) ResetCfg()

func (*R) SetAutoAck

func (r *R) SetAutoAck(enable bool)

func (*R) SetAutoAckPipe

func (r *R) SetAutoAckPipe(pipe uint8, enable bool)

func (*R) SetCRCLength

func (r *R) SetCRCLength(length CRCLENGTH)

func (*R) SetChannel

func (r *R) SetChannel(channel uint8)

func (*R) SetDataRate

func (r *R) SetDataRate(rate DATARATE)

func (*R) SetPALevel

func (r *R) SetPALevel(level PA_DBM)

Is there any way to use the rf24_pa_dbm_e enum type directly

func (*R) SetPayloadSize

func (r *R) SetPayloadSize(size uint8)

func (*R) SetRetries

func (r *R) SetRetries(delay uint8, count uint8)

func (*R) StartListening

func (r *R) StartListening()

func (*R) StartWrite

func (r *R) StartWrite(data []byte, length uint8, multicast bool)

func (*R) StopListening

func (r *R) StopListening()

func (*R) TestCarrier

func (r *R) TestCarrier() bool

func (*R) TestRPD

func (r *R) TestRPD() bool

func (*R) WhatHappened

func (r *R) WhatHappened() (tx_ok, tx_fail, rx_ready bool)

func (*R) Write

func (r *R) Write(data []byte, length uint8) bool

TODO: implement Reader/Writer compatible interfaces

func (*R) WriteAckPayload

func (r *R) WriteAckPayload(pipe uint8, data []byte, length uint8)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL