本文整理汇总了C++中RCC_APB1PeriphResetCmd函数的典型用法代码示例。如果您正苦于以下问题:C++ RCC_APB1PeriphResetCmd函数的具体用法?C++ RCC_APB1PeriphResetCmd怎么用?C++ RCC_APB1PeriphResetCmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RCC_APB1PeriphResetCmd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SPDIFRX_DeInit
/**
* @brief Deinitialize the SPDIFRXx peripheral registers to their default reset values.
* @param void
* @retval None
*/
void SPDIFRX_DeInit(void)
{
/* Enable SPDIFRX reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPDIFRX, ENABLE);
/* Release SPDIFRX from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPDIFRX, DISABLE);
}
示例2: I2C_DeInit
/*******************************************************************************
* Function Name : I2C_DeInit
* Description : Deinitializes the I2Cx peripheral registers to their default
* reset values.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output : None
* Return : None
*******************************************************************************/
void I2C_DeInit(I2C_TypeDef* I2Cx)
{
/* Check the parameters */
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
switch (*(u32*)&I2Cx)
{
case I2C1_BASE:
/* Enable I2C1 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
/* Release I2C1 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
break;
case I2C2_BASE:
/* Enable I2C2 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, ENABLE);
/* Release I2C2 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, DISABLE);
break;
default:
break;
}
}
示例3: 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));
switch (*(uint32_t*)&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;
case SPI3_BASE:
/* Enable SPI3 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
/* Release SPI3 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE);
break;
default:
break;
}
}
示例4: IOE_GPIO_Config
/**
* @brief Initializes the GPIO pins used by the IO expander.
* @param None
* @retval None
*/
static void IOE_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable IOE_I2C and IOE_I2C_GPIO_PORT & Alternate Function clocks */
RCC_APB1PeriphClockCmd(IOE_I2C_CLK, ENABLE);
RCC_AHB1PeriphClockCmd(IOE_I2C_SCL_GPIO_CLK | IOE_I2C_SDA_GPIO_CLK |
IOE_IT_GPIO_CLK, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Reset IOE_I2C IP */
RCC_APB1PeriphResetCmd(IOE_I2C_CLK, ENABLE);
/* Release reset signal of IOE_I2C IP */
RCC_APB1PeriphResetCmd(IOE_I2C_CLK, DISABLE);
/* Connect PXx to I2C_SCL*/
GPIO_PinAFConfig(IOE_I2C_SCL_GPIO_PORT, IOE_I2C_SCL_SOURCE, IOE_I2C_SCL_AF);
/* Connect PXx to I2C_SDA*/
GPIO_PinAFConfig(IOE_I2C_SDA_GPIO_PORT, IOE_I2C_SDA_SOURCE, IOE_I2C_SDA_AF);
/* IOE_I2C SCL and SDA pins configuration */
GPIO_InitStructure.GPIO_Pin = IOE_I2C_SCL_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(IOE_I2C_SCL_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = IOE_I2C_SDA_PIN;
GPIO_Init(IOE_I2C_SDA_GPIO_PORT, &GPIO_InitStructure);
}
示例5: CEC_DeInit
/**
* @brief Deinitializes the CEC peripheral registers to their default reset
* values.
* @param None
* @retval None
*/
void CEC_DeInit(void)
{
/* Enable CEC reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, ENABLE);
/* Release CEC from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, DISABLE);
}
示例6: number
/**
@brief Init I2C
@param[in] devnum I2C peripheral number (1 or 2)
@param[in] clkspd Baudrate (i.e. 100000 for 100kHz), F_CPU independent
*/
void i2c_init(uint8_t devnum, const uint32_t clkspd)
{
struct I2C_DevDef* pdef = i2c_get_pdef(devnum);
// Enable GPIO clocks
RCC_APB2PeriphClockCmd(pdef->gpio_clk, ENABLE);
// I2C1 clock enable
RCC_APB1PeriphClockCmd(pdef->i2c_clk, ENABLE);
// I2C1 SDA and SCL configuration
GPIO_InitTypeDef iotd;
iotd.GPIO_Pin = pdef->pin_sda | pdef->pin_scl;
iotd.GPIO_Speed = GPIO_Speed_50MHz;
iotd.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(pdef->gpio, &iotd);
// I2C1 Reset
RCC_APB1PeriphResetCmd(pdef->i2c_clk, ENABLE);
RCC_APB1PeriphResetCmd(pdef->i2c_clk, DISABLE);
// Configure I2Cx
I2C_InitTypeDef i2td;
i2td.I2C_ClockSpeed = clkspd;
i2td.I2C_Mode = I2C_Mode_I2C;
i2td.I2C_DutyCycle = I2C_DutyCycle_2;
i2td.I2C_OwnAddress1 = 0;
i2td.I2C_Ack = I2C_Ack_Enable;
i2td.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_Init(pdef->i2c, &i2td);
I2C_Cmd(pdef->i2c, ENABLE);
}
示例7: 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;
}
}
示例8: MPU6050_I2C_Init
/**
* @brief Initializes the I2C peripheral used to drive the MPU6050
* @param None
* @return None
*/
void MPU6050_I2C_Init()
{
I2C_InitTypeDef I2C_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable I2C and GPIO clocks */
RCC_APB1PeriphClockCmd(MPU6050_I2C_RCC_Periph, ENABLE);
RCC_AHB1PeriphClockCmd(MPU6050_I2C_RCC_Port, ENABLE);
RCC_APB1PeriphResetCmd ( RCC_APB1Periph_I2C1, ENABLE );
RCC_APB1PeriphResetCmd ( RCC_APB1Periph_I2C1, DISABLE );
/* Configure I2C pins: SCL and SDA */
GPIO_InitStructure.GPIO_Pin = MPU6050_I2C_SCL_Pin | MPU6050_I2C_SDA_Pin;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;// this activates the pullup resistors on the IO pins
GPIO_Init(MPU6050_I2C_Port, &GPIO_InitStructure);
/*
00099 #define I2Cx I2C1
00100 #define I2Cx_CLK RCC_APB1Periph_I2C1
00101 #define I2Cx_SDA_GPIO_CLK RCC_AHB1Periph_GPIOB
00102 #define I2Cx_SDA_PIN GPIO_Pin_9
00103 #define I2Cx_SDA_GPIO_PORT GPIOB
00104 #define I2Cx_SDA_SOURCE GPIO_PinSource9
00105 #define I2Cx_SDA_AF GPIO_AF_I2C1
00106
00107 #define I2Cx_SCL_GPIO_CLK RCC_AHB1Periph_GPIOB
00108 #define I2Cx_SCL_PIN GPIO_Pin_6
00109 #define I2Cx_SCL_GPIO_PORT GPIOB
00110 #define I2Cx_SCL_SOURCE GPIO_PinSource6
00111 #define I2Cx_SCL_AF GPIO_AF_I2C1
*/
/* Connect PXx to I2C_SCL */
GPIO_PinAFConfig ( GPIOB, GPIO_PinSource6 /*MPU6050_I2C_SCL_Pin*/, GPIO_AF_I2C1/*I2C1_SCL_AF*/);
/* Connect PXx to I2C_SDA */
GPIO_PinAFConfig ( GPIOB, GPIO_PinSource7 /*MPU6050_I2C_SDA_Pin*/, GPIO_AF_I2C1/*I2C1_SDA_AF*/);
/* I2C configuration */
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = MPU6050_DEFAULT_ADDRESS; // MPU6050 7-bit adress = 0x68, 8-bit adress = 0xD0;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = MPU6050_I2C_Speed;
/* Apply I2C configuration after enabling it */
I2C_Init(MPU6050_I2C, &I2C_InitStructure);
/* I2C Peripheral Enable */
I2C_Cmd(MPU6050_I2C, ENABLE);
}
示例9: IOE_GPIO_Config
/**
* @brief Initializes the GPIO pins used by the IO expander.
* @param None
* @retval None
*/
static void IOE_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable IOE_I2C and IOE_I2C_PORT & Alternate Function clocks */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_IOE_I2C, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB_IOE_I2C_PORT | RCC_APB_GPIO_IOE_ITPORT | RCC_APB2Periph_AFIO, ENABLE);
/* Reset IOE_I2C IP */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_IOE_I2C, ENABLE);
/* Release reset signal of IOE_I2C IP */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_IOE_I2C, DISABLE);
/* IOE_I2C SCL and SDA pins configuration */
GPIO_InitStructure.GPIO_Pin = IOE_SCL_PIN | IOE_SDA_PIN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(IOE_I2C_PORT, &GPIO_InitStructure);
/* Set EXTI pin as Input PullUp - IO_Expander_INT */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_IOE_ITPIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(GPIO_IOE_ITPORT, &GPIO_InitStructure);
/* Connect IO Expander IT line to EXTI line */
GPIO_EXTILineConfig(GPIO_PortSource_IOE_ITPORT, GPIO_PinSource_IOE_ITPIN);
}
示例10: init_I2C1_lowlevel
void init_I2C1_lowlevel(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
I2C_InitTypeDef I2C_InitStruct;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStruct.GPIO_OType = GPIO_OType_OD;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1); // SCL pini
GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_I2C1); // SDA pini
/* detail????????????? */
I2C_InitStruct.I2C_ClockSpeed = 100000; //?????????????????????????
I2C_InitStruct.I2C_Mode = I2C_Mode_I2C; //??????????????????
I2C_InitStruct.I2C_DutyCycle = I2C_DutyCycle_2; //???????????????
I2C_InitStruct.I2C_OwnAddress1 = 0x00; //???????????????????????
I2C_InitStruct.I2C_Ack = I2C_Ack_Enable; //?????????????????????????????????????
I2C_InitStruct.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; //??????????????????????
I2C_Init(I2C1, &I2C_InitStruct);
I2C_Cmd(I2C1, ENABLE);
}
示例11: 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 == 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);
}
}
}
示例12: CAN_DeInit
/*******************************************************************************
* 函数名称: CAN_DeInit
* 功能描述: D将CAN外设寄存器复位为它们的默认值
* 输入参数: 无.
* 输出参数: 无.
* 返回参数: 无.
*******************************************************************************/
void CAN_DeInit(void)
{
/* Enable CAN reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN, ENABLE);
/* Release CAN from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN, DISABLE);
}
示例13: LCD_Deinit
/* deinitialize lcd */
void LCD_Deinit(void)
{
/* Enable LCD reset state */
RCC_APB1PeriphResetCmd(APB1_LCD, ENABLE);
/* Release LCD from reset state */
RCC_APB1PeriphResetCmd(APB1_LCD, DISABLE);
}
示例14: i2c_config
void i2c_config()
{
// RCC
/* Enable GPIOB clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
// GPIO
GPIO_InitTypeDef GPIO_InitStructure;
/* Configure I2C1 pins: SCL and SDA */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Enable I2C1 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
/* Release I2C1 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
I2C_DeInit(I2C1);
// I2C
/* Enable I2C1 */
I2C_Cmd(I2C1, ENABLE);
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = ID;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = ClockSpeed;
I2C_Init(I2C1, &I2C_InitStructure);
I2C_GeneralCallCmd(I2C1, ENABLE);
/* Enable Event IT needed for ADDR and STOPF events ITs */
I2C_ITConfig(I2C1, I2C_IT_EVT, ENABLE);
/* Enable Error IT */
I2C_ITConfig(I2C1, I2C_IT_ERR, ENABLE);
/* Enable Buffer IT (TXE and RXNE ITs) */
I2C_ITConfig(I2C1, I2C_IT_BUF, ENABLE);
// NVIC
/* 1 bit for pre-emption priority, 3 bits for subpriority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
NVIC_SetPriority(I2C1_EV_IRQn, 0x00);
NVIC_EnableIRQ(I2C1_EV_IRQn);
NVIC_SetPriority(I2C1_ER_IRQn, 0x01);
NVIC_EnableIRQ(I2C1_ER_IRQn);
}
示例15: i2c_reset
void i2c_reset(i2c_t *obj) {
if (obj->i2c == I2C_1) {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
}
if (obj->i2c == I2C_2) {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, DISABLE);
}
}