add i2c_config

This commit is contained in:
2024-09-27 00:12:13 +08:00
parent 9d7d0935ba
commit 9ce4cd2e44
7 changed files with 188 additions and 52 deletions

View File

@@ -32,7 +32,7 @@ int main(void)
/* ---------- debug start ---------- */
i2c_config();
/* ---------- debug end ---------- */
@@ -43,7 +43,7 @@ int main(void)
delay_ms(2000);
while(1)
while (1)
{
delay_ms(ULTRASONIC_TRAN_US);
@@ -59,11 +59,12 @@ int main(void)
}
/* retarget the C library printf function to the USART */
int _write (int fd, char *pBuffer, int size) {
int _write(int fd, char* pBuffer, int size)
{
for (int i = 0; i < size; i++)
{
usart_data_transmit(USART0, (uint8_t)pBuffer[i]);
while(RESET == usart_flag_get(USART0, USART_FLAG_TBE));
while (RESET == usart_flag_get(USART0, USART_FLAG_TBE));
}
return size;
}