Crate nrfxlib

Source
Expand description

§nrfxlib - a Rust library for the nRF9160 interface C library

This crate contains wrappers for functions and types defined in Nordic’s libmodem, which is part of nrfxlib.

The nrfxlib_sys crate is the auto-generated wrapper for nrf_modem_os.h and nrf_socket.h. This crate contains Rustic wrappers for those auto-generated types.

To bring up the LTE stack you need to call nrf_modem_init(). Before that you need to enable the EGU1 and EGU2 interrupts, and arrange for the relevant functions (application_irq_handler and trace_irq_handler respectively) to be called when they occur. The IPC interrupt handler is registered by the relevant callback.

To talk to the LTE modem, use the at::send_at_command() function. It will call the callback with the response received from the modem.

To automatically send the AT commands which initialise the modem and wait until it has registered on the network, call the wait_for_lte() function. Once that is complete, you can create TCP or TLS sockets and send/receive data.

Copyright (c) 42 Technology Ltd 2021

Dual-licensed under MIT and Apache 2.0. See the README for more details.

Re-exports§

pub use api::*;

Modules§

api
libbsd.a API implementation
at
AT Sockets for nrfxlib
dtls
DTLS Sockets for nrfxlib
gnss
GNSS Module for nrfxlib
modem
Modem helper functions for nrfxlib
tcp
TCP Sockets for nrfxlib
tls
Raw Sockets for nrfxlib
udp
UDP Sockets for nrfxlib

Structs§

NrfAddrInfo
Create a camel-case type name for socket information.
NrfSockAddrIn
Create a camel-case type name for socket addresses.
PollEntry
Describes a socket you wish to poll, and the result of polling it.
PollResult
The ways a socket can respond to a poll.

Enums§

AtError
Errors that can be returned in response to an AT command.
Error
The set of error codes we can get from this API.
NrfxErr
IPC error type
PollFlags
The ways in which you can poll on a particular socket

Traits§

Pollable
Describes something we can poll on.

Functions§

get_last_error
Return the last error stored by the nrfxlib C library.
init
Start the NRF Modem library
poll
Poll on multiple sockets at once.
shutdown
Stop the NRF Modem library