Lh2#

group bsp_lh2

Control the LH2 sensor.

Author

Filip Maksimovic filip.maksimovic@inria.fr

Author

Said Alvarado-Marin said-alexander.alvarado-marin@inria.fr

Author

Alexandre Abadie alexandre.abadie@inria.fr

Copyright

Inria, 2022

Defines

LH2_LOCATIONS_COUNT#

Number of computed locations.

Enums

enum db_lh2_state_t#

LH2 internal state.

Values:

enumerator DB_LH2_IDLE#

the lh2 engine is idle

enumerator DB_LH2_RUNNING#

the lh2 engine is running

enumerator DB_LH2_RAW_DATA_READY#

some lh2 raw data is available

enumerator DB_LH2_LOCATION_READY#

some lh2 location is ready to be read

Functions

void db_lh2_init(db_lh2_t *lh2, const gpio_t *gpio_d, const gpio_t *gpio_e)#

Initialize LH2.

Parameters:
  • lh2[in] pointer to the lh2 instance

  • gpio_d[in] pointer to gpio data

  • gpio_e[in] pointer to gpio event

void db_lh2_process_raw_data(db_lh2_t *lh2)#

Process raw data coming from the lighthouse.

Parameters:
  • lh2[in] pointer to the lh2 instance

void db_lh2_process_location(db_lh2_t *lh2)#

Compute the location based on available raw data.

Parameters:
  • lh2[in] pointer to the lh2 instance

void db_lh2_start(db_lh2_t *lh2)#

Start the LH2 frame acquisition.

Parameters:
  • lh2[in] pointer to the lh2 instance

void db_lh2_stop(db_lh2_t *lh2)#

Stop the LH2 frame acquisition.

Parameters:
  • lh2[in] pointer to the lh2 instance

void db_lh2_reset(db_lh2_t *lh2)#

Reset the lh2 internal state so new location computation can be made.

Parameters:
  • lh2[in] pointer to the lh2 instance

struct db_lh2_raw_data_t#

LH2 raw data.

Public Members

uint64_t bits_sweep#

bits sweep is the result of the demodulation, sweep_N indicates which SPI transfer those bits are associated with

uint8_t selected_polynomial#

selected poly is the polyomial # (between 0 and 31) that the demodulation code thinks the demodulated bits are a part of, initialize to error state

int8_t bit_offset#

bit_offset indicates an offset between the start of the packet, as indicated by envelope dropping, and the 17-bit sequence that is verified to be in a known LFSR sequence

struct db_lh2_location_t#

LH2 raw data location.

Public Members

uint8_t selected_polynomial#

selected poly is the polyomial # (between 0 and 31) that the demodulation code thinks the demodulated bits are a part of, initialize to error state

uint32_t lfsr_location#

LFSR location is the position in a given polynomial’s LFSR that the decoded data is, initialize to error state.

struct db_lh2_t#

LH2 instance.

Public Members

db_lh2_state_t state#

current state of the lh2 engine

db_lh2_raw_data_t raw_data[LH2_LOCATIONS_COUNT]#

raw data decoded from the lighthouse

db_lh2_location_t locations[LH2_LOCATIONS_COUNT]#

buffer holding the computed locations