aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Hsu <ryan.hsu@telink-semi.com>2023-04-07 00:21:50 -0700
committerRyan Hsu <ryan.hsu@telink-semi.com>2023-04-07 00:23:56 -0700
commit6ea9df2468b105a8465a958ff574625dc55ed54a (patch)
treea551800168089f3831d8a2358d5e90cecbaa768a
parent568c6cb7f8e6b7c8c1a5f1c87521f36995a1694e (diff)
downloadrefDesignRcu-6ea9df2468b105a8465a958ff574625dc55ed54a.tar.gz
RCU update TX power level with manufacturer info
Use high power flag at 0x780F0 to set TX power level. For certain customer, use high power based on VID/PID. Provide the power setting thru Hardware Revision. "V1.0_B35" means 7.5dBm "V1.0_A63" means 3.5dBm Set the version number to 2.18 Bug: b/266562271 Bug: b/268733012 Test: Check the power output added to Hardware Revision string. Change-Id: I99258d852fb5719a25d993d5dad2e396b7e5aaaf
-rw-r--r--vendor/827x_ble_remote/app.c82
-rw-r--r--vendor/827x_ble_remote/app_att.c4
-rw-r--r--vendor/827x_ble_remote/app_custom.c36
-rw-r--r--version.h2
4 files changed, 111 insertions, 13 deletions
diff --git a/vendor/827x_ble_remote/app.c b/vendor/827x_ble_remote/app.c
index 7d709e7..e2beeae 100644
--- a/vendor/827x_ble_remote/app.c
+++ b/vendor/827x_ble_remote/app.c
@@ -67,7 +67,8 @@
#define MY_ADV_INTERVAL_MAX ADV_INTERVAL_25MS
#if (MCU_CORE_TYPE == MCU_CORE_8278)
- #define MY_RF_POWER_INDEX RF_POWER_P7p37dBm
+ #define MY_RF_POWER_INDEX RF_POWER_P3p50dBm
+
#else
#define MY_RF_POWER_INDEX RF_POWER_P3p01dBm
#endif
@@ -148,6 +149,10 @@ _attribute_data_retention_ u8 wakeup_key_keycount=0;
_attribute_data_retention_ u8 detpowerkey=0; //0:not det powerkey 1:det powerkey
+_attribute_data_retention_ u8 app_rcu_tx_power = RF_POWER_P3p50dBm;
+
+
+
_attribute_data_retention_ u8 mac_public[6];
extern u8 is_pairing_mode;
@@ -174,6 +179,79 @@ void app_set_printf_uart_flag(unsigned char data)
}
#endif
+void app_rcu_set_TxPower(u8 Index){
+
+ switch (Index) {
+ case RF_POWER_P11p26dBm :
+ case RF_POWER_P11p09dBm :
+ case RF_POWER_P10p83dBm :
+ case RF_POWER_P10p62dBm :
+ case RF_POWER_P10p30dBm :
+ case RF_POWER_P10p05dBm :
+ case RF_POWER_P9p79dBm :
+ case RF_POWER_P9p54dBm :
+ case RF_POWER_P9p23dBm :
+ case RF_POWER_P8p92dBm :
+ case RF_POWER_P8p57dBm :
+ case RF_POWER_P8p20dBm :
+ case RF_POWER_P7p80dBm :
+ case RF_POWER_P7p37dBm :
+ case RF_POWER_P6p91dBm :
+ case RF_POWER_P6p45dBm :
+ case RF_POWER_P5p92dBm :
+ case RF_POWER_P5p33dBm :
+ case RF_POWER_P4p69dBm :
+ case RF_POWER_P3p99dBm :
+ case RF_POWER_P3p50dBm :
+ case RF_POWER_P3p33dBm :
+ case RF_POWER_P3p13dBm :
+ case RF_POWER_P2p93dBm :
+ case RF_POWER_P2p60dBm :
+ case RF_POWER_P2p36dBm :
+ case RF_POWER_P2p10dBm :
+ case RF_POWER_P1p83dBm :
+ case RF_POWER_P1p56dBm :
+ case RF_POWER_P1p25dBm :
+ case RF_POWER_P0p71dBm :
+ case RF_POWER_P0p52dBm :
+ case RF_POWER_N0p28dBm :
+ case RF_POWER_N0p51dBm :
+ case RF_POWER_N0p74dBm :
+ case RF_POWER_N1p21dBm :
+ case RF_POWER_N1p69dBm :
+ case RF_POWER_N2p23dBm :
+ case RF_POWER_N2p84dBm :
+ case RF_POWER_N3p48dBm :
+ case RF_POWER_N4p18dBm :
+ case RF_POWER_N4p97dBm :
+ case RF_POWER_N5p85dBm :
+ case RF_POWER_N6p83dBm :
+ case RF_POWER_N7p88dBm :
+ case RF_POWER_N9p14dBm :
+ case RF_POWER_N10p70dBm :
+ case RF_POWER_N12p57dBm :
+ case RF_POWER_N15p01dBm :
+ case RF_POWER_N18p40dBm :
+ case RF_POWER_N24p28dBm :
+ app_rcu_tx_power = Index;
+ break;
+ default:
+ app_rcu_tx_power = RF_POWER_P3p50dBm;
+ break;
+ }
+
+
+ /* set TX power index to hardware revision */
+ extern u8 my_HWRevtrs [];
+ my_HWRevtrs[5] = (app_rcu_tx_power&BIT(7))?'A':'B';
+ my_HWRevtrs[6] = (app_rcu_tx_power&0x3F)/10 + '0';
+ my_HWRevtrs[7] = (app_rcu_tx_power&0x3F)%10 + '0';
+
+ printf("[NOTICE] Set TX power[%c%c%c]\n",my_HWRevtrs[5],my_HWRevtrs[6],my_HWRevtrs[7]);
+
+}
+
+
void app_enter_deep_timeset(void)
{
enterdeep_time = ADV_IDLE_ENTER_DEEP_COUNT;
@@ -649,7 +727,7 @@ _attribute_ram_code_ void user_set_rf_power (u8 e, u8 *p, int n)
rf_set_power_level_index(RF_POWER_P7p37dBm);
else
#endif
- rf_set_power_level_index (MY_RF_POWER_INDEX);
+ rf_set_power_level_index (app_rcu_tx_power);
}
diff --git a/vendor/827x_ble_remote/app_att.c b/vendor/827x_ble_remote/app_att.c
index 3a33622..64100ef 100644
--- a/vendor/827x_ble_remote/app_att.c
+++ b/vendor/827x_ble_remote/app_att.c
@@ -108,7 +108,9 @@ static const gap_periConnectParams_t my_periConnParameters = {8, 11, 0, 1000};
// _attribute_data_retention_ u8 my_SWRevtrs [] = {'V','1','.','0','2'};
static const u8 my_SWRevtrs [] = {'V', 0x30+((FW_VERSION>>8)&0x0f), '.', 0x30+((FW_VERSION>>4)&0x0f), 0x30+(FW_VERSION&0x0f)};
- static const u8 my_HWRevtrs [] = {'V','1','.','0'};
+// static const u8 my_HWRevtrs [] = {'V','1','.','0'};
+ _attribute_data_retention_ u8 my_HWRevtrs [] = {'V','1','.','0','_','A','6','3'};
+
static const u8 my_ManuNametrs [] = {'T','e','l','i','n','k'};
//////////////////////// Battery /////////////////////////////////////////////////
diff --git a/vendor/827x_ble_remote/app_custom.c b/vendor/827x_ble_remote/app_custom.c
index 26efbbf..818ab9c 100644
--- a/vendor/827x_ble_remote/app_custom.c
+++ b/vendor/827x_ble_remote/app_custom.c
@@ -55,6 +55,13 @@ typedef enum
}app_custom_data_update_sts;
+typedef struct{
+ u8 vid_src;
+ u16 vid;
+ u16 pid;
+ u16 prod_ver;
+}app_pnpid_format_t;
+
#define APP_CUSTOM_CMD_DATA_UPDATE_PREPARE 0xED00
#define APP_CUSTOM_CMD_DATA_UPDATE_START 0xED01
#define APP_CUSTOM_CMD_DATA_UPDATE_END 0xED02
@@ -602,15 +609,6 @@ void app_custom_data_update(void)
*/
void app_custom_init(void)
{
- /* 2.17 only
- * Special version, if the address APP_TX_POWER is 0xff, write 0x23 (TX power7.37dBm) */
- u8 my_TxPoewr = 0x00;
- flash_read_page(APP_TX_POWER_ADDR, 1 , &my_TxPoewr);
- if(0xff == my_TxPoewr){
- my_TxPoewr = RF_POWER_P7p37dBm;
- flash_write_page(APP_TX_POWER_ADDR, 1 , &my_TxPoewr);
- }
-
u8 buffer[80];
u8 addr_pos=0,i;
u8 *pREMOTE_B046 = (u8 *)("RemoteB046");
@@ -717,6 +715,26 @@ void app_custom_init(void)
app_woble_init_settings(_custom_data.wakeup_packet, my_woble_adv_type);
app_custom_param_init(_custom_data.device_ui_layout);
+
+
+ /* 230214 by ken. read TX power settings */
+ extern void app_rcu_set_TxPower(u8 Index);
+
+ app_pnpid_format_t *p_my_pnpid = (app_pnpid_format_t *)_custom_data.pnp_id;
+
+ if((0x01 == p_my_pnpid->vid_src) && (0x0957 == p_my_pnpid->vid) && (0x0005 == p_my_pnpid->pid)){
+ /* Customized settings for special customers */
+ app_rcu_set_TxPower(RF_POWER_P7p37dBm);
+ }else{
+ u8 my_TxPoewr = 0x00;
+ flash_read_page(APP_TX_POWER_ADDR, 1 , &my_TxPoewr);
+ if(0xff != my_TxPoewr){
+ app_rcu_set_TxPower(my_TxPoewr);
+ }
+ }
+
+
+
}
/**
diff --git a/version.h b/version.h
index d032d13..2910c30 100644
--- a/version.h
+++ b/version.h
@@ -27,6 +27,6 @@
#ifndef VERSION_H_
#define VERSION_H_
-#define FW_VERSION 0x34210217//FW:v3.4.2 SW:v2.17
+#define FW_VERSION 0x34210218//FW:v3.4.2 SW:v2.18
#endif /* VERSION_H_ */