port SLCD to gossamer, add new string display options

This commit is contained in:
joeycastillo 2024-09-18 16:04:55 -04:00
parent ac88e2de8c
commit 9e32cbc523
8 changed files with 887 additions and 242 deletions

View File

@ -32,6 +32,8 @@ SRCS += \
./watch-library/hardware/watch/watch_extint.c \
./watch-library/hardware/watch/watch_gpio.c \
./watch-library/hardware/watch/watch_rtc.c \
./watch-library/hardware/watch/watch_slcd.c \
./watch-library/shared/watch/watch_common_display.c \
./watch-library/hardware/watch/watch_tcc.c \
./app.c \

15
app.c
View File

@ -1,6 +1,5 @@
#include "app.h"
#include "watch.h"
#include "watch_private.h"
#include "delay.h"
void app_init(void) {
@ -8,21 +7,11 @@ void app_init(void) {
void app_setup(void) {
watch_enable_leds();
watch_enable_external_interrupts();
watch_register_interrupt_callback(HAL_GPIO_BTN_LIGHT_pin(), NULL, INTERRUPT_TRIGGER_FALLING);
watch_register_interrupt_callback(HAL_GPIO_BTN_MODE_pin(), NULL, INTERRUPT_TRIGGER_FALLING);
watch_register_interrupt_callback(HAL_GPIO_BTN_ALARM_pin(), NULL, INTERRUPT_TRIGGER_FALLING);
watch_enable_display();
}
bool app_loop(void) {
static bool on = false;
if (on) {
watch_set_led_off();
} else {
watch_set_led_yellow();
}
on = !on;
watch_display_main_line("123456");
return true;
}

View File

@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2020 Joey Castillo
* Copyright (c) 2020-2024 Joey Castillo
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -22,80 +22,123 @@
* SOFTWARE.
*/
#include "pins.h"
#include "watch_slcd.h"
#include "watch_private_display.h"
#include "hpl_slcd_config.h"
#include "watch_common_display.h"
#include "slcd.h"
//////////////////////////////////////////////////////////////////////////////////////////
// Segmented Display
static void _sync_slcd(void) {
while (SLCD->SYNCBUSY.reg);
}
static uint16_t _slcd_framerate = 0;
static uint16_t _slcd_fc_min_ms_bypass = 0;
void watch_enable_display(void) {
SEGMENT_LCD_0_init();
slcd_sync_enable(&SEGMENT_LCD_0);
HAL_GPIO_SLCD0_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD1_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD2_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD3_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD4_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD5_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD6_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD7_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD8_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD9_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD10_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD11_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD12_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD13_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD14_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD15_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD16_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD17_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD18_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD19_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD20_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD21_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD22_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD23_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD24_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD25_pmuxen(HAL_GPIO_PMUX_B);
HAL_GPIO_SLCD26_pmuxen(HAL_GPIO_PMUX_B);
#ifdef USE_CUSTOM_LCD
// Original famous Casio LCD: 1/3 bias, 1/4 duty with a frame rate of 32 Hz
slcd_init(LCD_PIN_ENABLE, SLCD_BIAS_THIRD, SLCD_DUTY_4_COMMON, SLCD_PRESCALER_DIV64, SLCD_CLOCKDIV_4);
// exact frame rate is: 32768 / (4 * 64 * 4) ≈ 32 Hz
_slcd_framerate = 32;
#else
// Original famous Casio LCD: 1/3 bias, 1/3 duty with a frame rate of ~34 Hz
slcd_init(LCD_PIN_ENABLE, SLCD_BIAS_THIRD, SLCD_DUTY_3_COMMON, SLCD_PRESCALER_DIV64, SLCD_CLOCKDIV_5);
// exact frame rate is: 32768 / (3 * 64 * 5) ≈ 34.13 Hz
_slcd_framerate = 34;
#endif
// calculate the smallest duration we can time before we have to engage the frame counter prescaler bypass
_slcd_fc_min_ms_bypass = 32 * (1000 / _slcd_framerate);
slcd_clear();
slcd_set_contrast(6);
slcd_enable();
}
inline void watch_set_pixel(uint8_t com, uint8_t seg) {
slcd_sync_seg_on(&SEGMENT_LCD_0, SLCD_SEGID(com, seg));
slcd_set_segment(com, seg);
}
inline void watch_clear_pixel(uint8_t com, uint8_t seg) {
slcd_sync_seg_off(&SEGMENT_LCD_0, SLCD_SEGID(com, seg));
slcd_clear_segment(com, seg);
}
void watch_clear_display(void) {
SLCD->SDATAL0.reg = 0;
SLCD->SDATAL1.reg = 0;
SLCD->SDATAL2.reg = 0;
slcd_clear();
}
void watch_start_character_blink(char character, uint32_t duration) {
SLCD->CTRLD.bit.FC0EN = 0;
_sync_slcd();
slcd_set_frame_counter_enabled(0, false);
if (duration <= SLCD_FC_BYPASS_MAX_MS) {
SLCD->FC0.reg = SLCD_FC0_PB | ((duration / (1000 / SLCD_FRAME_FREQUENCY)) - 1);
if (duration <= _slcd_fc_min_ms_bypass) {
slcd_configure_frame_counter(0, (duration / (1000 / _slcd_framerate)) - 1, false);
} else {
SLCD->FC0.reg = (((duration / (1000 / SLCD_FRAME_FREQUENCY)) / 8 - 1));
slcd_configure_frame_counter(0, ((duration / (1000 / _slcd_framerate)) / 8 - 1), true);
}
SLCD->CTRLD.bit.FC0EN = 1;
slcd_set_frame_counter_enabled(0, true);
watch_display_character(character, 7);
watch_clear_pixel(2, 10); // clear segment B of position 7 since it can't blink
SLCD->CTRLD.bit.BLINK = 0;
SLCD->CTRLA.bit.ENABLE = 0;
_sync_slcd();
SLCD->BCFG.bit.BSS0 = 0x07;
SLCD->BCFG.bit.BSS1 = 0x07;
SLCD->CTRLD.bit.BLINK = 1;
_sync_slcd();
SLCD->CTRLA.bit.ENABLE = 1;
_sync_slcd();
slcd_set_blink_enabled(false);
slcd_configure_blink(false, 0x07, 0x07, 0);
slcd_set_blink_enabled(true);
}
void watch_stop_blink(void) {
SLCD->CTRLD.bit.FC0EN = 0;
SLCD->CTRLD.bit.BLINK = 0;
slcd_set_frame_counter_enabled(0, false);
slcd_set_blink_enabled(false);
}
void watch_start_tick_animation(uint32_t duration) {
watch_display_character(' ', 8);
const uint32_t segs[] = { SLCD_SEGID(0, 2)};
slcd_sync_start_animation(&SEGMENT_LCD_0, segs, 1, duration);
slcd_set_frame_counter_enabled(1, false);
slcd_set_circular_shift_animation_enabled(false);
if (duration <= _slcd_fc_min_ms_bypass) {
slcd_configure_frame_counter(1, (duration / (1000 / _slcd_framerate)) - 1, false);
} else {
slcd_configure_frame_counter(1, ((duration / (1000 / _slcd_framerate)) / 8 - 1), true);
}
slcd_set_frame_counter_enabled(1, true);
slcd_configure_circular_shift_animation(0b00000001, 2, SLCD_CSRSHIFT_LEFT, 1);
slcd_set_circular_shift_animation_enabled(true);
}
bool watch_tick_animation_is_running(void) {
return hri_slcd_get_CTRLD_CSREN_bit(SLCD);
// TODO: wrap this in gossamer call
return SLCD->CTRLD.bit.CSREN;
}
void watch_stop_tick_animation(void) {
const uint32_t segs[] = { SLCD_SEGID(0, 2)};
slcd_sync_stop_animation(&SEGMENT_LCD_0, segs, 1);
slcd_set_circular_shift_animation_enabled(false);
watch_display_character(' ', 8);
}

View File

@ -62,7 +62,7 @@
typedef void (*watch_cb_t)(void);
#include "watch_rtc.h"
// #include "watch_slcd.h"
#include "watch_slcd.h"
#include "watch_extint.h"
#include "watch_tcc.h"
// #include "watch_adc.h"

View File

@ -23,16 +23,34 @@
*/
#include "watch_slcd.h"
#include "watch_private_display.h"
#include "watch_common_display.h"
#include <string.h>
#ifdef USE_CUSTOM_LCD
static const uint32_t IndicatorSegments[] = {
SLCD_SEGID(0, 21), // WATCH_INDICATOR_SIGNAL
SLCD_SEGID(1, 21), // WATCH_INDICATOR_BELL
SLCD_SEGID(3, 21), // WATCH_INDICATOR_PM
SLCD_SEGID(2, 21), // WATCH_INDICATOR_24H
SLCD_SEGID(1, 0), // WATCH_INDICATOR_LAP
SLCD_SEGID(2, 0), // WATCH_INDICATOR_BATTERY
SLCD_SEGID(3, 0), // WATCH_INDICATOR_SLEEP
};
#else
static const uint32_t IndicatorSegments[] = {
SLCD_SEGID(0, 17), // WATCH_INDICATOR_SIGNAL
SLCD_SEGID(0, 16), // WATCH_INDICATOR_BELL
SLCD_SEGID(2, 17), // WATCH_INDICATOR_PM
SLCD_SEGID(2, 16), // WATCH_INDICATOR_24H
SLCD_SEGID(1, 10), // WATCH_INDICATOR_LAP
// Aliases for indicators unavailable on the original F-91W LCD
SLCD_SEGID(1, 10), // WATCH_INDICATOR_BATTERY (same as LAP)
SLCD_SEGID(4, 0), // WATCH_INDICATOR_SLEEP (does not exist, will set in SDATAL4 which is harmless)
};
#endif
void watch_display_character(uint8_t character, uint8_t position) {
// special cases for positions 4 and 6
if (position == 4 || position == 6) {
@ -43,8 +61,6 @@ void watch_display_character(uint8_t character, uint8_t position) {
else if (character == 'M' || character == 'm' || character == 'N') character = 'n'; // M and uppercase N need to be lowercase n
else if (character == 'c') character = 'C'; // C needs to be uppercase
else if (character == 'J') character = 'j'; // same
else if (character == 't' || character == 'T') character = '+'; // t in those locations looks like E otherwise
else if (character == 'y' || character == 'Y') character = '4'; // y in those locations looks like g otherwise
else if (character == 'v' || character == 'V' || character == 'U' || character == 'W' || character == 'w') character = 'u'; // bottom segment duplicated, so show in top half
} else {
if (character == 'u') character = 'v'; // we can use the bottom segment; move to lower half
@ -72,25 +88,25 @@ void watch_display_character(uint8_t character, uint8_t position) {
if (character == 'I') character = 'l'; // uppercase I only works in position 0
}
uint64_t segmap = Segment_Map[position];
uint64_t segdata = Character_Set[character - 0x20];
digit_mapping_t segmap = Watch_Display_Mapping[position];
uint8_t segdata = Watch_Character_Set[character - 0x20];
for (int i = 0; i < 8; i++) {
uint8_t com = (segmap & 0xFF) >> 6;
if (com > 2) {
// COM3 means no segment exists; skip it.
segmap = segmap >> 8;
if (segmap.segment[i].value == segment_does_not_exist) {
// Segment does not exist; skip it.
segdata = segdata >> 1;
continue;
}
uint8_t seg = segmap & 0x3F;
uint8_t com = segmap.segment[i].address.com;
uint8_t seg = segmap.segment[i].address.seg;
if (segdata & 1)
watch_set_pixel(com, seg);
else
watch_clear_pixel(com, seg);
if (segdata & 1) {
watch_set_pixel(com, seg);
}
else {
watch_clear_pixel(com, seg);
}
segmap = segmap >> 8;
segdata = segdata >> 1;
}
@ -102,25 +118,25 @@ void watch_display_character(uint8_t character, uint8_t position) {
void watch_display_character_lp_seconds(uint8_t character, uint8_t position) {
// Will only work for digits and for positions 8 and 9 - but less code & checks to reduce power consumption
uint64_t segmap = Segment_Map[position];
uint64_t segdata = Character_Set[character - 0x20];
digit_mapping_t segmap = Watch_Display_Mapping[position];
uint8_t segdata = Watch_Character_Set[character - 0x20];
for (int i = 0; i < 8; i++) {
uint8_t com = (segmap & 0xFF) >> 6;
if (com > 2) {
// COM3 means no segment exists; skip it.
segmap = segmap >> 8;
if (segmap.segment[i].value == segment_does_not_exist) {
// Segment does not exist; skip it.
segdata = segdata >> 1;
continue;
}
uint8_t seg = segmap & 0x3F;
uint8_t com = segmap.segment[i].address.com;
uint8_t seg = segmap.segment[i].address.seg;
if (segdata & 1)
watch_set_pixel(com, seg);
else
watch_clear_pixel(com, seg);
if (segdata & 1) {
watch_set_pixel(com, seg);
}
else {
watch_clear_pixel(com, seg);
}
segmap = segmap >> 8;
segdata = segdata >> 1;
}
}
@ -130,21 +146,133 @@ void watch_display_string(char *string, uint8_t position) {
while(string[i] != 0) {
watch_display_character(string[i], position + i);
i++;
if (position + i >= Num_Chars) break;
if (position + i >= 10) break;
}
}
void watch_display_top_left(char *string) {
watch_display_character(string[0], 0);
if (string[1]) {
watch_display_character(string[1], 1);
}
}
void watch_display_top_left_with_fallback(char *string, char *fallback) {
#ifdef USE_CUSTOM_LCD
(void)fallback;
watch_display_character(string[0], 0);
if (string[1]) {
watch_display_character(string[1], 1);
} else {
return;
}
if (string[2]) {
// position 3 is at index 10 in the display mapping
watch_display_character(string[2], 10);
}
#else
(void)string;
watch_display_top_left(fallback);
#endif
}
void watch_display_top_right(char *string) {
watch_display_character(string[0], 2);
if (string[1]) {
watch_display_character(string[1], 3);
}
}
void watch_display_top_right_with_fallback(char *string, char *fallback) {
#ifdef USE_CUSTOM_LCD
(void)fallback;
watch_display_top_right(string);
#else
(void)string;
watch_display_top_right(fallback);
#endif
}
void watch_display_main_line(char *string) {
#ifdef USE_CUSTOM_LCD
watch_clear_pixel(0, 22);
#endif
int i = 0;
while (string[i] != 0) {
watch_display_character(string[i], 4 + i);
i++;
}
}
void watch_display_main_line_with_fallback(char *string, char *fallback) {
#ifdef USE_CUSTOM_LCD
(void)fallback;
watch_clear_pixel(0, 22);
int i = 0;
int offset = 0;
size_t len = strlen(string);
if (len == 7 && string[0] == '1') {
watch_set_pixel(0, 22);
offset = 1;
i++;
}
while (string[i] != 0) {
watch_display_character(string[i], 4 + i - offset);
i++;
}
#else
(void)string;
watch_display_main_line(fallback);
#endif
}
void watch_display_hours(char *string) {
watch_display_character(string[0], 4);
if (string[1]) {
watch_display_character(string[1], 5);
}
}
void watch_display_minutes(char *string) {
watch_display_character(string[0], 6);
if (string[1]) {
watch_display_character(string[1], 7);
}
}
void watch_display_seconds(char *string) {
watch_display_character(string[0], 8);
if (string[1]) {
watch_display_character(string[1], 9);
}
// uncomment this line to see screen output on terminal, i.e.
// FR 29
// 11 50 23
// note that for partial displays (positon > 0) it will only show the characters that were updated.
// printf("________\n %c%c %c%c\n%c%c %c%c %c%c\n--------\n", (position > 0) ? ' ' : string[0], (position > 1) ? ' ' : string[1 - position], (position > 2) ? ' ' : string[2 - position], (position > 3) ? ' ' : string[3 - position], (position > 4) ? ' ' : string[4 - position], (position > 5) ? ' ' : string[5 - position], (position > 6) ? ' ' : string[6 - position], (position > 7) ? ' ' : string[7 - position], (position > 8) ? ' ' : string[8 - position], (position > 9) ? ' ' : string[9 - position]);
}
void watch_set_colon(void) {
#ifdef USE_CUSTOM_LCD
watch_set_pixel(0, 0);
#else
watch_set_pixel(1, 16);
#endif
}
void watch_clear_colon(void) {
#ifdef USE_CUSTOM_LCD
watch_clear_pixel(0, 0);
#else
watch_clear_pixel(1, 16);
#endif
}
void watch_set_decimal_if_available(void) {
#ifdef USE_CUSTOM_LCD
watch_set_pixel(0, 14);
#endif
}
void watch_clear_decimal_if_available(void) {
#ifdef USE_CUSTOM_LCD
watch_clear_pixel(0, 14);
#endif
}
void watch_set_indicator(WatchIndicatorSegment indicator) {
@ -162,9 +290,12 @@ void watch_clear_indicator(WatchIndicatorSegment indicator) {
}
void watch_clear_all_indicators(void) {
watch_clear_pixel(2, 17);
watch_clear_pixel(2, 16);
watch_clear_pixel(0, 17);
watch_clear_pixel(0, 16);
watch_clear_pixel(1, 10);
/// TODO: Optimize this? Can be 3-4 writes to SDATAL registers
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
watch_clear_indicator(WATCH_INDICATOR_BELL);
watch_clear_indicator(WATCH_INDICATOR_PM);
watch_clear_indicator(WATCH_INDICATOR_24H);
watch_clear_indicator(WATCH_INDICATOR_LAP);
watch_clear_indicator(WATCH_INDICATOR_BATTERY);
watch_clear_indicator(WATCH_INDICATOR_SLEEP);
}

View File

@ -0,0 +1,514 @@
/*
* MIT License
*
* Copyright (c) 2020-2024 Joey Castillo
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
// Union representing a single segment mapping
// COM occupies two bits, SEG occupes the rest.
typedef union segment_mapping_t {
struct {
uint8_t com : 2;
uint8_t seg : 6;
} address;
uint8_t value;
} segment_mapping_t;
// Value to indicate that a segment does not exist
static const uint8_t segment_does_not_exist = 0xff;
// Union representing 8 segment mappings, A-H
typedef union digit_mapping_t {
segment_mapping_t segment[8];
uint64_t value;
} digit_mapping_t;
#ifdef USE_CUSTOM_LCD
// Custom extended LCD
// Character set is slightly different since we don't have to work around as much stuff.
static const uint8_t Watch_Character_Set[] =
{
0b00000000, // [space]
0b00000000, // ! (unused)
0b00100010, // "
0b01100011, // # (degree symbol, hash mark doesn't fit)
0b11101101, // $ (S with a downstroke)
0b00000000, // % (unused)
0b00000000, // & (unused)
0b00100000, // '
0b00111001, // (
0b00001111, // )
0b11000000, // * (The + sign for use in position 0)
0b01110000, // + (segments E, F and G; looks like ┣╸)
0b00000100, // ,
0b01000000, // -
0b00001000, // . (same as _, semantically most useful)
0b00010010, // /
0b00111111, // 0
0b00000110, // 1
0b01011011, // 2
0b01001111, // 3
0b01100110, // 4
0b01101101, // 5
0b01111101, // 6
0b00000111, // 7
0b01111111, // 8
0b01101111, // 9
0b00000000, // : (unused)
0b00000000, // ; (unused)
0b01011000, // <
0b01001000, // =
0b01001100, // >
0b01010011, // ?
0b11111111, // @ (all segments on)
0b01110111, // A
0b11001111, // B (with downstroke, only in weekday / seconds)
0b00111001, // C
0b10001111, // D (with downstroke, only in weekday / seconds)
0b01111001, // E
0b01110001, // F
0b00111101, // G
0b01110110, // H
0b10001001, // I (only works in position 0)
0b00001110, // J
0b01110101, // K
0b00111000, // L
0b10110111, // M (only works in position 0)
0b00110111, // N
0b00111111, // O
0b01110011, // P
0b01100111, // Q
0b01010000, // R (lowercase, this is the only capital we can't do)
0b01101101, // S
0b10000001, // T (only works in position 0; set (1, 12) to make it work in position 1)
0b00111110, // U
0b00111110, // V
0b10111110, // W (only works in position 0)
0b01111110, // X
0b01101110, // Y
0b00011011, // Z
0b00111001, // [
0b00100100, // backslash
0b00001111, // ]
0b00100011, // ^
0b00001000, // _
0b00000010, // `
0b01011111, // a
0b01111100, // b
0b01011000, // c
0b01011110, // d
0b01111011, // e
0b01110001, // f
0b01101111, // g
0b01110100, // h
0b00010000, // i
0b00001110, // j
0b01110101, // k
0b00110000, // l
0b10110111, // m (only works in position 0)
0b01010100, // n
0b01011100, // o
0b01110011, // p
0b01100111, // q
0b01010000, // r
0b01101101, // s
0b01111000, // t
0b00011100, // u
0b00011100, // v (looks like u)
0b10111110, // w
0b01111110, // x
0b01101110, // y
0b00011011, // z
0b00010110, // { (open brace doesn't really work; overriden to represent the two character ligature "il")
0b00110110, // | (overriden to represent the two character ligature "ll")
0b00110100, // } (overriden to represent the two character ligature "li")
0b00000001, // ~
};
static const digit_mapping_t Watch_Display_Mapping[] = {
{
.segment = {
{ .address = { .com = 0, .seg = 19 } }, // 0A
{ .address = { .com = 2, .seg = 19 } }, // 0B
{ .address = { .com = 3, .seg = 19 } }, // 0C
{ .address = { .com = 3, .seg = 20 } }, // 0D
{ .address = { .com = 2, .seg = 20 } }, // 0E
{ .address = { .com = 0, .seg = 20 } }, // 0F
{ .address = { .com = 1, .seg = 20 } }, // 0G
{ .address = { .com = 1, .seg = 19 } }, // 0H
},
},
{
.segment = {
{ .address = { .com = 0, .seg = 17 } }, // 1A
{ .address = { .com = 2, .seg = 17 } }, // 1B
{ .address = { .com = 3, .seg = 17 } }, // 1C
{ .address = { .com = 3, .seg = 18 } }, // 1D
{ .address = { .com = 2, .seg = 18 } }, // 1E
{ .address = { .com = 0, .seg = 18 } }, // 1F
{ .address = { .com = 1, .seg = 18 } }, // 1G
{ .address = { .com = 1, .seg = 17 } }, // 1H
},
},
{
.segment = {
{ .address = { .com = 0, .seg = 11 } }, // 2A
{ .address = { .com = 0, .seg = 10 } }, // 2B
{ .address = { .com = 2, .seg = 10 } }, // 2C
{ .address = { .com = 3, .seg = 11 } }, // 2D
{ .address = { .com = 2, .seg = 11 } }, // 2E
{ .address = { .com = 1, .seg = 11 } }, // 2F
{ .address = { .com = 1, .seg = 10 } }, // 2G
{ .value = segment_does_not_exist }, // 2H
},
},
{
.segment = {
{ .address = { .com = 0, .seg = 9 } }, // 3A
{ .address = { .com = 0, .seg = 8 } }, // 3B
{ .address = { .com = 2, .seg = 8 } }, // 3C
{ .address = { .com = 3, .seg = 9 } }, // 3D
{ .address = { .com = 2, .seg = 9 } }, // 3E
{ .address = { .com = 1, .seg = 9 } }, // 3F
{ .address = { .com = 1, .seg = 8 } }, // 3G
{ .value = segment_does_not_exist }, // 3H
},
},
{
.segment = {
{ .address = { .com = 3, .seg = 16 } }, // 4A
{ .address = { .com = 2, .seg = 16 } }, // 4B
{ .address = { .com = 1, .seg = 16 } }, // 4C
{ .address = { .com = 0, .seg = 16 } }, // 4D
{ .address = { .com = 1, .seg = 22 } }, // 4E
{ .address = { .com = 3, .seg = 22 } }, // 4F
{ .address = { .com = 2, .seg = 22 } }, // 4G
{ .value = segment_does_not_exist }, // 4H
},
},
{
.segment = {
{ .address = { .com = 3, .seg = 14 } }, // 5A
{ .address = { .com = 2, .seg = 14 } }, // 5B
{ .address = { .com = 1, .seg = 14 } }, // 5C
{ .address = { .com = 0, .seg = 15 } }, // 5D
{ .address = { .com = 1, .seg = 15 } }, // 5E
{ .address = { .com = 3, .seg = 15 } }, // 5F
{ .address = { .com = 2, .seg = 15 } }, // 5G
{ .value = segment_does_not_exist }, // 5H
},
},
{
.segment = {
{ .address = { .com = 3, .seg = 1 } }, // 6A
{ .address = { .com = 2, .seg = 2 } }, // 6B
{ .address = { .com = 0, .seg = 2 } }, // 6C
{ .address = { .com = 0, .seg = 1 } }, // 6D
{ .address = { .com = 1, .seg = 1 } }, // 6E
{ .address = { .com = 2, .seg = 1 } }, // 6F
{ .address = { .com = 1, .seg = 2 } }, // 6G
{ .value = segment_does_not_exist }, // 6H
},
},
{
.segment = {
{ .address = { .com = 3, .seg = 3 } }, // 7A
{ .address = { .com = 2, .seg = 4 } }, // 7B
{ .address = { .com = 0, .seg = 4 } }, // 7C
{ .address = { .com = 0, .seg = 3 } }, // 7D
{ .address = { .com = 1, .seg = 3 } }, // 7E
{ .address = { .com = 2, .seg = 3 } }, // 7F
{ .address = { .com = 1, .seg = 4 } }, // 7G
{ .value = segment_does_not_exist }, // 7H
},
},
{
.segment = {
{ .address = { .com = 3, .seg = 10 } }, // 8A
{ .address = { .com = 3, .seg = 8 } }, // 8B
{ .address = { .com = 0, .seg = 5 } }, // 8C
{ .address = { .com = 1, .seg = 5 } }, // 8D
{ .address = { .com = 3, .seg = 4 } }, // 8E
{ .address = { .com = 3, .seg = 2 } }, // 8F
{ .address = { .com = 2, .seg = 5 } }, // 8G
{ .address = { .com = 3, .seg = 5 } }, // 8H
},
},
{
.segment = {
{ .address = { .com = 3, .seg = 6 } }, // 9A
{ .address = { .com = 3, .seg = 7 } }, // 9B
{ .address = { .com = 2, .seg = 7 } }, // 9C
{ .address = { .com = 0, .seg = 7 } }, // 9D
{ .address = { .com = 0, .seg = 6 } }, // 9E
{ .address = { .com = 2, .seg = 6 } }, // 9F
{ .address = { .com = 1, .seg = 6 } }, // 9G
{ .address = { .com = 1, .seg = 7 } }, // 9H
},
},
// Position 10 is the third digit in the weekday, stashed at the end for backwards compatibility.
{
.segment = {
{ .address = { .com = 0, .seg = 12 } }, // 10A
{ .address = { .com = 2, .seg = 12 } }, // 10B
{ .address = { .com = 3, .seg = 12 } }, // 10C
{ .address = { .com = 3, .seg = 13 } }, // 10D
{ .address = { .com = 2, .seg = 13 } }, // 10E
{ .address = { .com = 0, .seg = 13 } }, // 10F
{ .address = { .com = 1, .seg = 13 } }, // 10G
{ .address = { .com = 1, .seg = 12 } }, // 10H
},
},
};
#else
// Original famous Casio LCD
static const uint8_t Watch_Character_Set[] =
{
0b00000000, // [space]
0b01100000, // ! (L in the top half for positions 4 and 6)
0b00100010, // "
0b01100011, // # (degree symbol, hash mark doesn't fit)
0b00101101, // $ (S without the center segment)
0b00000000, // % (unused)
0b01000100, // & ("lowercase 7" for positions 4 and 6)
0b00100000, // '
0b00111001, // (
0b00001111, // )
0b11000000, // * (The + sign for use in position 0)
0b01110000, // + (segments E, F and G; looks like ┣╸)
0b00000100, // ,
0b01000000, // -
0b01000000, // . (same as -, semantically most useful)
0b00010010, // /
0b00111111, // 0
0b00000110, // 1
0b01011011, // 2
0b01001111, // 3
0b01100110, // 4
0b01101101, // 5
0b01111101, // 6
0b00000111, // 7
0b01111111, // 8
0b01101111, // 9
0b00000000, // : (unused)
0b00000000, // ; (unused)
0b01011000, // <
0b01001000, // =
0b01001100, // >
0b01010011, // ?
0b11111111, // @ (all segments on)
0b01110111, // A
0b01111111, // B
0b00111001, // C
0b00111111, // D
0b01111001, // E
0b01110001, // F
0b00111101, // G
0b01110110, // H
0b10001001, // I (only works in position 0)
0b00001110, // J
0b01110101, // K
0b00111000, // L
0b10110111, // M (only works in position 0)
0b00110111, // N
0b00111111, // O
0b01110011, // P
0b01100111, // Q
0b11110111, // R (only works in position 1)
0b01101101, // S
0b10000001, // T (only works in position 0; set (1, 12) to make it work in position 1)
0b00111110, // U
0b00111110, // V
0b10111110, // W (only works in position 0)
0b01111110, // X
0b01101110, // Y
0b00011011, // Z
0b00111001, // [
0b00100100, // backslash
0b00001111, // ]
0b00100011, // ^
0b00001000, // _
0b00000010, // `
0b01011111, // a
0b01111100, // b
0b01011000, // c
0b01011110, // d
0b01111011, // e
0b01110001, // f
0b01101111, // g
0b01110100, // h
0b00010000, // i
0b01000010, // j (appears as superscript to work in more positions)
0b01110101, // k
0b00110000, // l
0b10110111, // m (only works in position 0)
0b01010100, // n
0b01011100, // o
0b01110011, // p
0b01100111, // q
0b01010000, // r
0b01101101, // s
0b01111000, // t
0b01100010, // u (appears in (u)pper half to work in more positions)
0b00011100, // v (looks like u but in the lower half)
0b10111110, // w (only works in position 0)
0b01111110, // x
0b01101110, // y
0b00011011, // z
0b00010110, // { (open brace doesn't really work; overriden to represent the two character ligature "il")
0b00110110, // | (overriden to represent the two character ligature "ll")
0b00110100, // } (overriden to represent the two character ligature "li")
0b00000001, // ~
};
static const digit_mapping_t Watch_Display_Mapping[] = {
// Positions 0 and 1 are the Weekday or Mode digits
{
.segment = {
{ .address = { .com = 0, .seg = 13 } }, // 0A
{ .address = { .com = 1, .seg = 13 } }, // 0B
{ .address = { .com = 2, .seg = 13 } }, // 0C
{ .address = { .com = 2, .seg = 15 } }, // 0D
{ .address = { .com = 2, .seg = 14 } }, // 0E
{ .address = { .com = 0, .seg = 14 } }, // 0F
{ .address = { .com = 1, .seg = 15 } }, // 0G
{ .address = { .com = 1, .seg = 14 } }, // 0H
},
},
{
.segment = {
{ .address = { .com = 0, .seg = 11 } }, // 1A
{ .address = { .com = 1, .seg = 11 } }, // 1B, note that 1B has the same address as 1C
{ .address = { .com = 1, .seg = 11 } }, // 1C, will override 1B when displaying a character
{ .address = { .com = 2, .seg = 11 } }, // 1D
{ .address = { .com = 1, .seg = 12 } }, // 1E, note that 1E has the same address as 1F
{ .address = { .com = 1, .seg = 12 } }, // 1F, will override 1E when displaying a character
{ .address = { .com = 2, .seg = 12 } }, // 1G
{ .address = { .com = 0, .seg = 12 } }, // 1H
},
},
// Positions 2 and 3 are the Day of Month digits
{
.segment = {
{ .address = { .com = 1, .seg = 9 } }, // 2A, note that 2A, 2D and 2G have the same address
{ .address = { .com = 0, .seg = 9 } }, // 2B
{ .address = { .com = 2, .seg = 9 } }, // 2C
{ .address = { .com = 1, .seg = 9 } }, // 2D, same address as 2A and 2G
{ .address = { .com = 0, .seg = 10 } }, // 2E
{ .value = segment_does_not_exist }, // 2F
{ .address = { .com = 1, .seg = 9 } }, // 2G, will override 2A and 2D when displaying a character
{ .value = segment_does_not_exist }, // 2H
},
},
{
.segment = {
{ .address = { .com = 0, .seg = 7 } }, // 3A
{ .address = { .com = 1, .seg = 7 } }, // 3B
{ .address = { .com = 2, .seg = 7 } }, // 3C
{ .address = { .com = 2, .seg = 6 } }, // 3D
{ .address = { .com = 2, .seg = 8 } }, // 3E
{ .address = { .com = 0, .seg = 8 } }, // 3F
{ .address = { .com = 1, .seg = 8 } }, // 3G
{ .value = segment_does_not_exist }, // 3H
},
},
// Positions 4-9 are the Clock digits
{
.segment = {
{ .address = { .com = 1, .seg = 18 } }, // 4A, note that 4A and 4D have the same address
{ .address = { .com = 2, .seg = 19 } }, // 4B
{ .address = { .com = 0, .seg = 19 } }, // 4C
{ .address = { .com = 1, .seg = 18 } }, // 4D, will override 4A when displaying a character
{ .address = { .com = 0, .seg = 18 } }, // 4E
{ .address = { .com = 2, .seg = 18 } }, // 4F
{ .address = { .com = 1, .seg = 19 } }, // 4G
{ .value = segment_does_not_exist }, // 4H
},
},
{
.segment = {
{ .address = { .com = 2, .seg = 20 } }, // 5A
{ .address = { .com = 2, .seg = 21 } }, // 5B
{ .address = { .com = 1, .seg = 21 } }, // 5C
{ .address = { .com = 0, .seg = 21 } }, // 5D
{ .address = { .com = 0, .seg = 20 } }, // 5E
{ .address = { .com = 1, .seg = 17 } }, // 5F
{ .address = { .com = 1, .seg = 20 } }, // 5G
{ .value = segment_does_not_exist }, // 5H
},
},
{
.segment = {
{ .address = { .com = 0, .seg = 22 } }, // 6A, note that 6A and 6D have the same address
{ .address = { .com = 2, .seg = 23 } }, // 6B
{ .address = { .com = 0, .seg = 23 } }, // 6C
{ .address = { .com = 0, .seg = 22 } }, // 6D, will override 6A when displaying a character
{ .address = { .com = 1, .seg = 22 } }, // 6E
{ .address = { .com = 2, .seg = 22 } }, // 6F
{ .address = { .com = 1, .seg = 23 } }, // 6G
{ .value = segment_does_not_exist }, // 6H
},
},
{
.segment = {
{ .address = { .com = 2, .seg = 1 } }, // 7A
{ .address = { .com = 2, .seg = 10 } }, // 7B
{ .address = { .com = 0, .seg = 1 } }, // 7C
{ .address = { .com = 0, .seg = 0 } }, // 7D
{ .address = { .com = 1, .seg = 0 } }, // 7E
{ .address = { .com = 2, .seg = 0 } }, // 7F
{ .address = { .com = 1, .seg = 1 } }, // 7G
{ .value = segment_does_not_exist }, // 7H
},
},
{
.segment = {
{ .address = { .com = 2, .seg = 2 } }, // 8A
{ .address = { .com = 2, .seg = 3 } }, // 8B
{ .address = { .com = 0, .seg = 4 } }, // 8C
{ .address = { .com = 0, .seg = 3 } }, // 8D
{ .address = { .com = 0, .seg = 2 } }, // 8E
{ .address = { .com = 1, .seg = 2 } }, // 8F
{ .address = { .com = 1, .seg = 3 } }, // 8G
{ .value = segment_does_not_exist }, // 8H
},
},
{
.segment = {
{ .address = { .com = 2, .seg = 4 } }, // 9A
{ .address = { .com = 2, .seg = 5 } }, // 9B
{ .address = { .com = 1, .seg = 6 } }, // 9C
{ .address = { .com = 0, .seg = 6 } }, // 9D
{ .address = { .com = 0, .seg = 5 } }, // 9E
{ .address = { .com = 1, .seg = 4 } }, // 9F
{ .address = { .com = 1, .seg = 5 } }, // 9G
{ .value = segment_does_not_exist }, // 9H
},
},
};
#endif
void watch_display_character(uint8_t character, uint8_t position);
void watch_display_character_lp_seconds(uint8_t character, uint8_t position);

View File

@ -1,148 +0,0 @@
/*
* MIT License
*
* Copyright (c) 2020 Joey Castillo
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _WATCH_PRIVATE_DISPLAY_H_INCLUDED
#define _WATCH_PRIVATE_DISPLAY_H_INCLUDED
#include "hpl_slcd_config.h"
#include "driver_init.h"
static const uint8_t Character_Set[] =
{
0b00000000, //
0b01100000, // ! (L in the top half for positions 4 and 6)
0b00100010, // "
0b01100011, // # (degree symbol, hash mark doesn't fit)
0b00101101, // $ (S without the center segment)
0b00000000, // % (unused)
0b01000100, // & ("lowercase 7" for positions 4 and 6)
0b00100000, // '
0b00111001, // (
0b00001111, // )
0b11000000, // * (The + sign for use in position 0)
0b01110000, // + (segments E, F and G; looks like ┣╸)
0b00000100, // ,
0b01000000, // -
0b01000000, // . (same as -, semantically most useful)
0b00010010, // /
0b00111111, // 0
0b00000110, // 1
0b01011011, // 2
0b01001111, // 3
0b01100110, // 4
0b01101101, // 5
0b01111101, // 6
0b00000111, // 7
0b01111111, // 8
0b01101111, // 9
0b00000000, // : (unused)
0b00000000, // ; (unused)
0b01011000, // <
0b01001000, // =
0b01001100, // >
0b01010011, // ?
0b11111111, // @ (all segments on)
0b01110111, // A
0b01111111, // B
0b00111001, // C
0b00111111, // D
0b01111001, // E
0b01110001, // F
0b00111101, // G
0b01110110, // H
0b10001001, // I (only works in position 0)
0b00001110, // J
0b01110101, // K
0b00111000, // L
0b10110111, // M (only works in position 0)
0b00110111, // N
0b00111111, // O
0b01110011, // P
0b01100111, // Q
0b11110111, // R (only works in position 1)
0b01101101, // S
0b10000001, // T (only works in position 0; set (1, 12) to make it work in position 1)
0b00111110, // U
0b00111110, // V
0b10111110, // W (only works in position 0)
0b01111110, // X
0b01101110, // Y
0b00011011, // Z
0b00111001, // [
0b00100100, // backslash
0b00001111, // ]
0b00100011, // ^
0b00001000, // _
0b00000010, // `
0b01011111, // a
0b01111100, // b
0b01011000, // c
0b01011110, // d
0b01111011, // e
0b01110001, // f
0b01101111, // g
0b01110100, // h
0b00010000, // i
0b01000010, // j (appears as superscript to work in more positions)
0b01110101, // k
0b00110000, // l
0b10110111, // m (only works in position 0)
0b01010100, // n
0b01011100, // o
0b01110011, // p
0b01100111, // q
0b01010000, // r
0b01101101, // s
0b01111000, // t
0b01100010, // u (appears in (u)pper half to work in more positions)
0b00011100, // v (looks like u but in the lower half)
0b10111110, // w (only works in position 0)
0b01111110, // x
0b01101110, // y
0b00011011, // z
0b00010110, // { (open brace doesn't really work; overriden to represent the two character ligature "il")
0b00110110, // | (overriden to represent the two character ligature "ll")
0b00110100, // } (overriden to represent the two character ligature "li")
0b00000001, // ~
};
static const uint64_t Segment_Map[] = {
0x4e4f0e8e8f8d4d0d, // Position 0, mode
0xc8c4c4c8b4b4b0b, // Position 1, mode (Segments B and C shared, as are segments E and F)
0xc049c00a49890949, // Position 2, day of month (Segments A, D, G shared; missing segment F)
0xc048088886874707, // Position 3, day of month
0xc053921252139352, // Position 4, clock hours (Segments A and D shared)
0xc054511415559594, // Position 5, clock hours
0xc057965616179716, // Position 6, clock minutes (Segments A and D shared)
0xc041804000018a81, // Position 7, clock minutes
0xc043420203048382, // Position 8, clock seconds
0xc045440506468584, // Position 9, clock seconds
};
static const uint8_t Num_Chars = 10;
void watch_display_character(uint8_t character, uint8_t position);
void watch_display_character_lp_seconds(uint8_t character, uint8_t position);
#endif

View File

@ -21,8 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _WATCH_SLCD_H_INCLUDED
#define _WATCH_SLCD_H_INCLUDED
#pragma once
////< @file watch_slcd.h
#include "watch.h"
@ -41,13 +42,21 @@
*/
/// @{
#define SLCD_SEGID(com, seg) (((com) << 16) | (seg))
#define SLCD_COMNUM(segid) (((segid) >> 16) & 0xFF)
#define SLCD_SEGNUM(segid) ((segid)&0xFF)
/// An enum listing the icons and indicators available on the watch.
typedef enum WatchIndicatorSegment {
WATCH_INDICATOR_SIGNAL = 0, ///< The hourly signal indicator; also useful for indicating that sensors are on.
WATCH_INDICATOR_BELL, ///< The small bell indicating that an alarm is set.
WATCH_INDICATOR_PM, ///< The PM indicator, indicating that a time is in the afternoon.
WATCH_INDICATOR_24H, ///< The 24H indicator, indicating that the watch is in a 24-hour mode.
WATCH_INDICATOR_LAP ///< The LAP indicator; the F-91W uses this in its stopwatch UI.
WATCH_INDICATOR_LAP, ///< The LAP indicator; the F-91W uses this in its stopwatch UI.
// These next indicators are only available on the new custom LCD:
WATCH_INDICATOR_BATTERY, ///< The battery indicator. Will fall back to the LAP icon on the original F-91W LCD.
WATCH_INDICATOR_SLEEP, ///< The sleep indicator. No fallback here; use the tick animation to indicate sleep.
} WatchIndicatorSegment;
/** @brief Enables the Segment LCD display.
@ -75,6 +84,8 @@ void watch_clear_display(void);
/** @brief Displays a string at the given position, starting from the top left. There are ten digits.
A space in any position will clear that digit.
* @deprecated This function is deprecated. Use `watch_display_top_left`, `watch_display_top_right`
and `watch_display_main_line` instead
* @param string A null-terminated string.
* @param position The position where you wish to start displaying the string. The day of week digits
* are positions 0 and 1; the day of month digits are positions 2 and 3, and the main
@ -82,7 +93,101 @@ void watch_clear_display(void);
* @note This method does not clear the display; if for example you display a two-character string at
position 0, positions 2-9 will retain whatever state they were previously displaying.
*/
void watch_display_string(char *string, uint8_t position);
void watch_display_string(char *string, uint8_t position) __attribute__ ((deprecated("Use watch_display_top_left, watch_display_top_right and watch_display_main_line instead.")));
/**
* @brief Displays a string at in the digits at the top left, which typically show the day of the week.
* @param string A null-terminated string with two characters to display.
*/
void watch_display_top_left(char *string);
/**
* @brief Displays a string at in the digits at the top left, which typically show the day of the week.
* @details This function is designed to make use of the new custom LCD, which has three digits at the
* top left. If you are using the original F-91W LCD, this function will fall back to displaying
* the fallback string. So for example if you were displaying a world clock for Anchorage, you
* could pass "ANC" as the string, and "AN" as the fallback.
* @param string A null-terminated string with 1-3 characters to display on the custom LCD.
* @param fallback A null-terminated string with 1-2 characters to display on the original F-91W LCD.
* @note Both the custom LCD and the original F-91W LCD have some limitations on what characters can be
* displayed. For example, the custom LCD can display "NYC" but the original F-91W LCD can't
* display "NY" due to the shared segments in position 1. On the other hand the original F-91W
* can display "FR" for Friday thanks to its extra segment in position 1, but the custom LCD can
* only display lowercase R, "Fri", due to the more simplistic 8-segment design of all the sigits.
* Some fine-tuning may be necessary to get the best results on both displays.
*/
void watch_display_top_left_with_fallback(char *string, char *fallback);
/**
* @brief Displays a string in the digits at the top right, which typically show the day of the month.
* @param string A null-terminated string with two characters to display.
*/
void watch_display_top_right(char *string);
/**
* @brief Displays a string in the digits at the top right, which typically show the day of the month.
* @param string A null-terminated string with two characters to display on the custom LCD.
* @param fallback A null-terminated string with two characters to display on the original F-91W LCD.
* @note On the original F-91W LCD, position 2 can only display the numbers 1, 2 and 3 (or a
* lowercase 'a') due to its aggressive segment sharing in this position. You may need to come
* up with more complex logic to create a useful fallback if displaying other characters here.
* Position 3, the second digit, is a standard 7-segment digit.
*/
void watch_display_top_right_with_fallback(char *string, char *fallback);
/**
* @brief Displays a string in the main line of the display, which typically shows the time.
* @param string A null-terminated string with six characters to display. Omit the colon; if you want
* the colon to appear, use watch_set_colon() to turn it on.
*/
void watch_display_main_line(char *string);
/**
* @brief Displays a string in the main line of the display, which typically shows the time.
* @param string A null-terminated string with 7 characters to display. The first character must be
* either a 1 or a space; on the custom LCD, this will indicate whether to turn on the leading
* '1' segment. Omit any colons or decimal points.
* @param fallback A null-terminated string with 6 characters to display if the custom LCD is not
* available. Once again, omit the colon.
* @note This function is a bit more complicated, but the gist is, the custom LCD can display
* "1888888", while the original F-91W LCD can only display "888888". In addition, on the original
* Casio LCD, the first digit of the hours and seconds display have their top and bottom segments
* linked, which causes some limitations. The intent is for you to use the function like this,
* for example, displaying a longutide and latitude:
*
* watch_display_main_line_with_fallback("14990#W", "-14990") // "149.90°W" or "-149.90"
* watch_display_main_line_with_fallback(" 6122#N", "+ 6122") // "61.22°N" or "+61.22"
*
* In the first example, the leading 1 allows us to dusplay "146.90°W" on the custom LCD, with the
* numeric portion in the clock digits, and the "°W" hint in the small seconds digits. Meanwhile on
* the classic LCD, the fallback string "-14990" will display -149 in the large clock digits, and
* 90 in the small seconds digits, indicating that this is a decimal portion.
* In the second example, the leading space allows us to display "61.22°N" on the custom LCD, with
* the "°N" in the seconds place, while the fallback string "+ 6122" will display +61 on the large
* clock digits, and 22 in the small seconds digits, indicating that this is a decimal portion.
*
* Note also that the custom LCD has a vertical descender in the two seconds digits, which can be
* used to displaty uppercase letters like D, I, T, M and W.
*/
void watch_display_main_line_with_fallback(char *string, char *fallback);
/**
* @brief Displays a string in the hours portion of the main line.
* @param string A null-terminated string with two characters to display.
*/
void watch_display_hours(char *string);
/**
* @brief Displays a string in the minutes portion of the main line.
* @param string A null-terminated string with two characters to display.
*/
void watch_display_minutes(char *string);
/**
* @brief Displays a string in the seconds portion of the main line.
* @param string A null-terminated string with two characters to display.
*/
void watch_display_seconds(char *string);
/** @brief Turns the colon segment on.
*/
@ -92,6 +197,16 @@ void watch_set_colon(void);
*/
void watch_clear_colon(void);
/** @brief Turns the decimal segment on.
* @note Only exists on the custom LCD, in the same position as the colon.
*/
void watch_set_decimal_if_available(void);
/** @brief Turns the decimal segment off.
* @note Only exists on the custom LCD, in the same position as the colon.
*/
void watch_clear_decimal_if_available(void);
/** @brief Sets an indicator on the LCD. Use this to turn on one of the indicator segments.
* @param indicator One of the indicator segments from the enum. @see WatchIndicatorSegment
*/
@ -148,4 +263,3 @@ bool watch_tick_animation_is_running(void);
*/
void watch_stop_tick_animation(void);
/// @}
#endif