void I2C_init(uint32_t I2Cx){ GPIO_Configuration_I2C(I2Cx); i2c_clock_config(I2Cx, 400000, I2C_DTCY_2); /* I2C address configure */ i2c_mode_addr_config(I2Cx, I2C_I2CMODE_ENABLE, I2C_ADDFORMAT_7BITS, 0); /* enable acknowledge */ i2c_ack_config(I2Cx, I2C_ACK_DISABLE); /...
5. // GPIO_BOP(GPIOA) = (uint32_t)GPIO_PIN_8;6. // receiver_buffer[0] = (uint16_t)(GET_BITS(USART_RDATA(USART0), 0U, 8U));7. // USART_REG_VAL(USART0, USART_INT_TBE) |= BIT(USART_BIT_POS(USART_INT_TBE));8. // 9. // } 10. // ...
I2C_SPEED, I2C_DTCY_2);/* configure I2C address */i2c_mode_addr_config(I2C_BUS[i2c_id], I2C_I2CMODE_ENABLE, I2C_ADDFORMAT_7BITS, I2C_OWN_ADDRESS7);/* enable I2C0 */i2c_enable(I2C_BUS[i2c_id]);/* enableacknowledge */i2c_ack_...
void I2C_init(uint32_t I2Cx) { GPIO_Configuration_I2C(I2Cx); i2c_clock_config(I2Cx, 400000, I2C_DTCY_2); /* I2Caddress configure */ i2c_mode_addr_config(I2Cx, I2C_I2CMODE_ENABLE, I2C_ADDFORMAT_7BITS, 0); /* enable acknowledge */ i2c_ack_config(I2Cx, I2C_ACK_DISABLE); /*...
CAN_FILTERBITS_32BIT:32位过滤器。 过滤器列表高位(filter_list_high) 用于存储要过滤的ID,若过滤器工作在32位模式,他存储的是所过滤ID的高16位;若过滤器工作在16位模式,它存储的就是一个完整的要过滤的ID。 描述:过滤器ID的高位部分,用于列表模式。
i2c_mode_addr_config(I2Cx, I2C_I2CMODE_ENABLE, I2C_ADDFORMAT_7BITS, 0); /* enable acknowledge */ i2c_ack_config(I2Cx, I2C_ACK_DISABLE); /* enable I2Cx */ i2c_enable(I2Cx); } 时钟及 GPIO 引脚配置 时钟及GPIO引脚配置如代码清单I2C时钟及GPIO引脚配置所示,在例程中PB6、PB7引脚需要配置...
"PE(Parity error),FE(Framing error),NE(Noise error),ORE(OverRun error) and IDLE(Idle line detected) pending bits are cleared by software sequence: a read operation to USART_SR register (USART_GetITStatus()) followed by a read operation to USART_DR register (USART_ReceiveData())." ...
/* get the card command classes from CSD */ tempbyte = (uint8_t)((sd_csd[1] & SD_MASK_24_31BITS) >> 24U); tempccc = (uint16_t)((uint16_t)tempbyte << 4U); tempbyte = (uint8_t)((sd_csd[1] & SD_MASK_16_23BITS) >> 16U); tempccc |= ((uint16_t)tempbyte & ...
复制Cvoid nvic_config(void){/* 2 bits for preemption priority, 2 bits for subpriority */nvic_...
复制Cvoid usb_timer_init (void){/* configure the priority group to 2 bits */nvic_priority_...