Skip to content

Instantly share code, notes, and snippets.

@ukaszjankowski
Created April 26, 2020 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ukaszjankowski/6ffca0fd179bcb6cafe5cc48cfa4a010 to your computer and use it in GitHub Desktop.
Save ukaszjankowski/6ffca0fd179bcb6cafe5cc48cfa4a010 to your computer and use it in GitHub Desktop.
HAL_StatusTypeDef result;
uint8_t i;
for (i=1; i<128; i++)
{
result = HAL_I2C_IsDeviceReady(&hi2c1, (uint16_t)(i<<1), 2, 2);
if (result != HAL_OK)
{
CDC_Transmit_FS(".", 1);
}
if (result == HAL_OK)
{
uint8_t buf[10] = {0};
sprintf(buf, "0x%X \r\n", i);
CDC_Transmit_FS(buf, sizeof(buf));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment