Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of X_NUCLEO_IDB0XA1 by
Utils.cpp
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #include "Utils.h" 00018 00019 /**************************************************************************/ 00020 /*! 00021 @brief sets values of EN_HIGH_POWER and PA_LEVEL corresponding to dBMLevel of tx power 00022 00023 */ 00024 /**************************************************************************/ 00025 tBleStatus getHighPowerAndPALevelValue(int8_t dBMLevel, int8_t& EN_HIGH_POWER, int8_t& PA_LEVEL) { 00026 tBleStatus ret = BLE_STATUS_SUCCESS; 00027 00028 if(dBMLevel==-18) { 00029 EN_HIGH_POWER = 0; 00030 PA_LEVEL = 0; 00031 } 00032 else if(dBMLevel==-15) { 00033 EN_HIGH_POWER = 0; 00034 PA_LEVEL = 1; 00035 } 00036 else if(dBMLevel==-14) { 00037 EN_HIGH_POWER = 1; 00038 PA_LEVEL = 0; 00039 } 00040 else if(dBMLevel==-12) { 00041 EN_HIGH_POWER = 0; 00042 PA_LEVEL = 2; 00043 } 00044 else if(dBMLevel==-11) { 00045 EN_HIGH_POWER = 1; 00046 PA_LEVEL = 1; 00047 } 00048 else if(dBMLevel==-9) { 00049 EN_HIGH_POWER = 0; 00050 PA_LEVEL = 3; 00051 } 00052 else if(dBMLevel==-8) { 00053 EN_HIGH_POWER = 1; 00054 PA_LEVEL = 2; 00055 } 00056 else if(dBMLevel==-6) { 00057 EN_HIGH_POWER = 0; 00058 PA_LEVEL = 4; 00059 } 00060 else if(dBMLevel==-5) { 00061 EN_HIGH_POWER = 1; 00062 PA_LEVEL = 3; 00063 } 00064 else if(dBMLevel==-2) { 00065 EN_HIGH_POWER = 1; 00066 PA_LEVEL = 4; 00067 } 00068 else if(dBMLevel==0) { 00069 EN_HIGH_POWER = 0; 00070 PA_LEVEL = 6; 00071 } 00072 else if(dBMLevel==2) { 00073 EN_HIGH_POWER = 1; 00074 PA_LEVEL = 5; 00075 } 00076 else if(dBMLevel==4) { 00077 EN_HIGH_POWER = 1; 00078 PA_LEVEL = 6; 00079 } 00080 else if(dBMLevel==5) { 00081 EN_HIGH_POWER = 0; 00082 PA_LEVEL = 7; 00083 } 00084 else if(dBMLevel==8) { 00085 EN_HIGH_POWER = 1; 00086 PA_LEVEL = 7; 00087 } 00088 else { 00089 ret = ERR_INVALID_HCI_CMD_PARAMS; 00090 } 00091 00092 return ret; 00093 }
Generated on Tue Jul 12 2022 16:31:46 by
