// WATCH FACE FUNCTIONS ///////////////////////////////////////////////////////
void geomancy_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+ (void) watch_face_index;
(void) settings;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(geomancy_state_t));
switch ( state->mode ) {
case 0:
state->mode++;
+ // fall through
case 1:
state->animate = true;
state->i_ching_hexagram = _iching_form_hexagram();
break;
case 2:
state->mode++;
+ // fall through
case 3:
state->animate = true;
state->geomantic_figure = _geomancy_pick_figure().bits;
// STATIC FUNCTIONS ///////////////////////////////////////////////////////////
/** @brief display handler */
+static void geomancy_face_display(geomancy_state_t *state);
static void geomancy_face_display(geomancy_state_t *state) {
char token[7] = {0};
nibble_t figure = *((nibble_t*) &state->geomantic_figure);
/** @brief form a trigram from three random bit picks
*/
-static tribble_t _iching_pick_trigram() {
+static tribble_t _iching_pick_trigram(void) {
uint8_t index = (divine_bit() << 2) | (divine_bit() << 1) | divine_bit();
tribble_t trigram = {(bagua >> (3 * index)) & 0b111};
return trigram;
/** @brief form a hexagram from two trigrams
*/
-static uint8_t _iching_form_hexagram() {
+static uint8_t _iching_form_hexagram(void);
+static uint8_t _iching_form_hexagram(void) {
tribble_t inner = _iching_pick_trigram();
tribble_t outer = _iching_pick_trigram();
uint8_t hexagram = (inner.bits << 3) | outer.bits;
/** @brief display hexagram
* @details | for unbroken lines and Ξ for broken lines, left of display is bottom
*/
+static void _display_hexagram(uint8_t hexagram, char* str);
static void _display_hexagram(uint8_t hexagram, char* str) {
str[6] = '\0'; // Null-terminate the string
for (uint8_t i = 0; i < 6; i++) {
/** @brief choose a geomantic figure from four random bits
* @details 0 represents · and 1 represents : counting from the bottom
*/
-static nibble_t _geomancy_pick_figure() {
+static nibble_t _geomancy_pick_figure(void);
+static nibble_t _geomancy_pick_figure(void) {
uint8_t index = (divine_bit() << 3) | (divine_bit() << 2) | (divine_bit() << 1) | divine_bit();
nibble_t figure = {(geomantic >> (4 * (15 - index))) & 0xF};
return figure;
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
void toss_up_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
+ (void) watch_face_index;
(void) settings;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(toss_up_state_t));
switch (state->mode) {
case 0:
state->mode++;
+ // fall through
case 1:
state->animate = true;
for (i = 0; i < state->coin_num; i++) {
break;
case 2:
state->mode++;
+ // fall through
case 3:
state->animate = true;
for (i = 0; i < state->dice_num; i++) {