Solaris Software
Loading...
Searching...
No Matches
sx1262.c File Reference

sx1262 module telemetry + SPP service implementation. More...

#include "spp/services/sx1262/sx1262.h"
#include <stdio.h>
#include <string.h>
#include "spp/core/packet.h"
#include "spp/hal/spi.h"
#include "spp/hal/gpio/gpio.h"
#include "spp/hal/time/time.h"
Include dependency graph for sx1262.c:

Go to the source code of this file.

Functions

static SPP_RetVal_t SPP_SERVICES_SX1262_init (void)
static SPP_RetVal_t SPP_SERVICES_SX1262_consumeData (void *p_data)
static SPP_RetVal_t SPP_SERVICES_SX1262_deliverToMailbox (const SPP_Packet_t p_pkt)
static SPP_SERVICE_ConsumerContract_t SPP_SERVICES_SX1262_getConsumerContract ()
static void SPP_SERVICES_SX1262_bmpPacket_to_text (SPP_Packet_t *p_pkt, char *dataStr)
static void SPP_SERVICES_SX1262_icmPacket_to_text (SPP_Packet_t *p_pkt, char *dataStr)
SPP_RetVal_t SX1262_Transmit (void *p_handle, spp_uint8_t *p_data, spp_uint8_t length)
SPP_RetVal_t SX1262_SetStandby (void *p_handle)
SPP_RetVal_t SX1262_SetTx (void *p_handle, spp_uint32_t timeout)
SPP_RetVal_t SX1262_SetPacketType (void *p_handle)
SPP_RetVal_t SX1262_SetRfFrequency (void *p_handle)
SPP_RetVal_t SX1262_SetPaConfig (void *p_handle)
SPP_RetVal_t SX1262_CalibrateImage (void *p_handle)
SPP_RetVal_t SX1262_SetTxParams (void *p_handle)
SPP_RetVal_t SX1262_SetBufferBaseAddress (void *p_handle)
SPP_RetVal_t SX1262_WriteBuffer (void *p_handle, spp_uint8_t *p_data, spp_uint8_t length)
SPP_RetVal_t SX1262_SetModulationParams (void *p_handle, spp_uint8_t sf, spp_uint8_t bw, spp_uint8_t cr, spp_uint8_t ldro)
SPP_RetVal_t SX1262_SetPacketParams (void *p_handle, spp_uint16_t preambleLength, spp_uint8_t payloadLength)
SPP_RetVal_t SX1262_SetDioIrqParams (void *p_handle, spp_uint16_t irqMask, spp_uint16_t dio1Mask, spp_uint16_t dio2Mask, spp_uint16_t dio3Mask)
SPP_RetVal_t SX1262_ClearIrqStatus (void *p_handle, spp_uint16_t clearMask)
void SX1262_InitInterrupts (void)
SPP_RetVal_t SX1262_WaitForTxDone (void *p_handle)
SPP_RetVal_t SX1262_WaitBusy (void)

Variables

static SPP_Packet_t mailboxData [K_SX1262_MAILBOX_SIZE] = {0}
static spp_uint8_t mailboxHead = 0
static spp_uint8_t mailboxTail = 0
static spp_uint8_t mailboxCount = 0
static spp_uint32_t s_frame_number = 1
static SPP_SERVICE_ConsumerContract_t sx1262Contract
volatile spp_bool_t g_txDoneFlag = SPP_FALSE
SPP_GpioIsrCtx_t g_dio1Ctx = { .p_flag = &g_txDoneFlag }

Detailed Description

sx1262 module telemetry + SPP service implementation.

Definition in file sx1262.c.

Function Documentation

◆ SPP_SERVICES_SX1262_init()

SPP_RetVal_t SPP_SERVICES_SX1262_init ( void )
static

Definition at line 57 of file sx1262.c.

References K_SPP_OK, SPP_SERVICES_SX1262_init(), and SX1262_InitInterrupts().

Referenced by SPP_SERVICES_SX1262_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_SX1262_consumeData()

SPP_RetVal_t SPP_SERVICES_SX1262_consumeData ( void * p_data)
static

Definition at line 78 of file sx1262.c.

References K_ICM20948_SERVICE_APID, K_SPP_OK, mailboxCount, mailboxData, mailboxHead, s_frame_number, SPP_Packet_t, SPP_SERVICES_SX1262_bmpPacket_to_text(), SPP_SERVICES_SX1262_consumeData(), and SPP_SERVICES_SX1262_icmPacket_to_text().

Referenced by SPP_SERVICES_SX1262_consumeData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_SX1262_deliverToMailbox()

SPP_RetVal_t SPP_SERVICES_SX1262_deliverToMailbox ( const SPP_Packet_t p_pkt)
static

Definition at line 64 of file sx1262.c.

References K_SPP_ERROR, K_SPP_OK, mailboxCount, mailboxData, mailboxTail, SPP_Packet_t, and SPP_SERVICES_SX1262_deliverToMailbox().

Referenced by SPP_SERVICES_SX1262_deliverToMailbox().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_SX1262_getConsumerContract()

SPP_SERVICE_ConsumerContract_t SPP_SERVICES_SX1262_getConsumerContract ( )
static

Definition at line 109 of file sx1262.c.

References SPP_SERVICES_SX1262_getConsumerContract(), and sx1262Contract.

Referenced by SPP_SERVICES_SX1262_getConsumerContract().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_SX1262_bmpPacket_to_text()

void SPP_SERVICES_SX1262_bmpPacket_to_text ( SPP_Packet_t * p_pkt,
char * dataStr )
static

Definition at line 170 of file sx1262.c.

References SPP_Packet_t, and SPP_SERVICES_SX1262_bmpPacket_to_text().

Referenced by SPP_SERVICES_SX1262_bmpPacket_to_text(), and SPP_SERVICES_SX1262_consumeData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_SX1262_icmPacket_to_text()

void SPP_SERVICES_SX1262_icmPacket_to_text ( SPP_Packet_t * p_pkt,
char * dataStr )
static

Definition at line 183 of file sx1262.c.

References SPP_Packet_t, and SPP_SERVICES_SX1262_icmPacket_to_text().

Referenced by SPP_SERVICES_SX1262_consumeData(), and SPP_SERVICES_SX1262_icmPacket_to_text().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_Transmit()

SPP_RetVal_t SX1262_Transmit ( void * p_handle,
spp_uint8_t * p_data,
spp_uint8_t length )

Definition at line 113 of file sx1262.c.

References g_txDoneFlag, K_SPP_OK, SX1262_CalibrateImage(), SX1262_SetBufferBaseAddress(), SX1262_SetDioIrqParams(), SX1262_SetModulationParams(), SX1262_SetPacketParams(), SX1262_SetPacketType(), SX1262_SetPaConfig(), SX1262_SetRfFrequency(), SX1262_SetStandby(), SX1262_SetTx(), SX1262_SetTxParams(), SX1262_Transmit(), SX1262_WaitForTxDone(), and SX1262_WriteBuffer().

Referenced by SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetStandby()

SPP_RetVal_t SX1262_SetStandby ( void * p_handle)

Definition at line 204 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_STANDBY, SX1262_SetStandby(), and SX1262_WaitBusy().

Referenced by SX1262_SetStandby(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetTx()

SPP_RetVal_t SX1262_SetTx ( void * p_handle,
spp_uint32_t timeout )

Definition at line 216 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_TX, SX1262_SetTx(), and SX1262_WaitBusy().

Referenced by SX1262_SetTx(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetPacketType()

SPP_RetVal_t SX1262_SetPacketType ( void * p_handle)

Definition at line 239 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_PACKET_TYPE, SX1262_SetPacketType(), and SX1262_WaitBusy().

Referenced by SX1262_SetPacketType(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetRfFrequency()

SPP_RetVal_t SX1262_SetRfFrequency ( void * p_handle)

Definition at line 252 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_RF_FRECUENCY, SX1262_SetRfFrequency(), and SX1262_WaitBusy().

Referenced by SX1262_SetRfFrequency(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetPaConfig()

SPP_RetVal_t SX1262_SetPaConfig ( void * p_handle)

Definition at line 267 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_PA_CONFIG, SX1262_SetPaConfig(), and SX1262_WaitBusy().

Referenced by SX1262_SetPaConfig(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_CalibrateImage()

SPP_RetVal_t SX1262_CalibrateImage ( void * p_handle)

Definition at line 282 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_CalibrateImage(), SX1262_OPCODE_CALIBRATE_IMAGE, and SX1262_WaitBusy().

Referenced by SX1262_CalibrateImage(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetTxParams()

SPP_RetVal_t SX1262_SetTxParams ( void * p_handle)

Definition at line 296 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_TX_PARAMS, SX1262_SetTxParams(), and SX1262_WaitBusy().

Referenced by SX1262_SetTxParams(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetBufferBaseAddress()

SPP_RetVal_t SX1262_SetBufferBaseAddress ( void * p_handle)

Definition at line 312 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_BUFFER_BASE_ADDRESS, SX1262_SetBufferBaseAddress(), and SX1262_WaitBusy().

Referenced by SX1262_SetBufferBaseAddress(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_WriteBuffer()

SPP_RetVal_t SX1262_WriteBuffer ( void * p_handle,
spp_uint8_t * p_data,
spp_uint8_t length )

Definition at line 325 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_WRITE_BUFFER, SX1262_WaitBusy(), and SX1262_WriteBuffer().

Referenced by SX1262_Transmit(), and SX1262_WriteBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetModulationParams()

SPP_RetVal_t SX1262_SetModulationParams ( void * p_handle,
spp_uint8_t sf,
spp_uint8_t bw,
spp_uint8_t cr,
spp_uint8_t ldro )

Definition at line 350 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_MODULATION_PARAMS, SX1262_SetModulationParams(), and SX1262_WaitBusy().

Referenced by SX1262_SetModulationParams(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetPacketParams()

SPP_RetVal_t SX1262_SetPacketParams ( void * p_handle,
spp_uint16_t preambleLength,
spp_uint8_t payloadLength )

Definition at line 365 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_PACKET_PARAMS, SX1262_SetPacketParams(), and SX1262_WaitBusy().

Referenced by SX1262_SetPacketParams(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_SetDioIrqParams()

SPP_RetVal_t SX1262_SetDioIrqParams ( void * p_handle,
spp_uint16_t irqMask,
spp_uint16_t dio1Mask,
spp_uint16_t dio2Mask,
spp_uint16_t dio3Mask )

Definition at line 387 of file sx1262.c.

References SPP_HAL_SPI_transmit(), SX1262_OPCODE_SET_DIO_IRQ_PARAMS, SX1262_SetDioIrqParams(), and SX1262_WaitBusy().

Referenced by SX1262_SetDioIrqParams(), and SX1262_Transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_ClearIrqStatus()

SPP_RetVal_t SX1262_ClearIrqStatus ( void * p_handle,
spp_uint16_t clearMask )

Definition at line 404 of file sx1262.c.

References K_SPP_OK, SPP_HAL_SPI_transmit(), SX1262_ClearIrqStatus(), SX1262_OPCODE_CLEAR_IRQ_STATUS, and SX1262_WaitBusy().

Referenced by SX1262_ClearIrqStatus(), and SX1262_WaitForTxDone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_InitInterrupts()

void SX1262_InitInterrupts ( void )

Definition at line 418 of file sx1262.c.

References g_dio1Ctx, SPP_HAL_GPIO_configInterrupt(), SPP_HAL_GPIO_registerIsr(), SX1262_InitInterrupts(), and SX126X_DIO1_PIN.

Referenced by SPP_SERVICES_SX1262_init(), and SX1262_InitInterrupts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_WaitForTxDone()

SPP_RetVal_t SX1262_WaitForTxDone ( void * p_handle)

Definition at line 427 of file sx1262.c.

References g_txDoneFlag, SX1262_ClearIrqStatus(), and SX1262_WaitForTxDone().

Referenced by SX1262_Transmit(), and SX1262_WaitForTxDone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SX1262_WaitBusy()

SPP_RetVal_t SX1262_WaitBusy ( void )

Definition at line 451 of file sx1262.c.

References K_SPP_OK, SX1262_BUSY_PIN, and SX1262_WaitBusy().

Referenced by SX1262_CalibrateImage(), SX1262_ClearIrqStatus(), SX1262_SetBufferBaseAddress(), SX1262_SetDioIrqParams(), SX1262_SetModulationParams(), SX1262_SetPacketParams(), SX1262_SetPacketType(), SX1262_SetPaConfig(), SX1262_SetRfFrequency(), SX1262_SetStandby(), SX1262_SetTx(), SX1262_SetTxParams(), SX1262_WaitBusy(), and SX1262_WriteBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ mailboxData

SPP_Packet_t mailboxData[K_SX1262_MAILBOX_SIZE] = {0}
static

◆ mailboxHead

spp_uint8_t mailboxHead = 0
static

Definition at line 22 of file sx1262.c.

Referenced by SPP_SERVICES_SX1262_consumeData().

◆ mailboxTail

spp_uint8_t mailboxTail = 0
static

Definition at line 23 of file sx1262.c.

Referenced by SPP_SERVICES_SX1262_deliverToMailbox().

◆ mailboxCount

spp_uint8_t mailboxCount = 0
static

◆ s_frame_number

spp_uint32_t s_frame_number = 1
static

Definition at line 26 of file sx1262.c.

Referenced by SPP_SERVICES_SX1262_consumeData().

◆ sx1262Contract

SPP_SERVICE_ConsumerContract_t sx1262Contract
static
Initial value:
= {
.consumerID = K_SX1262_SERVICE_APID,
.priority = 1,
.p_nameConsumer = "sx1262",
.tiemoutMs = K_SX1262_TASK_TIMEOUT_MS,
}
static SPP_RetVal_t SPP_SERVICES_SX1262_consumeData(void *p_data)
Definition sx1262.c:78
static SPP_RetVal_t SPP_SERVICES_SX1262_deliverToMailbox(const SPP_Packet_t p_pkt)
Definition sx1262.c:64
static SPP_RetVal_t SPP_SERVICES_SX1262_init(void)
Definition sx1262.c:57

Definition at line 28 of file sx1262.c.

Referenced by SPP_SERVICES_SX1262_getConsumerContract().

◆ g_txDoneFlag

volatile spp_bool_t g_txDoneFlag = SPP_FALSE

Definition at line 38 of file sx1262.c.

Referenced by SX1262_Transmit(), and SX1262_WaitForTxDone().

◆ g_dio1Ctx

SPP_GpioIsrCtx_t g_dio1Ctx = { .p_flag = &g_txDoneFlag }

Definition at line 39 of file sx1262.c.

Referenced by SX1262_InitInterrupts().