at_sample_ml307.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-12-16 Jonas first version
  9. */
  10. #include <at_device_ml307.h>
  11. #define LOG_TAG "at.sample.ml307"
  12. #include <at_log.h>
  13. #define ML307_SAMPLE_DEIVCE_NAME "ml3070"
  14. #if !defined ML307_SAMPLE_CLIENT_NAME
  15. #define ML307_SAMPLE_CLIENT_NAME "uart2"
  16. #endif
  17. #if !defined (ML307_SAMPLE_POWER_PIN)
  18. #define ML307_SAMPLE_POWER_PIN 0x1C
  19. #endif
  20. #if !defined (ML307_SAMPLE_STATUS_PIN)
  21. #define ML307_SAMPLE_STATUS_PIN 0x1E
  22. #endif
  23. #if !defined (ML307_SAMPLE_RECV_BUFF_LEN)
  24. #define ML307_SAMPLE_RECV_BUFF_LEN 4096
  25. #endif
  26. #if !defined (AT_DEVICE_CLASS_ML307)
  27. #define AT_DEVICE_CLASS_ML307 0xFFFFU
  28. #endif
  29. static struct at_device_ml307 ml3070 =
  30. {
  31. ML307_SAMPLE_DEIVCE_NAME,
  32. ML307_SAMPLE_CLIENT_NAME,
  33. ML307_SAMPLE_POWER_PIN,
  34. ML307_SAMPLE_STATUS_PIN,
  35. ML307_SAMPLE_RECV_BUFF_LEN,
  36. };
  37. static int ml307_device_register(void)
  38. {
  39. struct at_device_ml307 *ml307 = &ml3070;
  40. return at_device_register(&(ml307->device),
  41. ml307->device_name,
  42. ml307->client_name,
  43. AT_DEVICE_CLASS_ML307,
  44. (void *) ml307);
  45. }
  46. INIT_APP_EXPORT(ml307_device_register);