C-libraries for QPSK modulation and demodulation
▼ include | |
butterworth_filter.h | Butterworth Filter implementation for filtering continues signal Original code from: https://github.com/filoe/cscore |
bytes_symbols_converter.h | Methods to convert array of bytes to symbols and back |
pll.h | Numerically-controlled Phase locked loop |
qpsk_demodulator.h | QPSK demodulator (decoder) |
qpsk_modulator.h | QPSK modulator (encoder) |
rrc_filter.h | Root raised cosine (RRC) filter implementation by Fern Lane for filtering continues signal |
▼ src | |
butterworth_filter.c | Butterworth Filter implementation for filtering continues signal Original code from: https://github.com/filoe/cscore |
bytes_symbols_converter.c | Methods to convert array of bytes to symbols and back |
pll.c | Numerically-controlled Phase locked loop |
qpsk_demodulator.c | QPSK demodulator (decoder) |
qpsk_modulator.c | QPSK modulator (encoder) |
rrc_filter.c | Root raised cosine (RRC) filter implementation by Fern Lane for filtering continues signal |
Generated by 1.9.8
qpsk_modulator_s * | qpsk_modulator_init (float sample_rate, float carrier_frequency, float bandwidth, uint16_t halfcycles_per_symbol, float amplitude_peak) |
Initializes QPSK demodulator. | |
uint32_t | qpsk_modulator_calculate_samples_chunk_length (qpsk_modulator_s *qpsk_modulator, uint32_t symbols_chunk_length) |
Calculates the size of the array of sample after modulation. | |
void | qpsk_modulator_modulate_chunk (qpsk_modulator_s *qpsk_modulator, uint8_t *symbols_chunk, uint32_t symbols_chunk_length, float *samples_chunk, uint8_t debug_messages) |
Modulates chunk of symbols. | |
void | qpsk_modulator_reset (qpsk_modulator_s *qpsk_modulator) |
Resets QPSK modulator to the initial state. | |
void | qpsk_modulator_destroy (qpsk_modulator_s *qpsk_modulator) |
Frees all memory allocated by QPSK modulator. | |
QPSK modulator (encoder)
- Author
- Fern Lane
- Version
- 1.0.0
- Date
- 2023-09-26
- Copyright
- Copyright (c) 2023
Copyright (C) 2023 Fern Lane, QPSK modulator / demodulator libraries Licensed under the GNU Affero General Public License, Version 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.gnu.org/licenses/agpl-3.0.en.html Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file qpsk_modulator.c.
◆ qpsk_modulator_calculate_samples_chunk_length()
uint32_t qpsk_modulator_calculate_samples_chunk_length | ( | qpsk_modulator_s * | qpsk_modulator, |
uint32_t | symbols_chunk_length | ||
) |
Calculates the size of the array of sample after modulation.
- Parameters
-
qpsk_modulator QPSK modulator's struct symbols_chunk_length number of symbols
- Returns
- uint32_t number of samples
Definition at line 104 of file qpsk_modulator.c.
◆ qpsk_modulator_destroy()
void qpsk_modulator_destroy | ( | qpsk_modulator_s * | qpsk_modulator | ) |
Frees all memory allocated by QPSK modulator.
- Parameters
-
qpsk_modulator QPSK modulator's struct
Definition at line 252 of file qpsk_modulator.c.
◆ qpsk_modulator_init()
qpsk_modulator_s * qpsk_modulator_init | ( | float | sample_rate, |
float | carrier_frequency, | ||
float | bandwidth, | ||
uint16_t | halfcycles_per_symbol, | ||
float | amplitude_peak | ||
) |
Initializes QPSK demodulator.
- Parameters
-
sample_rate Sampling rate (in Hz) carrier_frequency Carrier frequency (in Hz) bandwidth Output signal required bandwidth (in Hz) halfcycles_per_symbol Rate of symbols in carrier halfcycles (2 halfcycles = 1 full carrier wave cycle) amplitude_peak Amplitude of modulated signal (peak value)
- Returns
- qpsk_modulator_s* QPSK modulator's struct
Definition at line 44 of file qpsk_modulator.c.
◆ qpsk_modulator_modulate_chunk()
void qpsk_modulator_modulate_chunk | ( | qpsk_modulator_s * | qpsk_modulator, |
uint8_t * | symbols_chunk, | ||
uint32_t | symbols_chunk_length, | ||
float * | samples_chunk, | ||
uint8_t | debug_messages | ||
) |
Modulates chunk of symbols.
- Parameters
-
qpsk_modulator QPSK modulator's struct symbols_chunk Array of symbols symbols_chunk_length Length of array of symbols samples_chunk Allocated array of samples (size must be qpsk_modulator_calculate_samples_chunk_length * sizeof(float)) debug_messages Enable printf() debug messages (greatly affects performance)
Definition at line 120 of file qpsk_modulator.c.
◆ qpsk_modulator_reset()
void qpsk_modulator_reset | ( | qpsk_modulator_s * | qpsk_modulator | ) |
Resets QPSK modulator to the initial state.
- Parameters
-
qpsk_modulator
Definition at line 232 of file qpsk_modulator.c.
Generated by 1.9.8
float | clampf (float value, float min, float max) |
Clamps float value to a range. | |
qpsk_demodulator_s * | qpsk_demodulator_init (float sample_rate, float lo_frequency, float bandwidth, uint16_t halfcycles_per_symbol, float carrier_start_threshold, float carrier_lost_threshold, float pll_lock_threshold, float pll_lock_time) |
Initializes QPSK demodulator. | |
void | qpsk_demodulator_demodulate_chunk (qpsk_demodulator_s *qpsk_demodulator, float *samples_chunk, uint32_t samples_chunk_size, uint8_t *symbols_chunk, uint8_t debug_messages) |
Demodulates one chunk of samples into symbols. | |
void | qpsk_demodulator_reset (qpsk_demodulator_s *qpsk_demodulator) |
Resets QPSK demodulator to the initial state. | |
void | qpsk_demodulator_destroy (qpsk_demodulator_s *qpsk_demodulator) |
Frees all memory allocated by QPSK demodulator. | |
QPSK demodulator (decoder)
- Author
- Fern Lane
- Version
- 1.0.0
- Date
- 2023-09-26
- Copyright
- Copyright (c) 2023
Copyright (C) 2023 Fern Lane, QPSK modulator / demodulator libraries Licensed under the GNU Affero General Public License, Version 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.gnu.org/licenses/agpl-3.0.en.html Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file qpsk_demodulator.c.
◆ clampf()
float clampf | ( | float | value, |
float | min, | ||
float | max | ||
) |
Clamps float value to a range.
- Parameters
-
value Value to clamp min Range minimum value max Range maximum value
- Returns
- float Clamped value
Definition at line 42 of file qpsk_demodulator.c.
◆ qpsk_demodulator_demodulate_chunk()
void qpsk_demodulator_demodulate_chunk | ( | qpsk_demodulator_s * | qpsk_demodulator, |
float * | samples_chunk, | ||
uint32_t | samples_chunk_size, | ||
uint8_t * | symbols_chunk, | ||
uint8_t | debug_messages | ||
) |
Demodulates one chunk of samples into symbols.
- Parameters
-
qpsk_demodulator QPSK demodulator's struct samples_chunk Aarray of samples samples_chunk_size Length of array of symbols symbols_chunk Allocated array of symbols (size equal to samples_chunk_size) 0xFF - no symbol decoded at current sample, 0b00, 0b01, 0b10, 0b11 - decoded symbols at specific samples debug_messages Enable printf() debug messages (greatly affects performance)
Definition at line 153 of file qpsk_demodulator.c.
◆ qpsk_demodulator_destroy()
void qpsk_demodulator_destroy | ( | qpsk_demodulator_s * | qpsk_demodulator | ) |
Frees all memory allocated by QPSK demodulator.
- Parameters
-
qpsk_demodulator QPSK demodulator's struct
Definition at line 481 of file qpsk_demodulator.c.
◆ qpsk_demodulator_init()
qpsk_demodulator_s * qpsk_demodulator_init | ( | float | sample_rate, |
float | lo_frequency, | ||
float | bandwidth, | ||
uint16_t | halfcycles_per_symbol, | ||
float | carrier_start_threshold, | ||
float | carrier_lost_threshold, | ||
float | pll_lock_threshold, | ||
float | pll_lock_time | ||
) |
Initializes QPSK demodulator.
- Parameters
-
sample_rate Sampling rate (in Hz) lo_frequency Carrier frequency (local oscillator) (in Hz) bandwidth Input signal bandwidth (in Hz) halfcycles_per_symbol Rate of symbols in carrier halfcycles (2 halfcycles = 1 full carrier wave cycle) carrier_start_threshold Signal must be above this threshold to start PLL locking and demodulating (in dBFS RMS) carrier_lost_threshold Signal must be below this threshold to stop PLL locking and demodulating (in dBFS RMS) pll_lock_threshold PLL's input (IQ error) should't change during pll_lock_time more than this value pll_lock_time PLL's input (IQ error) should't change during this time (in seconds) more than pll_lock_threshold
- Returns
- qpsk_demodulator_s* QPSK demodulator's struct
Definition at line 61 of file qpsk_demodulator.c.
◆ qpsk_demodulator_reset()
void qpsk_demodulator_reset | ( | qpsk_demodulator_s * | qpsk_demodulator | ) |
Resets QPSK demodulator to the initial state.
- Parameters
-
qpsk_demodulator QPSK demodulator's struct
Definition at line 449 of file qpsk_demodulator.c.
Generated by 1.9.8