1 /* 2 * Copyright 2018 Oticon A/S 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #ifndef BS_P2G4_UTILS_H 7 #define BS_P2G4_UTILS_H 8 9 /** 10 * Utility functions related to the 2.4G PhyCom IF 11 * Mostly, conversion functions from the 2.4G PhyCom types into more general types 12 */ 13 14 #include "bs_pc_2G4_types.h" 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 typedef enum {Mod_None, OnlyReceivable, OnlyNonReceivable} p2G4_mod_limits_t; 21 22 int p2G4_modulation_from_string(const char* name, p2G4_modulation_t *modulation, p2G4_mod_limits_t limit, int verb); 23 24 double p2G4_freq_to_d(p2G4_freq_t freq); 25 int p2G4_freq_from_d(double center_freq, int prevent_OOB, p2G4_freq_t *result); 26 p2G4_freq_t p2G4_center_freq_from_ble_ch_nbr(uint channel_idx); 27 28 p2G4_power_t p2G4_power_from_d(double power); 29 double p2G4_power_to_d(p2G4_power_t power); 30 31 double p2G4_RSSI_value_to_dBm(p2G4_rssi_power_t value); 32 p2G4_rssi_power_t p2G4_RSSI_value_from_dBm(double value); 33 34 #ifdef __cplusplus 35 } 36 #endif 37 38 #endif 39