bc26.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef _BC26_H_
  2. #define _BC26_H_
  3. #define BC26_RST_PIN GPIO_Pin_7
  4. #define BC26_RST_GPIO_PORT GPIOA
  5. #define BC26_RST_HIGH() GPIO_WriteBit(BC26_RST_GPIO_PORT, BC26_RST_PIN, Bit_SET)
  6. #define BC26_RST_LOW() GPIO_WriteBit(BC26_RST_GPIO_PORT, BC26_RST_PIN, Bit_RESET)
  7. #define BC26_WAKE_PIN GPIO_Pin_4
  8. #define BC26_WAKE_GPIO_PORT GPIOC
  9. #define BC26_WAKE_HIGH() GPIO_WriteBit(BC26_WAKE_GPIO_PORT, BC26_WAKE_PIN, Bit_SET)
  10. #define BC26_WAKE_LOW() GPIO_WriteBit(BC26_WAKE_GPIO_PORT, BC26_WAKE_PIN, Bit_RESET)
  11. #define AT "AT\r\n"
  12. #define ATRST "AT+QRST=1\r\n"
  13. #define ATQSCLK "AT+QSCLK=0\r\n" //退出休眠模式
  14. #define LIGHTSLEEP "AT+QSCLK=2\r\n" //可进入浅睡眠
  15. #define DEEPSLEEP "AT+QSCLK=1\r\n" //可进入深睡眠
  16. #define ATE1 "ATE1\r\n" //回显命令
  17. #define ATE0 "ATE0\r\n" //不回显命令
  18. #define CIMI "AT+CIMI\r\n" //查询卡号
  19. #define CGATT "AT+CGATT=1\r\n" //将 MT 附着于 PS 域
  20. #define SCGATT "AT+CGATT?\r\n"
  21. #define SQBAND "AT+QBAND?\r\n"
  22. #define CSQ "AT+CSQ\r\n"
  23. #define SCOPS "AT+COPS?\r\n"
  24. #define SCEREG "AT+CEREG?\r\n"
  25. #define QICFG "AT+QICFG=\"dataformat\",1,0\r\n"
  26. #define QIOPEN "AT+QIOPEN=0,0,\"TCP\",\"%s\",%s,0,1\r\n"
  27. #define QIOPENUDP "AT+QIOPEN=0,0,\"UDP\",\"%s\",%s,0,1\r\n"
  28. //#define QIOPEN "AT+QIOPEN=0,0,\"TCP\",\"a17IWSEFgWP.iot-as-mqtt.cn-shanghai.aliyuncs.com\",1883,0,1\r\n"
  29. #define QICLOSE "AT+QICLOSE=0\r\n"
  30. #define QISTATE "AT+QISTATE=1,0\r\n" //查询tcp连接状态
  31. #define CFUN0 "AT+CFUN=0\r\n" //UE功能最小化
  32. int bc26_sal_init(void);
  33. void bc26_sal_register(void);
  34. //static int bc26_init(void);
  35. //static void bc26_tcp_connect(const char *ip, const char *port);
  36. //static void bc26_tcp_reconnect(const char *ip, const char *port);
  37. //static int bc26_tcp_state(void);
  38. //static int bc26_tcp_close(void);
  39. //static int bc26_tcp_state(void);
  40. //static int bc26_send_cmd(char *cmd, char *res);
  41. //static void bc26_send_cmd_back(char *cmd, char data[], int size);
  42. //static int bc26_send_data(const void *data, int len);
  43. //static int bc26_get_data(void *data,int len,int timeOut);
  44. #endif