hpw422移植新的sdk

This commit is contained in:
xushaoxiang
2026-07-03 18:08:25 +08:00
commit 945a5a5b0b
2583 changed files with 713209 additions and 0 deletions
@@ -0,0 +1,18 @@
#ifndef __APP_64M__
#define __APP_64M__
#include "xc6xxx_rf_2_4g.h"
#define __write_hw_reg32(reg, val) ((*reg) = (val))
#define __read_hw_reg32(reg, val) ((val) = (*reg))
#define CPR_CTLAPBCLKEN_GRCTL ((volatile unsigned *)(0x40000000 + 0x070))
#define CPR_AOCLKEN_GRCTL ((volatile unsigned *)(0x40002400 + 0x7C))
#define AO_GPIO_MODE ((volatile unsigned *)(0x40002000 + 0x0044))
#define AO_GPIO_CTL ((volatile unsigned *)(0x40002000 + 0x0048))
void use_64m_crtstal_init(void);
void rf_64M_set_rx_channel(uint16_t channel);
void rf_64M_set_tx_channel(uint16_t channel);
void testpin_64M_config(void);
void Init_rtc_gpio(uint32_t num, uint8_t inter_mode);
#endif //__APP_64M__
@@ -0,0 +1,95 @@
/*
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2023-12-12 14:23:55
* @LastEditors: sueRimn
* @LastEditTime: 2024-06-07 13:46:09
*/
/*!
* \file main.h
*
* \brief The head file of main.c
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
*
* _ __ _ ________ _
* | |/ /(_)___ / ____/ /_ (_)___
* | // / __ \/ / / __ \/ / __ \
* / |/ / / / / /___/ / / / / /_/ /
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
* /_/
* (C) 2022-2025 XinChip
*
* \endcode
*
* \author ( XinChip ) Alex-J
*
* \author ( XinChip )
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H__
#define __MAIN_H__
#ifdef __cplusplus
extern "C"
{
#endif
/*-----------------------------------------------------------------------------------
INCLUDE HEADE FILES
------------------------------------------------------------------------------------*/
#include "rf_config.h"
#include "xc6xxx.h"
#include "xc6xxx_rf_2_4g.h"
#include "xc6xxx_rf_ADV.h"
#include "rf_compatible_normal.h"
/*------------------------------------------------------------------------------------
Macros
-------------------------------------------------------------------------------------*/
#define DEBUG_LOG
#define SEND_TIMERMS_CNT 7
#define RECV_TIMERMS_OUT (7 + SEND_TIMERMS_CNT)
#define XC_SEND_NUM 1000U
#define RF_TX_TIMERx TIMER0_IDX
#define RF_RX_TIMERx TIMER0_IDX
#define RF_CONFIRMED_VALUE 5
#define GPIO_TEST 1
#define TEST_GPIO_1 GPIO_1
#if XC62XX
#define TEST_GPIO_2 GPIO_0
#else
#define TEST_GPIO_2 GPIO_21
#endif
/*------------------------------------------------------------------------------------
TypeDef
-------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------
Global Variables
-------------------------------------------------------------------------------------*/
extern bool rf_send_timer_flag;
/*------------------------------------------------------------------------------------
Exported Functions
-------------------------------------------------------------------------------------*/
void rf_buff_info(uint8_t *buff, uint16_t len);
void rf_2M_reg_info(void);
void rf_dump_log(void);
uint8_t rf_data_config(uint8_t *buff, uint16_t len);
#ifdef __cplusplus
}
#endif
#endif /* __MAIN_H__ */
@@ -0,0 +1,25 @@
#ifndef __RF_COMPATIBLE_NORMAL__
#define __RF_COMPATIBLE_NORMAL__
#include "rf_config.h"
#include "xc6xxx_rf_2_4g.h"
#include "xc_software_crc.h"
#include <stdint.h>
#define RF_ADDR_LEN XINCX_RF_TX_ADDR_WIDTH // 5U
#define RF_RECV_EXTEN_LEN 3U
#define RF_MAX_RECV_LEN 60U
#define RF_CRC_INIT_VALUE 0xFFFF
#define PANCHIP_WHITEN_INIT_VAL (0x7F)
extern uint16_t rf_addr_crc;
extern uint8_t panchip_addr_whiten;
extern uint8_t addr_buff[5];
void rf_addr_map(uint8_t *addr_buff);
uint16_t rf_get_addr_crc(void);
uint8_t rf_recv_addr(void);
void rf_compatible_config(void);
uint32_t rf_rx_normal_manage(void);
uint32_t rf_tx_normal_manage(uint8_t *buff, uint8_t length);
#endif //__RF_COMPATIBLE_NORMAL__
@@ -0,0 +1,152 @@
#ifndef SDK_DRIVER_CONFIG_H
#define SDK_DRIVER_CONFIG_H
// <<< Use Configuration Wizard in Context Menu >>>\n
#ifdef USE_APP_CONFIG
#include "app_config.h"
#endif
// <h> XC_Drivers
// <e> XC_CLOCK_ENABLED
//==========================================================
#ifndef XC_CLOCK_ENABLED
#define XC_CLOCK_ENABLED 1
#endif
// </e>
// <e> XC_PWR_ENABLED
//==========================================================
#ifndef XC_PWR_ENABLED
#define XC_PWR_ENABLED 1
#endif
// </e>
// <e> XC_WDT_ENABLED
//==========================================================
#ifndef XC_WDT_ENABLED
#define XC_WDT_ENABLED 1
#endif
// </e>
// <e> XC_BOR_ENABLED
//==========================================================
#ifndef XC_BOR_ENABLED
#define XC_BOR_ENABLED 1
#endif
// </e>
// <e> XC_SYSTICK_ENABLED
//==========================================================
#ifndef XC_SYSTICK_ENABLED
#define XC_SYSTICK_ENABLED 1
#endif
// </e>
// <e> XC_TIMER_ENABLED
//==========================================================
#ifndef XC_TIMER_ENABLED
#define XC_TIMER_ENABLED 0
#endif
// </e>
// <e> XC_AOTIMER_ENABLED
//==========================================================
#ifndef XC_AOTIMER_ENABLED
#define XC_AOTIMER_ENABLED 0
#endif
// </e>
// <e> XC_GPIO_ENABLED
//==========================================================
#ifndef XC_GPIO_ENABLED
#define XC_GPIO_ENABLED 1
#endif
// </e>
// <e> XC_ADC_ENABLED
//==========================================================
#ifndef XC_ADC_ENABLED
#define XC_ADC_ENABLED 1
#endif
// </e>
// <e> XC_UART_ENABLED
//==========================================================
#ifndef XC_UART_ENABLED
#define XC_UART_ENABLED 1
#endif
// </e>
// <e> XC_PWM_ENABLED
//==========================================================
#ifndef XC_PWM_ENABLED
#define XC_PWM_ENABLED 1
#endif
// </e>
// <e> XC_FMC_SPI_ENABLED
//==========================================================
#ifndef XC_FMC_SPI_ENABLED
#define XC_FMC_SPI_ENABLED 1
#endif
// </e>
// <e> XC_SPI_ENABLED
//==========================================================
#ifndef XC_SPI_ENABLED
#define XC_SPI_ENABLED 0
#endif
// </e>
// <e> XC_IIC_ENABLED
//==========================================================
#ifndef XC_IIC_ENABLED
#define XC_IIC_ENABLED 0
#endif
// </e>
// <e> XC_RTC_ENABLED
//==========================================================
#ifndef XC_RTC_ENABLED
#define XC_RTC_ENABLED 0
#endif
//==========================================================
// <q> XC_RTC_DATE_INT_ENABLED
#ifndef XC_RTC_DATE_INT_ENABLED
#define XC_RTC_DATE_INT_ENABLED 0
#endif
// </e>
// <e> XC_DMA_ENABLED
//==========================================================
#ifndef XC_DMA_ENABLED
#define XC_DMA_ENABLED 0
#endif
// </e>
// <e> XC_PGA_ENABLED
//==========================================================
#ifndef XC_PGA_ENABLED
#define XC_PGA_ENABLED 0
#endif
// </e>
// <e> XC_QDEC_ENABLED
//==========================================================
#ifndef XC_QDEC_ENABLED
#define XC_QDEC_ENABLED 0
#endif
// </e>
// <e> XC_CALIB_ENABLED
//==========================================================
#ifndef XC_CALIB_ENABLED
#define XC_CALIB_ENABLED 0
#endif
// </e>
// <<< end of configuration section >>>
#endif //SDK_DRIVER_CONFIG_H