本文整理汇总了C++中I2C_DeInit函数的典型用法代码示例。如果您正苦于以下问题:C++ I2C_DeInit函数的具体用法?C++ I2C_DeInit怎么用?C++ I2C_DeInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了I2C_DeInit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Codec_TIMEOUT_UserCallback
/**
* @brief Codec_TIMEOUT_UserCallback
* @param None
* @retval None
*/
uint32_t Codec_TIMEOUT_UserCallback(void)
{
#if 0
I2C_InitTypeDef I2C_InitStructure;
LCD_ErrLog("> I2C Timeout error (CS43L22)\n");
I2C_GenerateSTOP(I2C1, ENABLE);
I2C_SoftwareResetCmd(I2C1, ENABLE);
I2C_SoftwareResetCmd(I2C1, DISABLE);
I2C_DeInit(I2C1);
/* CODEC_I2C peripheral configuration */
I2C_DeInit(I2C1);
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = 0x33;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = I2C_SPEED;
/* Enable the I2C peripheral */
I2C_Cmd(I2C1, ENABLE);
I2C_Init(I2C1, &I2C_InitStructure);
LCD_UsrLog("> I2C error recovered.\n");
#endif
return 0;
}
示例2: cpu_deinit_all
void cpu_deinit_all() {
//** ADC_DeInit(LPC_ADC);
CAN_DeInit(LPC_CAN1);
CAN_DeInit(LPC_CAN2);
EMAC_DeInit();
EXTI_DeInit();
I2C_DeInit(LPC_I2C0);
I2C_DeInit(LPC_I2C1);
I2C_DeInit(LPC_I2C2);
I2S_DeInit(LPC_I2S);
NVIC_DeInit();
NVIC_SCBDeInit();
PWM_DeInit(LPC_PWM1);
QEI_DeInit(LPC_QEI);
//** RIT_DeInit(LPC_RIT);
RTC_DeInit(LPC_RTC);
SPI_DeInit(LPC_SPI);
SSP_DeInit(LPC_SSP0);
SSP_DeInit(LPC_SSP1);
UART_DeInit(LPC_UART0);
UART_DeInit((LPC_UART_TypeDef *) LPC_UART1);
//** UART_DeInit(LPC_UART2);
//** UART_DeInit(LPC_UART3);
TIM_DeInit(LPC_TIM0);
TIM_DeInit(LPC_TIM1);
//** TIM_DeInit(LPC_TIM2);
//** TIM_DeInit(LPC_TIM3);
}
示例3: Init_I2C
void Init_I2C(void){
I2C_InitTypeDef I2C_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable I2C and GPIO clocks */
RCC_APB1PeriphClockCmd(I2C_RCC_Periph, ENABLE);
RCC_AHB1PeriphClockCmd(I2C_RCC_Port, ENABLE);
/* Configure I2C pins: SCL and SDA */
GPIO_InitStructure.GPIO_Pin = I2C_SCL_Pin | I2C_SDA_Pin;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType=GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_NOPULL;
GPIO_Init(I2C_Port, &GPIO_InitStructure);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource8, GPIO_AF_I2C1);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_I2C1);
I2C_DeInit(I2C1);
/* I2C configuration */
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = 0x68<<1;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = I2C_Speed;
/* Apply I2C configuration after enabling it */
I2C_Init(I2C1, &I2C_InitStructure);
/* I2C Peripheral Enable */
I2C_Cmd(I2C1, ENABLE);
}
示例4: iic_init
/*************************************************
名称:iic_init(void)
功能:iic外设2初始化(管脚配置 总线速度 数据位宽)
输入参数:无
输出参数:无
返回值: 无
**************************************************/
void iic_init(void)
{
I2C_InitTypeDef I2C_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1,ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
/* PB6,7 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);
I2C_DeInit(I2C1);
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = 0x30;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = 300000; //200K
I2C_Cmd(I2C1, ENABLE);
I2C_Init(I2C1, &I2C_InitStructure);
/*允许1字节1应答模式*/
I2C_AcknowledgeConfig(I2C1, ENABLE);
}
示例5: I2CHW_Reset
void I2CHW_Reset(void)
{
__IO uint32_t Timeout;
//uint8_t i;
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_8;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);
I2C_DeInit(I2C1);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, DISABLE);
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_8;
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
// GPIO_Init(GPIOB, &GPIO_InitStructure);
//
// GPIO_SetBits(GPIOB,GPIO_Pin_9);
// GPIO_SetBits(GPIOB,GPIO_Pin_8);
// Timeout=0x1ff;
// while(Timeout--);
I2C_Configuration();
Timeout=0x1ff;
while(Timeout--);
}
示例6: i2cSetup
void i2cSetup(uint32_t speed) {
I2C_InitTypeDef i2cConfig;
// GPIO Init
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource9, GPIO_AF_I2C1);
GPIO_Init(GPIOB, &(GPIO_InitTypeDef){GPIO_Pin_6, GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_OD, GPIO_PuPd_NOPULL});
GPIO_Init(GPIOB, &(GPIO_InitTypeDef){GPIO_Pin_9, GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_OD, GPIO_PuPd_NOPULL});
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
// I2C init
I2C_StructInit(&i2cConfig);
// TODO - Figure out why the speed isn't being set porperly
i2cConfig.I2C_ClockSpeed = speed;
i2cConfig.I2C_DutyCycle = I2C_DutyCycle_16_9;
I2C_DeInit(I2C1);
I2C_Init(I2C1, &i2cConfig);
I2C_ITConfig(I2C1, I2C_IT_ERR, ENABLE);
NVIC_EnableIRQ(I2C1_ER_IRQn);
I2C_Cmd(I2C1, ENABLE);
}
示例7: init_i2c
void init_i2c(void) {
I2C_InitTypeDef I2C_InitStruct;
GPIO_InitTypeDef GPIO_InitStruct;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11; // SCL,SDA
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(GPIOB, &GPIO_InitStruct);
I2C_SoftwareResetCmd(I2C2, ENABLE);
I2C_ITConfig(I2C2,I2C_IT_ERR,ENABLE);
I2C_StructInit(&I2C_InitStruct);
I2C_DeInit(I2C2);
I2C_InitStruct.I2C_ClockSpeed = 100000;
I2C_InitStruct.I2C_Ack = I2C_Ack_Enable;
I2C_InitStruct.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStruct.I2C_Mode = I2C_Mode_I2C;
I2C_InitStruct.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStruct.I2C_OwnAddress1 = 0x00;
I2C_Init(I2C2, &I2C_InitStruct);
I2C_Cmd(I2C2, ENABLE);
}
示例8: LM75_LowLevel_DeInit
/**
* @brief DeInitializes the LM75_I2C.
* @param None
* @retval None
*/
void LM75_LowLevel_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/*!< Disable LM75_I2C */
I2C_Cmd(LM75_I2C, DISABLE);
/*!< DeInitializes the LM75_I2C */
I2C_DeInit(LM75_I2C);
/*!< LM75_I2C Periph clock disable */
RCC_APB1PeriphClockCmd(LM75_I2C_CLK, DISABLE);
/*!< Configure LM75_I2C pins: SCL */
GPIO_InitStructure.GPIO_Pin = LM75_I2C_SCL_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(LM75_I2C_SCL_GPIO_PORT, &GPIO_InitStructure);
/*!< Configure LM75_I2C pins: SDA */
GPIO_InitStructure.GPIO_Pin = LM75_I2C_SDA_PIN;
GPIO_Init(LM75_I2C_SDA_GPIO_PORT, &GPIO_InitStructure);
/*!< Configure LM75_I2C pin: SMBUS ALERT */
GPIO_InitStructure.GPIO_Pin = LM75_I2C_SMBUSALERT_PIN;
GPIO_Init(LM75_I2C_SMBUSALERT_GPIO_PORT, &GPIO_InitStructure);
}
示例9: TS751_LowLevel_DeInit
/**
* @brief DeInitializes the TS751_I2C.
* @param None
* @retval None
*/
void TS751_LowLevel_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Disable TS751_I2C */
I2C_Cmd(TS751_I2C, DISABLE);
/* DeInitializes the TS751_I2C */
I2C_DeInit(TS751_I2C);
/* TS751_I2C Periph clock disable */
RCC_APB1PeriphClockCmd(TS751_I2C_CLK, DISABLE);
/* Configure TS751_I2C pins: SCL */
GPIO_InitStructure.GPIO_Pin = TS751_I2C_SCL_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(TS751_I2C_SCL_GPIO_PORT, &GPIO_InitStructure);
/* Configure TS751_I2C pins: SDA */
GPIO_InitStructure.GPIO_Pin = TS751_I2C_SDA_PIN;
GPIO_Init(TS751_I2C_SDA_GPIO_PORT, &GPIO_InitStructure);
/* Configure TS751_I2C pin: SMBUS ALERT */
GPIO_InitStructure.GPIO_Pin = TS751_I2C_SMBUSALERT_PIN;
GPIO_Init(TS751_I2C_SMBUSALERT_GPIO_PORT, &GPIO_InitStructure);
}
示例10: Mems_Init
/*******************************************************************************
* Function Name : Mems_Init
* Description : It inits mems
* Input : None
* Output : status
* Return : None
*******************************************************************************/
int8u Mems_Init(void)
{
int8u ret = 0;
// GPIO assignments
// PA1: SC2SDA (Serial Data)
// PA2: SC2SCL (Serial Clock)
//-----SC2 I2C Master GPIO configuration
TIM2_CCER &= 0xFFFFEEEE;
SC2_MODE = SC2_MODE_I2C;
GPIO_PACFGL &= 0xFFFFF00F;
GPIO_PACFGL |= 0x00000DD0;
SC2_RATELIN = 14; // generates standard 100kbps or 400kbps
SC2_RATEEXP = 1; // 3 yields 100kbps; 1 yields 400kbps
SC2_TWICTRL1 = 0; // start from a clean state
SC2_TWICTRL2 = 0; // start from a clean state
ret = I2C_MEMS_Init();
fullscale_state = MEMS_LOW_RANGE;
//Add later if really needed
#ifdef ST_DBG
if (!ret)
I2C_DeInit(MEMS_I2C);
#endif
return ret;
}/* end Mems_Init */
示例11: I2cInit
void I2cInit( void )
{
I2C_DeInit( I2C_INTERFACE );
I2cGpioConfig( );
I2cConfig( );
}
示例12: vhI2C_initI2C1
void vhI2C_initI2C1(void)
{
I2C_InitTypeDef I2C_InitStruct;
/* I2C1
* setup SCL and SDA pins
* SCL = PB8
* SDA = PB9
*/
/* Deinit and reset the I2C to avoid it locking up */
I2C_DeInit(I2C1 );
I2C_SoftwareResetCmd(I2C1, ENABLE);
I2C_SoftwareResetCmd(I2C1, DISABLE);
I2C_InitStruct.I2C_ClockSpeed = I2C1_clockSpeed; // I2C1_clockSpeed [Hz]
I2C_InitStruct.I2C_Mode = I2C_Mode_I2C; // I2C mode
I2C_InitStruct.I2C_DutyCycle = I2C_DutyCycle_2; // 50% duty cycle --> standard
I2C_InitStruct.I2C_OwnAddress1 = I2C1_ownAddress; // own address, not relevant in master mode
I2C_InitStruct.I2C_Ack = I2C_Ack_Disable;
I2C_InitStruct.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; // set address length to 7 bit addresses
I2C_Init(I2C1, &I2C_InitStruct); // init I2C1
I2C_Cmd(I2C1, ENABLE);
}
示例13: I2C_Configuration
/*******************************************************************************
* Function Name : I2C_Configuration
* Description : I2C Configuration
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void I2C_Configuration(void)
{
I2C_InitTypeDef I2C_InitStructure;
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);
/* I2C configuration */
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = I2C1_SLAVE_ADDRESS7;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = I2C_Speed;
I2C_DeInit(I2C1);
/* I2C Peripheral Enable */
I2C_Cmd(I2C1, ENABLE);
/* Apply I2C configuration after enabling it */
I2C_Init(I2C1, &I2C_InitStructure);
}
示例14: i2c_frequency
void i2c_frequency(i2c_t *obj, int hz) {
I2C_TypeDef *i2c = (I2C_TypeDef *)(obj->i2c);
I2C_InitTypeDef I2C_InitStructure;
uint32_t tim = 0;
// Disable the Fast Mode Plus capability
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // Enable SYSCFG clock
SYSCFG_I2CFastModePlusConfig(SYSCFG_I2CFastModePlus_I2C1, DISABLE);
SYSCFG_I2CFastModePlusConfig(SYSCFG_I2CFastModePlus_I2C2, DISABLE);
/*
Values calculated with I2C_Timing_Configuration_V1.0.1.xls file (see AN4235)
* Standard mode (up to 100 kHz)
* Fast Mode (up to 400 kHz)
* Fast Mode Plus (up to 1 MHz)
Below values obtained with:
- I2C clock source = 8 MHz (HSI clock per default)
- Analog filter delay = ON
- Digital filter coefficient = 0
- Rise time = 100 ns
- Fall time = 10ns
*/
switch (hz) {
case 100000:
tim = 0x00201D2B; // Standard mode
break;
case 200000:
tim = 0x0010021E; // Fast Mode
break;
case 400000:
tim = 0x0010020A; // Fast Mode
break;
case 1000000:
tim = 0x00100001; // Fast Mode Plus
// Enable the Fast Mode Plus capability
if (obj->i2c == I2C_1) {
SYSCFG_I2CFastModePlusConfig(SYSCFG_I2CFastModePlus_I2C1, ENABLE);
}
if (obj->i2c == I2C_2) {
SYSCFG_I2CFastModePlusConfig(SYSCFG_I2CFastModePlus_I2C2, ENABLE);
}
break;
default:
error("Only 100kHz, 200kHz, 400kHz and 1MHz I2C frequencies are supported.");
break;
}
// I2C configuration
I2C_DeInit(i2c);
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_AnalogFilter = I2C_AnalogFilter_Enable;
I2C_InitStructure.I2C_DigitalFilter = 0x00;
I2C_InitStructure.I2C_OwnAddress1 = 0x00;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_Timing = tim;
I2C_Init(i2c, &I2C_InitStructure);
I2C_Cmd(i2c, ENABLE);
}
示例15: mchf_hw_i2c2_init
//*----------------------------------------------------------------------------
//* Function Name : mchf_hw_i2c2_init
//* Object :
//* Object :
//* Input Parameters :
//* Output Parameters :
//* Functions called :
//*----------------------------------------------------------------------------
void mchf_hw_i2c2_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
I2C_InitTypeDef I2C_InitStructure;
// CODEC_I2C SCL and SDA pins configuration
GPIO_InitStructure.GPIO_Pin = I2C2_SCL_PIN|I2C2_SDA_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; // we also have ext pullups
GPIO_Init(I2C2_SCL_GPIO, &GPIO_InitStructure);
// Connect pins to I2C peripheral
GPIO_PinAFConfig(I2C2_SCL_GPIO, I2C2_SCL_PINSRC, CODEC_I2C_GPIO_AF);
GPIO_PinAFConfig(I2C2_SDA_GPIO, I2C2_SDA_PINSRC, CODEC_I2C_GPIO_AF);
// Enable the CODEC_I2C peripheral clock
RCC_APB1PeriphClockCmd(I2C2_CLK, ENABLE);
// CODEC_I2C peripheral configuration
I2C_DeInit(CODEC_I2C);
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = 0x33;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = I2C2_SPEED;
// Enable the I2C peripheral
I2C_Cmd (CODEC_I2C, ENABLE);
I2C_Init(CODEC_I2C, &I2C_InitStructure);
}