| Name | sx126x JSON |
| Version |
2.2.4
JSON |
| download |
| home_page | None |
| Summary | None |
| upload_time | 2025-10-21 19:02:45 |
| maintainer | nbdy |
| docs_url | None |
| author | nbdy |
| requires_python | >=3.9 |
| license | MIT License |
| keywords |
lora
sx126x
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# sx126x
A Python library for interfacing with SX126X LoRa modules. This library provides a simple API for configuring and using SX126X devices for wireless communication.
## Hardware Requirements
This library is designed to work with SX126X LoRa modules connected to a Raspberry Pi. The default configuration assumes the module is connected to GPIO pins 5 and 6 for mode control, but this can be customized.
## Installation
**Using pip:**
```shell
pip install sx126x
```
**Using uv:**
```shell
uv pip install sx126x
```
For more information about uv, see https://docs.astral.sh/uv/
## Default Configuration
| Parameter | Default Value | Description |
|----------------------|----------------------------|-----------------------------------------------------------------------|
| `address` | `Address.parse("242.242")` | Device address |
| `net_id` | `1` | Network ID |
| `channel` | `1` | Channel |
| `port` | `None` | Serial port path |
| `pin_m0` | `6` | [GPIO 6](https://pinout.xyz/pinout/pin31_gpio6/) — Mode select pin M0 |
| `pin_m1` | `5` | [GPIO 5](https://pinout.xyz/pinout/pin29_gpio5/) — Mode select pin M1 |
| `baud_rate` | `BaudRate.B9600` | UART baud rate |
| `byte_size` | `8` | Number of data bits |
| `parity` | `Parity.NONE` | Parity bit setting |
| `stop_bits` | `1` | Number of stop bits |
| `write_persist` | `False` | Write registers persistently |
| `mode` | `Mode.CONFIGURATION` | Set M0 and M1 according to mode |
| `timeout` | `2` | Read/write timeout in seconds |
| `debug` | `False` | Enable debug logging |
| `air_speed` | `AirSpeed.K2_4` | Air data rate |
| `packet_size` | `PacketSize.SIZE_128` | Packet size |
| `ambient_noise` | `AmbientNoise.DISABLED` | Ambient noise detection mode |
| `transmit_power` | `TransmitPower.DBM_22` | RF transmit power |
| `rssi` | `RSSI.DISABLED` | Add RSSI to RX data |
| `transfer_method` | `TransferMethod.FIXED` | Transmission addressing mode |
| `relay` | `Relay.DISABLED` | Enable or disable relay functionality |
| `lbt` | `LBT.DISABLED` | Listen Before Talk mode |
| `wor_control` | `WORControl.TRANSMIT` | WOR (Wake On Radio) mode control |
| `wor_period` | `WORPeriod.MS_500` | WOR cycle period |
| `crypt_key` | `CryptKey(0, 0)` | 16-bit encryption key |
| `overwrite_defaults` | `True` | Whether to override internal default parameters |
## Usage Examples
The following examples demonstrate how to use the SX126X library for basic sending and receiving operations.
### Sender
```python
from sx126x import SX126X, Address
lora = SX126X(Address(3, 4))
lora.tx(Address(6, 9), b"Hello from device 3.4")
```
### Receiver
```python
from sx126x import SX126X, Address
lora = SX126X(Address(6, 9))
address, data = lora.rx()
# or
def lora_cb(address: Address, data: bytes) -> bool:
if address.__str__() == "3.4" and data == b"Hello from device 3.4":
print(f"Received message: {data.decode()}")
return False # stop receiving
return True # continue receiving
lora.rx_loop(lora_cb)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "sx126x",
"maintainer": "nbdy",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "lora, sx126x",
"author": "nbdy",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/a2/40/5cc09c8d0a0d6f2cd14dd8c429a2d1ab1c1fea563f435cce6a18511956ce/sx126x-2.2.4.tar.gz",
"platform": null,
"description": "# sx126x\n\nA Python library for interfacing with SX126X LoRa modules. This library provides a simple API for configuring and using SX126X devices for wireless communication.\n\n## Hardware Requirements\n\nThis library is designed to work with SX126X LoRa modules connected to a Raspberry Pi. The default configuration assumes the module is connected to GPIO pins 5 and 6 for mode control, but this can be customized.\n\n## Installation\n\n**Using pip:**\n```shell\npip install sx126x\n```\n\n**Using uv:**\n```shell\nuv pip install sx126x\n```\n\nFor more information about uv, see https://docs.astral.sh/uv/\n\n## Default Configuration\n\n| Parameter | Default Value | Description |\n|----------------------|----------------------------|-----------------------------------------------------------------------|\n| `address` | `Address.parse(\"242.242\")` | Device address |\n| `net_id` | `1` | Network ID |\n| `channel` | `1` | Channel |\n| `port` | `None` | Serial port path |\n| `pin_m0` | `6` | [GPIO 6](https://pinout.xyz/pinout/pin31_gpio6/) \u2014 Mode select pin M0 |\n| `pin_m1` | `5` | [GPIO 5](https://pinout.xyz/pinout/pin29_gpio5/) \u2014 Mode select pin M1 |\n| `baud_rate` | `BaudRate.B9600` | UART baud rate |\n| `byte_size` | `8` | Number of data bits |\n| `parity` | `Parity.NONE` | Parity bit setting |\n| `stop_bits` | `1` | Number of stop bits |\n| `write_persist` | `False` | Write registers persistently |\n| `mode` | `Mode.CONFIGURATION` | Set M0 and M1 according to mode |\n| `timeout` | `2` | Read/write timeout in seconds |\n| `debug` | `False` | Enable debug logging |\n| `air_speed` | `AirSpeed.K2_4` | Air data rate |\n| `packet_size` | `PacketSize.SIZE_128` | Packet size |\n| `ambient_noise` | `AmbientNoise.DISABLED` | Ambient noise detection mode |\n| `transmit_power` | `TransmitPower.DBM_22` | RF transmit power |\n| `rssi` | `RSSI.DISABLED` | Add RSSI to RX data |\n| `transfer_method` | `TransferMethod.FIXED` | Transmission addressing mode |\n| `relay` | `Relay.DISABLED` | Enable or disable relay functionality |\n| `lbt` | `LBT.DISABLED` | Listen Before Talk mode |\n| `wor_control` | `WORControl.TRANSMIT` | WOR (Wake On Radio) mode control |\n| `wor_period` | `WORPeriod.MS_500` | WOR cycle period |\n| `crypt_key` | `CryptKey(0, 0)` | 16-bit encryption key |\n| `overwrite_defaults` | `True` | Whether to override internal default parameters |\n\n\n## Usage Examples\n\nThe following examples demonstrate how to use the SX126X library for basic sending and receiving operations.\n\n### Sender\n\n```python\nfrom sx126x import SX126X, Address\n\nlora = SX126X(Address(3, 4))\nlora.tx(Address(6, 9), b\"Hello from device 3.4\")\n```\n\n### Receiver\n\n```python\nfrom sx126x import SX126X, Address\n\nlora = SX126X(Address(6, 9))\naddress, data = lora.rx()\n# or\ndef lora_cb(address: Address, data: bytes) -> bool:\n if address.__str__() == \"3.4\" and data == b\"Hello from device 3.4\":\n print(f\"Received message: {data.decode()}\")\n return False # stop receiving\n return True # continue receiving\nlora.rx_loop(lora_cb)\n```\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": null,
"version": "2.2.4",
"project_urls": {
"Documentation": "https://github.com/nbdy/pysx126x/wiki",
"Homepage": "https://github.com/nbdy/pysx126x",
"Issues": "https://github.com/nbdy/pysx126x/issues",
"Repository": "https://github.com/nbdy/pysx126x.git"
},
"split_keywords": [
"lora",
" sx126x"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a62e0105c8cc671cc183838455f8efab284b3335f840c28a408886de4cb10c0c",
"md5": "d597fb8793583d00db76f8ae7f264956",
"sha256": "f722d7f4076bcb606a116053666e7a9f996360f5fffb8aca72e71e37aadb87a1"
},
"downloads": -1,
"filename": "sx126x-2.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d597fb8793583d00db76f8ae7f264956",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 15594,
"upload_time": "2025-10-21T19:02:44",
"upload_time_iso_8601": "2025-10-21T19:02:44.817051Z",
"url": "https://files.pythonhosted.org/packages/a6/2e/0105c8cc671cc183838455f8efab284b3335f840c28a408886de4cb10c0c/sx126x-2.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a2405cc09c8d0a0d6f2cd14dd8c429a2d1ab1c1fea563f435cce6a18511956ce",
"md5": "93ac91dc73c4bd548e5735addbd9b9d2",
"sha256": "abd38f0147475f37f178a5f34f57484517c0229913e319f3fc23a7d82c6f80d6"
},
"downloads": -1,
"filename": "sx126x-2.2.4.tar.gz",
"has_sig": false,
"md5_digest": "93ac91dc73c4bd548e5735addbd9b9d2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 29917,
"upload_time": "2025-10-21T19:02:45",
"upload_time_iso_8601": "2025-10-21T19:02:45.895275Z",
"url": "https://files.pythonhosted.org/packages/a2/40/5cc09c8d0a0d6f2cd14dd8c429a2d1ab1c1fea563f435cce6a18511956ce/sx126x-2.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-21 19:02:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nbdy",
"github_project": "pysx126x",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sx126x"
}