util.h 893 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef UTIL_H
  2. #define UTIL_H
  3. extern const char* FW_VERSION_STR_P();
  4. // Definition of a firmware flavor numerical values.
  5. enum FirmwareRevisionFlavorType
  6. {
  7. FIRMWARE_REVISION_DEV = 0,
  8. FIRMWARE_REVISION_ALPHA = 1,
  9. FIRMWARE_REVISION_BETA = 2,
  10. FIRMWARE_REVISION_RC,
  11. FIRMWARE_REVISION_RC2,
  12. FIRMWARE_REVISION_RC3,
  13. FIRMWARE_REVISION_RC4,
  14. FIRMWARE_REVISION_RC5,
  15. FIRMWARE_REVISION_RELEASED = 127
  16. };
  17. extern bool show_upgrade_dialog_if_version_newer(const char *version_string);
  18. extern bool force_selftest_if_fw_version();
  19. extern void update_current_firmware_version_to_eeprom();
  20. inline int8_t eeprom_read_int8(unsigned char* addr) {
  21. uint8_t v = eeprom_read_byte(addr);
  22. return *reinterpret_cast<int8_t*>(&v);
  23. }
  24. inline void eeprom_update_int8(unsigned char* addr, int8_t v) {
  25. eeprom_update_byte(addr, *reinterpret_cast<uint8_t*>(&v));
  26. }
  27. #endif /* UTIL_H */