本文整理汇总了C++中RCC_APB2PeriphResetCmd函数的典型用法代码示例。如果您正苦于以下问题:C++ RCC_APB2PeriphResetCmd函数的具体用法?C++ RCC_APB2PeriphResetCmd怎么用?C++ RCC_APB2PeriphResetCmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RCC_APB2PeriphResetCmd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ADC_DeInit
/**
* @brief Deinitializes all ADCs peripherals registers to their default reset values.
* @param None
* @retval None
*/
void ADC_DeInit(void)
{
/* Enable all ADCs reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC, ENABLE);
/* Release all ADCs from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC, DISABLE);
}
开发者ID:ADTL,项目名称:ARMWork,代码行数:12,代码来源:stm32f2xx_adc.c
示例2: jump_to_app
void jump_to_app()
{
const struct pios_board_info *bdinfo = &pios_board_info_blob;
PIOS_LED_On(PIOS_LED_HEARTBEAT);
// Look at cm3_vectors struct in startup. In a fw image the first uint32_t contains the address of the top of irqstack
uint32_t fwIrqStackBase = (*(__IO uint32_t *)bdinfo->fw_base) & 0xFFFE0000;
// Check for the two possible irqstack locations (sram or core coupled sram)
if (fwIrqStackBase == 0x20000000 || fwIrqStackBase == 0x10000000) {
/* Jump to user application */
FLASH_Lock();
RCC_APB2PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB1PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB2PeriphResetCmd(0xffffffff, DISABLE);
RCC_APB1PeriphResetCmd(0xffffffff, DISABLE);
#ifdef PIOS_INCLUDE_USB
PIOS_USBHOOK_Deactivate();
#endif
JumpAddress = *(__IO uint32_t *)(bdinfo->fw_base + 4);
Jump_To_Application = (pFunction)JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t *)bdinfo->fw_base);
Jump_To_Application();
} else {
DeviceState = failed_jump;
return;
}
}
开发者ID:dibalavs,项目名称:OpenPilotPort,代码行数:30,代码来源:main.c
示例3: SPI_I2S_DeInit
/*******************************************************************************
* 函数名称: SPI_I2S_DeInit
* 功能描述: 将SPIx外设寄存器重置为他们的缺省值(Affects also the I2Ss).
* 输入参数: SPIx x为1,2或3用于选定SPI外设。
* 输出参数: 无
* 返回参数: 无
*******************************************************************************/
void SPI_I2S_DeInit(SPI_TypeDef* SPIx)
{
/* Check the parameters [检查参数]*/
assert_param(IS_SPI_ALL_PERIPH(SPIx));
switch (*(u32*)&SPIx)
{
case SPI1_BASE:
/* Enable SPI1 reset state [使能SPI1复位状态]*/
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
/* Release SPI1 from reset state [解除SPI1复位状态]*/
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
break;
case SPI2_BASE:
/* Enable SPI2 reset state [使能SPI2复位状态]*/
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
/* Release SPI2 from reset state [解除SPI2复位状态]*/
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE);
break;
case SPI3_BASE:
/* Enable SPI3 reset state [使能SPI3复位状态]*/
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
/* Release SPI3 from reset state [解除SPI3复位状态]*/
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE);
break;
default:
break;
}
}
开发者ID:WrongChao,项目名称:lammbo-fly,代码行数:39,代码来源:stm32f10x_spi.c
示例4: SPI_I2S_DeInit
/**
* @brief Deinitializes the SPIx peripheral registers to their default
* reset values (Affects also the I2Ss).
* @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral.
* @retval None
*/
void SPI_I2S_DeInit(SPI_TypeDef* SPIx)
{
/* Check the parameters */
assert_param(IS_SPI_ALL_PERIPH(SPIx));
if (SPIx == STM32_SPI1)
{
/* Enable SPI1 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
/* Release SPI1 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
}
else if (SPIx == SPI2)
{
/* Enable SPI2 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
/* Release SPI2 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE);
}
else
{
if (SPIx == SPI3)
{
/* Enable SPI3 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
/* Release SPI3 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE);
}
}
}
开发者ID:DFRobot,项目名称:BlunoM3,代码行数:36,代码来源:stm32f10x_spi.c
示例5: spi_free
void spi_free(spi_t *obj) {
// Reset SPI and disable clock
if (obj->spi == SPI_1) {
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, DISABLE);
}
if (obj->spi == SPI_2) {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, DISABLE);
}
if (obj->spi == SPI_3) {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI3, DISABLE);
}
// Configure GPIOs
pin_function(obj->pin_miso, STM_PIN_DATA(GPIO_Mode_IN_FLOATING, 0));
pin_function(obj->pin_mosi, STM_PIN_DATA(GPIO_Mode_IN_FLOATING, 0));
pin_function(obj->pin_sclk, STM_PIN_DATA(GPIO_Mode_IN_FLOATING, 0));
pin_function(obj->pin_ssel, STM_PIN_DATA(GPIO_Mode_IN_FLOATING, 0));
}
开发者ID:52osworld,项目名称:Stm32f103_mbed,代码行数:25,代码来源:spi_api.c
示例6: SAI_DeInit
/**
* @brief Deinitialize the SAIx peripheral registers to their default reset values.
* @param SAIx: To select the SAIx peripheral, where x can be the different instances
*
* @retval None
*/
void SAI_DeInit(SAI_TypeDef* SAIx)
{
/* Check the parameters */
assert_param(IS_SAI_PERIPH(SAIx));
if(SAIx == SAI1)
{
/* Enable SAI1 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SAI1, ENABLE);
/* Release SAI1 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SAI1, DISABLE);
}
else
{
#if defined(STM32F446xx)
if(SAIx == SAI2)
{
/* Enable SAI2 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SAI2, ENABLE);
/* Release SAI2 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SAI2, DISABLE);
}
#endif /* STM32F446xx */
}
}
开发者ID:DKhanh,项目名称:DK_BallBot,代码行数:31,代码来源:stm32f4xx_sai.c
示例7: SPI1_Config_Init
/*
* 函数名:SPI_Config_Init()
* 输入:void
* 输出:void
* 功能:对SPI进行初始化设置
*/
void SPI1_Config_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStructure;
//开启外设时钟
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB,ENABLE); //PORTB时钟使能
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1,ENABLE);//SPI1时钟使能
//配置CLK端口的GPIO
GPIO_InitStructure.GPIO_Pin = SPI_CLK_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; //复用功能
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; //10MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_Init(SPI_CLK_GPIO_PORT,&GPIO_InitStructure);
//配置MISO端口的GPIO
GPIO_InitStructure.GPIO_Pin = SPI_MISO_GPIO_PIN ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; //复用功能
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽输出 因为复用的时候端口方向由内部控制,所以这里设置成输出相当于浮空输入
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; //10MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_Init(SPI_MISO_GPIO_PORT,&GPIO_InitStructure);
//配置MOSI端口的GPIO
GPIO_InitStructure.GPIO_Pin = SPI_MOSI_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; //复用功能
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; //10MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_Init(SPI_MOSI_GPIO_PORT,&GPIO_InitStructure);
//设置端口复用
GPIO_PinAFConfig(SPI_CLK_GPIO_PORT ,SPI_CLK_AF_PINSOURCE ,GPIO_AF_SPI1); //PB3复用为SPI1
GPIO_PinAFConfig(SPI_MISO_GPIO_PORT,SPI_MISO_AF_PINSOURCE,GPIO_AF_SPI1); //PB4复用为SPI1
GPIO_PinAFConfig(SPI_MOSI_GPIO_PORT,SPI_MOSI_AF_PINSOURCE,GPIO_AF_SPI1); //PB5复用为SPI1
//这里只针对SPI口初始化
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1,ENABLE); //复位SPI1
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1,DISABLE);//停止复位SPI1
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; //SPI设置为双线双向全双工
SPI_InitStructure.SPI_Mode = SPI_Mode_Master; //设置SPI工作模式:设置为主SPI
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; //设置SPI的数据大小:SPI发送接收8位帧结构
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; //串行同步时钟的空闲状态为高电平
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; //串行同步时钟的第二个跳变沿(上升或下降)数据被采样
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; //NSS信号由软件(使用SSI位)管理
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256; ////定义波特率预分频的值:波特率预分频值为256 为主时钟分频
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; //指定数据传输从MSB位开始
SPI_InitStructure.SPI_CRCPolynomial = 7; //CRC值计算的多项式,含义是CRC的简记式,使用CRC-8
SPI_Init(SPIx_USE, &SPI_InitStructure); //根据SPI_InitStruct中指定的参数初始化外设SPIx寄存器
SPI_Cmd(SPIx_USE,ENABLE); //使能SPI外设
SPI1_ReadWriteByte(0xff); //启动传输
}
开发者ID:zeroWin,项目名称:work-stm32,代码行数:63,代码来源:SPI.c
示例8: SAI_DeInit
/**
* @brief Deinitialize the SAIx peripheral registers to their default reset values.
* @param SAIx: To select the SAIx peripheral, where x can be the different instances
*
* @retval None
*/
void SAI_DeInit(SAI_TypeDef* SAIx)
{
/* Check the parameters */
assert_param(IS_SAI_PERIPH(SAIx));
/* Enable SAI1 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SAI1, ENABLE);
/* Release SAI1 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SAI1, DISABLE);
}
开发者ID:LONELY-WOLF,项目名称:spider,代码行数:16,代码来源:stm32f4xx_sai.c
示例9: ADC_DeInit
/**
* @brief Deinitializes ADC1 peripheral registers to their default reset values.
* @param ADCx: where x can be 1 to select the ADC peripheral.
* @retval None
*/
void ADC_DeInit(ADC_TypeDef* ADCx)
{
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
if (ADCx == ADC1) {
/* Enable ADC1 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, ENABLE);
/* Release ADC1 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, DISABLE);
}
}
开发者ID:ccccjason,项目名称:IMU,代码行数:18,代码来源:stm32f0xx_adc.c
示例10: s_hal_spi_hw_init
static void s_hal_spi_hw_init(hal_spi_t id)
{
#if defined(HAL_USE_CPU_FAM_STM32F1) || defined(HAL_USE_CPU_FAM_STM32F4)
//uint32_t RCC_APB1Periph_SPIx = (hal_spi1 == id) ? (RCC_APB1Periph_SPI1) : (RCC_APB1Periph_SPI2); RCC_APB1Periph_SPI3
if(hal_spi1 == id)
{
// spi periph clock enable
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
// the reset and exit from reset is also done by SPI_I2S_DeInit() ..... thus it can be removed from here
// reset spi periph
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
// release reset
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
}
else
{
uint32_t RCC_APB1Periph_SPIx = s_hal_spi_hw_rcc[HAL_spi_id2index(id)];
// spi periph clock enable
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPIx, ENABLE);
// the reset and exit from reset is also done by SPI_I2S_DeInit() ..... thus it can be removed from here
// reset spi periph
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPIx, ENABLE);
// release reset
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPIx, DISABLE);
}
// // // system configuration controller clock
// #warning --> in stm32f4 removed "RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);" from spi_hw_init() and it still works....
// // RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
//
// // spi periph clock enable
// RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPIx, ENABLE);
//
// // reset spi periph
// RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPIx, ENABLE);
//
// // release reset
// RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPIx, DISABLE);
#else //defined(HAL_USE_CPU_FAM_*)
#error ERR --> choose a HAL_USE_CPU_FAM_*
#endif
}
开发者ID:Tarintote,项目名称:icub-firmware,代码行数:51,代码来源:hal_periph_spi.with.dma.c
示例11: Standby_SysEnter
/************************************************
* 函 数: Standby_SysEnter(void)
* 功 能: 系统进入待机模式
*
* 参 数: 无
*
* 返回值: 无
*************************************************/
void Standby_SysEnter(void)
{
RCC_APB2PeriphResetCmd(0x01FC, DISABLE); // 复位所有IO口
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); // 使能PWR外设时钟
PWR_WakeUpPinCmd(ENABLE); // 使能唤醒引脚唤醒功能
PWR_EnterSTANDBYMode(); // 进入待机模式
} // Standby_SysEnter()
开发者ID:orkash,项目名称:Library_Jacob,代码行数:15,代码来源:standby.c
示例12: SPI1_Init
void SPI1_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);//使能GPIOA时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);//使能SPI1时钟
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;//PA5~7复用功能输出
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
GPIO_Init(GPIOA, &GPIO_InitStructure);//初始化
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;//cs
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_PinAFConfig(GPIOA,GPIO_PinSource5,GPIO_AF_SPI1); //PA5复用为 SPI1
GPIO_PinAFConfig(GPIOA,GPIO_PinSource6,GPIO_AF_SPI1); //PA6复用为 SPI1
GPIO_PinAFConfig(GPIOA,GPIO_PinSource7,GPIO_AF_SPI1); //PA7复用为 SPI1
//这里只针对SPI口初始化
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1,ENABLE);//复位SPI1
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1,DISABLE);//停止复位SPI1
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; //设置SPI单向或者双向的数据模式:SPI设置为双线双向全双工
SPI_InitStructure.SPI_Mode = SPI_Mode_Master; //设置SPI工作模式:设置为主SPI
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; //设置SPI的数据大小:SPI发送接收8位帧结构
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; //串行同步时钟的空闲状态为高电平
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; //串行同步时钟的第二个跳变沿(上升或下降)数据被采样
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; //NSS信号由硬件(NSS管脚)还是软件(使用SSI位)管理:内部NSS信号有SSI位控制
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32; //定义波特率预分频的值:波特率预分频值为256
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; //指定数据传输从MSB位还是LSB位开始:数据传输从MSB位开始
SPI_InitStructure.SPI_CRCPolynomial = 7; //CRC值计算的多项式
SPI_Init(SPI1, &SPI_InitStructure); //根据SPI_InitStruct中指定的参数初始化外设SPIx寄存器
SPI_Cmd(SPI1, ENABLE); //使能SPI外设
}
开发者ID:big-big,项目名称:RD15002WV,代码行数:44,代码来源:bsp_ltc2402.c
示例13: serial_free
void serial_free(serial_t *obj) {
// Reset UART and disable clock
if (obj->uart == UART_1) {
RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, DISABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, DISABLE);
}
if (obj->uart == UART_2) {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, DISABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, DISABLE);
}
// Configure GPIOs
pin_function(obj->pin_tx, STM_PIN_DATA(GPIO_Mode_IN, 0, GPIO_PuPd_NOPULL, 0xFF));
pin_function(obj->pin_rx, STM_PIN_DATA(GPIO_Mode_IN, 0, GPIO_PuPd_NOPULL, 0xFF));
serial_irq_ids[obj->index] = 0;
}
开发者ID:23chrischen,项目名称:mbed,代码行数:19,代码来源:serial_api.c
示例14: jump_to_app
void jump_to_app() {
if (((*(__IO uint32_t*) START_OF_USER_CODE) & 0x2FFE0000) == 0x20000000) { /* Jump to user application */
FLASH_Lock();
RCC_APB2PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB1PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB2PeriphResetCmd(0xffffffff, DISABLE);
RCC_APB1PeriphResetCmd(0xffffffff, DISABLE);
_SetCNTR(0); // clear interrupt mask
_SetISTR(0); // clear all requests
JumpAddress = *(__IO uint32_t*) (START_OF_USER_CODE + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) START_OF_USER_CODE);
Jump_To_Application();
} else {
DeviceState = failed_jump;
return;
}
}
开发者ID:gotosteven,项目名称:my_OpenPilot_mods,代码行数:20,代码来源:main.c
示例15: SPI1_Config
/*******************************************************************************
* Function Name : SPI_Config
* Description : Config the SPI1
* Pin Map : PB3-->SPI1_SCK;
* PB4-->SPI1_MISO;
* PB5-->SPI1_MOSI;
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void SPI1_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStructure;
SPI_I2S_DeInit(SPI1);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB,ENABLE); //使能GPIOB时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1,ENABLE); //使能SPI1时钟
//GPIOPB3,4,5初始化设置:复用功能输出
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; //复用功能
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_Init(GPIOB,&GPIO_InitStructure);
GPIO_PinAFConfig(GPIOB,GPIO_PinSource3,GPIO_AF_SPI1); //PB3复用为SPI1_SCK
GPIO_PinAFConfig(GPIOB,GPIO_PinSource4,GPIO_AF_SPI1); //PB4复用为SPI1_MISO
GPIO_PinAFConfig(GPIOB,GPIO_PinSource5,GPIO_AF_SPI1); //PB5复用为SPI1_MOSI
//Init SPI1 & Set Working Mode
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1,ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1,DISABLE);
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; //双线双向全双工
SPI_InitStructure.SPI_Mode = SPI_Mode_Master; //主SPI
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; //SPI发送接收8位帧结构
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; //串行同步时钟的空闲状态为低电平
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; //第二个跳变沿数据采样(下降沿)
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; //NSS信号由软件控制
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_128;//预分频4,传输速度84M/32=2.625Mhz
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; //数据传输从MSB位开始
SPI_InitStructure.SPI_CRCPolynomial = 7; //CRC值计算的多项式
SPI_Init(SPI1,&SPI_InitStructure);
SPI_Cmd(SPI1,ENABLE);
SPI1_ReadWriteByte(0xFF);
}
开发者ID:PaulingZhou,项目名称:Homework_Sensor,代码行数:51,代码来源:spi1.c
示例16: jump_to_app
void jump_to_app() {
const struct pios_board_info * bdinfo = &pios_board_info_blob;
if (((*(__IO uint32_t*) bdinfo->fw_base) & 0x2FFE0000) == 0x20000000) { /* Jump to user application */
FLASH_Lock();
RCC_APB2PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB1PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB2PeriphResetCmd(0xffffffff, DISABLE);
RCC_APB1PeriphResetCmd(0xffffffff, DISABLE);
_SetCNTR(0); // clear interrupt mask
_SetISTR(0); // clear all requests
JumpAddress = *(__IO uint32_t*) (bdinfo->fw_base + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) bdinfo->fw_base);
Jump_To_Application();
} else {
DeviceState = failed_jump;
return;
}
}
开发者ID:abdulparis1,项目名称:OpenPilot,代码行数:21,代码来源:main.c
示例17: ADC_DeInit
/**
* @brief Deinitializes the ADCx peripheral registers to their default
* reset values.
* @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
* @retval : None
*/
void ADC_DeInit(ADC_TypeDef* ADCx)
{
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
switch (*(uint32_t*)&ADCx)
{
case ADC1_BASE:
/* Enable ADC1 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, ENABLE);
/* Release ADC1 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, DISABLE);
break;
case ADC2_BASE:
/* Enable ADC2 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC2, ENABLE);
/* Release ADC2 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC2, DISABLE);
break;
case ADC3_BASE:
/* Enable ADC3 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC3, ENABLE);
/* Release ADC3 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC3, DISABLE);
break;
default:
break;
}
}
开发者ID:2garryn,项目名称:sd_disk_learning,代码行数:36,代码来源:stm32f10x_adc.c
示例18: SPI_DeInit
/*******************************************************************************
* Function Name : SPI_DeInit
* Description : Deinitializes the SPIx peripheral registers to their default
* reset values.
* Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
* Output : None
* Return : None
*******************************************************************************/
void SPI_DeInit(SPI_TypeDef* SPIx)
{
switch (*(u32*)&SPIx)
{
case SPI1_BASE:
/* Enable SPI1 reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
/* Release SPI1 from reset state */
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
break;
case SPI2_BASE:
/* Enable SPI2 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
/* Release SPI2 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE);
break;
default:
break;
}
}
开发者ID:AldenHiggins,项目名称:ELEC424-Lab06-Scheduling-with-FreeRTOS,代码行数:30,代码来源:stm32f10x_spi.c
示例19: BSP_DeInit
/**-----------------------------------------------------------------------------
* @brief Desinitialisation de la carte.
*/
void BSP_DeInit() {
// Desactivation des interruptions
__disable_irq();
// Arret Systick
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
// DeInitialisation des horloges
//RCC_AHB1PeriphClockCmd(0xFFFFFFFF, DISABLE);
RCC_AHB1PeriphResetCmd(0xFFFFFFFF, ENABLE);
RCC_AHB1PeriphResetCmd(0xFFFFFFFF, DISABLE);
//RCC_AHB2PeriphClockCmd(0xFFFFFFFF, DISABLE);
RCC_AHB2PeriphResetCmd(0xFFFFFFFF, ENABLE);
RCC_AHB2PeriphResetCmd(0xFFFFFFFF, DISABLE);
//RCC_AHB3PeriphClockCmd(0xFFFFFFFF, DISABLE);
RCC_AHB3PeriphResetCmd(0xFFFFFFFF, ENABLE);
RCC_AHB3PeriphResetCmd(0xFFFFFFFF, DISABLE);
//RCC_APB1PeriphClockCmd(0xFFFFFFFF, DISABLE);
RCC_APB1PeriphResetCmd(0xFFFFFFFF, ENABLE);
RCC_APB1PeriphResetCmd(0xFFFFFFFF, DISABLE);
//RCC_APB2PeriphClockCmd(0xFFFFFFFF, DISABLE);
RCC_APB2PeriphResetCmd(0xFFFFFFFF, ENABLE);
RCC_APB2PeriphResetCmd(0xFFFFFFFF, DISABLE);
RCC_DeInit();
// ReInit Flash
FLASH_PrefetchBufferCmd(DISABLE);
FLASH_InstructionCacheCmd(DISABLE);
FLASH_DataCacheCmd(DISABLE);
}
开发者ID:jdaheron,项目名称:BLDR,代码行数:41,代码来源:BSP_CARTE.c
示例20: jump_to_app
void jump_to_app() {
const struct pios_board_info * bdinfo = &pios_board_info_blob;
PIOS_LED_On(PIOS_LED_HEARTBEAT);
if (((*(__IO uint32_t*) bdinfo->fw_base) & 0x2FFE0000) == 0x20000000) { /* Jump to user application */
FLASH_Lock();
RCC_APB2PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB1PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB2PeriphResetCmd(0xffffffff, DISABLE);
RCC_APB1PeriphResetCmd(0xffffffff, DISABLE);
PIOS_USBHOOK_Deactivate();
JumpAddress = *(__IO uint32_t*) (bdinfo->fw_base + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) bdinfo->fw_base);
Jump_To_Application();
} else {
DeviceState = failed_jump;
return;
}
}
开发者ID:mirasanti,项目名称:vbrain,代码行数:23,代码来源:main.c
注:本文中的RCC_APB2PeriphResetCmd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论