Skip to content
Permalink
Browse files
callback tweak
  • Loading branch information
gfwilliams committed Feb 19, 2021
1 parent 2f4c750 commit 8ca56d2929298152f683e4309bf876e735034216
Showing with 10 additions and 3 deletions.
  1. +2 −0 devices/SX127x.js
  2. +8 −3 devices/SX127x.md
@@ -304,6 +304,8 @@ function SX(options) {
setTimeout(this.init.bind(this), 7);
this.options = {};
this.state = "";
if (options.callback)
setTimeout(options.callback, 10);
}

SX.prototype.w = function(a,v) {
@@ -34,12 +34,17 @@ You set the `SX127x` module up like many others:

```
SPI1.setup({ sck:B3, miso:B4, mosi:B5 });
var sx = require("SX127x").connect({spi: SPI1, cs: B6, rst : B7 });
var sx = require("SX127x").connect({spi: SPI1, cs: B6, rst : B7, callback:function() {
// callback when SX127x is initialised
// Until DIO0 line irqs are implemented we need this:
setInterval(function() { sx.onIRQ(); }, 100);
// Until DIO0 line irqs are implemented we need this:
setInterval(function() { sx.onIRQ(); }, 100);
} });
```

**Note:** `require("SX127x").connect` doesn't complete immediately, so it is important that you
only use the returned module either >10ms after calling it, or ideally when the `callback` function is called.

You should then define some options. Sensible defaults are set, so realistically you need only:

```

0 comments on commit 8ca56d2

Please sign in to comment.