Skip to content

Commit 30fd4c6

Browse files
committed
修复了不会同步库文件的BUG
修复了不会同步库文件的的问题 修复了自动下载最新8266驱动的问题 屏蔽了.vscode的同步
1 parent 79c7527 commit 30fd4c6

File tree

1,226 files changed

+537694
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,226 files changed

+537694
-2
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.pio
1+
.pio/build/
22
.vscode/.browse.c_cpp.db*
33
.vscode/c_cpp_properties.json
44
.vscode/launch.json
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#
2+
# NOTE! Don't add files that are generated in specific
3+
# subdirectories here. Add them in the ".gitignore" file
4+
# in that subdirectory instead.
5+
#
6+
# NOTE! Please use 'git ls-files -i --exclude-standard'
7+
# command after changing this file, to see if there are
8+
# any tracked files which get ignored after the change.
9+
#
10+
# Normal rules
11+
#
12+
.*
13+
*.o
14+
*.o.*
15+
*.a
16+
*.s
17+
*.ko
18+
*.so
19+
*.so.dbg
20+
*.mod.c
21+
*.i
22+
*.lst
23+
*.symtypes
24+
*.order
25+
modules.builtin
26+
*.elf
27+
*.bin
28+
*.gz
29+
*.bz2
30+
*.lzma
31+
*.patch
32+
*.gcno
33+
34+
#
35+
# Top-level generic files
36+
#
37+
/tags
38+
/TAGS
39+
/linux
40+
/vmlinux
41+
/vmlinuz
42+
/System.map
43+
/Module.markers
44+
/Module.symvers
45+
46+
#
47+
# git files that we don't want to ignore even it they are dot-files
48+
#
49+
!.gitignore
50+
!.mailmap
51+
52+
#
53+
# Generated include files
54+
#
55+
include/config
56+
include/linux/version.h
57+
include/generated
58+
59+
# stgit generated dirs
60+
patches-*
61+
62+
# quilt's files
63+
patches
64+
series
65+
66+
# cscope files
67+
cscope.*
68+
ncscope.*
69+
70+
# gnu global files
71+
GPATH
72+
GRTAGS
73+
GSYMS
74+
GTAGS
75+
76+
# QT-Creator files
77+
Makefile.am.user
78+
*.config
79+
*.creator
80+
*.creator.user
81+
*.files
82+
*.includes
83+
84+
*.orig
85+
*~
86+
\#*#
87+
*.lo
88+
*.la
89+
Makefile
90+
Makefile.in
91+
aclocal.m4
92+
autoconfig.h
93+
autoconfig.h.in
94+
autom4te.cache/
95+
build-aux/
96+
config.log
97+
config.status
98+
configure
99+
libtool
100+
libupnp.pc
101+
m4/libtool.m4
102+
m4/ltoptions.m4
103+
m4/ltsugar.m4
104+
m4/ltversion.m4
105+
m4/lt~obsolete.m4
106+
stamp-h1
107+
docs/doxygen
108+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#include "Adafruit_Sensor.h"
2+
3+
/**************************************************************************/
4+
/*!
5+
@brief Prints sensor information to serial console
6+
*/
7+
/**************************************************************************/
8+
void Adafruit_Sensor::printSensorDetails(void) {
9+
sensor_t sensor;
10+
getSensor(&sensor);
11+
Serial.println(F("------------------------------------"));
12+
Serial.print(F("Sensor: "));
13+
Serial.println(sensor.name);
14+
Serial.print(F("Type: "));
15+
switch ((sensors_type_t)sensor.type) {
16+
case SENSOR_TYPE_ACCELEROMETER:
17+
Serial.print(F("Acceleration (m/s2)"));
18+
break;
19+
case SENSOR_TYPE_MAGNETIC_FIELD:
20+
Serial.print(F("Magnetic (uT)"));
21+
break;
22+
case SENSOR_TYPE_ORIENTATION:
23+
Serial.print(F("Orientation (degrees)"));
24+
break;
25+
case SENSOR_TYPE_GYROSCOPE:
26+
Serial.print(F("Gyroscopic (rad/s)"));
27+
break;
28+
case SENSOR_TYPE_LIGHT:
29+
Serial.print(F("Light (lux)"));
30+
break;
31+
case SENSOR_TYPE_PRESSURE:
32+
Serial.print(F("Pressure (hPa)"));
33+
break;
34+
case SENSOR_TYPE_PROXIMITY:
35+
Serial.print(F("Distance (cm)"));
36+
break;
37+
case SENSOR_TYPE_GRAVITY:
38+
Serial.print(F("Gravity (m/s2)"));
39+
break;
40+
case SENSOR_TYPE_LINEAR_ACCELERATION:
41+
Serial.print(F("Linear Acceleration (m/s2)"));
42+
break;
43+
case SENSOR_TYPE_ROTATION_VECTOR:
44+
Serial.print(F("Rotation vector"));
45+
break;
46+
case SENSOR_TYPE_RELATIVE_HUMIDITY:
47+
Serial.print(F("Relative Humidity (%)"));
48+
break;
49+
case SENSOR_TYPE_AMBIENT_TEMPERATURE:
50+
Serial.print(F("Ambient Temp (C)"));
51+
break;
52+
case SENSOR_TYPE_OBJECT_TEMPERATURE:
53+
Serial.print(F("Object Temp (C)"));
54+
break;
55+
case SENSOR_TYPE_VOLTAGE:
56+
Serial.print(F("Voltage (V)"));
57+
break;
58+
case SENSOR_TYPE_CURRENT:
59+
Serial.print(F("Current (mA)"));
60+
break;
61+
case SENSOR_TYPE_COLOR:
62+
Serial.print(F("Color (RGBA)"));
63+
break;
64+
}
65+
66+
Serial.println();
67+
Serial.print(F("Driver Ver: "));
68+
Serial.println(sensor.version);
69+
Serial.print(F("Unique ID: "));
70+
Serial.println(sensor.sensor_id);
71+
Serial.print(F("Min Value: "));
72+
Serial.println(sensor.min_value);
73+
Serial.print(F("Max Value: "));
74+
Serial.println(sensor.max_value);
75+
Serial.print(F("Resolution: "));
76+
Serial.println(sensor.resolution);
77+
Serial.println(F("------------------------------------\n"));
78+
}
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
/*
2+
* Copyright (C) 2008 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software< /span>
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/* Update by K. Townsend (Adafruit Industries) for lighter typedefs, and
18+
* extended sensor support to include color, voltage and current */
19+
20+
#ifndef _ADAFRUIT_SENSOR_H
21+
#define _ADAFRUIT_SENSOR_H
22+
23+
#ifndef ARDUINO
24+
#include <stdint.h>
25+
#elif ARDUINO >= 100
26+
#include "Arduino.h"
27+
#include "Print.h"
28+
#else
29+
#include "WProgram.h"
30+
#endif
31+
32+
/* Constants */
33+
#define SENSORS_GRAVITY_EARTH (9.80665F) /**< Earth's gravity in m/s^2 */
34+
#define SENSORS_GRAVITY_MOON (1.6F) /**< The moon's gravity in m/s^2 */
35+
#define SENSORS_GRAVITY_SUN (275.0F) /**< The sun's gravity in m/s^2 */
36+
#define SENSORS_GRAVITY_STANDARD (SENSORS_GRAVITY_EARTH)
37+
#define SENSORS_MAGFIELD_EARTH_MAX \
38+
(60.0F) /**< Maximum magnetic field on Earth's surface */
39+
#define SENSORS_MAGFIELD_EARTH_MIN \
40+
(30.0F) /**< Minimum magnetic field on Earth's surface */
41+
#define SENSORS_PRESSURE_SEALEVELHPA \
42+
(1013.25F) /**< Average sea level pressure is 1013.25 hPa */
43+
#define SENSORS_DPS_TO_RADS \
44+
(0.017453293F) /**< Degrees/s to rad/s multiplier \
45+
*/
46+
#define SENSORS_RADS_TO_DPS \
47+
(57.29577793F) /**< Rad/s to degrees/s multiplier */
48+
#define SENSORS_GAUSS_TO_MICROTESLA \
49+
(100) /**< Gauss to micro-Tesla multiplier */
50+
51+
/** Sensor types */
52+
typedef enum {
53+
SENSOR_TYPE_ACCELEROMETER = (1), /**< Gravity + linear acceleration */
54+
SENSOR_TYPE_MAGNETIC_FIELD = (2),
55+
SENSOR_TYPE_ORIENTATION = (3),
56+
SENSOR_TYPE_GYROSCOPE = (4),
57+
SENSOR_TYPE_LIGHT = (5),
58+
SENSOR_TYPE_PRESSURE = (6),
59+
SENSOR_TYPE_PROXIMITY = (8),
60+
SENSOR_TYPE_GRAVITY = (9),
61+
SENSOR_TYPE_LINEAR_ACCELERATION =
62+
(10), /**< Acceleration not including gravity */
63+
SENSOR_TYPE_ROTATION_VECTOR = (11),
64+
SENSOR_TYPE_RELATIVE_HUMIDITY = (12),
65+
SENSOR_TYPE_AMBIENT_TEMPERATURE = (13),
66+
SENSOR_TYPE_OBJECT_TEMPERATURE = (14),
67+
SENSOR_TYPE_VOLTAGE = (15),
68+
SENSOR_TYPE_CURRENT = (16),
69+
SENSOR_TYPE_COLOR = (17)
70+
} sensors_type_t;
71+
72+
/** struct sensors_vec_s is used to return a vector in a common format. */
73+
typedef struct {
74+
union {
75+
float v[3]; ///< 3D vector elements
76+
struct {
77+
float x; ///< X component of vector
78+
float y; ///< Y component of vector
79+
float z; ///< Z component of vector
80+
}; ///< Struct for holding XYZ component
81+
/* Orientation sensors */
82+
struct {
83+
float roll; /**< Rotation around the longitudinal axis (the plane body, 'X
84+
axis'). Roll is positive and increasing when moving
85+
downward. -90 degrees <= roll <= 90 degrees */
86+
float pitch; /**< Rotation around the lateral axis (the wing span, 'Y
87+
axis'). Pitch is positive and increasing when moving
88+
upwards. -180 degrees <= pitch <= 180 degrees) */
89+
float heading; /**< Angle between the longitudinal axis (the plane body)
90+
and magnetic north, measured clockwise when viewing from
91+
the top of the device. 0-359 degrees */
92+
}; ///< Struct for holding roll/pitch/heading
93+
}; ///< Union that can hold 3D vector array, XYZ components or
94+
///< roll/pitch/heading
95+
int8_t status; ///< Status byte
96+
uint8_t reserved[3]; ///< Reserved
97+
} sensors_vec_t;
98+
99+
/** struct sensors_color_s is used to return color data in a common format. */
100+
typedef struct {
101+
union {
102+
float c[3]; ///< Raw 3-element data
103+
/* RGB color space */
104+
struct {
105+
float r; /**< Red component */
106+
float g; /**< Green component */
107+
float b; /**< Blue component */
108+
}; ///< RGB data in floating point notation
109+
}; ///< Union of various ways to describe RGB colorspace
110+
uint32_t rgba; /**< 24-bit RGBA value */
111+
} sensors_color_t;
112+
113+
/* Sensor event (36 bytes) */
114+
/** struct sensor_event_s is used to provide a single sensor event in a common
115+
* format. */
116+
typedef struct {
117+
int32_t version; /**< must be sizeof(struct sensors_event_t) */
118+
int32_t sensor_id; /**< unique sensor identifier */
119+
int32_t type; /**< sensor type */
120+
int32_t reserved0; /**< reserved */
121+
int32_t timestamp; /**< time is in milliseconds */
122+
union {
123+
float data[4]; ///< Raw data
124+
sensors_vec_t acceleration; /**< acceleration values are in meter per second
125+
per second (m/s^2) */
126+
sensors_vec_t
127+
magnetic; /**< magnetic vector values are in micro-Tesla (uT) */
128+
sensors_vec_t orientation; /**< orientation values are in degrees */
129+
sensors_vec_t gyro; /**< gyroscope values are in rad/s */
130+
float temperature; /**< temperature is in degrees centigrade (Celsius) */
131+
float distance; /**< distance in centimeters */
132+
float light; /**< light in SI lux units */
133+
float pressure; /**< pressure in hectopascal (hPa) */
134+
float relative_humidity; /**< relative humidity in percent */
135+
float current; /**< current in milliamps (mA) */
136+
float voltage; /**< voltage in volts (V) */
137+
sensors_color_t color; /**< color in RGB component values */
138+
}; ///< Union for the wide ranges of data we can carry
139+
} sensors_event_t;
140+
141+
/* Sensor details (40 bytes) */
142+
/** struct sensor_s is used to describe basic information about a specific
143+
* sensor. */
144+
typedef struct {
145+
char name[12]; /**< sensor name */
146+
int32_t version; /**< version of the hardware + driver */
147+
int32_t sensor_id; /**< unique sensor identifier */
148+
int32_t type; /**< this sensor's type (ex. SENSOR_TYPE_LIGHT) */
149+
float max_value; /**< maximum value of this sensor's value in SI units */
150+
float min_value; /**< minimum value of this sensor's value in SI units */
151+
float resolution; /**< smallest difference between two values reported by this
152+
sensor */
153+
int32_t min_delay; /**< min delay in microseconds between events. zero = not a
154+
constant rate */
155+
} sensor_t;
156+
157+
/** @brief Common sensor interface to unify various sensors.
158+
* Intentionally modeled after sensors.h in the Android API:
159+
* https://github.com/android/platform_hardware_libhardware/blob/master/include/hardware/sensors.h
160+
*/
161+
class Adafruit_Sensor {
162+
public:
163+
// Constructor(s)
164+
Adafruit_Sensor() {}
165+
virtual ~Adafruit_Sensor() {}
166+
167+
// These must be defined by the subclass
168+
169+
/*! @brief Whether we should automatically change the range (if possible) for
170+
higher precision
171+
@param enabled True if we will try to autorange */
172+
virtual void enableAutoRange(bool enabled) {
173+
(void)enabled; /* suppress unused warning */
174+
};
175+
176+
/*! @brief Get the latest sensor event
177+
@returns True if able to fetch an event */
178+
virtual bool getEvent(sensors_event_t *) = 0;
179+
/*! @brief Get info about the sensor itself */
180+
virtual void getSensor(sensor_t *) = 0;
181+
182+
void printSensorDetails(void);
183+
184+
private:
185+
bool _autoRange;
186+
};
187+
188+
#endif

0 commit comments

Comments
 (0)