Files
hpw421/component/rf24/Drivers/xc6xxx_rf_single/xc6xxx_rf_single.c
T
2026-07-03 18:08:25 +08:00

70 lines
1.9 KiB
C

/*!
* \file rf_2_4g.c
*
* \brief Target RF 2.4g implementation
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
*
* _ __ _ ________ _
* | |/ /(_)___ / ____/ /_ (_)___
* | // / __ \/ / / __ \/ / __ \
* / |/ / / / / /___/ / / / / /_/ /
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
* /_/
* (C) 2022-2025 XinChip
*
* \endcode
*
* \author ( XinChip ) Alex-J
*
* \author ( XinChip )
*/
/*-----------------------------------------------------------------------------------
INCLUDE HEADE FILES
------------------------------------------------------------------------------------*/
#include "xc6xxx_rf_single.h"
#include "xc6xxx.h"
/*------------------------------------------------------------------------------------
Macros
-------------------------------------------------------------------------------------*/
#define RF_SINGLE 0x01
/*------------------------------------------------------------------------------------
Functions
-------------------------------------------------------------------------------------*/
/**
* @brief RF single initialization
* @param void
*
* @retval void
*/
void rf_single_init(void)
{
/* Rf modem init*/
rf24g_modem_init();
/* Set up 2.4G RF modem*/
rf24g_config();
/* Set modulation frequency offset to 0 */
XC_RF_2_4G->TXPROC_CFG = 0x00;
/* Set to enter single carrier mode */
set_rf_DR(XINCX_RF_TRANS_RATE | RF_SINGLE);
/* Set configuration register */
XC_RF_2_4G->CFG_TOP = 0x298272;
/* Set transmission power */
set_rf_power(XINCX_POWER);
/* Set up crystal oscillator capacitor array */
freq_ctune(XINCX_2_4G_CRY_CPT_ARRAY);
}