Sfoglia il codice sorgente

Merge pull request #7 from misonyo/master

修改uart)Sample.c代码缩进
yqiu 7 anni fa
parent
commit
0cc0b26eee
3 ha cambiato i file con 8 aggiunte e 8 eliminazioni
  1. 2 2
      i2c_aht10_sample.c
  2. 1 1
      spi_w25q_sample.c
  3. 5 5
      uart_sample.c

+ 2 - 2
i2c_aht10_sample.c

@@ -114,7 +114,7 @@ static void i2c_aht10_sample(int argc,char *argv[])
     {
     {
         rt_strncpy(name, AHT10_I2C_BUS_NAME, RT_NAME_MAX);
         rt_strncpy(name, AHT10_I2C_BUS_NAME, RT_NAME_MAX);
     }
     }
-    rt_kprintf("name is:%s!\n",name);
+
     if (!initialized)
     if (!initialized)
     {
     {
         /* 传感器初始化 */
         /* 传感器初始化 */
@@ -130,7 +130,7 @@ static void i2c_aht10_sample(int argc,char *argv[])
     }
     }
     else
     else
     {
     {
-        rt_kprintf("i2c sample run failed! initialize sensor failed!\n");
+        rt_kprintf("initialize sensor failed!\n");
     }
     }
 }
 }
 /* 导出到 msh 命令列表中 */
 /* 导出到 msh 命令列表中 */

+ 1 - 1
spi_w25q_sample.c

@@ -35,7 +35,7 @@ static void spi_w25q_sample(int argc,char *argv[])
     {
     {
         rt_strncpy(name, W25Q_SPI_DEVICE_NAME, RT_NAME_MAX);
         rt_strncpy(name, W25Q_SPI_DEVICE_NAME, RT_NAME_MAX);
     }
     }
-    rt_kprintf("name is:%s!\n",name);
+
     /* 查找 spi 设备获取设备句柄 */
     /* 查找 spi 设备获取设备句柄 */
     spi_dev_w25q = (struct rt_spi_device *)rt_device_find(name);
     spi_dev_w25q = (struct rt_spi_device *)rt_device_find(name);
     if (!spi_dev_w25q)
     if (!spi_dev_w25q)

+ 5 - 5
uart_sample.c

@@ -39,7 +39,7 @@ static void serial_thread_entry(void* parameter)
 
 
     /* 查找系统中的串口设备 */
     /* 查找系统中的串口设备 */
     serial = rt_device_find(uart_name);
     serial = rt_device_find(uart_name);
-    
+
     if (serial != RT_NULL)
     if (serial != RT_NULL)
     {
     {
         rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO);
         rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO);
@@ -58,9 +58,9 @@ static void serial_thread_entry(void* parameter)
                 /* 阻塞等待接收信号量,等到信号量后再次读取数据 */
                 /* 阻塞等待接收信号量,等到信号量后再次读取数据 */
                 rt_sem_take(&rx_sem, RT_WAITING_FOREVER);
                 rt_sem_take(&rx_sem, RT_WAITING_FOREVER);
             }
             }
-        /* 读取到的数据通过串口错位输出 */
-        ch = ch + 1;
-        rt_device_write(serial, 0, &ch, 1);
+            /* 读取到的数据通过串口错位输出 */
+            ch = ch + 1;
+            rt_device_write(serial, 0, &ch, 1);
         }
         }
     }
     }
     else
     else
@@ -79,7 +79,7 @@ static void uart_sample(int argc,char *argv[])
     {
     {
         rt_strncpy(uart_name, SAMPLE_UART_NAME, RT_NAME_MAX);
         rt_strncpy(uart_name, SAMPLE_UART_NAME, RT_NAME_MAX);
     }
     }
-    rt_kprintf("name is:%s!\n",uart_name);
+
     /* 创建 serial 线程 */
     /* 创建 serial 线程 */
     rt_thread_t thread = rt_thread_create("serial",serial_thread_entry, RT_NULL, 1024, 25, 10);
     rt_thread_t thread = rt_thread_create("serial",serial_thread_entry, RT_NULL, 1024, 25, 10);
     /* 创建成功则启动线程 */
     /* 创建成功则启动线程 */