Finalizing the I2C

This commit is contained in:
Lennart Eriksson 2016-10-03 09:51:09 +02:00
parent a4d7eccd2b
commit 6983d53f8e
2 changed files with 4 additions and 4 deletions

View File

@ -68,8 +68,7 @@ int main(void)
// Initialize the Hardware Abstraction Layer
HAL_Init();
// Configure the system clock to 100 MHz
system_clock_config();
init_system();
I2C_HandleTypeDef i2c_profile;
@ -89,7 +88,8 @@ int main(void)
uint8_t reset_pointer_data[1] = { 0b00000011 };
uint8_t response_data[6] = { 0x0 };
// This sequence starts the compass by first initializing it with the first 2 send
// The third is there to say that the system should be continous communication
i2c_send(&i2c_profile, address, &start_request_1, 2);
i2c_send(&i2c_profile, address, &start_request_2, 2);
i2c_send(&i2c_profile, address, &start_request_3, 2);

View File

@ -59,7 +59,7 @@ bool i2c_configure(I2C_TypeDef *i2c,
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = i2c_af;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_GPIO_Init(i2c_port, &GPIO_InitStruct);
//Initialize I2C communication
out_profile->Instance = i2c;