本文整理汇总了C++中LCD::writeStringTiny方法的典型用法代码示例。如果您正苦于以下问题:C++ LCD::writeStringTiny方法的具体用法?C++ LCD::writeStringTiny怎么用?C++ LCD::writeStringTiny使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LCD
的用法示例。
在下文中一共展示了LCD::writeStringTiny方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sysStatus
volatile char sysStatus(char key, char first)
{
char* text;
if(first)
{
}
lcd.cls();
text = getChargingStatus();
char l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 6 + SY, text);
lcd.writeStringTiny(3, 6 + SY, TEXT("USB:"));
char buf[6];
uint16_t val;
val = (uint16_t)battery_percent;
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 12 + SY, text);
lcd.writeStringTiny(3, 12 + SY, TEXT("Battery:"));
val = hardware_freeMemory();
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 18 + SY, text);
lcd.writeStringTiny(3, 18 + SY, TEXT("Free RAM:"));
val = clock.seconds;
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 24 + SY, text);
lcd.writeStringTiny(3, 24 + SY, TEXT("Clock s:"));
val = clock.ms;
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 30 + SY, text);
lcd.writeStringTiny(3, 30 + SY, TEXT("Clock ms:"));
menu.setTitle(TEXT("Sys Status"));
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.update();
_delay_ms(10);
if(key == FL_KEY || key == LEFT_KEY)
return FN_CANCEL;
return FN_CONTINUE;
}
示例2: firmwareUpdated
volatile char firmwareUpdated(char key, char first)
{
if(first)
{
uint8_t l, c;
char* text;
char buf[6];
lcd.cls();
menu.setTitle(TEXT("FIRMWARE"));
lcd.writeStringTiny(13, 10, TEXT("Successfully"));
lcd.writeStringTiny(25, 16, TEXT("Updated"));
lcd.writeStringTiny(8, 28, TEXT("Version:"));
uint32_t version = VERSION;
l = 0;
while(version)
{
c = (char)(version % 10);
buf[0] = ((char)(c + '0'));
buf[1] = 0;
text = buf;
l += lcd.measureStringTiny(text) + 1;
lcd.writeStringTiny(75 - l, 28, text);
version -= (uint32_t)c;
version /= 10;
}
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.update();
}
switch(key)
{
case FL_KEY:
case LEFT_KEY:
return FN_CANCEL;
}
return FN_CONTINUE;
}
示例3: lightMeter
volatile char lightMeter(char key, char first)
{
static char held = 0;
if(first)
{
lcd.backlight(0);
hardware_flashlight(0);
}
if(!held)
{
lcd.cls();
menu.setTitle(TEXT("Light Meter"));
if(key == FR_KEY)
{
held = 1;
menu.setBar(TEXT("RETURN"), TEXT("RUN"));
}
else
{
menu.setBar(TEXT("RETURN"), TEXT("PAUSE"));
}
char buf[6] , l;
uint16_t val;
char* text;
val = (uint16_t)hardware_readLight(0);
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 12 + SY, text);
lcd.writeStringTiny(3, 12 + SY, TEXT("Level 1:"));
val = (uint16_t)hardware_readLight(1);
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 18 + SY, text);
lcd.writeStringTiny(3, 18 + SY, TEXT("Level 2:"));
val = (uint16_t)hardware_readLight(2);
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 24 + SY, text);
lcd.writeStringTiny(3, 24 + SY, TEXT("Level 3:"));
lcd.update();
_delay_ms(10);
}
else
{
if(key == FR_KEY)
held = 0;
}
if(key == FL_KEY)
{
lcd.backlight(255);
return FN_CANCEL;
}
return FN_CONTINUE;
}
示例4: sysInfo
volatile char sysInfo(char key, char first)
{
if(first)
{
lcd.cls();
char l;
char* text;
char buf[6];
uint16_t val;
// Lines (Y) = 6, 12, 18, 24, 30
val = (uint16_t)bt.version();
text = TEXT("TLP01");
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 6 + SY, text);
lcd.writeStringTiny(3, 6 + SY, TEXT("Model:"));
if(val > 1)
text = TEXT("BTLE");
else
text = TEXT("KS99");
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 12 + SY, text);
lcd.writeStringTiny(3, 12 + SY, TEXT("Edition:"));
lcd.writeStringTiny(3, 18 + SY, TEXT("Firmware:"));
uint32_t version = VERSION;
char c;
l = 0;
while(version)
{
c = (char)(version % 10);
buf[0] = ((char)(c + '0'));
buf[1] = 0;
text = buf;
l += lcd.measureStringTiny(text) + 1;
lcd.writeStringTiny(80 - l, 18 + SY, text);
version -= (uint32_t)c;
version /= 10;
}
if(val > 1)
{
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 30 + SY, text);
lcd.writeStringTiny(3, 30 + SY, TEXT("BT FW Version:"));
}
menu.setTitle(TEXT("System Info"));
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.update();
}
if(key == FL_KEY || key == LEFT_KEY)
return FN_CANCEL;
return FN_CONTINUE;
}
示例5: displayTimerStatus
void displayTimerStatus(uint8_t remote_system)
{
timer_status stat;
char buf[6], l, *text;
uint16_t val;
if(remote_system)
{
stat = remote.status;
l = remote.running;
}
else
{
stat = timer.status;
l = timer.running;
}
//
//06 Time remaining
//12 Time to next photo
//18 Next bulb
//24 Status
//30 Battery %
if(l)
{
if(stat.mode & TIMELAPSE)
{
val = stat.photosTaken;
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 6 + SY, text);
lcd.writeStringTiny(3, 6 + SY, TEXT("Photos:"));
val = stat.photosRemaining;
if(stat.infinitePhotos == 0)
{
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 12 + SY, text);
lcd.writeStringTiny(3, 12 + SY, TEXT("Photos rem:"));
}
else
{
lcd.writeStringTiny(3, 12 + SY, TEXT("Infinite Photos"));
}
val = stat.nextPhoto;
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 18 + SY, text);
lcd.writeStringTiny(3, 18 + SY, TEXT("Next Photo:"));
}
}
text = stat.textStatus;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 24 + SY, text);
lcd.writeStringTiny(3, 24 + SY, TEXT("Status:"));
if(remote_system)
val = (uint16_t) remote.battery;
else
val = (uint16_t) battery_percent;
int_to_str(val, buf);
text = buf;
l = lcd.measureStringTiny(text);
lcd.writeStringTiny(80 - l, 30 + SY, text);
lcd.writeStringTiny(3, 30 + SY, TEXT("Battery Level:"));
}
示例6: batteryStatus
volatile char batteryStatus(char key, char first)
{
// uint16_t batt_high = 645;
// uint16_t batt_low = 540;
static uint8_t charging;
char stat = battery_status();
if(first)
{
charging = (stat > 0);
}
// unsigned int batt_level = battery_read_raw();
#define BATT_LINES 36
// uint8_t lines = ((batt_level - batt_low) * BATT_LINES) / (batt_high - batt_low);
uint8_t lines = (uint8_t)((uint16_t)battery_percent * BATT_LINES / 100);
if(lines > BATT_LINES - 1 && stat == 1)
lines = BATT_LINES - 1;
if(lines > BATT_LINES || stat == 2)
lines = BATT_LINES;
lcd.cls();
char* text;
text = getChargingStatus();
char l = lcd.measureStringTiny(text) / 2;
if(battery_status())
lcd.writeStringTiny(41 - l, 31, text);
// Draw Battery Outline //
lcd.drawLine(20, 15, 60, 15);
lcd.drawLine(20, 16, 20, 27);
lcd.drawLine(21, 27, 60, 27);
lcd.drawLine(60, 16, 60, 19);
lcd.drawLine(60, 23, 60, 26);
lcd.drawLine(61, 19, 61, 23);
// Draw Battery Charge //
for(uint8_t i = 0; i <= lines; i++)
{
lcd.drawLine(22 + i, 17, 22 + i, 25);
}
menu.setTitle(TEXT("Battery Status"));
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.update();
if(stat == 0 && charging)
{
clock.awake();
return FN_CANCEL; // unplugged
}
if(key == FL_KEY)
return FN_CANCEL;
return FN_CONTINUE;
}
示例7: shutterTest
volatile char shutterTest(char key, char first)
{
static char status, cable;
if(first)
{
status = 0;
cable = 0;
lcd.cls();
menu.setTitle(TEXT("Shutter Test"));
menu.setBar(TEXT("Half"), TEXT("Full"));
lcd.update();
}
if(key == FL_KEY && status != 1)
{
status = 1;
lcd.eraseBox(20, 18, 20 + 6 * 6, 26);
lcd.writeString(20, 18, TEXT("(HALF)"));
timer.half();
lcd.update();
}
else if(key == FR_KEY && status != 2)
{
status = 2;
lcd.eraseBox(20, 18, 20 + 6 * 6, 26);
lcd.writeString(20, 18, TEXT("(FULL)"));
timer.full();
lcd.update();
}
else if(key != 0)
{
status = 0;
lcd.eraseBox(20, 18, 20 + 6 * 6, 26);
timer.off();
lcd.update();
}
if(timer.cableIsConnected())
{
if(cable == 0)
{
cable = 1;
lcd.writeStringTiny(6, 28, TEXT("Cable Connected"));
lcd.update();
}
}
else
{
if(cable == 1)
{
cable = 0;
lcd.eraseBox(6, 28, 6 + 15 * 5, 36);
lcd.update();
}
}
if(key == LEFT_KEY)
return FN_CANCEL;
return FN_CONTINUE;
}
示例8: btConnect
volatile char btConnect(char key, char first)
{
static uint8_t sfirst = 1;
uint8_t i;
static uint8_t menuSize;
static uint8_t menuSelected;
uint8_t c;
uint8_t update, menuScroll;
update = 0;
if(sfirst)
{
menuScroll = 0;
menuSelected = 0;
sfirst = 0;
update = 1;
if(bt.state != BT_ST_CONNECTED)
{
bt.advertise();
bt.scan();
}
}
switch(key)
{
case LEFT_KEY:
case FL_KEY:
sfirst = 1;
if(bt.state != BT_ST_CONNECTED) bt.sleep();
return FN_CANCEL;
case FR_KEY:
if(bt.state == BT_ST_CONNECTED)
{
bt.disconnect();
}
else
{
bt.connect(bt.device[menuSelected].addr);
}
break;
}
update = 1;
switch(bt.event)
{
case BT_EVENT_DISCOVERY:
debug(STR("dicovery!\r\n"));
break;
case BT_EVENT_SCAN_COMPLETE:
debug(STR("done!\r\n"));
if(bt.state != BT_ST_CONNECTED) bt.scan();
break;
case BT_EVENT_DISCONNECT:
bt.scan();
break;
default:
update = 0;
}
bt.event = BT_EVENT_NULL; // clear event so we don't process it twice
if(first)
{
update = 1;
}
if(key == UP_KEY && menuSelected > 0)
{
menuSelected--;
update = 1;
}
else if(key == DOWN_KEY && menuSelected < menuSize - 1)
{
menuSelected++;
update = 1;
}
if(update)
{
lcd.cls();
if(bt.state == BT_ST_CONNECTED)
{
menu.setTitle(TEXT("Connect"));
lcd.writeStringTiny(18, 20, TEXT("Connected!"));
menu.setBar(TEXT("RETURN"), TEXT("DISCONNECT"));
}
else
{
if(menuSelected > 2)
menuScroll = menuSelected - 2;
menuSize = 0;
for(i = 0; i < bt.devices; i++)
{
if(i >= menuScroll && i <= menuScroll + 4)
{
//.........这里部分代码省略.........
示例9: motionTrigger
volatile char motionTrigger(char key, char first)
{
uint8_t i;
uint16_t val;
static uint16_t lv[3];
static uint8_t threshold = 2;
if(key == LEFT_KEY)
{
if(threshold > 0) threshold--;
first = 1;
}
if(key == RIGHT_KEY)
{
if(threshold < 4) threshold++;
first = 1;
}
if(first)
{
sleepOk = 0;
clock.tare();
lcd.cls();
menu.setTitle(TEXT("Motion Sensor"));
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.drawLine(10, 22, 84-10, 22);
lcd.drawLine(11, 21, 11, 23);
lcd.drawLine(84-11, 21, 84-11, 23);
lcd.drawLine(12, 20, 12, 24);
lcd.drawLine(84-12, 20, 84-12, 24);
lcd.drawLine(13, 20, 13, 24);
lcd.drawLine(84-13, 20, 84-13, 24);
lcd.setPixel(42, 21);
lcd.setPixel(42+10, 21);
lcd.setPixel(42-10, 21);
lcd.setPixel(42+20, 21);
lcd.setPixel(42-20, 21);
i = threshold * 10;
lcd.drawLine(42-3-20+i, 16, 42+3-20+i, 16);
lcd.drawLine(42-2-20+i, 17, 42+2-20+i, 17);
lcd.drawLine(42-1-20+i, 18, 42+1-20+i, 18);
lcd.setPixel(42-20+i, 19);
lcd.writeStringTiny(19, 25, TEXT("SENSITIVITY"));
lcd.update();
lcd.backlight(0);
hardware_flashlight(0);
_delay_ms(50);
for(i = 0; i < 3; i++)
{
lv[i] = (uint16_t)hardware_readLight(i);
}
}
uint8_t thres = 4 - threshold + 2;
if((4 - threshold) > 2) thres += ((4 - threshold) - 1) * 2;
for(i = 0; i < 3; i++)
{
val = (uint16_t)hardware_readLight(i);
if(clock.eventMs() > 1000 && val > thres && (val < (lv[i] - thres) || val > (lv[i] + thres)))
{
clock.tare();
shutter_capture();
}
lv[i] = val;
}
if(key == FL_KEY)
{
sleepOk = 1;
lcd.backlight(255);
return FN_CANCEL;
}
return FN_CONTINUE;
}