一、描述你遇到的问题
源码中我用手机碰一碰之后会跳转到小熊派官方,但是我把对对应的web域名换成我们自己的之后 碰一碰无法实现跳转 这是怎么回事
二、你具体做的所有步骤结果截图
/*
- Copyright (c) 2020 Nanjing Xiaoxiongpai Intelligent 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 <unistd.h>
#include "cmsis_os2.h"
#include "iot_errno.h"
#include "iot_gpio.h"
#include "iot_gpio_ex.h"
#include "iot_i2c.h"
#include "nfc.h"
#include "ohos_init.h"
#define I2C_TASK_STACK_SIZE (1024 * 8)
#define I2C_TASK_PRIO 25
#define TEXT "Minz"
#define WEB "min-z.com"
#define I2C1_SCL_GPIO 15
#define I2C1_SDA_GPIO 16
#define IOT_I2C_IDX 1
#define IOT_IO_FUNC_GPIO_16_I2C1_SDA 2
#define IOT_IO_FUNC_GPIO_15_I2C1_SCL 2
#define IOT_I2C_BAUDRATE 400000
#define TASK_DELAY_1S 1000000
/**
- @brief i2c task writes data to NFC tag
*/
static void I2cTask(void)
{
uint8_t ret;
// GPIO_16 multiplexed to I2C1_SDA
IoTGpioInit(I2C1_SDA_GPIO);
IoTGpioSetFunc(I2C1_SDA_GPIO, IOT_IO_FUNC_GPIO_16_I2C1_SDA);
IoTGpioSetPull(I2C1_SDA_GPIO, IOT_GPIO_PULL_UP);
// GPIO_15 multiplexed to I2C1_SCL
IoTGpioInit(I2C1_SCL_GPIO);
IoTGpioSetFunc(I2C1_SCL_GPIO, IOT_IO_FUNC_GPIO_15_I2C1_SCL);
IoTGpioSetPull(I2C1_SCL_GPIO, IOT_GPIO_PULL_UP);
// baudrate: 400kbps
IoTI2cInit(IOT_I2C_IDX, IOT_I2C_BAUDRATE);
printf("I2C Test Start\n");
ret = storeText(NDEFFirstPos, (uint8_t *)TEXT);
if (ret != 1) {
printf("NFC Write Data Failed :%d \n", ret);
}
ret = storeUrihttp(NDEFLastPos, (uint8_t *)WEB);
if (ret != 1) {
printf("NFC Write Data Failed :%d \n", ret);
}
while (1) {
printf("=======================================\n");
printf("***********I2C_NFC_example**********\n");
printf("=======================================\n");
printf("Please use the mobile phone with NFC function close to the development board!\n");
usleep(TASK_DELAY_1S);
}
}
/**
- @brief Main Entry of the I2c Example
*/
static void I2cExampleEntry(void)
{
osThreadAttr_t attr;
attr.name = "I2cTask";
attr.attr_bits = 0U;
attr.cb_mem = NULL;
attr.cb_size = 0U;
attr.stack_mem = NULL;
attr.stack_size = I2C_TASK_STACK_SIZE;
attr.priority = I2C_TASK_PRIO;
if (osThreadNew((osThreadFunc_t)I2cTask, NULL, &attr) == NULL) {
printf("Failed to create I2cTask!\n");
}
}
APP_FEATURE_INIT(I2cExampleEntry);
三、当前开发板状态全景照片
请插入图片
四、开发板串口所有日志
rf cali OK. time cost:82, ret:0
NFC URL Data storeText :1
NFC URL Data storeUrihttp :1