Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

mem.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * mem.h
  3. *
  4. * Copyright (c) 2023 - 2024 Thomas Buck (thomas@xythobuz.de)
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * See <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __MEM_H__
  19. #define __MEM_H__
  20. #include "hardware/flash.h"
  21. #include <stdint.h>
  22. #include <stdbool.h>
  23. #include "sequence.h"
  24. /*
  25. * We use the last flash page for our persistent storage.
  26. * This is kept clear by our custom linker script.
  27. */
  28. #define EEPROM_FLASH_OFFSET (PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE)
  29. // to migrate settings when struct changes between releases
  30. #define MEM_VERSION 0
  31. struct mem_data {
  32. uint32_t boot_anim_ms;
  33. uint32_t ch_timings[NUM_CHANNELS];
  34. uint32_t ch_count; // to invalidate if number of channels changes
  35. };
  36. // .ch_timings is assigned in mem_load_defaults
  37. #define MEM_DATA_INIT { \
  38. .boot_anim_ms = LOGO_INIT_MS, \
  39. .ch_count = NUM_CHANNELS, \
  40. }
  41. void mem_load(void);
  42. void mem_write(void);
  43. struct mem_data *mem_data(void);
  44. void mem_load_defaults(void);
  45. #endif // __MEM_H__