发现WF5803和WF282A挂在同一SPI下有问题
This commit is contained in:
parent
f179752527
commit
f4b6ae581c
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
BasedOnStyle: Microsoft
|
||||
Language: Cpp
|
||||
|
||||
###################################
|
||||
# indent conf
|
||||
###################################
|
||||
|
||||
UseTab: Never
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
ColumnLimit: 0
|
||||
AccessModifierOffset: -4
|
||||
NamespaceIndentation: All
|
||||
FixNamespaceComments: false
|
||||
BreakBeforeBraces: Allman
|
||||
|
||||
###################################
|
||||
# other styles
|
||||
###################################
|
||||
|
||||
#
|
||||
# for more conf, you can ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||
#
|
||||
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
|
||||
AllowShortBlocksOnASingleLine: true
|
||||
|
||||
IndentCaseLabels: true
|
||||
|
||||
SortIncludes: false
|
||||
|
||||
AlignConsecutiveMacros: AcrossEmptyLines
|
||||
|
||||
AlignConsecutiveAssignments: Consecutive
|
|
@ -70,8 +70,8 @@
|
|||
</option>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.2020844713" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.gnu99" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.177116515" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="DEBUG=0"/>
|
||||
<listOptionValue builtIn="false" value="CLK_OSC32K=0"/>
|
||||
<listOptionValue builtIn="false" value="DEBUG=1"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.files.288896968" name="Include files (-include)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.files" useByScannerDiscovery="true" valueType="includeFiles"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.preprocessonly.1594987158" name="Preprocess only (-E)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.preprocessonly" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||
|
@ -166,5 +166,5 @@
|
|||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
</cproject>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-396086618748589211" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-427504215130445276" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"ch58x_common.h": "c"
|
||||
"ch58x_common.h": "c",
|
||||
"bsp_wf5803.h": "c",
|
||||
"config.h": "c"
|
||||
}
|
||||
}
|
||||
|
|
136
APP/bsp_wf5803.c
136
APP/bsp_wf5803.c
|
@ -3,21 +3,28 @@
|
|||
|
||||
static uint8_t Peripheral_TaskID = 0xff;
|
||||
|
||||
#define WF5803_CSB1_HIGH() GPIOB_SetBits(GPIO_Pin_17)
|
||||
#define WF5803_CSB1_LOW() GPIOB_ResetBits(GPIO_Pin_17)
|
||||
|
||||
void SPICs_Start(void)
|
||||
{
|
||||
GPIOA_ResetBits(GPIO_Pin_6);
|
||||
// GPIOA_ResetBits(GPIO_Pin_6);
|
||||
WF5803_CSB1_LOW();
|
||||
}
|
||||
|
||||
void SPICs_Stop(void)
|
||||
{
|
||||
GPIOA_SetBits(GPIO_Pin_6);
|
||||
// GPIOA_SetBits(GPIO_Pin_6);
|
||||
WF5803_CSB1_HIGH();
|
||||
}
|
||||
|
||||
uint8_t WF5803_SendByte(uint8_t data)
|
||||
{
|
||||
R8_SPI1_BUFFER = data;
|
||||
while (!(R8_SPI1_INT_FLAG & RB_SPI_FREE))
|
||||
;
|
||||
return (R8_SPI1_BUFFER);
|
||||
R8_SPI0_BUFFER = data;
|
||||
while (!(R8_SPI0_INT_FLAG & RB_SPI_FREE));
|
||||
return (R8_SPI0_BUFFER);
|
||||
}
|
||||
|
||||
void WF5803_WriteReg(uint8_t Address, uint8_t value)
|
||||
{
|
||||
SPICs_Start();
|
||||
|
@ -26,6 +33,7 @@ void WF5803_WriteReg(uint8_t Address, uint8_t value)
|
|||
WF5803_SendByte(value);
|
||||
SPICs_Stop();
|
||||
}
|
||||
|
||||
uint8_t WF5803_ReadReg(uint8_t addr)
|
||||
{
|
||||
uint8_t value;
|
||||
|
@ -36,6 +44,7 @@ uint8_t WF5803_ReadReg(uint8_t addr)
|
|||
SPICs_Stop();
|
||||
return value;
|
||||
}
|
||||
|
||||
void WF5803_Init(void)
|
||||
{
|
||||
/**
|
||||
|
@ -44,29 +53,88 @@ void WF5803_Init(void)
|
|||
* SDA: PA1
|
||||
* SDO: PA2
|
||||
*/
|
||||
|
||||
/**
|
||||
* CSB: PB17
|
||||
* SCL: PA13
|
||||
* SDA: PA14
|
||||
* SDO: PA15
|
||||
*/
|
||||
// SDA: MOSI
|
||||
// SDO: MISO
|
||||
#if 1
|
||||
// CSB1: PA3
|
||||
|
||||
GPIOA_SetBits(GPIO_Pin_3);
|
||||
GPIOA_ModeCfg(GPIO_Pin_3, GPIO_ModeOut_PP_5mA);
|
||||
GPIOA_SetBits(GPIO_Pin_3);
|
||||
|
||||
// CSB2: PB9
|
||||
GPIOB_ResetBits(GPIO_Pin_9);
|
||||
GPIOB_ModeCfg(GPIO_Pin_9, GPIO_ModeOut_PP_5mA);
|
||||
GPIOB_ResetBits(GPIO_Pin_9);
|
||||
|
||||
// WF5803_CSB1_HIGH();
|
||||
|
||||
// CSB3: PB4
|
||||
GPIOB_ResetBits(GPIO_Pin_4);
|
||||
GPIOB_ModeCfg(GPIO_Pin_4, GPIO_ModeOut_PP_5mA);
|
||||
GPIOB_ResetBits(GPIO_Pin_9);
|
||||
|
||||
// CSB4: PB17
|
||||
GPIOB_SetBits(GPIO_Pin_17);
|
||||
GPIOB_ModeCfg(GPIO_Pin_17, GPIO_ModeOut_PP_5mA);
|
||||
// WF5803_CSB1_HIGH();
|
||||
|
||||
// PRINT("WF5803_CSB1_HIGH()\r\n");
|
||||
|
||||
// spi初始化,模式0
|
||||
GPIOA_ModeCfg(GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_6 | GPIO_Pin_3, GPIO_ModeOut_PP_5mA);
|
||||
GPIOA_ModeCfg(GPIO_Pin_2, GPIO_ModeIN_Floating);
|
||||
SPI1_MasterDefInit();
|
||||
GPIOA_ModeCfg(GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14, GPIO_ModeOut_PP_5mA);
|
||||
GPIOA_ModeCfg(GPIO_Pin_15, GPIO_ModeIN_PU);
|
||||
#endif
|
||||
// PRINT("GPIOA_ModeCfg ok\r\n");
|
||||
|
||||
SPI0_MasterDefInit();
|
||||
// PRINT("SPI1_MasterDefInit ok\r\n");
|
||||
|
||||
SPICs_Stop();
|
||||
// PRINT("SPICs_Stop ok\r\n");
|
||||
WF5803_WriteReg(0x00, 0x81); // 配置spi为四线模式
|
||||
// PRINT("WF5803_WriteReg ok\r\n");
|
||||
|
||||
// PRINT("SPI_Init ok\r\n");
|
||||
}
|
||||
|
||||
long reading = 0;
|
||||
float press = 0;
|
||||
float temp = 0;
|
||||
float fDat = 0;
|
||||
void WF5803_DeInit(void)
|
||||
{
|
||||
// GPIOA_ModeCfg(GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_6, GPIO_ModeIN_PD);
|
||||
// GPIOA_ModeCfg(GPIO_Pin_2, GPIO_ModeIN_PD);
|
||||
|
||||
// GPIOA_ResetBits(GPIO_Pin_4);
|
||||
// GPIOA_ResetBits(GPIO_Pin_5);
|
||||
// GPIOA_ResetBits(GPIO_Pin_12);
|
||||
|
||||
// GPIOA_ModeCfg(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_12, GPIO_ModeIN_PD);
|
||||
}
|
||||
|
||||
long reading = 0;
|
||||
float press = 0;
|
||||
float temp = 0;
|
||||
float fDat = 0;
|
||||
float press_air = 101.0f;
|
||||
int a = 1;
|
||||
int a = 1;
|
||||
uint8_t RawData[5];
|
||||
|
||||
uint8_t *GetSensorData(void)
|
||||
{
|
||||
memset(RawData, 0, sizeof(uint8_t) * 5);
|
||||
WF5803_WriteReg(0x30, 0x0a);
|
||||
DelayMs(50);
|
||||
// WF5803_WriteReg(0x30, 0x0a);
|
||||
// DelayMs(50);
|
||||
|
||||
PRINT("DRDTY = %02x\r\n", WF5803_ReadReg(0x02));
|
||||
|
||||
// 气压数据
|
||||
|
||||
RawData[0] = WF5803_ReadReg(0x06);
|
||||
RawData[1] = WF5803_ReadReg(0x07);
|
||||
RawData[2] = WF5803_ReadReg(0x08);
|
||||
|
@ -80,11 +148,18 @@ uint8_t *GetSensorData(void)
|
|||
// }
|
||||
return RawData;
|
||||
}
|
||||
|
||||
void WF5803_Start(void)
|
||||
{
|
||||
WF5803_WriteReg(0x21, 0x47); // 开启气压和温度传感器
|
||||
WF5803_WriteReg(0x27, 0x41); // 开启气压和温度传感器
|
||||
}
|
||||
|
||||
void SensorData_Process(void)
|
||||
{
|
||||
uint8_t *p1 = GetSensorData();
|
||||
reading = p1[0];
|
||||
reading = reading << 8;
|
||||
reading = p1[0];
|
||||
reading = reading << 8;
|
||||
reading |= p1[1];
|
||||
reading = reading << 8;
|
||||
reading |= p1[2];
|
||||
|
@ -119,16 +194,28 @@ void SensorData_Process(void)
|
|||
}
|
||||
// PRINT("--s-1--\r\n");
|
||||
PRINT("P=%d.%d pa\r\n", (int)(press * 1000), ((int)(press * 10000000.0f) % 10000));
|
||||
// PRINT("T=%d.%d \r\n", (int)temp, ((int)(temp * 100.0f) % 100));
|
||||
PRINT("T=%d.%d \r\n", (int)temp, ((int)(temp * 100.0f) % 100));
|
||||
}
|
||||
|
||||
uint16_t wf5803_ProcessEvent(uint8_t task_id, uint16_t events)
|
||||
{
|
||||
if (events & WF5803_EVT)
|
||||
if (events & WF5803_EVT_START)
|
||||
{
|
||||
// SensorData_Process();
|
||||
// WF5803_WriteReg(0x30, 0x0a);
|
||||
|
||||
WF5803_WriteReg(0x30, 0x0A);
|
||||
|
||||
tmos_start_task(Peripheral_TaskID, WF5803_EVT_READ, MS1_TO_SYSTEM_TIME(50));
|
||||
return (events ^ WF5803_EVT_START);
|
||||
}
|
||||
else if (events & WF5803_EVT_READ)
|
||||
{
|
||||
SensorData_Process();
|
||||
tmos_start_task(Peripheral_TaskID, WF5803_EVT, MS1_TO_SYSTEM_TIME(100));
|
||||
return (events ^ WF5803_EVT);
|
||||
// WF5803_WriteReg(0x30, 0x0a);
|
||||
|
||||
tmos_start_task(Peripheral_TaskID, WF5803_EVT_START, MS1_TO_SYSTEM_TIME(800));
|
||||
return (events ^ WF5803_EVT_READ);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -137,5 +224,8 @@ void BSPWF5803_Init(void)
|
|||
{
|
||||
WF5803_Init();
|
||||
Peripheral_TaskID = TMOS_ProcessEventRegister(wf5803_ProcessEvent);
|
||||
tmos_set_event(Peripheral_TaskID, WF5803_EVT);
|
||||
// WF5803_WriteReg(0x30, 0x2B);
|
||||
tmos_set_event(Peripheral_TaskID, WF5803_EVT_START);
|
||||
// tmos_start_task(Peripheral_TaskID, WF5803_EVT_READ, MS1_TO_SYSTEM_TIME(50));
|
||||
// PRINT("WF5803_Init\r\n");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
#include "CH58x_common.h"
|
||||
|
||||
#define WF5803_EVT 0x0010
|
||||
#define WF5803_EVT_START 0x0010
|
||||
#define WF5803_EVT_READ 0x0100
|
||||
|
||||
void WF5803_Init(void);
|
||||
void WF5803_WriteReg(uint8_t Address, uint8_t value);
|
||||
|
@ -12,4 +13,7 @@ uint8_t *GetSensorData(void);
|
|||
void SensorData_Process(void);
|
||||
void BSPWF5803_Init(void);
|
||||
|
||||
void WF5803_DeInit(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#define SBP_PHY_UPDATE_DELAY 2400
|
||||
|
||||
// What is the advertising interval when device is discoverable (units of 625us, 80=50ms)
|
||||
#define DEFAULT_ADVERTISING_INTERVAL 80
|
||||
#define DEFAULT_ADVERTISING_INTERVAL (160 * 10)
|
||||
|
||||
// Limited discoverable mode advertises for 30.72s, and then stops
|
||||
// General discoverable mode advertises indefinitely
|
||||
|
|
|
@ -39,6 +39,7 @@ __HIGH_CODE
|
|||
__attribute__((noinline))
|
||||
void Main_Circulation()
|
||||
{
|
||||
PRINT("Main_Circulation\n");
|
||||
while(1)
|
||||
{
|
||||
TMOS_SystemProcess();
|
||||
|
@ -64,21 +65,40 @@ int main(void)
|
|||
GPIOB_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
GPIOA_SetBits(GPIO_Pin_14);
|
||||
GPIOPinRemap(ENABLE, RB_PIN_UART0);
|
||||
GPIOA_ModeCfg(GPIO_Pin_14, GPIO_ModeOut_PP_5mA);
|
||||
UART0_DefInit();
|
||||
// GPIOA_SetBits(GPIO_Pin_14);
|
||||
// GPIOPinRemap(ENABLE, RB_PIN_UART0);
|
||||
// GPIOA_ModeCfg(GPIO_Pin_14, GPIO_ModeOut_PP_5mA);
|
||||
// UART0_DefInit();
|
||||
// GPIOA_SetBits(GPIO_Pin_9);
|
||||
// // GPIOPinRemap(ENABLE, RB_PIN_UART1);
|
||||
// GPIOA_ModeCfg(GPIO_Pin_9, GPIO_ModeOut_PP_5mA);
|
||||
// // UART0_DefInit();
|
||||
// UART1_DefInit();
|
||||
|
||||
/* 配置串口1:先配置IO口模式,再配置串口 */
|
||||
GPIOA_SetBits(GPIO_Pin_9);
|
||||
GPIOA_ModeCfg(GPIO_Pin_8, GPIO_ModeIN_PU); // RXD-配置上拉输入
|
||||
GPIOA_ModeCfg(GPIO_Pin_9, GPIO_ModeOut_PP_5mA); // TXD-配置推挽输出,注意先让IO口输出高电平
|
||||
UART1_DefInit();
|
||||
|
||||
#endif
|
||||
PRINT("Start @ChipID=%02X\n", R8_CHIP_ID);
|
||||
PRINT("%s\n", VER_LIB);
|
||||
|
||||
CH58x_BLEInit();
|
||||
PRINT("BLE init ok\n");
|
||||
HAL_Init();
|
||||
PRINT("HAL init ok\n");
|
||||
GAPRole_PeripheralInit();
|
||||
PRINT("GAP init ok\n");
|
||||
Peripheral_Init();
|
||||
PRINT("Peripheral init ok\n");
|
||||
|
||||
BSPWF5803_Init();
|
||||
PRINT("BSP init ok\n");
|
||||
|
||||
Main_Circulation();
|
||||
PRINT("Main_Circulation\n");
|
||||
}
|
||||
|
||||
/******************************** endfile @ main ******************************/
|
||||
|
|
10
HAL/SLEEP.c
10
HAL/SLEEP.c
|
@ -6,7 +6,7 @@
|
|||
* Description : 睡眠配置及其初始化
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
|||
/* 头文件包含 */
|
||||
#include "HAL.h"
|
||||
|
||||
#include "bsp_wf5803.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn CH58x_LowPower
|
||||
*
|
||||
|
@ -48,7 +50,7 @@ uint32_t CH58x_LowPower(uint32_t time)
|
|||
}
|
||||
|
||||
// 若睡眠时间小于最小睡眠时间或大于最大睡眠时间,则不睡眠
|
||||
if ((time_sleep < SLEEP_RTC_MIN_TIME) ||
|
||||
if ((time_sleep < SLEEP_RTC_MIN_TIME) ||
|
||||
(time_sleep > SLEEP_RTC_MAX_TIME)) {
|
||||
SYS_RecoverIrq(irq_status);
|
||||
return 2;
|
||||
|
@ -65,8 +67,12 @@ uint32_t CH58x_LowPower(uint32_t time)
|
|||
// LOW POWER-sleep模式
|
||||
if(!RTCTigFlag)
|
||||
{
|
||||
WF5803_DeInit();
|
||||
|
||||
LowPower_Sleep(RB_PWR_RAM32K | RB_PWR_RAM96K | RB_PWR_EXTEND |RB_XT_PRE_EN );
|
||||
HSECFG_Current(HSE_RCur_100); // 降为额定电流(低功耗函数中提升了HSE偏置电流)
|
||||
|
||||
WF5803_Init();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define __CONFIG_H
|
||||
|
||||
|
||||
#define CHIP_ID ID_CH585
|
||||
#define CHIP_ID ID_CH584
|
||||
|
||||
#ifdef CH58xBLE_ROM
|
||||
#include "CH58xBLE_ROM.h"
|
||||
|
|
|
@ -3,7 +3,7 @@ ENTRY( _start )
|
|||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 448K
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Description : source file(ch585/ch584)
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
|
@ -28,7 +28,7 @@ void PWR_DCDCCfg(FunctionalState s)
|
|||
|
||||
if(s == DISABLE)
|
||||
{
|
||||
|
||||
|
||||
adj &= ~RB_DCDC_CHARGE;
|
||||
plan &= ~(RB_PWR_DCDC_EN | RB_PWR_DCDC_PRE); // ÅÔ· DC/DC
|
||||
sys_safe_access_enable();
|
||||
|
@ -227,7 +227,7 @@ void PowerMonitor(FunctionalState s, VolM_LevelypeDef vl)
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
cfg = vl & 0x03;
|
||||
ctrl = RB_BAT_DET_EN;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Description : source file(ch585/ch584)
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
void SPI0_MasterDefInit(void)
|
||||
{
|
||||
R8_SPI0_CLOCK_DIV = 240; // 主频时钟4分频
|
||||
R8_SPI0_CLOCK_DIV = 8; // 主频时钟4分频
|
||||
R8_SPI0_CTRL_MOD = RB_SPI_ALL_CLEAR;
|
||||
R8_SPI0_CTRL_MOD = RB_SPI_MOSI_OE | RB_SPI_SCK_OE | RB_SPI_MISO_OE;
|
||||
R8_SPI0_CTRL_CFG |= RB_SPI_AUTO_IF; // ·ÃÎÊBUFFER/FIFO×Ô¶¯Çå³ýIF_BYTE_END±êÖ¾
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Description : source file(ch585/ch584)
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
void UART1_DefInit(void)
|
||||
{
|
||||
UART1_BaudRateCfg(115200);
|
||||
UART1_BaudRateCfg(460800);
|
||||
R8_UART1_FCR = (2 << 6) | RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN; // FIFO´ò¿ª£¬´¥·¢µã4×Ö½Ú
|
||||
R8_UART1_LCR = RB_LCR_WORD_SZ;
|
||||
R8_UART1_IER = RB_IER_TXD_EN;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Description : head file(ch585/ch584)
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in New Issue