Browse Source

adapt (#3)

* adapt

* adapt
CXSforHPU 1 year ago
parent
commit
27dfcb7101
5 changed files with 24 additions and 12 deletions
  1. 1 1
      README.md
  2. 4 1
      SConscript
  3. 0 8
      sensor_goer_spl0601.h
  4. 2 2
      spl0601_sensor_v1.c
  5. 17 0
      spl0601_sensor_v1.h

+ 1 - 1
README.md

@@ -76,7 +76,7 @@ int rt_hw_spl0601_init(const char *name, struct rt_sensor_config *cfg);
 #### 初始化示例
 
 ```
-#include "sensor_goer_spl0601.h"
+#include "spl0601_sensor_v1.h"
 
 int spl0601_port(void)
 {

+ 4 - 1
SConscript

@@ -2,9 +2,12 @@ from building import *
 Import('rtconfig')
 
 cwd     = GetCurrentDir()
-src	= Glob('*.c')
+src = ["spl06_01.c"]
 path = [cwd]
 
+if GetDepend('PKG_SPL0601_USING_SENSOR_V1'):
+    src += ["spl0601_sensor_v1.c"]
+
 group = DefineGroup('spl0601', src, depend = ['PKG_USING_SPL0601'], CPPPATH = path)
 
 Return('group')

+ 0 - 8
sensor_goer_spl0601.h

@@ -1,8 +0,0 @@
-#ifndef SENSOR_GOER_SPL0601_H__
-#define SENSOR_GOER_SPL0601_H__
-
-#include <sensor.h>
-
-int rt_hw_spl0601_init(const char *name, struct rt_sensor_config *cfg);
-
-#endif

+ 2 - 2
sensor_goer_spl0601.c → spl0601_sensor_v1.c

@@ -1,4 +1,4 @@
-#include "sensor_goer_spl0601.h"
+#include "spl0601_sensor_v1.h"
 #include "spl06_01.h"
 
 #define DBG_ENABLE
@@ -23,7 +23,7 @@ static spl0601_t * _spl0601_create(struct rt_sensor_intf *intf)
     return hdev;
 }
 
-static rt_size_t spl0601_fetch_data(struct rt_sensor_device *sensor, void *buf, rt_size_t len)
+static RT_SIZE_TYPE spl0601_fetch_data(struct rt_sensor_device *sensor, void *buf, rt_size_t len)
 {
     spl0601_t *hdev = sensor->parent.user_data;
     struct rt_sensor_data *data = (struct rt_sensor_data *)buf;

+ 17 - 0
spl0601_sensor_v1.h

@@ -0,0 +1,17 @@
+#ifndef SENSOR_GOER_SPL0601_H__
+#define SENSOR_GOER_SPL0601_H__
+
+#include <rtdevice.h>
+#include <rtthread.h>
+
+#if defined(RT_VERSION_CHECK)
+    #if (RTTHREAD_VERSION >= RT_VERSION_CHECK(5, 0, 2))
+        #define RT_SIZE_TYPE   rt_ssize_t
+    #else
+        #define RT_SIZE_TYPE   rt_size_t
+    #endif
+#endif
+
+int rt_hw_spl0601_init(const char *name, struct rt_sensor_config *cfg);
+
+#endif