Login
1 branch 0 tags
Ben (Desktop/Arch) .onigiri -> Onigiri 38f4776 1 month ago 74 Commits
moon / src / moon.h
/*
 * moon.h - header with types/globals that should be available pretty much
 * everywhere
 */
#pragma once
#include <stdint.h>

#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define countof(x) (sizeof(x) / sizeof(*x))

// --- User Settings ---
#define MUSIC_ROOT "/Music"
#define AUDIOBOOKS_ROOT "/Audiobooks"
#define DATA_DIR "Onigiri"
#define BOOKMARK_FILE "Onigiri/state.toml"
#define PLAYLIST_FILE "Onigiri/playlist.toml"
#define PLAYLIST_BOOKMARK_INTERVAL_MS 8192
#define PREV_RESTART_THRESHOLD_MS 10000

#define DISPLAY_DIM_AFTER_MS_INACTIVITY 4096
#define DISPLAY_DIM_AFTER_MS_STEP 16
#define DISPLAY_DIM_BRIGHTNESS 56

#define DISPLAY_SLEEP_AFTER_MS_INACTIVITY 16384
#define DISPLAY_SLEEP_AFTER_MS_STEP 32
#define DISPLAY_SLEEP_BRIGHTNESS 0

// --- Internal Settings ---
#define SCREEN_WIDTH 160
#define SCREEN_HEIGHT 128
#define TOPBAR_H 18
#define TOPBAR_ICON_SCALE 208  // 256 = 100%
#define STORAGE_MAX_PATH 256
#define STORAGE_MAX_NAME 192
#define STORAGE_MAX_DIR_ENTRIES 64
#define PLAYLIST_MAX_ENTRIES 64
#define MAX_AUDIOBOOK_FILES 128

extern uint8_t button_state;
#define BUTTON_STATE_UP (1 << 0)
#define BUTTON_STATE_DOWN (1 << 1)
#define BUTTON_STATE_OK (1 << 2)
#define BUTTON_STATE_BACK (1 << 3)

void blit_buf(const void* buf, int yStart, int yEnd);
void blit_buf_rect(const void* buf, int xStart, int yStart, int xEnd, int yEnd);
void set_display_brightness(uint8_t level);