极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9280|回复: 2

求助函数调用

[复制链接]
发表于 2013-8-11 15:08:34 | 显示全部楼层 |阅读模式
一个TFT的库文件  函数

inline size_t TFTLCD::write(uint8_t c) {
        if (c == '\n') {     
    cursor_y += textsize*8;
    cursor_x = 0;
  } else if (c == '\r') {
    // skip em
  } else {
    drawChar(cursor_x, cursor_y, c, textcolor, textsize);
    cursor_x += textsize*6;
  }
return 1;
}//写


怎么在程序里面调用
tft.write("000");   这样不行  是要提前定义变量吗
回复

使用道具 举报

发表于 2013-8-11 15:27:05 | 显示全部楼层
tft.write('0');
tft.write('0');
tft.write('0');
回复 支持 反对

使用道具 举报

发表于 2013-8-12 09:29:56 | 显示全部楼层
tft.write("000");
“000”是个字符串吧。
TFTLCD::write(uint8_t c)
这里定义的write参数类型是uint8_t,参数类型不对,当然不能这么调用。
  1. tft.write('0');
  2. tft.write('\n');
  3. tft.write('\r');
  4. 都是可以的。
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-5 22:19 , Processed in 0.035227 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表