diff --git a/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV with Calibration.c b/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV with Calibration.c new file mode 100644 index 00000000..fd5b7e03 --- /dev/null +++ b/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV with Calibration.c @@ -0,0 +1,121 @@ +/* + LIS3DH Test ADC mV with Calibration.c + + Test Harness for the Parallax LIS3DH 3 Axis Accelerometer module with ADC. + + http://learn.parallax.com/propeller-c-simple-devices/lis3dh-three-axis-accelerometer + + + I/O Pins connections: + + P8 -> CLK (SCK) + P7 <-> DATA (SDI) + P6 -> /ENABLE (CS) + + + Instructions: + + Connect LIS3DH module to Propeller using the pins shown above + Also connect 3.3V and GND to the LIS3DH module + Upload this code to the Propeller + Open SimpleIDE Terminal or Parallax Serial Terminal at 115200 baud to view the output + + + Apply voltage to measure to any of the three ADC inputs (measurement ranges +- 400mV): + + AD1 - Sip header, accepts 0-7800mV (+- 200mV) + AD2 - PCB top pad, accepts 900mV - 1700mV (+- 100mV) + AD3 - PCB top pad, accepts 900mV - 1700mV (+- 100mV) + + + Note: Voltages lower or higher than the acceptable range will be rounded to + the minimum or maximum range value. Do NOT exceed 2.5VIN on AD2 or AD3. + + + +*/ + +#include "simpletools.h" // Include simpletools header +#include "lis3dh.h" // Include lis3dh header + +lis3dh *LIS3DH; + +int main() // Main function +{ + + pause(1000); // Start-up pause for debug terminal + term_cmd(CLS); + term_cmd(HOME); + + print("Parallax LIS3DH 3 Axis Accelerometer module with ADC %c \r", CLREOL); + print("Test ADC (milli-Volt values) %c \r\r", CLREOL); + + + int ad1, ad2, ad3; + + LIS3DH = lis3dh_init(8, 7, 6); // Initialize sensor with pins SCK, SDI, CS + + lis3dh_setResolution(LIS3DH, 12); // 8, 10 or 12 bit + + + lis3dh_adcCal_mV(LIS3DH, 0, 0, 0, 0); // Disable ADC calibration + + + /* Example of setting calibration values + Substitute the values with your own readings, obtained with ADC calibration disabled + Parameters : (LIS3DH device reference, calibration mV #1, calibration mV #2, mV reading obtained at calibration voltage #1, mV reading obtained at calibration voltage #2) + + In the following example, -466 was measured at 0 mV, and 3104 was measured at 3300mV (3.3V) */ + + + //lis3dh_adcCal_mV(LIS3DH, 0, 3300, -466, 3104); // Uncomment to enable ADC Calibration + + + while(1) { + // Continuously read from sensor and print results to debug terminal + + lis3dh_adc_mV(LIS3DH, &ad1, &ad2, &ad3); // Read ADC values + + print(" ad1 = %dmV, ad2 = %dmV, ad3 = %dmV %c \r", + ad1, ad2, ad3, CLREOL ); // Display measurements + + + + + pause(500); // 1/2 second pause before repeat + + print("%c", CRSRUP); // Terminal up one line + + + } + +} + + + +/** + * TERMS OF USE: MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + + + + diff --git a/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV with Calibration.side b/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV with Calibration.side new file mode 100644 index 00000000..0b0a5018 --- /dev/null +++ b/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV with Calibration.side @@ -0,0 +1,7 @@ +LIS3DH Test ADC mV with Calibration.c +>compiler=C +>memtype=cmm main ram compact +>optimize=-Os +>-m32bit-doubles +>-fno-exceptions +>BOARD::ACTIVITYBOARD diff --git a/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV.c b/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV.c index e96e550b..04e3e679 100644 --- a/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV.c +++ b/Learn/Examples/Devices/Sensor/Accelerometer 3-Axis LIS3DH/LIS3DH Test ADC mV.c @@ -16,11 +16,11 @@ Upload this code to the Propeller Open SimpleIDE Terminal or Parallax Serial Terminal at 115200 baud to view the output - Apply voltage to measure to any of the three ADC inputs: + Apply voltage to measure to any of the three ADC inputs (measurement ranges +- 400mV): AD1 (Sip header, accepts 0-8 VDC) - AD2 (PCB top pad, accepts 900mV - 1800mV) - AD3 (PCB top pad, accepts 900mV - 1800mV) + AD2 (PCB top pad, accepts 900mV - 1700mV) + AD3 (PCB top pad, accepts 900mV - 1700mV) Note: Voltages lower or higher than the acceptable range will be rounded to @@ -46,7 +46,8 @@ int main() // Main function int ad1, ad2, ad3; LIS3DH = lis3dh_init(8, 7, 6); // Initialize sensor with pins SCK, SDI, CS - + + while(1) { // Continuously read from sensor and print results to debug terminal diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/Documentation lis3dh Library.html b/Learn/Simple Libraries/Sensor/liblis3dh/Documentation lis3dh Library.html index d19d834d..1822c3be 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/Documentation lis3dh Library.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/Documentation lis3dh Library.html @@ -305,6 +305,9 @@ int lis3dh_getADC_mV (lis3dh_t *device, int channel)  Gets mV adc measurement from a single ADC channel. More...
  +void lis3dh_adcCal_mV (lis3dh_t *device, int mV_L, int mV_H, int value_L, int value_H) + Sets the adc calibration values for adc mV reading on AD1. More...
+  void lis3dh_tempCal_C (lis3dh_t *device, int actualTempC)  Sets the actual temperature to provide a reference for the relative temperature sensor. More...
  @@ -348,12 +351,12 @@

Detailed Description

Simplifies reading Parallax LIS3DH 3-Axis Accelerometer Module with ADC.

Author
Michael Mulholland
-
Version
1.0.0
- +
Version
1.0.1
+
diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/accel.c b/Learn/Simple Libraries/Sensor/liblis3dh/accel.c index c0d7d2ce..9279fc45 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/accel.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/accel.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Gets raw axis measurements for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/accel_mg.c b/Learn/Simple Libraries/Sensor/liblis3dh/accel_mg.c index f95ecfe7..2a3adc26 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/accel_mg.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/accel_mg.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Read acceleration (G-Force) for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/adc.c b/Learn/Simple Libraries/Sensor/liblis3dh/adc.c index c138b644..b9cf3546 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/adc.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/adc.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Reads adc measurements from the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/adc_mV.c b/Learn/Simple Libraries/Sensor/liblis3dh/adc_mV.c index ef8df666..ccf4b6dc 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/adc_mV.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/adc_mV.c @@ -3,10 +3,10 @@ * * @author Michael Mulholland * - * @version 1.0.0 + * @version 1.0.1 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Reads mV adc measurements from the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * @@ -19,13 +19,15 @@ // Helper functions for ADC to mV conversion -// ADC Channel 1 accepts 0-8V (+- 400mV); fromLow is offset to ensure readings at low adc voltages accounting for tolerances -// ADC Channels 2 and 3 accept 900mV to 1800mV (+- 400mV) +// ADC Channel 1 accepts 0-7800mV (+- 200mV); fromLow is offset to ensure readings at low adc voltages accounting for tolerances +// ADC Channels 2 and 3 accept 900mV to 1700mV (+- 100mV) // lis3dh_adcMap(valueToMap, fromLow, fromHigh, toLow, toHigh) int lis3dh_adcMap(int valueToMap, int fromLow, int fromHigh, int toLow, int toHigh) { - return (valueToMap - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow; + + return ((valueToMap - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow); + } @@ -38,26 +40,38 @@ void lis3dh_adc_mV(lis3dh_t *device, int *ad1, int *ad2, int *ad3) int res = lis3dh_getResolution(device); - if (res == 8) { // 8-bit samples + + if (res == 8) { // 8-bit samples, -128 to 127 - *ad1 = lis3dh_adcMap(a1, 69, -128, 0, 8000); - *ad2 = lis3dh_adcMap(a2, 127, -128, 900, 1800); - *ad3 = lis3dh_adcMap(a3, 127, -128, 900, 1800); + *ad1 = lis3dh_adcMap(a1, 87, -128, 0, 7800); + *ad2 = lis3dh_adcMap(a2, 127, -128, 900, 1700); + *ad3 = lis3dh_adcMap(a3, 127, -128, 900, 1700); - } else if (res == 10) { // 10-bit samples + } else if (res == 10) { // 10-bit samples, -512 to 511 - *ad1 = lis3dh_adcMap(a1, 400, -508, 0, 8000); - *ad2 = lis3dh_adcMap(a2, 508, -508, 900, 1800); - *ad3 = lis3dh_adcMap(a3, 508, -508, 900, 1800); + *ad1 = lis3dh_adcMap(a1, 350, -508, 0, 7800); + *ad2 = lis3dh_adcMap(a2, 508, -508, 900, 1700); + *ad3 = lis3dh_adcMap(a3, 508, -508, 900, 1700); - } else { // 12-bit samples (Note- 10 bit is maximum ADC resolution, but data presented as 12-bit if XYZ sampling is 12-bit) + } else { // 12-bit samples, -2048 to 2047 + // (Note- 10 bit is maximum ADC resolution, but data presented as 12-bit if XYZ sampling is 12-bit) - *ad1 = lis3dh_adcMap(a1, 1600, -2032, 0, 8000); - *ad2 = lis3dh_adcMap(a2, 2032, -2032, 900, 1800); - *ad3 = lis3dh_adcMap(a3, 2032, -2032, 900, 1800); + *ad1 = lis3dh_adcMap(a1, 1400, -2032, 0, 7800); // Offset the minimum value as lowest AD1 voltage about 0.97V (post divider) + *ad2 = lis3dh_adcMap(a2, 2032, -2032, 900, 1700); + *ad3 = lis3dh_adcMap(a3, 2032, -2032, 900, 1700); - } + } + + // Calibration of AD1 + + if ((device->adccal_m1000 != 0) || (device->adccal_b1000 != 0)) { + + *ad1 = ((*ad1 * device->adccal_m1000) + device->adccal_b1000) / 1000; + + } + + } @@ -80,6 +94,23 @@ int lis3dh_getADC_mV(lis3dh_t *device, int channel) } +void lis3dh_adcCal_mV(lis3dh_t *device, int mV_L, int mV_H, int value_L, int value_H) +{ + + if (mV_L == 0 & mV_H == 0 & value_L == 0 & value_H == 0) { + + device->adccal_m1000 = 0; + device->adccal_b1000 = 0; + + } else { + + device->adccal_m1000 = (1000 * mV_H) / (value_H + (value_L * -1)); + device->adccal_b1000 = (device->adccal_m1000 * value_L) * -1; + + } +} + + diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/cmm/liblis3dh.a b/Learn/Simple Libraries/Sensor/liblis3dh/cmm/liblis3dh.a index 731e5346..0f7ca4aa 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/cmm/liblis3dh.a and b/Learn/Simple Libraries/Sensor/liblis3dh/cmm/liblis3dh.a differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/getRange.c b/Learn/Simple Libraries/Sensor/liblis3dh/getRange.c index 7a7cd3d0..05d78e79 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/getRange.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/getRange.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Gets g acceleration range of the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/getResolution.c b/Learn/Simple Libraries/Sensor/liblis3dh/getResolution.c index 6ee3a88c..e65a944b 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/getResolution.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/getResolution.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Gets resolution mode from the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/getSPImode.c b/Learn/Simple Libraries/Sensor/liblis3dh/getSPImode.c index e5db84e0..a6dbc39e 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/getSPImode.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/getSPImode.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Gets SPI mode for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/getWhoAmI.c b/Learn/Simple Libraries/Sensor/liblis3dh/getWhoAmI.c index 3e2282f0..37b3effd 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/getWhoAmI.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/getWhoAmI.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Gets g acceleration range of the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/annotated.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/annotated.html index 1d2651de..42b11b5f 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/annotated.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/annotated.html @@ -52,7 +52,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/bc_s.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/bc_s.png index 224b29aa..2eba412e 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/bc_s.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/bc_s.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/bdwn.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/bdwn.png index 940a0b95..42638302 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/bdwn.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/bdwn.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/classes.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/classes.html index 91ccbc68..81c020b6 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/classes.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/classes.html @@ -58,7 +58,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/closed.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/closed.png index 98cc2c90..7b3198ff 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/closed.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/closed.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/doc.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/doc.png index 17edabff..3b60d92c 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/doc.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/doc.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/doxygen.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/doxygen.png index 3ff17d80..1a1ed58f 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/doxygen.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/doxygen.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/files.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/files.html index b7bfcd42..5ffc6e0a 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/files.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/files.html @@ -52,7 +52,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/folderclosed.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/folderclosed.png index bb8ab35e..0e8458af 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/folderclosed.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/folderclosed.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/folderopen.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/folderopen.png index d6c7f676..cc10730f 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/folderopen.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/folderopen.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/globals.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/globals.html index cca158f0..beca113b 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/globals.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/globals.html @@ -40,7 +40,9 @@
-
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/globals_func.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/globals_func.html index 79c0b4e5..d0773e1b 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/globals_func.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/globals_func.html @@ -53,6 +53,9 @@
  • lis3dh_adc_mV() : lis3dh.h
  • +
  • lis3dh_adcCal_mV() +: lis3dh.h +
  • lis3dh_getAccel() : lis3dh.h
  • @@ -119,6 +122,12 @@
  • lis3dh_tempRaw() : lis3dh.h
  • +
  • lis3dh_tilt() +: lis3dh.h +
  • +
  • lis3dh_tiltConfig() +: lis3dh.h +
  • lis3dh_writeByte() : lis3dh.h
  • @@ -126,7 +135,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/globals_type.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/globals_type.html index 0a8897d2..c2bd03db 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/globals_type.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/globals_type.html @@ -48,7 +48,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-1.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-1.html index b4f01901..87905d9a 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-1.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-1.html @@ -187,7 +187,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-2.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-2.html index b26dd536..ed93e29d 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-2.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-2.html @@ -112,7 +112,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-3.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-3.html index 8d28952e..9022c7ef 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-3.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-3.html @@ -81,7 +81,7 @@

    diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-4.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-4.html index 942e36f2..77a55e3a 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-4.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/group__group-4.html @@ -97,6 +97,9 @@ int lis3dh_getADC_mV (lis3dh_t *device, int channel)  Gets mV adc measurement from a single ADC channel. More...
      +void lis3dh_adcCal_mV (lis3dh_t *device, int mV_L, int mV_H, int value_L, int value_H) + Sets the adc calibration values for adc mV reading on AD1. More...
    +  void lis3dh_tempCal_C (lis3dh_t *device, int actualTempC)  Sets the actual temperature to provide a reference for the relative temperature sensor. More...
      @@ -124,6 +127,12 @@ int lis3dh_getAccel_mg (lis3dh_t *device, int axis)  Gets mg (milli-g's) accelerometer measurements from a single axis (x, y, or z). More...
      +int lis3dh_tilt (lis3dh_t *device, int *ax, int *ay, int *az, int *motion) + Gets tilt angle measurements for each axis, and magnitude of motion. More...
    +  +int lis3dh_tiltConfig (lis3dh_t *device, int avg_factor) + Optional configuration for tilt sensor. More...
    +  void lis3dh_writeByte (lis3dh_t *device, unsigned char address, unsigned char value)  write a byte value to an LIS3DH register More...
      @@ -279,7 +288,7 @@

    Note
    Channel 1 range is 0-8000mV. Channel 2 and 3 ranges are 900-1800mV.
    +
    Note
    Channel 1 range is 0-7800mV (+- 200mV). Channel 2 and 3 ranges are 900-1700mV (+- 100mV).
    Parameters
    @@ -332,7 +341,7 @@

    Note
    Channel 1 range is 0-8000mV. Channel 2 and 3 ranges are 900-1800mV.
    +
    Note
    Channel 1 range is 0-7800mV (+- 200mV). Channel 2 and 3 ranges are 900-1700mV (+- 100mV).
    Parameters

    devicePointer to the sensor device structure
    @@ -343,6 +352,65 @@

    +

    ◆ lis3dh_adcCal_mV()

    + +
    +
    +
    devicePointer to the sensor device structure
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    void lis3dh_adcCal_mV (lis3dh_tdevice,
    int mV_L,
    int mV_H,
    int value_L,
    int value_H 
    )
    +
    + +

    Sets the adc calibration values for adc mV reading on AD1.

    +

    The internal adc has an initial tolerance of +-400mV, and may require calibration before use.

    +
    Parameters
    + + + + + + +
    devicePointer to the sensor device structure
    mV_LValue for ADC mV calibration - voltage at which lower calibration reading taken, in millivolts
    mV_HValue for ADC mV calibration - voltage at which upper calibration reading taken, in millivolts
    value_LValue for ADC mV calibration - value measured at lower calibration voltage, in millivolts
    value_HValue for ADC mV calibration - value measured at upper calibration voltage, in millivolts
    +
    +
    +
    @@ -451,7 +519,7 @@

    Note
    Channel 1 range is 0-8000mV. Channel 2 and 3 ranges are 900-1800mV.

    +
    Note
    Channel 1 range is 0-7800mV (+- 200mV). Channel 2 and 3 ranges are 900-1700mV (+- 100mV).
    Parameters
    @@ -491,7 +559,7 @@

    Note
    Channel 1 range is 0-8000mV. Channel 2 and 3 ranges are 900-1800mV.
    +
    Note
    Channel 1 range is 0-7800mV (+- 200mV). Channel 2 and 3 ranges are 900-1700mV (+- 100mV).
    Parameters

    devicePointer to the sensor device structure
    @@ -1130,6 +1198,105 @@

    Returns
    Value of the temperature change.
    + + +
    +

    ◆ lis3dh_tilt()

    + +
    +
    +
    devicePointer to the sensor device structure
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    int lis3dh_tilt (lis3dh_tdevice,
    int * ax,
    int * ay,
    int * az,
    int * motion 
    )
    +
    + +

    Gets tilt angle measurements for each axis, and magnitude of motion.

    +

    Angle to each axis in degrees, X relative to ground Y relative to ground Z relative to gravity. Motion is the sum of g-force on all axis relative to gravity at ground level (1G). 0 is motionless, larger positve or negative values represent more intense motion. The motion value could be used on it's own for projects requiring vibration sensing.

    +
    Parameters
    + + + + + + +
    devicePointer to the sensor device structure
    *axVariable to store angle of x axis relative to ground.
    *ayVariable to store angle of y axis relative to ground.
    *azVariable to store angle of z axis relative to gravity.
    *motionVariable to store positive or negative value representing intensity of motion, with 0 being motionless at ground level.
    +
    +
    +
    Returns
    1 if new data is available, 0 if no new data is available, or invalid request.
    + +
    + + +

    ◆ lis3dh_tiltConfig()

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    int lis3dh_tiltConfig (lis3dh_tdevice,
    int avg_factor 
    )
    +
    + +

    Optional configuration for tilt sensor.

    +

    Values stored in RAM. Reasonable defaults are set by the library.

    +
    Parameters
    + + + +
    devicePointer to the sensor device structure
    avg_factorPercentage of new data added to tilt readings low pass filter (moving average). Valid values are 0 to 100. (Setting 0 or 100 will disable the filter. For example, if avg_factor is 75, moving average calculation will include 75% new data and 25% existing data. Default value = 100 (moving average low pass filter disabled).
    +
    +
    +
    Returns
    1 if operation successful, 0 if operation failed (invalid values).
    +
    @@ -1179,7 +1346,7 @@

    diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/index.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/index.html index 843c6b48..b2a0fbb5 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/index.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/index.html @@ -47,7 +47,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/lis3dh_8h.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/lis3dh_8h.html index f1d98f20..5d7d3126 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/lis3dh_8h.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/lis3dh_8h.html @@ -305,6 +305,9 @@ int lis3dh_getADC_mV (lis3dh_t *device, int channel)  Gets mV adc measurement from a single ADC channel. More...
      +void lis3dh_adcCal_mV (lis3dh_t *device, int mV_L, int mV_H, int value_L, int value_H) + Sets the adc calibration values for adc mV reading on AD1. More...
    +  void lis3dh_tempCal_C (lis3dh_t *device, int actualTempC)  Sets the actual temperature to provide a reference for the relative temperature sensor. More...
      @@ -332,6 +335,12 @@ int lis3dh_getAccel_mg (lis3dh_t *device, int axis)  Gets mg (milli-g's) accelerometer measurements from a single axis (x, y, or z). More...
      +int lis3dh_tilt (lis3dh_t *device, int *ax, int *ay, int *az, int *motion) + Gets tilt angle measurements for each axis, and magnitude of motion. More...
    +  +int lis3dh_tiltConfig (lis3dh_t *device, int avg_factor) + Optional configuration for tilt sensor. More...
    +  void lis3dh_writeByte (lis3dh_t *device, unsigned char address, unsigned char value)  write a byte value to an LIS3DH register More...
      @@ -342,12 +351,12 @@

    Detailed Description

    Simplifies reading Parallax LIS3DH 3-Axis Accelerometer Module with ADC.

    Author
    Michael Mulholland
    -
    Version
    1.0.0
    - +
    Version
    1.0.1
    +
    diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/lis3dh_8h_source.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/lis3dh_8h_source.html index 0c6505db..0e1edaee 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/lis3dh_8h_source.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/lis3dh_8h_source.html @@ -123,157 +123,175 @@
    122 typedef struct lis3dh_st
    123 {
    124  volatile int tempcalC; // for degrees Celcius
    -
    125 
    -
    126  int sdi_pin;
    -
    127  int sdo_pin;
    -
    128  int sck_pin;
    -
    129  int cs_pin;
    -
    130 
    -
    131 } lis3dh_t;
    -
    132 
    -
    133 
    -
    134 // Simpler type name for use with SimpleIDE
    -
    135 typedef lis3dh_t lis3dh;
    -
    136 
    -
    137 
    +
    125 
    +
    126  volatile int adccal_m1000; // for mV ADC calibration
    +
    127  volatile int adccal_b1000; // for mV ADC calibration
    +
    128 
    +
    129  volatile int tiltavgX;
    +
    130  volatile int tiltavgY;
    +
    131  volatile int tiltavgZ;
    +
    132  volatile int tiltavg_factor;
    +
    133 
    +
    134  int sdi_pin;
    +
    135  int sdo_pin;
    +
    136  int sck_pin;
    +
    137  int cs_pin;
    138 
    -
    162 lis3dh_t *lis3dh_init(int pinSCK, int pinSDI, int pinCS);
    -
    163 
    -
    164 
    -
    165 
    -
    179 lis3dh_t *lis3dh_init4wire(int pinSCK, int pinSDI, int pinSDO, int pinCS);
    -
    180 
    -
    181 
    -
    182 
    -
    188 void lis3dh_shutdown(lis3dh_t *device);
    -
    189 
    +
    139 } lis3dh_t;
    +
    140 
    +
    141 
    +
    142 // Simpler type name for use with SimpleIDE
    +
    143 typedef lis3dh_t lis3dh;
    +
    144 
    +
    145 
    +
    146 
    +
    172 lis3dh_t *lis3dh_init(int pinSCK, int pinSDI, int pinCS);
    +
    173 
    +
    174 
    +
    175 
    +
    189 lis3dh_t *lis3dh_init4wire(int pinSCK, int pinSDI, int pinSDO, int pinCS);
    190 
    191 
    -
    200 int lis3dh_getWhoAmI(lis3dh_t *device);
    +
    192 
    +
    198 void lis3dh_shutdown(lis3dh_t *device);
    +
    199 
    +
    200 
    201 
    -
    202 
    -
    203 
    -
    214 void lis3dh_setResolution(lis3dh_t *device, int bits);
    -
    215 
    -
    216 
    -
    217 
    -
    226 int lis3dh_getResolution(lis3dh_t *device);
    +
    210 int lis3dh_getWhoAmI(lis3dh_t *device);
    +
    211 
    +
    212 
    +
    213 
    +
    224 void lis3dh_setResolution(lis3dh_t *device, int bits);
    +
    225 
    +
    226 
    227 
    -
    228 
    -
    229 
    -
    240 void lis3dh_setRange(lis3dh_t *device, int range);
    -
    241 
    -
    242 
    -
    243 
    -
    252 int lis3dh_getRange(lis3dh_t *device);
    +
    236 int lis3dh_getResolution(lis3dh_t *device);
    +
    237 
    +
    238 
    +
    239 
    +
    250 void lis3dh_setRange(lis3dh_t *device, int range);
    +
    251 
    +
    252 
    253 
    -
    254 
    -
    255 
    -
    264 void lis3dh_setSPImode(lis3dh_t *device, int mode);
    +
    262 int lis3dh_getRange(lis3dh_t *device);
    +
    263 
    +
    264 
    265 
    -
    266 
    -
    267 
    -
    276 int lis3dh_getSPImode(lis3dh_t *device);
    +
    274 void lis3dh_setSPImode(lis3dh_t *device, int mode);
    +
    275 
    +
    276 
    277 
    -
    278 
    -
    279 
    -
    291 void lis3dh_setBDUmode(lis3dh_t *device, int mode);
    -
    292 
    -
    293 
    -
    294 
    -
    306 void lis3dh_setADCmode(lis3dh_t *device, int adcEnable, int tempEnable);
    -
    307 
    -
    308 
    -
    309 
    -
    326 void lis3dh_adc(lis3dh_t *device, int *ad1, int *ad2, int *ad3);
    -
    327 
    -
    328 
    -
    329 
    -
    344 int lis3dh_getADC(lis3dh_t *device, int channel);
    -
    345 
    -
    346 
    -
    347 
    -
    364 void lis3dh_adc_mV(lis3dh_t *device, int *ad1, int *ad2, int *ad3);
    -
    365 
    -
    366 
    -
    367 
    -
    382 int lis3dh_getADC_mV(lis3dh_t *device, int channel);
    -
    383 
    -
    384 
    -
    385 
    -
    396 void lis3dh_tempCal_C(lis3dh_t *device, int actualTempC);
    -
    397 
    -
    398 
    -
    399 
    -
    412 void lis3dh_tempCal_F(lis3dh_t *device, int actualTempF);
    -
    413 
    -
    414 
    -
    415 
    -
    429 int lis3dh_tempRaw(lis3dh_t *device);
    -
    430 
    -
    431 
    -
    432 
    -
    446 int lis3dh_temp_C(lis3dh_t *device);
    -
    447 
    -
    448 
    -
    449 
    -
    463 int lis3dh_temp_F(lis3dh_t *device);
    -
    464 
    -
    465 
    -
    466 
    -
    467 
    -
    485 //int lis3dh_accel(int *x, int *y, int *z);
    -
    486 int lis3dh_accel(lis3dh_t *device, int *x, int *y, int *z);
    -
    487 
    -
    488 
    -
    502 int lis3dh_getAccel(lis3dh_t *device, int axis);
    -
    503 
    -
    504 
    -
    505 
    -
    523 int lis3dh_accel_mg(lis3dh_t *device, int *xmg, int *ymg, int *zmg);
    -
    524 
    -
    525 
    -
    526 
    -
    540 int lis3dh_getAccel_mg(lis3dh_t *device, int axis);
    -
    541 
    -
    542 
    -
    543 
    -
    553 //void lis3dh_writeByte(unsigned char address, unsigned char value);
    -
    554 void lis3dh_writeByte(lis3dh_t *device, unsigned char address, unsigned char value);
    -
    555 
    -
    556 
    -
    566 //unsigned char lis3dh_readByte(unsigned char address);
    -
    567 unsigned char lis3dh_readByte(lis3dh_t *device, unsigned char address);
    +
    286 int lis3dh_getSPImode(lis3dh_t *device);
    +
    287 
    +
    288 
    +
    289 
    +
    301 void lis3dh_setBDUmode(lis3dh_t *device, int mode);
    +
    302 
    +
    303 
    +
    304 
    +
    316 void lis3dh_setADCmode(lis3dh_t *device, int adcEnable, int tempEnable);
    +
    317 
    +
    318 
    +
    319 
    +
    336 void lis3dh_adc(lis3dh_t *device, int *ad1, int *ad2, int *ad3);
    +
    337 
    +
    338 
    +
    339 
    +
    354 int lis3dh_getADC(lis3dh_t *device, int channel);
    +
    355 
    +
    356 
    +
    357 
    +
    374 void lis3dh_adc_mV(lis3dh_t *device, int *ad1, int *ad2, int *ad3);
    +
    375 
    +
    376 
    +
    377 
    +
    392 int lis3dh_getADC_mV(lis3dh_t *device, int channel);
    +
    393 
    +
    394 
    +
    395 
    +
    409 void lis3dh_adcCal_mV(lis3dh_t *device, int mV_L, int mV_H, int value_L, int value_H);
    +
    410 
    +
    411 
    +
    422 void lis3dh_tempCal_C(lis3dh_t *device, int actualTempC);
    +
    423 
    +
    424 
    +
    425 
    +
    438 void lis3dh_tempCal_F(lis3dh_t *device, int actualTempF);
    +
    439 
    +
    440 
    +
    441 
    +
    455 int lis3dh_tempRaw(lis3dh_t *device);
    +
    456 
    +
    457 
    +
    458 
    +
    472 int lis3dh_temp_C(lis3dh_t *device);
    +
    473 
    +
    474 
    +
    475 
    +
    489 int lis3dh_temp_F(lis3dh_t *device);
    +
    490 
    +
    491 
    +
    492 
    +
    493 
    +
    511 int lis3dh_accel(lis3dh_t *device, int *x, int *y, int *z);
    +
    512 
    +
    513 
    +
    527 int lis3dh_getAccel(lis3dh_t *device, int axis);
    +
    528 
    +
    529 
    +
    530 
    +
    548 int lis3dh_accel_mg(lis3dh_t *device, int *xmg, int *ymg, int *zmg);
    +
    549 
    +
    550 
    +
    551 
    +
    565 int lis3dh_getAccel_mg(lis3dh_t *device, int axis);
    +
    566 
    +
    567 
    568 
    -
    572 #if defined(__cplusplus)
    -
    573 }
    -
    574 #endif
    -
    575 /* __cplusplus */
    -
    576 #endif
    -
    577 /* LIS3DH_H */
    -
    578 
    -
    579 
    -
    580 
    -
    581 
    +
    594 int lis3dh_tilt(lis3dh_t *device, int *ax, int *ay, int *az, int *motion);
    +
    595 
    +
    596 
    +
    612 int lis3dh_tiltConfig(lis3dh_t *device, int avg_factor);
    +
    613 
    +
    614 
    +
    615 
    +
    625 void lis3dh_writeByte(lis3dh_t *device, unsigned char address, unsigned char value);
    +
    626 
    +
    627 
    +
    637 unsigned char lis3dh_readByte(lis3dh_t *device, unsigned char address);
    +
    638 
    +
    642 #if defined(__cplusplus)
    +
    643 }
    +
    644 #endif
    +
    645 /* __cplusplus */
    +
    646 #endif
    +
    647 /* LIS3DH_H */
    +
    648 
    +
    649 
    +
    650 
    +
    651 
    void lis3dh_tempCal_C(lis3dh_t *device, int actualTempC)
    Sets the actual temperature to provide a reference for the relative temperature sensor.
    Definition: temp.c:66
    lis3dh_t * lis3dh_init(int pinSCK, int pinSDI, int pinCS)
    Initialize the sensor with typical configuration for reading axis and adc. Uses 3-Wire SPI mode.
    Definition: init.c:21
    void lis3dh_shutdown(lis3dh_t *device)
    Shutdown the sensor, set configuration defaults with sensor disabled and clear buffers.
    Definition: shutdown.c:21
    +
    int lis3dh_tiltConfig(lis3dh_t *device, int avg_factor)
    Optional configuration for tilt sensor.
    Definition: tilt.c:106
    int lis3dh_getRange(lis3dh_t *device)
    Reads the g measurement range; one of +/- 2, +/-4, +/- 8, +- 16 g.
    Definition: getRange.c:21
    void lis3dh_setRange(lis3dh_t *device, int range)
    Sets the g measurement range to +/- 2, +/-4, +/- 8, +- 16 g.
    Definition: setRange.c:21
    void lis3dh_writeByte(lis3dh_t *device, unsigned char address, unsigned char value)
    write a byte value to an LIS3DH register
    Definition: writeByte.c:21
    int lis3dh_getWhoAmI(lis3dh_t *device)
    Reads the sensor identification register (WhoAmI).
    Definition: getWhoAmI.c:21
    +
    void lis3dh_adcCal_mV(lis3dh_t *device, int mV_L, int mV_H, int value_L, int value_H)
    Sets the adc calibration values for adc mV reading on AD1.
    Definition: adc_mV.c:97
    void lis3dh_setSPImode(lis3dh_t *device, int mode)
    Sets the SPI mode to either 3-wire or 4-wire.
    Definition: setSPImode.c:21
    struct lis3dh_st lis3dh_t
    void lis3dh_setADCmode(lis3dh_t *device, int adcEnable, int tempEnable)
    Sets ADC mode for the Parallax LIS3DH 3-Axis Accelerometer Module.
    Definition: setADCmode.c:21
    int lis3dh_temp_F(lis3dh_t *device)
    Reads the calibrated (referenced) temperature value from the sensor.
    Definition: temp.c:57
    int lis3dh_getAccel(lis3dh_t *device, int axis)
    Gets raw accelerometer measurements for a single axis (x, y, or z).
    Definition: accel.c:62
    lis3dh_t * lis3dh_init4wire(int pinSCK, int pinSDI, int pinSDO, int pinCS)
    Initialize the sensor with typical configuration for reading axis and adc. Uses 4-Wire SPI mode.
    Definition: init.c:29
    -
    void lis3dh_adc_mV(lis3dh_t *device, int *ad1, int *ad2, int *ad3)
    Gets mV adc measurements from all three ADC channels.
    Definition: adc_mV.c:33
    +
    void lis3dh_adc_mV(lis3dh_t *device, int *ad1, int *ad2, int *ad3)
    Gets mV adc measurements from all three ADC channels.
    Definition: adc_mV.c:35
    void lis3dh_setBDUmode(lis3dh_t *device, int mode)
    Sets the sensor BDU (Block Data Update) mode.
    Definition: setBDUmode.c:21
    -
    int lis3dh_getADC_mV(lis3dh_t *device, int channel)
    Gets mV adc measurement from a single ADC channel.
    Definition: adc_mV.c:64
    +
    int lis3dh_getADC_mV(lis3dh_t *device, int channel)
    Gets mV adc measurement from a single ADC channel.
    Definition: adc_mV.c:78
    int lis3dh_tempRaw(lis3dh_t *device)
    Reads the raw relative temperature value from the sensor.
    Definition: temp.c:23
    int lis3dh_getAccel_mg(lis3dh_t *device, int axis)
    Gets mg (milli-g's) accelerometer measurements from a single axis (x, y, or z).
    Definition: accel_mg.c:64
    +
    int lis3dh_tilt(lis3dh_t *device, int *ax, int *ay, int *az, int *motion)
    Gets tilt angle measurements for each axis, and magnitude of motion.
    Definition: tilt.c:51
    void lis3dh_setResolution(lis3dh_t *device, int bits)
    Sets the bit resolution for the sensor readings. 8-bit, 10-bit or 12-bit.
    Definition: setResolution.c:21
    int lis3dh_accel_mg(lis3dh_t *device, int *xmg, int *ymg, int *zmg)
    Gets mg (milli-g's) accelerometer measurements from all three axis (x, y, z).
    Definition: accel_mg.c:33
    void lis3dh_adc(lis3dh_t *device, int *ad1, int *ad2, int *ad3)
    Gets raw adc measurements from all three ADC channels.
    Definition: adc.c:21
    @@ -287,7 +305,7 @@
    int lis3dh_temp_C(lis3dh_t *device)
    Reads the calibrated (referenced) temperature value from the sensor.
    Definition: temp.c:48
    diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/menudata.js b/Learn/Simple Libraries/Sensor/liblis3dh/html/menudata.js index 8a8e07f9..8ebd2ae1 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/menudata.js +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/menudata.js @@ -29,6 +29,7 @@ var menudata={children:[ {text:"Files",url:"files.html",children:[ {text:"File List",url:"files.html"}, {text:"Globals",url:"globals.html",children:[ -{text:"All",url:"globals.html"}, +{text:"All",url:"globals.html",children:[ +{text:"l",url:"globals.html#index_l"}]}, {text:"Functions",url:"globals_func.html"}, {text:"Typedefs",url:"globals_type.html"}]}]}]} diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/modules.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/modules.html index 234174f6..3a0710bb 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/modules.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/modules.html @@ -55,7 +55,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_f.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_f.png index 72a58a52..4b24ffcb 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_f.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_f.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_g.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_g.png index 2093a237..34942a13 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_g.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_g.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_h.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_h.png index 33389b10..5e2fe5d1 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_h.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/nav_h.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/open.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/open.png index 30f75c7e..fae6d8ff 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/open.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/open.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/splitbar.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/splitbar.png index fe895f2c..3148d9c2 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/splitbar.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/splitbar.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/structlis3dh__st.html b/Learn/Simple Libraries/Sensor/liblis3dh/html/structlis3dh__st.html index 551015cd..c169679d 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/html/structlis3dh__st.html +++ b/Learn/Simple Libraries/Sensor/liblis3dh/html/structlis3dh__st.html @@ -54,6 +54,24 @@ volatile int tempcalC   + +volatile int adccal_m1000 +  + +volatile int adccal_b1000 +  + +volatile int tiltavgX +  + +volatile int tiltavgY +  + +volatile int tiltavgZ +  + +volatile int tiltavg_factor int sdi_pin   @@ -75,7 +93,7 @@ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/sync_off.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/sync_off.png index 3b443fc6..9fc7d81b 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/sync_off.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/sync_off.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/sync_on.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/sync_on.png index e08320fb..c93c8e2d 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/sync_on.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/sync_on.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_a.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_a.png index 3b725c41..2997353b 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_a.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_a.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_b.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_b.png index e2b4a863..97ef1fbe 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_b.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_b.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_h.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_h.png index fd5cb705..62f82716 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_h.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_h.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_s.png b/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_s.png index ab478c95..e7f57661 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_s.png and b/Learn/Simple Libraries/Sensor/liblis3dh/html/tab_s.png differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/init.c b/Learn/Simple Libraries/Sensor/liblis3dh/init.c index c34a837e..3a36b4df 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/init.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/init.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Initializes the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * @@ -36,6 +36,12 @@ lis3dh_t *lis3dh_init4wire(int pinSCK, int pinSDI, int pinSDO, int pinCS) if (!(device = (lis3dh_t *)malloc(sizeof(lis3dh_t)))) return NULL; + + // default - disable ADC calibration + device->adccal_m1000 = 0; + device->adccal_b1000 = 0; + + // Store IO pins device->sdi_pin = pinSDI; device->sdo_pin = pinSDO; // Set the same for 3-wire SPI mode diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/liblis3dh.c b/Learn/Simple Libraries/Sensor/liblis3dh/liblis3dh.c index 2e8dd2fa..8aa688c9 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/liblis3dh.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/liblis3dh.c @@ -36,7 +36,7 @@ int main() // Main function int x, y, z, ax, ay, az, motion; - pause(1000); // Start-up pause for debug terminal + pause(1500); // Start-up pause for debug terminal term_cmd(CLS); term_cmd(HOME); @@ -69,11 +69,10 @@ int main() // Main function print("Acceleration range is +-%dg, Resolution is %d bit %c \r\r", lis3dh_getRange(LIS3DH), lis3dh_getResolution(LIS3DH), CLREOL); - //lis3dh_tiltConfig(LIS3DH, 75); // Set tilt sensor moving average factor (low-pass filter) - + while(1) { @@ -94,7 +93,7 @@ int main() // Main function // ADC - + lis3dh_adc(LIS3DH, &x, &y, &z); // Get adc values print(" adc : 1 = %d, 2 = %d, 3 = %d %c \r", x, y, z, CLREOL ); // Display measurements diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/liblis3dh.side b/Learn/Simple Libraries/Sensor/liblis3dh/liblis3dh.side index b81b2ec3..8555b93e 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/liblis3dh.side +++ b/Learn/Simple Libraries/Sensor/liblis3dh/liblis3dh.side @@ -21,7 +21,7 @@ adc.c adc_mV.c tilt.c >compiler=C ->memtype=lmm main ram +>memtype=cmm main ram compact >optimize=-Os >-m32bit-doubles >-Wall diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/lis3dh.h b/Learn/Simple Libraries/Sensor/liblis3dh/lis3dh.h index 54cdfcc6..b317c693 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/lis3dh.h +++ b/Learn/Simple Libraries/Sensor/liblis3dh/lis3dh.h @@ -3,10 +3,10 @@ * * @author Michael Mulholland * - * @version 1.0.0 + * @version 1.0.1 * * @copyright - * Copyright (C) Parallax, Inc. 2014. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Simplifies reading Parallax LIS3DH 3-Axis Accelerometer Module with ADC. */ @@ -123,6 +123,9 @@ typedef struct lis3dh_st { volatile int tempcalC; // for degrees Celcius + volatile int adccal_m1000; // for mV ADC calibration + volatile int adccal_b1000; // for mV ADC calibration + volatile int tiltavgX; volatile int tiltavgY; volatile int tiltavgZ; @@ -319,7 +322,7 @@ void lis3dh_setADCmode(lis3dh_t *device, int adcEnable, int tempEnable); * * @details ADC resolution is user-configured in the sensor to 8 or 10 bit. (Refer to setResolution and getResolution functions). * - * @note Channel 1 range is 0-8000mV. Channel 2 and 3 ranges are 900-1800mV. + * @note Channel 1 range is 0-7800mV (+- 200mV). Channel 2 and 3 ranges are 900-1700mV (+- 100mV). * * @param device Pointer to the sensor device structure * @@ -339,7 +342,7 @@ void lis3dh_adc(lis3dh_t *device, int *ad1, int *ad2, int *ad3); * * @details ADC resolution is user-configured in the sensor to 8 or 10 bit. (Refer to setResolution and getResolution functions). * - * @note Channel 1 range is 0-8000mV. Channel 2 and 3 ranges are 900-1800mV. + * @note Channel 1 range is 0-7800mV (+- 200mV). Channel 2 and 3 ranges are 900-1700mV (+- 100mV). * * @param device Pointer to the sensor device structure * @@ -357,7 +360,7 @@ int lis3dh_getADC(lis3dh_t *device, int channel); * * @details ADC resolution is user-configured in the sensor to 8 or 10 bit. (Refer to setResolution and getResolution functions). * - * @note Channel 1 range is 0-8000mV. Channel 2 and 3 ranges are 900-1800mV. + * @note Channel 1 range is 0-7800mV (+- 200mV). Channel 2 and 3 ranges are 900-1700mV (+- 100mV). * * @param device Pointer to the sensor device structure * @@ -377,7 +380,7 @@ void lis3dh_adc_mV(lis3dh_t *device, int *ad1, int *ad2, int *ad3); * * @details ADC resolution is user-configured in the sensor to 8 or 10 bit. (Refer to setResolution and getResolution functions). * - * @note Channel 1 range is 0-8000mV. Channel 2 and 3 ranges are 900-1800mV. + * @note Channel 1 range is 0-7800mV (+- 200mV). Channel 2 and 3 ranges are 900-1700mV (+- 100mV). * * @param device Pointer to the sensor device structure * @@ -390,6 +393,22 @@ int lis3dh_getADC_mV(lis3dh_t *device, int channel); +/** + * @brief Sets the adc calibration values for adc mV reading on AD1. + * + * @details The internal adc has an initial tolerance of +-400mV, and may require calibration before use. + * + * @param device Pointer to the sensor device structure + * + * @param mV_L Value for ADC mV calibration - voltage at which lower calibration reading taken, in millivolts + * @param mV_H Value for ADC mV calibration - voltage at which upper calibration reading taken, in millivolts + * @param value_L Value for ADC mV calibration - value measured at lower calibration voltage, in millivolts + * @param value_H Value for ADC mV calibration - value measured at upper calibration voltage, in millivolts + * + */ +void lis3dh_adcCal_mV(lis3dh_t *device, int mV_L, int mV_H, int value_L, int value_H); + + /** * @brief Sets the actual temperature to provide a reference for the relative temperature sensor. * @@ -489,7 +508,6 @@ int lis3dh_temp_F(lis3dh_t *device); * @returns 1 if new data is available, 0 if no new data is available. * */ -//int lis3dh_accel(int *x, int *y, int *z); int lis3dh_accel(lis3dh_t *device, int *x, int *y, int *z); @@ -604,7 +622,6 @@ int lis3dh_tiltConfig(lis3dh_t *device, int avg_factor); * * @param value Configuration value for the register. */ -//void lis3dh_writeByte(unsigned char address, unsigned char value); void lis3dh_writeByte(lis3dh_t *device, unsigned char address, unsigned char value); @@ -617,7 +634,6 @@ void lis3dh_writeByte(lis3dh_t *device, unsigned char address, unsigned char val * * @returns Value stored by the LIS3DH register. */ -//unsigned char lis3dh_readByte(unsigned char address); unsigned char lis3dh_readByte(lis3dh_t *device, unsigned char address); /** @} */ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/lmm/liblis3dh.a b/Learn/Simple Libraries/Sensor/liblis3dh/lmm/liblis3dh.a index f9191b8c..d1a2e8f9 100644 Binary files a/Learn/Simple Libraries/Sensor/liblis3dh/lmm/liblis3dh.a and b/Learn/Simple Libraries/Sensor/liblis3dh/lmm/liblis3dh.a differ diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/readByte.c b/Learn/Simple Libraries/Sensor/liblis3dh/readByte.c index da013ed7..9a20a662 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/readByte.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/readByte.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Reads a byte from a register in the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/setADCmode.c b/Learn/Simple Libraries/Sensor/liblis3dh/setADCmode.c index 0a56e1cb..040fe798 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/setADCmode.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/setADCmode.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Sets ADC mode for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/setBDUmode.c b/Learn/Simple Libraries/Sensor/liblis3dh/setBDUmode.c index 1485710f..1f4903cc 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/setBDUmode.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/setBDUmode.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Sets BDU (Block Data Update) mode for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/setRange.c b/Learn/Simple Libraries/Sensor/liblis3dh/setRange.c index 695f0726..cdee444d 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/setRange.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/setRange.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Sets g acceleration range for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/setResolution.c b/Learn/Simple Libraries/Sensor/liblis3dh/setResolution.c index b4d80459..db5c8e03 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/setResolution.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/setResolution.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Sets 8, 10 or 12 bit resolution mode for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/setSPImode.c b/Learn/Simple Libraries/Sensor/liblis3dh/setSPImode.c index 77050ef8..d6d9addd 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/setSPImode.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/setSPImode.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Sets 3 or 4 wire SPI mode for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/shutdown.c b/Learn/Simple Libraries/Sensor/liblis3dh/shutdown.c index a6be4000..47afad9b 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/shutdown.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/shutdown.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Clears registers, buffers and disables the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/temp.c b/Learn/Simple Libraries/Sensor/liblis3dh/temp.c index 5218efac..3d82bd4b 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/temp.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/temp.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Read and calibrate temperature for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/tilt.c b/Learn/Simple Libraries/Sensor/liblis3dh/tilt.c index 43206052..5680f636 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/tilt.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/tilt.c @@ -7,7 +7,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Gets tilt angle measurements for all axis for the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Simple Libraries/Sensor/liblis3dh/writeByte.c b/Learn/Simple Libraries/Sensor/liblis3dh/writeByte.c index f60de768..e8c796d6 100644 --- a/Learn/Simple Libraries/Sensor/liblis3dh/writeByte.c +++ b/Learn/Simple Libraries/Sensor/liblis3dh/writeByte.c @@ -6,7 +6,7 @@ * @version 1.0.0 * * @copyright - * Copyright (C) Parallax, Inc. 2019. All Rights MIT Licensed. + * Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed. * * @brief Writes a byte to a register in the Parallax LIS3DH 3-Axis Accelerometer Module with ADC. * diff --git a/Learn/Update Your Learn Folder.html b/Learn/Update Your Learn Folder.html index 8ec56e1b..bc41480d 100644 --- a/Learn/Update Your Learn Folder.html +++ b/Learn/Update Your Learn Folder.html @@ -55,6 +55,15 @@

    Get the Latest Learn Folder

    Update History

    +

    +Update 3/2/2020 Simple Libraries v1.4.153 +
    +

      +
    • Tagged release version.
    • +
    • Update lis3dh library with ADC calibration and tilt functions.
    • +
    +

    +

    Update 2/3/2020 Simple Libraries v1.4.145
    diff --git a/version.txt b/version.txt index a679f3bf..311f4f09 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v1.4.145 +v1.4.152