我正在使用 STM32476 Nucleo 板,现在我将传感器中的一些数据写入可读文件,但速度太慢了。显示我现在正在做的一些代码:
static char buffer[LINE_MAX];
char* p = buffer;
p += sprintf(p, "%f,%f,%f,", s.ax.val, s.ay.val, s.az.val);
p += sprintf(p, "%f,%f,%f,", s.gx.val, s.gy.val, s.gz.val);
p += sprintf(p, " %f"DEGREE_UTF8"C\r\n", s.temperature);
int ret;
unsigned bytes_written=0;
if ((ret = f_write(&USERFile, buffer, length, &bytes_written)) != FR_OK || bytes_written != length) {
hang("write failed: %d (written = %u)", ret, bytes_written);
}
我怎么能把它改成用二进制写呢?