Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool isl29125_init(I2C_HandleTypeDef* hi2c_x)
- {
- bool ret = true;
- if(HAL_I2C_IsDeviceReady(hi2c_x, ISL_I2C_ADDR<<1, 10, 1000) != HAL_OK) {
- ret &= false;
- }
- uint8_t receive_data[1];
- uint8_t send_data = DEVICE_ID;
- HAL_I2C_Master_Transmit(hi2c_x,ISL_I2C_ADDR<<1,&send_data,1,1000);
- HAL_Delay(15);
- HAL_I2C_Master_Receive(hi2c_x,ISL_I2C_ADDR<<1,receive_data,1,1000);
- if (receive_data[0] != 0x7D) {
- ret &= false;
- }
- return(ret);
- }
- static void MX_I2C1_Init(void)
- {
- hi2c1.Instance = I2C1;
- hi2c1.Init.Timing = 0x2000090E;
- hi2c1.Init.OwnAddress1 = 0;
- hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
- hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
- hi2c1.Init.OwnAddress2 = 0;
- hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
- hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
- hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
- }
Add Comment
Please, Sign In to add comment