hal.h (1142B)
1 /* hal.h - capa de hardware de la PicoCalc (la app se escribe contra esto). 2 * Implementaciones: hal_rp2040.c (la PicoCalc real) y hal_sim.c (simulador en la PC con SDL). */ 3 #ifndef COMUN_HAL_H 4 #define COMUN_HAL_H 5 6 #include "gfx.h" 7 8 void hal_init(void); 9 uint32_t hal_ms(void); 10 void hal_sleep(int ms); 11 /* Dibuja la pantalla entera llamando a paint (en la PicoCalc, una vez por franja). */ 12 void hal_draw(void (*paint)(Surface *s, void *ctx), void *ctx); 13 int hal_key(void); /* K_* o caracter; -1 si no hay */ 14 /* Cable: bytes crudos, no bloqueante. */ 15 void hal_link_write(const char *buf, int n); 16 int hal_link_read(char *buf, int max); 17 /* Guardado persistente (flash / archivo). */ 18 bool hal_store_save(const char *data, int n); 19 int hal_store_load(char *buf, int max); 20 int hal_battery(void); /* porcentaje o -1 */ 21 uint32_t hal_random(void); 22 void hal_log(const char *line); /* diagnostico: pantalla + SD (o stderr en el simulador) */ 23 void hal_log_clear(void); 24 25 /* la app define esta funcion; la llama main() */ 26 void app_main(void); 27 28 #endif