pebble / lib / src / pebble_th.h

/** \file
 * Functions in libpblth.a.
 */
#ifndef _pblth_h_
#define _pblth_h_

#include <stdint.h>
#include "pebble_os.h"

#define PEBBLE_SCREEN_WIDTH 144
#define PEBBLE_SCREEN_HEIGHT 168


extern int
__attribute__((__format__(printf, 2, 3)))
pebble_sprintf(
	char * buf,
	const char * fmt,
	...
);


extern void
text_layer_setup(
	Window * window,
	TextLayer * layer,
	GRect frame,
	GFont font
);


void
monospace_text(
	GContext * ctx,
	const char * buf,
	GFont font,
	GPoint xy,
	int x_size,
	int y_size
);


#define container_of(ptr, type, member) ({ \
	char * __mptr = (char*)(uintptr_t) (ptr); \
	(type *)(__mptr - offsetof(type,member) ); \
})


/** Translate a Pebble time struct into unix epoch.
 *
 * GMT offset is in seconds east of GMT.
 * For example, NYC EST is -5 * 3600 seconds.
 * \todo check dst offset!
 */
uint32_t
unix_epoch_time(
	const PblTm * const curr_time,
	const int gmt_offset
);


#endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.