VMUPro SDK v1.0.0
Application Development SDK for the VMUPro
|
VMUPro Utility Functions. More...
#include "stdint.h"
#include "stdbool.h"
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | vmupro_emubrowser_settings_t |
Settings structure for the emulator browser. More... | |
Functions | |
void | vmupro_sleep_ms (uint32_t milliseconds) |
Sleep for a specified number of milliseconds. | |
uint64_t | vmupro_get_time_us (void) |
Get current time in microseconds. | |
void | vmupro_delay_us (uint64_t delay_us) |
Delay for a specified number of microseconds. | |
void | vmupro_delay_ms (uint64_t delay_ms) |
Delay for a specified number of milliseconds. | |
int | vmupro_snprintf (char *buffer, size_t size, const char *format,...) |
Safe string formatting function. | |
void * | vmupro_malloc (size_t size) |
Memory allocation with SPIRAM preference. | |
int | vmupro_emubrowser_init (vmupro_emubrowser_settings_t settings) |
Initialize the emulator browser. | |
void | vmupro_emubrowser_render_contents (char *launchfile) |
Render the emulator browser and get selected file. | |
VMUPro Utility Functions.
This header provides utility functions for the VMUPro SDK. It includes common helper functions for timing, delays, and other general-purpose operations.
Definition in file vmupro_utils.h.
void vmupro_delay_ms | ( | uint64_t | delay_ms | ) |
Delay for a specified number of milliseconds.
Blocks execution for the specified duration in milliseconds. This function provides millisecond precision timing control.
delay_ms | Duration to delay in milliseconds |
void vmupro_delay_us | ( | uint64_t | delay_us | ) |
Delay for a specified number of microseconds.
Blocks execution for the specified duration in microseconds. This function provides precise timing control for frame rate limiting and delays.
delay_us | Duration to delay in microseconds |
int vmupro_emubrowser_init | ( | vmupro_emubrowser_settings_t | settings | ) |
Initialize the emulator browser.
Initializes the emulator file browser with the specified settings. This must be called before using vmupro_emubrowser_render_contents().
settings | Browser configuration settings |
void vmupro_emubrowser_render_contents | ( | char * | launchfile | ) |
Render the emulator browser and get selected file.
Displays the file browser interface and allows the user to navigate and select a file. The function blocks until the user makes a selection or cancels the operation.
[out] | launchfile | Buffer to receive the selected file path Must be at least 256 bytes in size |
uint64_t vmupro_get_time_us | ( | void | ) |
Get current time in microseconds.
Returns the current system time in microseconds since boot. This function provides high-resolution timing for precise measurements.
void * vmupro_malloc | ( | size_t | size | ) |
Memory allocation with SPIRAM preference.
Allocates memory with preference for SPIRAM (external RAM) when available. Falls back to internal RAM if SPIRAM allocation fails or is unavailable. This provides better memory utilization by using external RAM for large allocations.
size | Number of bytes to allocate |
void vmupro_sleep_ms | ( | uint32_t | milliseconds | ) |
Sleep for a specified number of milliseconds.
Suspends the current task/thread for the specified duration. This function provides a blocking delay that can be used for timing control in applications.
milliseconds | The number of milliseconds to sleep (maximum 1000ms per call) |
int vmupro_snprintf | ( | char * | buffer, |
size_t | size, | ||
const char * | format, | ||
... | |||
) |
Safe string formatting function.
Formats and stores a string in a buffer with guaranteed null-termination. This is a safe alternative to sprintf that prevents buffer overflows.
buffer | Destination buffer for the formatted string |
size | Size of the destination buffer |
format | Format string (printf-style) |
... | Variable arguments for the format string |