1 /* USER CODE BEGIN Header */
2 /**
3   ******************************************************************************
4   * @file    power_table.c
5   * @author  MCD Application Team
6   * @brief   This file contains supported power tables
7   ******************************************************************************
8   * @attention
9   *
10   * Copyright (c) 2022 STMicroelectronics.
11   * All rights reserved.
12   *
13   * This software is licensed under terms that can be found in the LICENSE file
14   * in the root directory of this software component.
15   * If no LICENSE file comes with this software, it is provided AS-IS.
16   *
17   ******************************************************************************
18   */
19 /* USER CODE END Header */
20 
21 /* Includes ------------------------------------------------------------------*/
22 #include "power_table.h"
23 
24 /* Private typedef -----------------------------------------------------------*/
25 
26 /* VDD_LDO values to be written in PHY registers to select the TX_Power mode.
27  * g_vdd_ldo_value_1 : is to be set in PHY register address 0x63.
28  * g_vdd_ldo_value_2 : is to be set in PHY register address 0xEA. */
29 
30 typedef enum _vdd_ldo_value_e {
31   VDD_LDO_VALUE_MAX_POWER  = 0x70,
32   VDD_LDO_VALUE_LOW_POWER  = 0x20,
33   VDD_LDO_VALUE_2_ID_0  = 0x00,
34 } vdd_ldo_value_e;
35 
36 /* Private defines -----------------------------------------------------------*/
37 /* Private macros ------------------------------------------------------------*/
38 /* Private variables ---------------------------------------------------------*/
39 
40 const power_table_entry ll_tx_power_table_max_power[] = {
41   {0x02, 0x02, 0x01, -20}, /* Actual_Power = -20.4 dBm */
42   {0x02, 0x03, 0x01, -19}, /* Actual_Power = -19.4 dBm */
43   {0x02, 0x04, 0x01, -18}, /* Actual_Power = -18.3 dBm */
44   {0x02, 0x05, 0x01, -17}, /* Actual_Power = -17.3 dBm */
45   {0x02, 0x06, 0x01, -16}, /* Actual_Power = -16.4 dBm */
46   {0x02, 0x07, 0x01, -15}, /* Actual_Power = -15.4 dBm */
47   {0x02, 0x08, 0x01, -14}, /* Actual_Power = -14.3 dBm */
48   {0x02, 0x09, 0x01, -13}, /* Actual_Power = -13.3 dBm */
49   {0x02, 0x0A, 0x01, -12}, /* Actual_Power = -12.3 dBm */
50   {0x02, 0x0B, 0x01, -11}, /* Actual_Power = -11.4 dBm */
51   {0x02, 0x0C, 0x01, -10}, /* Actual_Power = -10.4 dBm */
52   {0x02, 0x0D, 0x01, -9},  /* Actual_Power = -9.5 dBm */
53   {0x02, 0x0E, 0x01, -8},  /* Actual_Power = -8.4 dBm */
54   {0x00, 0x0F, 0x01, -7},  /* Actual_Power = -7.5 dBm */
55   {0x00, 0x10, 0x01, -6},  /* Actual_Power = -6.5 dBm */
56   {0x00, 0x11, 0x01, -5},  /* Actual_Power = -5.4 dBm */
57   {0x00, 0x12, 0x01, -4},  /* Actual_Power = -4.5 dBm */
58   {0x00, 0x13, 0x01, -3},  /* Actual_Power = -3.5 dBm */
59   {0x02, 0x14, 0x01, -2},  /* Actual_Power = -2.4 dBm */
60   {0x00, 0x15, 0x01, -1},  /* Actual_Power = -1.5 dBm */
61   {0x02, 0x16, 0x01, 0},   /* Actual_Power = -0.3 dBm */
62   {0x00, 0x17, 0x01, 1},   /* Actual_Power = 0.9 dBm */
63   {0x00, 0x18, 0x01, 2},   /* Actual_Power = 2.3 dBm */
64   {0x02, 0x18, 0x01, 3},   /* Actual_Power = 2.8 dBm */
65   {0x00, 0x19, 0x01, 4},   /* Actual_Power = 3.9 dBm */
66   {0x02, 0x19, 0x01, 5},   /* Actual_Power = 4.8 dBm */
67   {0x03, 0x19, 0x01, 6},   /* Actual_Power = 5.6 dBm */
68   {0x05, 0x19, 0x01, 7},   /* Actual_Power = 6.9 dBm */
69   {0x06, 0x19, 0x01, 8},   /* Actual_Power = 7.5 dBm */
70   {0x08, 0x19, 0x01, 9},   /* Actual_Power = 8.5 dBm */
71   {0x0D, 0x19, 0x01, 10},  /* Actual_Power = 10 dBm */
72 };
73 
74 const power_table_entry ll_tx_power_table_low_power[] = {
75   {0x02, 0x02, 0x01, -20}, /* Actual_Power = -20.5 dBm */
76   {0x02, 0x03, 0x01, -19}, /* Actual_Power = -19.5 dBm */
77   {0x00, 0x05, 0x01, -18}, /* Actual_Power = -17.9 dBm */
78   {0x00, 0x06, 0x01, -17}, /* Actual_Power = -17.0 dBm */
79   {0x00, 0x07, 0x01, -16}, /* Actual_Power = -16.0 dBm */
80   {0x00, 0x08, 0x01, -15}, /* Actual_Power = -15.0 dBm */
81   {0x00, 0x09, 0x01, -14}, /* Actual_Power = -14.1 dBm */
82   {0x00, 0x0A, 0x01, -13}, /* Actual_Power = -13.1 dBm */
83   {0x00, 0x0B, 0x01, -12}, /* Actual_Power = -12.2 dBm */
84   {0x00, 0x0C, 0x01, -11}, /* Actual_Power = -11.3 dBm */
85   {0x00, 0x0D, 0x01, -10}, /* Actual_Power = -10.4 dBm */
86   {0x00, 0x0E, 0x01, -9},  /* Actual_Power = -9.4 dBm */
87   {0x00, 0x0F, 0x01, -8},  /* Actual_Power = -8.3 dBm */
88   {0x00, 0x10, 0x01, -7},  /* Actual_Power = -7.2 dBm */
89   {0x00, 0x11, 0x01, -6},  /* Actual_Power = -6.2 dBm */
90   {0x00, 0x12, 0x01, -5},  /* Actual_Power = -5.5 dBm */
91   {0x00, 0x13, 0x01, -4},  /* Actual_Power = -4.5 dBm */
92   {0x02, 0x14, 0x01, -3},  /* Actual_Power = -3.5 dBm */
93   {0x02, 0x15, 0x01, -2},  /* Actual_Power = -2.5 dBm */
94   {0x00, 0x17, 0x01, -1},  /* Actual_Power = -0.6 dBm */
95   {0x02, 0x17, 0x01, 0},   /* Actual_Power = -0.4 dBm */
96   {0x00, 0x18, 0x01, 1},   /* Actual_Power = 0.7 dBm */
97   {0x00, 0x19, 0x01, 2},   /* Actual_Power = 2.0 dBm */
98   {0x02, 0x19, 0x01, 3},   /* Actual_Power = 2.6 dBm */
99 };
100 
101 /* USER CODE BEGIN ll_tx_power_table */
102 
103 /* USER CODE END ll_tx_power_table */
104 
105 /* Supported TX_Power tables. */
106 const power_table_id_t ll_tx_power_tables[] = {
107   {ll_tx_power_table_max_power, sizeof(ll_tx_power_table_max_power)/sizeof(ll_tx_power_table_max_power[0]), VDD_LDO_VALUE_MAX_POWER, VDD_LDO_VALUE_2_ID_0, 0},
108   {ll_tx_power_table_low_power, sizeof(ll_tx_power_table_low_power)/sizeof(ll_tx_power_table_low_power[0]), VDD_LDO_VALUE_LOW_POWER, VDD_LDO_VALUE_2_ID_0, 1},
109   /* USER CODE BEGIN ll_tx_power_tables */
110 
111   /* USER CODE END ll_tx_power_tables */
112 };
113 
114 /* Number of supported TX_Power tables. */
115 const uint8_t num_of_supported_power_tables = sizeof(ll_tx_power_tables)/sizeof(ll_tx_power_tables[0]);
116 
117 /* Functions Definition ------------------------------------------------------*/
118 /* Private functions ----------------------------------------------------------*/
119 /* Public functions ----------------------------------------------------------*/
120