123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- /*
- * Copyright (c) 2020 Jinan Bosai Network Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- #include <stdio.h>
- #include <string.h>
- #include "L76K.h"
- #include "iot_errno.h"
- #include "iot_gpio.h"
- #include "iot_gpio_ex.h"
- #include "iot_pwm.h"
- #include "iot_uart.h"
- #define WIFI_IOT_PWM_PORT_PWM1 1
- #define WIFI_IOT_IO_FUNC_GPIO_8_PWM1_OUT 5
- #define WIFI_IOT_IO_FUNC_GPIO_7_GPIO 0
- #define BEEP_GPIO 8
- #define LED_GPIO 14
- #define RESET_GPIO 7
- #define STANDBY_GPIO 13
- #define WIFI_IOT_UART_IDX_1 1
- /***************************************************************
- * 函数名称: BoardInit
- * 说 明: 初始化扩展板
- * 参 数: 无
- * 返 回 值: 无
- ***************************************************************/
- void BoardInit(void)
- {
- uint32_t ret;
-
- IotUartAttribute uart_attr = {
- // baud_rate: 9600
- .baudRate = 9600,
- // data_bits: 8bits
- .dataBits = 8,
- .stopBits = 1,
- .parity = 0,
- };
- // Initialize uart driver
- ret = IoTUartInit(WIFI_IOT_UART_IDX_1, &uart_attr);
- if (ret != IOT_SUCCESS) {
- printf("Failed to init uart! Err code = %d\n", ret);
- return;
- }
- }
- static const char* data = "A2\r\n";
- /***************************************************************
- * 函数名称: L76ReadData
- * 说 明: 获取经纬度信息
- * 参 数: 无
- * 返 回 值: 无
- ***************************************************************/
- void PLAY(void)
- {
- //通过串口1接收数据
- IoTUartWrite(WIFI_IOT_UART_IDX_1, (unsigned char*)data, strlen(data));
- }
|