at_device_bc28.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * File : at_device_bc28.h
  3. * This file is part of RT-Thread RTOS
  4. * Copyright (c) 2020, RudyLo <luhuadong@163.com>
  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 2 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. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2020-02-12 luhuadong first version
  23. */
  24. #ifndef __AT_DEVICE_BC28_H__
  25. #define __AT_DEVICE_BC28_H__
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. #include <stdlib.h>
  30. #include <at_device.h>
  31. /* The maximum number of sockets supported by the BC28 device */
  32. #define AT_DEVICE_BC28_SOCKETS_NUM 7
  33. #define IP_ADDR_SIZE_MAX 16
  34. #define AT_DEVICE_BC28_MIN_SOCKET BC28_SAMPLE_MIN_SOCKET
  35. #define BC28_AT_CLIENT_BAUD_RATE BC28_SAMPLE_BAUD_RATE
  36. struct at_device_bc28
  37. {
  38. char *device_name;
  39. char *client_name;
  40. int power_pin; /* BC28 has not power_en, it should be reset pin */
  41. int power_status_pin; /* ADC */
  42. size_t recv_bufsz;
  43. struct at_device device;
  44. void *socket_data;
  45. void *user_data;
  46. rt_bool_t power_status;
  47. rt_bool_t sleep_status;
  48. };
  49. #ifdef AT_USING_SOCKET
  50. /* bc28 device socket initialize */
  51. int bc28_socket_init(struct at_device *device);
  52. /* bc28 device class socket register */
  53. int bc28_socket_class_register(struct at_device_class *class);
  54. #endif /* AT_USING_SOCKET */
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #endif /* __AT_DEVICE_BC28_H__ */