Skip to content

Commit 7d96345

Browse files
committed
add license
1 parent ccbbe80 commit 7d96345

File tree

3 files changed

+127
-50
lines changed

3 files changed

+127
-50
lines changed

Adafruit_LPS28.cpp

Lines changed: 65 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
1-
/**
2-
* @file Adafruit_LPS28.cpp
3-
* @brief Driver for the LPS28 Pressure Sensor
4-
* @author Adafruit Industries
5-
* @copyright BSD License
1+
// For Adafruit_LPS28.cpp:
2+
/*!
3+
* @file Adafruit_LPS28.cpp
4+
*
5+
* @mainpage Adafruit LPS28 Pressure & Temperature Sensor library
6+
*
7+
* @section intro_sec Introduction
8+
*
9+
* This is a library for the LPS28 Pressure & Temperature Sensor
10+
*
11+
* Designed specifically to work with the Adafruit LPS28 Breakout
12+
* ----> http://www.adafruit.com/products/6067
13+
*
14+
* These sensors use I2C to communicate, 2 pins are required to interface.
15+
*
16+
* Adafruit invests time and resources providing this open source code,
17+
* please support Adafruit and open-source hardware by purchasing products
18+
* from Adafruit!
19+
*
20+
* @section author Author
21+
*
22+
* Written by Limor Fried/Ladyada for Adafruit Industries.
23+
*
24+
* @section license License
25+
*
26+
* MIT license, all text above must be included in any redistribution
627
*/
728

829
#include "Adafruit_LPS28.h"
@@ -15,7 +36,7 @@ Adafruit_LPS28::Adafruit_LPS28() {}
1536
/**
1637
* @brief Initializes the sensor with given parameters, tried reading
1738
* and veriying the WHOAMI register
18-
*
39+
*
1940
* @param theWire The Wire object to be used for I2C communication
2041
* @param i2c_addr The I2C address of the sensor
2142
* @return true If sensor initialization was successful
@@ -33,7 +54,7 @@ bool Adafruit_LPS28::begin(TwoWire *theWire, uint8_t i2c_addr) {
3354

3455
/**
3556
* @brief Sets the pressure threshold for interrupt generation
36-
*
57+
*
3758
* @param threshold The pressure threshold value to set
3859
* @return true If threshold was set successfully
3960
* @return false If threshold setting failed
@@ -45,7 +66,7 @@ bool Adafruit_LPS28::setThresholdPressure(uint16_t threshold) {
4566

4667
/**
4768
* @brief Gets the current pressure threshold value for the IRQ
48-
*
69+
*
4970
* @return uint16_t The current pressure threshold value
5071
*/
5172
uint16_t Adafruit_LPS28::getThresholdPressure() {
@@ -55,7 +76,7 @@ uint16_t Adafruit_LPS28::getThresholdPressure() {
5576

5677
/**
5778
* @brief Sets the data output rate of the sensor (ODR)
58-
*
79+
*
5980
* @param odr The desired output data rate from lps28_odr_t enum
6081
* @return true If data rate was set successfully
6182
* @return false If data rate setting failed
@@ -68,7 +89,7 @@ bool Adafruit_LPS28::setDataRate(lps28_odr_t odr) {
6889

6990
/**
7091
* @brief Gets the current data output rate setting (ODR)
71-
*
92+
*
7293
* @return lps28_odr_t The current output data rate setting
7394
*/
7495
lps28_odr_t Adafruit_LPS28::getDataRate() {
@@ -77,10 +98,9 @@ lps28_odr_t Adafruit_LPS28::getDataRate() {
7798
return (lps28_odr_t)odr_bits.read();
7899
}
79100

80-
81101
/**
82102
* @brief Sets the number of pressure and temperature samples to average
83-
*
103+
*
84104
* @param avg The averaging setting from lps28_avg_t enum
85105
* @return true If averaging setting was set successfully
86106
* @return false If averaging setting failed
@@ -93,7 +113,7 @@ bool Adafruit_LPS28::setAveraging(lps28_avg_t avg) {
93113

94114
/**
95115
* @brief Gets the current averaging setting
96-
*
116+
*
97117
* @return lps28_avg_t The current averaging setting
98118
*/
99119
lps28_avg_t Adafruit_LPS28::getAveraging() {
@@ -104,7 +124,7 @@ lps28_avg_t Adafruit_LPS28::getAveraging() {
104124

105125
/**
106126
* @brief Reboots the memory content of the sensor
107-
*
127+
*
108128
* @return true If memory reboot was successful
109129
* @return false If memory reboot failed
110130
*/
@@ -116,8 +136,9 @@ bool Adafruit_LPS28::rebootMemory() {
116136

117137
/**
118138
* @brief Sets the full scale mode of the sensor
119-
*
120-
* @param mode true for FS_MODE=1 (1/2048 hPa/LSB), false for FS_MODE=0 (1/4096 hPa/LSB)
139+
*
140+
* @param mode true for FS_MODE=1 (1/2048 hPa/LSB), false for FS_MODE=0 (1/4096
141+
* hPa/LSB)
121142
* @return true If full scale mode was set successfully
122143
* @return false If full scale mode setting failed
123144
*/
@@ -129,7 +150,7 @@ bool Adafruit_LPS28::setFullScaleMode(bool mode) {
129150

130151
/**
131152
* @brief Gets the current full scale mode setting
132-
*
153+
*
133154
* @return true FS_MODE=1 (1/2048 hPa/LSB)
134155
* @return false FS_MODE=0 (1/4096 hPa/LSB)
135156
*/
@@ -141,7 +162,7 @@ bool Adafruit_LPS28::getFullScaleMode() {
141162

142163
/**
143164
* @brief Enables or disables the low-pass filter at ODR/9
144-
*
165+
*
145166
* @param enable true to enable the low-pass filter, false to disable
146167
* @return true If setting was applied successfully
147168
* @return false If setting failed
@@ -152,10 +173,9 @@ bool Adafruit_LPS28::setLowPassODR9(bool enable) {
152173
return lpfp_cfg_bit.write(enable);
153174
}
154175

155-
156176
/**
157177
* @brief Performs a software reset of the sensor
158-
*
178+
*
159179
* @return true If reset was successful
160180
* @return false If reset failed
161181
*/
@@ -167,7 +187,7 @@ bool Adafruit_LPS28::reset() {
167187

168188
/**
169189
* @brief Triggers a one-shot measurement
170-
*
190+
*
171191
* @return true If one-shot measurement was triggered successfully
172192
* @return false If trigger failed
173193
*/
@@ -179,7 +199,7 @@ bool Adafruit_LPS28::triggerOneShot() {
179199

180200
/**
181201
* @brief Configures the interrupt pin settings
182-
*
202+
*
183203
* @param polarity true for active-high, false for active-low
184204
* @param openDrain true for open-drain output, false for push-pull
185205
* @return true If interrupt pin configuration was successful
@@ -194,7 +214,7 @@ bool Adafruit_LPS28::setInterruptPin(bool polarity, bool openDrain) {
194214

195215
/**
196216
* @brief Enables or disables the SDA line internal pull-up resistor
197-
*
217+
*
198218
* @param enable true to enable pull-up, false to disable
199219
* @return true If pull-up setting was changed successfully
200220
* @return false If setting change failed
@@ -207,7 +227,7 @@ bool Adafruit_LPS28::setSDAPullup(bool enable) {
207227

208228
/**
209229
* @brief Enables or disables the INT pin internal pull-down resistor
210-
*
230+
*
211231
* @param enable true to enable pull-down, false to disable
212232
* @return true If pull-down setting was changed successfully
213233
* @return false If setting change failed
@@ -220,7 +240,7 @@ bool Adafruit_LPS28::setINTPulldown(bool enable) {
220240

221241
/**
222242
* @brief Sets up automatic reference pressure mode
223-
*
243+
*
224244
* @param enable true to enable auto reference pressure, false to disable
225245
* @return true If auto reference pressure setting was changed successfully
226246
* @return false If setting change failed
@@ -231,10 +251,9 @@ bool Adafruit_LPS28::setAutoReferencePressure(bool enable) {
231251
return autozero_bit.write(enable);
232252
}
233253

234-
235254
/**
236255
* @brief Gets the current auto reference pressure setting
237-
*
256+
*
238257
* @return true If auto reference pressure is enabled
239258
* @return false If auto reference pressure is disabled
240259
*/
@@ -246,7 +265,7 @@ bool Adafruit_LPS28::getAutoReferencePressure() {
246265

247266
/**
248267
* @brief Resets the auto reference pressure setting
249-
*
268+
*
250269
* @return true If reset was successful
251270
* @return false If reset failed
252271
*/
@@ -258,7 +277,7 @@ bool Adafruit_LPS28::resetAutoReferencePressure() {
258277

259278
/**
260279
* @brief Enables or disables the auto-zero function
261-
*
280+
*
262281
* @param enable true to enable auto-zero, false to disable
263282
* @return true If auto-zero setting was changed successfully
264283
* @return false If setting change failed
@@ -271,7 +290,7 @@ bool Adafruit_LPS28::setAutoZero(bool enable) {
271290

272291
/**
273292
* @brief Gets the current auto-zero setting
274-
*
293+
*
275294
* @return true If auto-zero is enabled
276295
* @return false If auto-zero is disabled
277296
*/
@@ -283,7 +302,7 @@ bool Adafruit_LPS28::getAutoZero() {
283302

284303
/**
285304
* @brief Resets the auto-zero function
286-
*
305+
*
287306
* @return true If reset was successful
288307
* @return false If reset failed
289308
*/
@@ -295,7 +314,7 @@ bool Adafruit_LPS28::resetAutoZero() {
295314

296315
/**
297316
* @brief Configures pressure interrupt settings
298-
*
317+
*
299318
* @param low Enable low pressure interrupt
300319
* @param high Enable high pressure interrupt
301320
* @param latching Enable latching mode for interrupts
@@ -312,7 +331,7 @@ bool Adafruit_LPS28::setPressureInterrupt(bool low, bool high, bool latching) {
312331

313332
/**
314333
* @brief Configures which conditions trigger the interrupt pin
315-
*
334+
*
316335
* @param drdy Enable data ready interrupt
317336
* @param drdy_pulse Enable pulsed mode for data ready interrupt
318337
* @param int_enable Enable pressure threshold interrupt
@@ -349,10 +368,9 @@ bool Adafruit_LPS28::setIntPinOutput(bool drdy, bool drdy_pulse,
349368
fifo_watermark_ok && fifo_overrun_ok;
350369
}
351370

352-
353371
/**
354372
* @brief Configures the FIFO operation mode
355-
*
373+
*
356374
* @param stop_on_watermark Stop collecting data when watermark is reached
357375
* @param mode FIFO operation mode from lps28_fifo_mode_t enum
358376
* @return true If FIFO configuration was successful
@@ -375,7 +393,7 @@ bool Adafruit_LPS28::setFIFOmode(bool stop_on_watermark,
375393

376394
/**
377395
* @brief Sets the FIFO watermark level
378-
*
396+
*
379397
* @param wtm Watermark level (0-127)
380398
* @return true If watermark was set successfully
381399
* @return false If setting failed
@@ -387,7 +405,7 @@ bool Adafruit_LPS28::setFIFOWatermark(uint8_t wtm) {
387405

388406
/**
389407
* @brief Gets the current FIFO watermark level
390-
*
408+
*
391409
* @return uint8_t Current watermark level (0-127)
392410
*/
393411
uint8_t Adafruit_LPS28::getFIFOWatermark() {
@@ -397,7 +415,7 @@ uint8_t Adafruit_LPS28::getFIFOWatermark() {
397415

398416
/**
399417
* @brief Gets the current reference pressure value
400-
*
418+
*
401419
* @return int16_t Current reference pressure value
402420
*/
403421
int16_t Adafruit_LPS28::getReferencePressure() {
@@ -407,7 +425,7 @@ int16_t Adafruit_LPS28::getReferencePressure() {
407425

408426
/**
409427
* @brief Sets the pressure offset value
410-
*
428+
*
411429
* @param offset Pressure offset value to set
412430
* @return true If offset was set successfully
413431
* @return false If setting failed
@@ -419,7 +437,7 @@ bool Adafruit_LPS28::setPressureOffset(int16_t offset) {
419437

420438
/**
421439
* @brief Gets the current pressure offset value
422-
*
440+
*
423441
* @return int16_t Current pressure offset value
424442
*/
425443
int16_t Adafruit_LPS28::getPressureOffset() {
@@ -429,7 +447,7 @@ int16_t Adafruit_LPS28::getPressureOffset() {
429447

430448
/**
431449
* @brief Gets the source of the last interrupt
432-
*
450+
*
433451
* @return uint8_t Interrupt source register value
434452
* Bit 7: AUTOZERO
435453
* Bit 6: RESET_ARP
@@ -447,7 +465,7 @@ uint8_t Adafruit_LPS28::getIntSource() {
447465

448466
/**
449467
* @brief Gets the number of unread samples in the FIFO
450-
*
468+
*
451469
* @return uint8_t Number of unread FIFO samples
452470
*/
453471
uint8_t Adafruit_LPS28::getFIFOunreadSamples() {
@@ -457,7 +475,7 @@ uint8_t Adafruit_LPS28::getFIFOunreadSamples() {
457475

458476
/**
459477
* @brief Gets the current sensor status
460-
*
478+
*
461479
* @return uint8_t Status register value
462480
* Bit 3: P_OR (Pressure data overrun)
463481
* Bit 2: T_OR (Temperature data overrun)
@@ -471,7 +489,7 @@ uint8_t Adafruit_LPS28::getStatus() {
471489

472490
/**
473491
* @brief Gets the current pressure reading
474-
*
492+
*
475493
* @return float Pressure reading in hPa (hectopascals)
476494
* @note Resolution depends on FS_MODE:
477495
* - FS_MODE = 0: 1 LSB = 1/4096 hPa
@@ -498,7 +516,7 @@ float Adafruit_LPS28::getPressure() {
498516

499517
/**
500518
* @brief Gets the current temperature reading
501-
*
519+
*
502520
* @return float Temperature in degrees Celsius
503521
* @note Resolution is 0.01°C per LSB
504522
*/
@@ -515,7 +533,7 @@ float Adafruit_LPS28::getTemperature() {
515533

516534
/**
517535
* @brief Gets the current FIFO status
518-
*
536+
*
519537
* @return uint8_t FIFO status register value
520538
* Bit 7-6: FIFO_FULL_IA (FIFO full interrupt active)
521539
* Bit 5: FIFO_OVR_IA (FIFO overrun interrupt active)
@@ -529,7 +547,7 @@ uint8_t Adafruit_LPS28::getFIFOstatus() {
529547

530548
/**
531549
* @brief Reads the next pressure value from the FIFO buffer
532-
*
550+
*
533551
* @return float Pressure reading from FIFO in hPa (hectopascals)
534552
* @note Resolution depends on FS_MODE:
535553
* - FS_MODE = 0: 1 LSB = 1/4096 hPa

0 commit comments

Comments
 (0)