Skip to content

Commit

Permalink
document bindings' API
Browse files Browse the repository at this point in the history
also check radio is in TX mode before send() executes to prevent infinite loops

avoid using binding generators' object renaming behavior; uses rust namespacing instead
  • Loading branch information
2bndy5 committed Oct 24, 2024
1 parent 8ef7171 commit 4981446
Show file tree
Hide file tree
Showing 40 changed files with 1,858 additions and 1,280 deletions.
10 changes: 9 additions & 1 deletion .config/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ version: 2
build:
os: ubuntu-22.04
tools:
# rust: latest
nodejs: latest
rust: latest
python: latest
jobs:
pre_build:
- yarn install
- yarn build:debug
- yarn docs

mkdocs:
configuration: docs/mkdocs.yml
Expand All @@ -20,3 +26,5 @@ mkdocs:
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: '.'
9 changes: 9 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: yarn install
- name: Build Node.js type definitions
run: yarn build:debug
- name: Generate Node.js API docs
run: yarn docs
- run: pip install -r docs/requirements.txt
- run: pip install .
- run: just docs-build
- name: Save docs build as artifact
uses: actions/upload-artifact@v4
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,3 @@ Cargo.lock
# coverage output
coverage.json
lcov.info

# supplemental docs build
docs/site/
6 changes: 3 additions & 3 deletions bindings/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ version = "0.0.0"
crate-type = ["cdylib"]

[dependencies]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "2.12.2", default-features = false, features = ["napi4"] }
napi-derive = "2.12.2"
# Default `napi` features: see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = "2.16.13"
napi-derive = "2.16.12"

[build-dependencies]
napi-build = "2.0.1"
Expand Down
41 changes: 41 additions & 0 deletions bindings/node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# `@rf24/rf24`

The node.js binding for the [rf24-rs] project (written in rust).

[rf24-rs]: https://github.com/nRF24/rf24-rs

This package is only functional on Linux machines.
Although, installing this package in non-Linux environments will
provide the typing information used on Linux.

## Install

To install from npmjs.org:

```text
npm install @rf24/rf24
```

To build from source:

```text
yarn install
yarn build:debug
```

## Examples

The examples are written in Typescript and located in the repository's root path "examples/node/ts".
To compile them to Javascript, run the following commands:

```text
yarn install
yarn examples-build
```

Afterwards the Javascript files are located "examples/node/js".
To run them just pass the example file's path to the node interpreter:

```text
node examples/node/js/gettingStarted.js
```
2 changes: 1 addition & 1 deletion bindings/node/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod types;
#[cfg(target_os = "linux")]
mod radio;
mod types;

#[macro_use]
extern crate napi_derive;
Loading

0 comments on commit 4981446

Please sign in to comment.