基质喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
867 B

3 weeks ago
  1. #include "sn.h"
  2. #include <stdbool.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <stdio.h>
  6. /*******************************************************************************
  7. * EXTERN *
  8. *******************************************************************************/
  9. static sn_t m_sn;
  10. sn_t* xs_device_info_get() { //
  11. // sn_t* info = (sn_t*)DEVICE_INFO_START_ADD;
  12. // m_sn = *info;
  13. //
  14. // if (m_sn.year < 0) {
  15. // m_sn.year = 0;
  16. // }
  17. //
  18. // if (m_sn.weak < 0) {
  19. // m_sn.weak = 0;
  20. // }
  21. //
  22. // if (m_sn.index < 0) {
  23. // m_sn.index = 0;
  24. // }
  25. return &m_sn;
  26. }
  27. const char* sn_get_str() {
  28. sn_t* info = xs_device_info_get();
  29. static char sn_str[32];
  30. sprintf(sn_str, "%s%02d%02d%04d", "SN", info->year, info->weak, info->index);
  31. return sn_str;
  32. }