Вот и проводка:
in main.c выполнять задание следующим образом:
Код: Выделить всё
lib.hppКод: Выделить всё
#ifndef INC_LIB_HPP_
#define INC_LIB_HPP_
#if __cplusplus
extern "C" {
#endif
inline I2C_HandleTypeDef hi2c1;
inline UART_HandleTypeDef huart2;
inline uint8_t buf[32];
inline HAL_StatusTypeDef ret;
inline int16_t val;
inline float temp_c;
void run();
void I2C1_Scan();
void HTU21D_Init();
#if __cplusplus
}
#endif
#endif
< /code>
код Edit < /strong>:
lib.cppКод: Выделить всё
static constexpr uint8_t HTU21D_ADDR = (0x40 0x7FF)
val |= 0xF000;
temp_c = val * 0.0625;
temp_c *= 100;
sprintf((char*)buf,
"%u.%02u C\r\n",
((unsigned int)temp_c / 100),
((unsigned int) temp_c % 100));
}
}
HAL_UART_Transmit(&huart2, buf, strlen((char*)buf), HAL_MAX_DELAY);
HAL_Delay(500);
} // End of whil(1)
}
wyly Idea is is is is is how what is is is yt has how is is how who is is yt has how who is hay is hay hay is yt has how?>
Подробнее здесь: https://stackoverflow.com/questions/797 ... tting-data
Мобильная версия