1
0

L76K.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (c) 2020  Jinan Bosai Network Technology Co., Ltd.
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include "L76K.h"
  18. #include "iot_errno.h"
  19. #include "iot_gpio.h"
  20. #include "iot_gpio_ex.h"
  21. #include "iot_pwm.h"
  22. #include "iot_uart.h"
  23. #define WIFI_IOT_PWM_PORT_PWM1 1
  24. #define WIFI_IOT_IO_FUNC_GPIO_8_PWM1_OUT 5
  25. #define WIFI_IOT_IO_FUNC_GPIO_7_GPIO 0
  26. #define BEEP_GPIO 8
  27. #define LED_GPIO 14
  28. #define RESET_GPIO 7
  29. #define STANDBY_GPIO 13
  30. #define WIFI_IOT_UART_IDX_1 1
  31. /***************************************************************
  32. * 函数名称: BoardInit
  33. * 说 明: 初始化扩展板
  34. * 参 数: 无
  35. * 返 回 值: 无
  36. ***************************************************************/
  37. void BoardInit(void)
  38. {
  39. uint32_t ret;
  40. IotUartAttribute uart_attr = {
  41. // baud_rate: 9600
  42. .baudRate = 9600,
  43. // data_bits: 8bits
  44. .dataBits = 8,
  45. .stopBits = 1,
  46. .parity = 0,
  47. };
  48. // Initialize uart driver
  49. ret = IoTUartInit(WIFI_IOT_UART_IDX_1, &uart_attr);
  50. if (ret != IOT_SUCCESS) {
  51. printf("Failed to init uart! Err code = %d\n", ret);
  52. return;
  53. }
  54. }
  55. static const char* data = "A2\r\n";
  56. /***************************************************************
  57. * 函数名称: L76ReadData
  58. * 说 明: 获取经纬度信息
  59. * 参 数: 无
  60. * 返 回 值: 无
  61. ***************************************************************/
  62. void PLAY(void)
  63. {
  64. //通过串口1接收数据
  65. IoTUartWrite(WIFI_IOT_UART_IDX_1, (unsigned char*)data, strlen(data));
  66. }