Code Monkey home page Code Monkey logo

android-things-rf24's Introduction

Android-Things-RF24

Android-Things port of RF24 for the nRF24L01(+) 2.4GHz Wireless Transceiver

This is a working implementation of RF24 and RF24Network with Android-Things on a Raspberry Pi 3.

This is based off the work from https://github.com/TMRh20/RF24 and is a cpp implementation with changes for ndk and with an android library wrapper.

Example

The example is a simple gui for running the PING tests, which can be used to test the RF24 device.

Configuration

The current configuration is the CE is CE0, and the CSN pin is GPIO22 or Pin 15.

Currently there is no GUI, change the example by changing what is enabled in the background thread only one at a time will work so don't bother enabling more.

Installing

Add the repo http://dl.bintray.com/wintersandroid/maven, for example in you base build.gradle

allprojects {
    repositories {
       jcenter()
       google()
        maven { url  "http://dl.bintray.com/wintersandroid/maven" }
    }
}

Then import the project in your dependancies.

    implementation "nz.org.winters:libRF24:{version}"

Find the version in the release tags.

Using RF24 & RF24Network

Essentially the same as what is documented on the RF24 Site, just use NativeRF24 class, and NativeRF24Network classes.

  static final String send_payload_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ789012";
  static long[] pipes = {0xF0F0F0F0E1L, 0xF0F0F0F0D2L};

  void test(){
    NativeRF24 radio = new NativeRF24(cePin, spiSpeed, spiBus);

    radio.begin();
    radio.enableDynamicPayloads();
    radio.setRetries((byte) 5, (byte) 15);
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe((byte) 1, pipes[0]);

    radio.printDetails();

    radio.write(send_payload_str, send_payload_str.length());

    radio.startListening();

    if(radio.available()) {
       len = radio.getDynamicPayloadSize();
       receive_payload = radio.read(len);
    }
    radio.startListening();

}

android-things-rf24's People

Contributors

fleker avatar mathew-winters-ctct avatar mwinters-stuff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fleker

android-things-rf24's Issues

Can I have the API for this driver ?

I just started with Android Things recently and I want to play around with RPi and nRF24L01. I want to use this driver for this project of mine, but I don't understand how to set up and use the functions from the driver. I read 'TMRh20' but the functions here have some differences from that so I'm a little bit confused on how and what to use.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.