util.h 849 B

1234567891011121314151617181920212223242526272829303132333435
  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 void update_current_firmware_version_to_eeprom();
  19. inline int8_t eeprom_read_int8(unsigned char* addr) {
  20. uint8_t v = eeprom_read_byte(addr);
  21. return *reinterpret_cast<int8_t*>(&v);
  22. }
  23. inline void eeprom_update_int8(unsigned char* addr, int8_t v) {
  24. eeprom_update_byte(addr, *reinterpret_cast<uint8_t*>(&v));
  25. }
  26. #endif /* UTIL_H */