|
LDL
0.5.0
|
The Radio uses chip interface function pointers to control the hardware:
Implementations of these functions must be assigned to the radio driver during initialisation. Use the examples in the function pointer documentation as a guide. These functions will need to interact with IO connected to the radio chip.
The Radio driver can receive an interrupt from the radio via the LDL_Radio_handleInterrupt() function.
The following connections are required for SX1272 and SX1276:
| signal | direction on host | type | polarity |
|---|---|---|---|
| MOSI | output | push-pull | |
| MISO | input | hiz with opt. pull-up | |
| SCK | output | push-pull | |
| NSS | output | push-pull | active-low |
| Reset | input/output | hiz/push-pull | active-high |
| DIO0 | input | hiz with opt. pull-down | active-high |
| DIO1 | input | hiz with opt. pull-down | active-high |
The following connections are required for SX1261 and SX1262:
| signal | direction on host | type | polarity |
|---|---|---|---|
| MOSI | output | push-pull | |
| MISO | input | hiz with opt. pull-up | |
| SCK | output | push-pull | |
| NSS | output | push-pull | active-low |
| Reset | input/output | hiz/push-pull | active-low |
| Busy | input | hiz | active-high |
| DIO1 | input | hiz with opt. pull-down | active-high |
Note that SX126X reset is active-low, while SX127X reset is active-high.
Function List | |
| void | LDL_Radio_handleInterrupt (struct ldl_radio *self, uint8_t n) |
Typedefs | |
| typedef void(* | ldl_chip_set_mode_fn) (void *self, enum ldl_chip_mode mode) |
| typedef bool(* | ldl_chip_write_fn) (void *self, const void *opcode, size_t opcode_size, const void *data, size_t size) |
| typedef bool(* | ldl_chip_read_fn) (void *self, const void *opcode, size_t opcode_size, void *data, size_t size) |
| void LDL_Radio_handleInterrupt | ( | struct ldl_radio * | self, |
| uint8_t | n | ||
| ) |
Receive an interrupt from the chip
| [in] | self | ldl_radio |
| [in] | n | DIO number |
This function will typically be called from an ISR like this:
| typedef void(* ldl_chip_set_mode_fn) (void *self, enum ldl_chip_mode mode) |
Use this function to configure the transceiver and associated hardware.
| [in] | self | |
| [in] | mode | ldl_chip_mode |
| typedef bool(* ldl_chip_write_fn) (void *self, const void *opcode, size_t opcode_size, const void *data, size_t size) |
Write opcode and write payload
| [in] | self | |
| [in] | opcode | opcode data that must be written |
| [in] | opcode_size | size of opcode data |
| [in] | data | buffer to write |
| [in] | size | size of buffer in bytes |
| true | operation complete |
| false | chip is still busy after timeout |
This function must handle:
| typedef bool(* ldl_chip_read_fn) (void *self, const void *opcode, size_t opcode_size, void *data, size_t size) |
Write opcode and read payload
| [in] | self | |
| [in] | opcode | opcode data that must be written |
| [in] | opcode_size | size of opcode data |
| [out] | data | read into this buffer |
| [in] | size | number of bytes to read (and size of buffer in bytes) |
| true | operation complete |
| false | chip is still busy after timeout |
This function must handle:
For example:
| enum ldl_chip_mode |
chip mode tells the chip interface code what to do with various IO lines.