lriot 2.1.0.0
lr1110_modem_gnss.h File Reference

GNSS scan driver definition for LR1110 modem. More...

#include <stdbool.h>
#include <stdint.h>
#include "modem/lr1110_modem_gnss_types.h"
#include "modem/lr1110_modem_common.h"
#include "lriot.h"

Go to the source code of this file.

Functions

err_t lr1110_modem_gnss_set_constellations_to_use (lriot_t *ctx, lr1110_modem_gnss_constellation_mask_t constellation_to_use)
 Activate the GNSS scan constellation.
 
err_t lr1110_modem_gnss_read_used_constellations (lriot_t *ctx, lr1110_modem_gnss_constellation_mask_t *constellations_used)
 Read constellation used by the GNSS scanner from the almanac update configuration.
 
err_t lr1110_modem_gnss_set_almanac_update (lriot_t *ctx, lr1110_modem_gnss_constellation_mask_t constellations_to_update)
 Activate the almanac update.
 
err_t lr1110_modem_gnss_read_almanac_update (lriot_t *ctx, lr1110_modem_gnss_constellation_mask_t *constellations_to_update)
 Function to read the almanac update configuration.
 
err_t lr1110_modem_gnss_set_frequency_search (lriot_t *ctx, lr1110_modem_gnss_frequency_search_space_mask_t frequency_search_space)
 Set the GNSS frequency search.
 
err_t lr1110_modem_gnss_read_frequency_search (lriot_t *ctx, lr1110_modem_gnss_frequency_search_space_mask_t *frequency_search_space)
 Read constellation used by the GNSS scanner from the almanac update configuration.
 
err_t lr1110_modem_gnss_read_firmware_version (lriot_t *ctx, lr1110_modem_gnss_version_t *version)
 Function to read the GNSS firmware version.
 
err_t lr1110_modem_gnss_read_supported_constellations (lriot_t *ctx, lr1110_modem_gnss_constellation_mask_t *supported_constellations)
 Function to read the supported constellation, GPS or BEIDOU other constellations.
 
err_t lr1110_modem_gnss_almanac_full_update (lriot_t *ctx, lr1110_modem_gnss_almanac_full_update_bytestream_t almanac_bytestream)
 Update full almanac for all satellites.
 
err_t lr1110_modem_gnss_one_chunk_almanac_update (lriot_t *ctx, lr1110_modem_gnss_almanac_one_chunk_bytestream_t almanac_one_chunk_bytestream)
 One chunk almanac update.
 
err_t lr1110_modem_gnss_set_assistance_position (lriot_t *ctx, lr1110_modem_gnss_solver_assistance_position_t *assistance_position)
 Function to set the assistance position.
 
err_t lr1110_modem_gnss_read_assistance_position (lriot_t *ctx, lr1110_modem_gnss_solver_assistance_position_t *assistance_position)
 Function to read the assistance position.
 
err_t lr1110_modem_gnss_set_xtal_error (lriot_t *ctx, float xtal_error_in_ppm)
 Function to set the Xtal error.
 
err_t lr1110_modem_gnss_read_xtal_error (lriot_t *ctx, float *xtal_error_in_ppm)
 Function to read the Xtal error.
 
err_t lr1110_modem_gnss_get_context (lriot_t *ctx, lr1110_modem_gnss_context_t *gnss_context)
 Function to read context status.
 
err_t lr1110_modem_gnss_get_nb_detected_satellites (lriot_t *ctx, uint8_t *nb_detected_satellites)
 Get the number of detected satellites during last scan.
 
err_t lr1110_modem_gnss_get_detected_satellites (lriot_t *ctx, uint8_t nb_detected_satellites, lr1110_modem_gnss_detected_satellite_t *detected_satellite_id_snr)
 Get the satellites detected on last scan with their IDs and C/N (aka. CNR)
 
err_t lr1110_modem_gnss_get_timings (lriot_t *ctx, lr1110_modem_gnss_timings_t *timings)
 Get the timings spent in signal acquisition and signal analyzis.
 
err_t lr1110_modem_gnss_almanac_read_by_index (lriot_t *ctx, uint8_t sv_id, uint8_t nb_sv, uint8_t *almanac_read, uint8_t buffer_len)
 Read at maximum 11 sv’s Almanac, starting from sv id.
 
err_t lr1110_modem_gnss_scan_autonomous (lriot_t *ctx, lr1110_modem_gnss_search_mode_t effort_mode, uint8_t gnss_result_mask, uint8_t nb_sat)
 GNSS scan with no assisted parameters needed.
 
err_t lr1110_modem_gnss_scan_assisted (lriot_t *ctx, lr1110_modem_gnss_search_mode_t effort_mode, uint8_t gnss_result_mask, uint8_t nb_sat)
 GNSS scan with assisted parameters.
 
err_t lr1110_modem_gnss_push_solver_msg (lriot_t *ctx, uint8_t *payload, uint16_t payload_size)
 Push data received from solver to LR1110 modem.
 

Detailed Description

GNSS scan driver definition for LR1110 modem.

Revised BSD License Copyright Semtech Corporation 2020. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the Semtech corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ lr1110_modem_gnss_almanac_full_update()

err_t lr1110_modem_gnss_almanac_full_update ( lriot_t * ctx,
lr1110_modem_gnss_almanac_full_update_bytestream_t almanac_bytestream )

Update full almanac for all satellites.

This function is to be used to update satellites almanac. Note that all 128 satellite almanacs must be update in a row. Therefore, this function must be called 128 times in a row without any other calls in between.

Parameters
[in]ctxChip implementation context
[in]almanac_bytestreamAlmanac buffer to update all almanac of the LR1110. It is up to the application to ensure that the buffer almanac_bytestream is indeed of size LR1110_MODEM_GNSS_FULL_ALMANAC_WRITE_BUFFER_SIZE
Returns
Operation status

◆ lr1110_modem_gnss_almanac_read_by_index()

err_t lr1110_modem_gnss_almanac_read_by_index ( lriot_t * ctx,
uint8_t sv_id,
uint8_t nb_sv,
uint8_t * almanac_read,
uint8_t buffer_len )

Read at maximum 11 sv’s Almanac, starting from sv id.

Parameters
[in]ctxChip implementation context
[in]sv_idSatellite ID
[in]nb_svNumber of satellites
Note
the maximum nb sv readable is 11.
Parameters
[out]almanac_readThe almanac buffer
Note
the minimal size of the buffer to provide is nb_sv * 22 bytes
Parameters
[in]buffer_lenBuffer len of the almanac_read buffer.
Returns
Operation status

◆ lr1110_modem_gnss_get_context()

err_t lr1110_modem_gnss_get_context ( lriot_t * ctx,
lr1110_modem_gnss_context_t * gnss_context )

Function to read context status.

Parameters
[in]ctxChip implementation context
[out]gnss_contextlr1110_modem_gnss_context_t
Returns
Operation status

◆ lr1110_modem_gnss_get_detected_satellites()

err_t lr1110_modem_gnss_get_detected_satellites ( lriot_t * ctx,
uint8_t nb_detected_satellites,
lr1110_modem_gnss_detected_satellite_t * detected_satellite_id_snr )

Get the satellites detected on last scan with their IDs and C/N (aka. CNR)

Parameters
[in]ctxChip implementation context
[in]nb_detected_satellitesNumber of detected satellites on last scan (obtained by calling lr1110_gnss_get_nb_detected_satellites)
[out]detected_satellite_id_snrPointer to an array of structures of size big enough to contain nb_detected_satellites elements
Returns
Operation status

◆ lr1110_modem_gnss_get_nb_detected_satellites()

err_t lr1110_modem_gnss_get_nb_detected_satellites ( lriot_t * ctx,
uint8_t * nb_detected_satellites )

Get the number of detected satellites during last scan.

Parameters
[in]ctxChip implementation context
[out]nb_detected_satellitesNumber of satellites detected
Returns
Operation status

◆ lr1110_modem_gnss_get_timings()

err_t lr1110_modem_gnss_get_timings ( lriot_t * ctx,
lr1110_modem_gnss_timings_t * timings )

Get the timings spent in signal acquisition and signal analyzis.

These timings allow to compute the current timings of the last GNSS scan.

Parameters
[in]ctxChip implementation context
[out]timingsGNSS timings of last GNSS scan
Returns
Operation status

◆ lr1110_modem_gnss_one_chunk_almanac_update()

err_t lr1110_modem_gnss_one_chunk_almanac_update ( lriot_t * ctx,
lr1110_modem_gnss_almanac_one_chunk_bytestream_t almanac_one_chunk_bytestream )

One chunk almanac update.

This function is to be used to update a single chunk almanac. Note that all 129 chunks almanacs must be updated in a row. Therefore, this function must be called 129 times in a row without any other calls in between.

On the contrary, lr1110_gnss_almanac_full_update can be used to update all almanacs in one call, but the application must be able to provide a buffer that holds all almanac (>2kB).

Parameters
[in]ctxChip implementation context
[in]almanac_one_chunk_bytestreamAlmanac buffer to update one chunk almanac of the LR1110. It is up to the application to ensure that bytestream is at least LR1110_MODEM_GNSS_SINGLE_ALMANAC_WRITE_SIZE long.
Returns
Status of the driver call

◆ lr1110_modem_gnss_push_solver_msg()

err_t lr1110_modem_gnss_push_solver_msg ( lriot_t * ctx,
uint8_t * payload,
uint16_t payload_size )

Push data received from solver to LR1110 modem.

Parameters
[in]ctxChip implementation context
[in]payloadPayload received from solver
[in]payload_sizeSize of the payload received from solver (in bytes)
Returns
Operation status

◆ lr1110_modem_gnss_read_almanac_update()

err_t lr1110_modem_gnss_read_almanac_update ( lriot_t * ctx,
lr1110_modem_gnss_constellation_mask_t * constellations_to_update )

Function to read the almanac update configuration.

Parameters
[in]ctxChip implementation context
[out]constellations_to_updateBit mask of the constellations to mark to update. See lr1110_modem_gnss_constellation_t for the possible values
Returns
Operation status

◆ lr1110_modem_gnss_read_assistance_position()

err_t lr1110_modem_gnss_read_assistance_position ( lriot_t * ctx,
lr1110_modem_gnss_solver_assistance_position_t * assistance_position )

Function to read the assistance position.

The assistance position read may be different from the one set beforehand with lr1110_modem_gnss_set_assistance_position due to a scaling computation.

Parameters
[in]ctxChip implementation context
[out]assistance_positionlatitude 12 bits and longitude 12 bits lr1110_modem_gnss_solver_assistance_position_t
Returns
Operation status

◆ lr1110_modem_gnss_read_firmware_version()

err_t lr1110_modem_gnss_read_firmware_version ( lriot_t * ctx,
lr1110_modem_gnss_version_t * version )

Function to read the GNSS firmware version.

Parameters
[in]ctxChip implementation context
[out]versionGNSS Firmware version currently running on the chip
Returns
Operation status

◆ lr1110_modem_gnss_read_frequency_search()

err_t lr1110_modem_gnss_read_frequency_search ( lriot_t * ctx,
lr1110_modem_gnss_frequency_search_space_mask_t * frequency_search_space )

Read constellation used by the GNSS scanner from the almanac update configuration.

Parameters
[in]ctxChip implementation context
[out]frequency_search_spaceBit mask of the frequency search space used. See lr1110_modem_gnss_frequency_search_space_mask_t for the possible values
See also
lr1110_modem_gnss_frequency_search_space_mask
Returns
Operation status

◆ lr1110_modem_gnss_read_supported_constellations()

err_t lr1110_modem_gnss_read_supported_constellations ( lriot_t * ctx,
lr1110_modem_gnss_constellation_mask_t * supported_constellations )

Function to read the supported constellation, GPS or BEIDOU other constellations.

Parameters
[in]ctxChip implementation context
[out]supported_constellationsBit mask of the constellations used. See lr1110_modem_gnss_constellation_mask_t for the possible values
Returns
Operation status

◆ lr1110_modem_gnss_read_used_constellations()

err_t lr1110_modem_gnss_read_used_constellations ( lriot_t * ctx,
lr1110_modem_gnss_constellation_mask_t * constellations_used )

Read constellation used by the GNSS scanner from the almanac update configuration.

Parameters
[in]ctxChip implementation context
[out]constellations_usedBit mask of the constellations used. See lr1110_modem_gnss_constellation_mask_t for the possible values
See also
lr1110_modem_gnss_set_constellations_to_use
Returns
Operation status

◆ lr1110_modem_gnss_read_xtal_error()

err_t lr1110_modem_gnss_read_xtal_error ( lriot_t * ctx,
float * xtal_error_in_ppm )

Function to read the Xtal error.

Parameters
[in]ctxChip implementation context
[out]xtal_error_in_ppmvalue returned between +/-30ppm
Returns
Operation status

◆ lr1110_modem_gnss_scan_assisted()

err_t lr1110_modem_gnss_scan_assisted ( lriot_t * ctx,
lr1110_modem_gnss_search_mode_t effort_mode,
uint8_t gnss_result_mask,
uint8_t nb_sat )

GNSS scan with assisted parameters.

Parameters
[in]ctxChip implementation context
[in]effort_modeEffort mode lr1110_modem_gnss_search_mode_t
[in]gnss_result_maskBit mask indicating which information is added in the output payload lr1110_modem_gnss_result_mask_e
[in]nb_satThe expected number of satellite to provide. This value must be in the range [0:128]
Returns
Operation status

◆ lr1110_modem_gnss_scan_autonomous()

err_t lr1110_modem_gnss_scan_autonomous ( lriot_t * ctx,
lr1110_modem_gnss_search_mode_t effort_mode,
uint8_t gnss_result_mask,
uint8_t nb_sat )

GNSS scan with no assisted parameters needed.

Warning
Parameter effort_mode can only be set to LR1110_MODEM_GNSS_OPTION_DEFAULT
Parameters
[in]ctxChip implementation context
[in]effort_modeEffort mode lr1110_modem_gnss_search_mode_t
[in]gnss_result_maskBit mask indicating which information is added in the output payload lr1110_modem_gnss_result_mask_e
[in]nb_satThe expected number of satellite to provide. This value must be in the range [0:128]
Returns
Operation status

◆ lr1110_modem_gnss_set_almanac_update()

err_t lr1110_modem_gnss_set_almanac_update ( lriot_t * ctx,
lr1110_modem_gnss_constellation_mask_t constellations_to_update )

Activate the almanac update.

Parameters
[in]ctxChip implementation context
[in]constellations_to_updateBit mask of the constellations to mark to update. See lr1110_modem_gnss_constellation_t for the possible values
Returns
Operation status

◆ lr1110_modem_gnss_set_assistance_position()

err_t lr1110_modem_gnss_set_assistance_position ( lriot_t * ctx,
lr1110_modem_gnss_solver_assistance_position_t * assistance_position )

Function to set the assistance position.

Parameters
[in]ctxChip implementation context
[in]assistance_positionlatitude 12 bits and longitude 12 bits lr1110_modem_gnss_solver_assistance_position_t
Returns
Operation status

◆ lr1110_modem_gnss_set_constellations_to_use()

err_t lr1110_modem_gnss_set_constellations_to_use ( lriot_t * ctx,
lr1110_modem_gnss_constellation_mask_t constellation_to_use )

Activate the GNSS scan constellation.

Parameters
[in]ctxChip implementation context
[in]constellation_maskBit mask of the constellations to use. See lr1110_modem_gnss_constellation_mask_t for the possible values
See also
lr1110_gnss_read_used_constellations
Returns
Operation status

◆ lr1110_modem_gnss_set_frequency_search()

err_t lr1110_modem_gnss_set_frequency_search ( lriot_t * ctx,
lr1110_modem_gnss_frequency_search_space_mask_t frequency_search_space )

Set the GNSS frequency search.

Parameters
[in]ctxChip implementation context
[in]frequency_search_spaceBit mask of the frequency search space to use. See lr1110_modem_gnss_frequency_search_space_mask_t for the possible values
See also
lr1110_modem_gnss_frequency_search_space_mask
Returns
Operation status

◆ lr1110_modem_gnss_set_xtal_error()

err_t lr1110_modem_gnss_set_xtal_error ( lriot_t * ctx,
float xtal_error_in_ppm )

Function to set the Xtal error.

Parameters
[in]ctxChip implementation context
[in]xtal_error_in_ppmvalue in +/-40ppm
Returns
Operation status