My first attemp at an app (sorry about poor coding ahead of time, I am ultra novice) .. Just wanted a simple display ... one click on and one click off font is kremlin.ttf
http://www.jyito.com/firstapp/firstapp.ziplink has resource/include/src folders
#include <pulse_os.h>
#include <pulse_types.h>
#include <app_resources.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
uint8_t current_min;
uint8_t current_hour;
struct pulse_time_tm current_time;
struct PWTextBox clock_text_box;
struct PWidgetTextDynamic clock_text_widget;
int onoff = 1;
enum PWTextStyle clock_text_style = (PWTS_WRAP | PWTS_TRUNCATE | PWTS_CENTER);
// Text buffers to store text to be rendered
char clock_text_buffer[16];
void print_time_into_text_buffer()
{
pulse_get_time_date(¤t_time);
sprintf(clock_text_buffer, "%02d%02d", current_time.tm_hour,current_time.tm_min);
}
void update_time()
{
if(onoff != 0)
{
pulse_blank_canvas();
print_time_into_text_buffer();
pulse_render_text(&clock_text_box, &clock_text_widget);
// Register a timer to update the time on the minute mark
pulse_register_timer(60000 - current_time.tm_sec * 1000, &update_time, 0);
}
}
void main_app_init() {
pulse_blank_canvas();
clock_text_box.top = 0;
clock_text_box.bottom = 126;
clock_text_box.left = 0;
clock_text_box.right = SCREEN_WIDTH;
pulse_init_dynamic_text_widget(&clock_text_widget, clock_text_buffer,FONT_KREMLIN, COLOR_RED24, clock_text_style);
update_time();
}
void handle_button_causing_wakeup() {
}
void main_app_handle_button_down() {
}
void main_app_handle_button_up() {
if(onoff == 1) {
pulse_blank_canvas();
onoff = 0;
} else {
onoff = 1;
update_time();
}
}
void main_app_loop() {
}
void main_app_handle_doz() {
}
void main_app_handle_hardware_update(enum PulseHardwareEvent event) {
}