From 9fe9d4aec2e78e2d568dc0fe4e02e949d373f31c Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Tue, 15 Sep 2015 16:52:37 -0600 Subject: [PATCH] loudness: merge groveloudness and hyld9767 into a single driver Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- examples/c++/CMakeLists.txt | 9 +-- examples/c++/groveloudness.cxx | 63 --------------- examples/c++/{hyld9767.cxx => loudness.cxx} | 10 +-- examples/javascript/groveloudness.js | 43 ----------- .../javascript/{hyld9767.js => loudness.js} | 6 +- examples/python/groveloudness.py | 48 ------------ examples/python/{hyld9767.py => loudness.py} | 6 +- src/groveloudness/CMakeLists.txt | 5 -- src/groveloudness/groveloudness.h | 77 ------------------- src/groveloudness/javaupm_groveloudness.i | 8 -- src/groveloudness/jsupm_groveloudness.i | 8 -- src/groveloudness/pyupm_groveloudness.i | 9 --- src/hyld9767/javaupm_hyld9767.i | 8 -- src/hyld9767/jsupm_hyld9767.i | 8 -- src/hyld9767/pyupm_hyld9767.i | 9 --- src/{hyld9767 => loudness}/CMakeLists.txt | 4 +- src/loudness/javaupm_loudness.i | 8 ++ src/loudness/jsupm_loudness.i | 8 ++ .../hyld9767.cxx => loudness/loudness.cxx} | 8 +- .../hyld9767.h => loudness/loudness.h} | 42 +++++----- src/loudness/pyupm_loudness.i | 9 +++ 21 files changed, 66 insertions(+), 330 deletions(-) delete mode 100644 examples/c++/groveloudness.cxx rename examples/c++/{hyld9767.cxx => loudness.cxx} (88%) delete mode 100644 examples/javascript/groveloudness.js rename examples/javascript/{hyld9767.js => loudness.js} (91%) delete mode 100644 examples/python/groveloudness.py rename examples/python/{hyld9767.py => loudness.py} (92%) delete mode 100644 src/groveloudness/CMakeLists.txt delete mode 100644 src/groveloudness/groveloudness.h delete mode 100644 src/groveloudness/javaupm_groveloudness.i delete mode 100644 src/groveloudness/jsupm_groveloudness.i delete mode 100644 src/groveloudness/pyupm_groveloudness.i delete mode 100644 src/hyld9767/javaupm_hyld9767.i delete mode 100644 src/hyld9767/jsupm_hyld9767.i delete mode 100644 src/hyld9767/pyupm_hyld9767.i rename src/{hyld9767 => loudness}/CMakeLists.txt (50%) create mode 100644 src/loudness/javaupm_loudness.i create mode 100644 src/loudness/jsupm_loudness.i rename src/{hyld9767/hyld9767.cxx => loudness/loudness.cxx} (92%) rename src/{hyld9767/hyld9767.h => loudness/loudness.h} (71%) create mode 100644 src/loudness/pyupm_loudness.i diff --git a/examples/c++/CMakeLists.txt b/examples/c++/CMakeLists.txt index 1aea7528..52efe317 100644 --- a/examples/c++/CMakeLists.txt +++ b/examples/c++/CMakeLists.txt @@ -72,7 +72,6 @@ add_executable (grovelinefinder-example grovelinefinder.cxx) add_executable (grovevdiv-example grovevdiv.cxx) add_executable (grovewater-example grovewater.cxx) add_executable (guvas12d-example guvas12d.cxx) -add_executable (groveloudness-example groveloudness.cxx) add_executable (mpr121-example mpr121.cxx) add_executable (ublox6-example ublox6.cxx) add_executable (yg1006-example yg1006.cxx) @@ -140,7 +139,7 @@ add_executable (ak8975-example ak8975.cxx) add_executable (lsm9ds0-example lsm9ds0.cxx) add_executable (eboled-example eboled.cxx) add_executable (mpu9250-example mpu9250.cxx) -add_executable (hyld9767-example hyld9767.cxx) +add_executable (loudness-example loudness.cxx) add_executable (mg811-example mg811.cxx) add_executable (wheelencoder-example wheelencoder.cxx) add_executable (sm130-example sm130.cxx) @@ -196,7 +195,6 @@ include_directories (${PROJECT_SOURCE_DIR}/src/grovelinefinder) include_directories (${PROJECT_SOURCE_DIR}/src/grovevdiv) include_directories (${PROJECT_SOURCE_DIR}/src/grovewater) include_directories (${PROJECT_SOURCE_DIR}/src/guvas12d) -include_directories (${PROJECT_SOURCE_DIR}/src/groveloudness) include_directories (${PROJECT_SOURCE_DIR}/src/mpr121) include_directories (${PROJECT_SOURCE_DIR}/src/ublox6) include_directories (${PROJECT_SOURCE_DIR}/src/yg1006) @@ -252,7 +250,7 @@ include_directories (${PROJECT_SOURCE_DIR}/src/rgbringcoder) include_directories (${PROJECT_SOURCE_DIR}/src/hp20x) include_directories (${PROJECT_SOURCE_DIR}/src/pn532) include_directories (${PROJECT_SOURCE_DIR}/src/lsm9ds0) -include_directories (${PROJECT_SOURCE_DIR}/src/hyld9767) +include_directories (${PROJECT_SOURCE_DIR}/src/loudness) include_directories (${PROJECT_SOURCE_DIR}/src/mg811) include_directories (${PROJECT_SOURCE_DIR}/src/wheelencoder) include_directories (${PROJECT_SOURCE_DIR}/src/sm130) @@ -331,7 +329,6 @@ target_link_libraries (grovelinefinder-example grovelinefinder ${CMAKE_THREAD_LI target_link_libraries (grovevdiv-example grovevdiv ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (grovewater-example grovewater ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (guvas12d-example guvas12d ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveloudness-example groveloudness ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (mpr121-example mpr121 ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (ublox6-example ublox6 ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (yg1006-example yg1006 ${CMAKE_THREAD_LIBS_INIT}) @@ -399,7 +396,7 @@ target_link_libraries (ak8975-example mpu9150 ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (lsm9ds0-example lsm9ds0 ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (eboled-example i2clcd ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (mpu9250-example mpu9150 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (hyld9767-example hyld9767 ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries (loudness-example loudness ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (mg811-example mg811 ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (wheelencoder-example wheelencoder ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (sm130-example sm130 ${CMAKE_THREAD_LIBS_INIT}) diff --git a/examples/c++/groveloudness.cxx b/examples/c++/groveloudness.cxx deleted file mode 100644 index dbfceb68..00000000 --- a/examples/c++/groveloudness.cxx +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Author: Jon Trulson - * Copyright (c) 2014 Intel Corporation. - * - * 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. - */ - -#include -#include -#include -#include "groveloudness.h" - -using namespace std; - -int shouldRun = true; - -void sig_handler(int signo) -{ - if (signo == SIGINT) - shouldRun = false; -} - - -int main () -{ - signal(SIGINT, sig_handler); - -//! [Interesting] - // Instantiate a Grove Loudness sensor on analog pin A0 - upm::GroveLoudness* loudness = new upm::GroveLoudness(0); - - // Print the loudness value every 0.1 seconds - while (shouldRun) - { - int val = loudness->value(); - cout << "Loudness value (higher is louder): " << val << endl; - - usleep(100000); - } -//! [Interesting] - - cout << "Exiting" << endl; - - delete loudness; - return 0; -} diff --git a/examples/c++/hyld9767.cxx b/examples/c++/loudness.cxx similarity index 88% rename from examples/c++/hyld9767.cxx rename to examples/c++/loudness.cxx index bd3122e8..44e62b06 100644 --- a/examples/c++/hyld9767.cxx +++ b/examples/c++/loudness.cxx @@ -25,13 +25,13 @@ #include #include #include -#include "hyld9767.h" +#include "loudness.h" using namespace std; bool shouldRun = true; -#define HYLD9767_AREF 5.0 +#define LOUDNESS_AREF 5.0 void sig_handler(int signo) { @@ -45,9 +45,9 @@ int main() //! [Interesting] - // Instantiate a HYLD9767 on analog pin A0, with an analog - // reference voltage of HYLD9767_AREF - upm::HYLD9767 *loud = new upm::HYLD9767(0, HYLD9767_AREF); + // Instantiate a Loudness sensor on analog pin A0, with an analog + // reference voltage of LOUDNESS_AREF + upm::Loudness *loud = new upm::Loudness(0, LOUDNESS_AREF); // Every tenth of a second, sample the loudness and output it's // corresponding analog voltage. diff --git a/examples/javascript/groveloudness.js b/examples/javascript/groveloudness.js deleted file mode 100644 index a12f8e6d..00000000 --- a/examples/javascript/groveloudness.js +++ /dev/null @@ -1,43 +0,0 @@ -/*jslint node:true, vars:true, bitwise:true, unparam:true */ -/*jshint unused:true */ -/*global */ -/* -* Author: Zion Orent -* Copyright (c) 2014 Intel Corporation. -* -* 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. -*/ - -var loudnessSensor = require('jsupm_groveloudness'); -// Instantiate a Grove Loudness sensor on analog pin A0 -var myLoudnessSensor = new loudnessSensor.GroveLoudness(0); - -// Print the loudness value every 0.1 seconds -setInterval(function() -{ - console.log("Loudness value (higher is louder): " + myLoudnessSensor.value()); -}, 100); - -// Print message when exiting -process.on('SIGINT', function() -{ - console.log("Exiting..."); - process.exit(0); -}); diff --git a/examples/javascript/hyld9767.js b/examples/javascript/loudness.js similarity index 91% rename from examples/javascript/hyld9767.js rename to examples/javascript/loudness.js index a79043c5..94485a39 100644 --- a/examples/javascript/hyld9767.js +++ b/examples/javascript/loudness.js @@ -26,11 +26,11 @@ */ -var sensorObj = require('jsupm_hyld9767'); +var sensorObj = require('jsupm_loudness'); -// Instantiate a HYLD9767 on analog pin A0, with an analog +// Instantiate a Loudness sensor on analog pin A0, with an analog // reference voltage of 5.0 -var sensor = new sensorObj.HYLD9767(0, 5.0); +var sensor = new sensorObj.Loudness(0, 5.0); // Every tenth of a second, sample the loudness and output it's // corresponding analog voltage. diff --git a/examples/python/groveloudness.py b/examples/python/groveloudness.py deleted file mode 100644 index 45ba6edc..00000000 --- a/examples/python/groveloudness.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/python -# Author: Zion Orent -# Copyright (c) 2015 Intel Corporation. -# -# 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. - -import time, sys, signal, atexit -import pyupm_groveloudness as upmGroveloudness - -# Instantiate a Grove Loudness sensor on analog pin A0 -myLoudness = upmGroveloudness.GroveLoudness(0) - - -## Exit handlers ## -# This stops python from printing a stacktrace when you hit control-C -def SIGINTHandler(signum, frame): - raise SystemExit - -# This lets you run code on exit, including functions from myLoudness -def exitHandler(): - print "Exiting" - sys.exit(0) - -# Register exit handlers -atexit.register(exitHandler) -signal.signal(signal.SIGINT, SIGINTHandler) - - -while (1): - print "Loudness value (higher is louder):", myLoudness.value() - time.sleep(.1) diff --git a/examples/python/hyld9767.py b/examples/python/loudness.py similarity index 92% rename from examples/python/hyld9767.py rename to examples/python/loudness.py index bf21856f..1b4101b1 100644 --- a/examples/python/hyld9767.py +++ b/examples/python/loudness.py @@ -22,11 +22,11 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import time, sys, signal, atexit -import pyupm_hyld9767 as sensorObj +import pyupm_loudness as sensorObj -# Instantiate a HYLD9767 on analog pin A0, with an analog +# Instantiate a Loudness sensor on analog pin A0, with an analog # reference voltage of 5.0 -sensor = sensorObj.HYLD9767(0, 5.0) +sensor = sensorObj.Loudness(0, 5.0) ## Exit handlers ## # This function stops python from printing a stacktrace when you hit control-C diff --git a/src/groveloudness/CMakeLists.txt b/src/groveloudness/CMakeLists.txt deleted file mode 100644 index 890000c4..00000000 --- a/src/groveloudness/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set (libname "groveloudness") -set (libdescription "upm grove loudness module") -set (module_src ${libname}.cxx) -set (module_h ${libname}.h) -upm_module_init() diff --git a/src/groveloudness/groveloudness.h b/src/groveloudness/groveloudness.h deleted file mode 100644 index 835d8df5..00000000 --- a/src/groveloudness/groveloudness.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Author: Jon Trulson - * Copyright (c) 2014 Intel Corporation. - * - * 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. - */ -#pragma once - -#include -#include - -namespace upm { - /** - * @brief Grove Loudness sensor library - * @defgroup groveloudness libupm-groveloudness - * @ingroup seeed analog sound - */ - - /** - * @library groveloudness - * @sensor groveloudness - * @comname Grove Loudness Sensor - * @type sound - * @man seeed - * @con analog - * - * @brief API for the Grove Loudness Sensor - * - * UPM module for the Grove Loudness Sensor. This sensor - * detects how loud the surrounding environment is. - * The higher the output analog value, the louder the sound. - * - * @image html groveloudness.jpg - * @snippet groveloudness.cxx Interesting - */ - class GroveLoudness { - public: - /** - * Grove analog loudness sensor constructor - * - * @param pin Analog pin to use - */ - GroveLoudness(int pin); - /** - * GroveLoudness destructor - */ - ~GroveLoudness(); - /** - * Gets the loudness value from the sensor - * - * @return Loudness reading - */ - int value(); - - private: - mraa_aio_context m_aio; - }; -} - - diff --git a/src/groveloudness/javaupm_groveloudness.i b/src/groveloudness/javaupm_groveloudness.i deleted file mode 100644 index 7ccb67ea..00000000 --- a/src/groveloudness/javaupm_groveloudness.i +++ /dev/null @@ -1,8 +0,0 @@ -%module javaupm_groveloudness -%include "../upm.i" - -%{ - #include "groveloudness.h" -%} - -%include "groveloudness.h" diff --git a/src/groveloudness/jsupm_groveloudness.i b/src/groveloudness/jsupm_groveloudness.i deleted file mode 100644 index 8f18ea08..00000000 --- a/src/groveloudness/jsupm_groveloudness.i +++ /dev/null @@ -1,8 +0,0 @@ -%module jsupm_groveloudness -%include "../upm.i" - -%{ - #include "groveloudness.h" -%} - -%include "groveloudness.h" diff --git a/src/groveloudness/pyupm_groveloudness.i b/src/groveloudness/pyupm_groveloudness.i deleted file mode 100644 index 8630e958..00000000 --- a/src/groveloudness/pyupm_groveloudness.i +++ /dev/null @@ -1,9 +0,0 @@ -%module pyupm_groveloudness -%include "../upm.i" - -%feature("autodoc", "3"); - -%include "groveloudness.h" -%{ - #include "groveloudness.h" -%} diff --git a/src/hyld9767/javaupm_hyld9767.i b/src/hyld9767/javaupm_hyld9767.i deleted file mode 100644 index b06bec0a..00000000 --- a/src/hyld9767/javaupm_hyld9767.i +++ /dev/null @@ -1,8 +0,0 @@ -%module javaupm_hyld9767 -%include "../upm.i" - -%{ - #include "hyld9767.h" -%} - -%include "hyld9767.h" diff --git a/src/hyld9767/jsupm_hyld9767.i b/src/hyld9767/jsupm_hyld9767.i deleted file mode 100644 index c9817309..00000000 --- a/src/hyld9767/jsupm_hyld9767.i +++ /dev/null @@ -1,8 +0,0 @@ -%module jsupm_hyld9767 -%include "../upm.i" - -%{ - #include "hyld9767.h" -%} - -%include "hyld9767.h" diff --git a/src/hyld9767/pyupm_hyld9767.i b/src/hyld9767/pyupm_hyld9767.i deleted file mode 100644 index 56f3e7c1..00000000 --- a/src/hyld9767/pyupm_hyld9767.i +++ /dev/null @@ -1,9 +0,0 @@ -%module pyupm_hyld9767 -%include "../upm.i" - -%feature("autodoc", "3"); - -%include "hyld9767.h" -%{ - #include "hyld9767.h" -%} diff --git a/src/hyld9767/CMakeLists.txt b/src/loudness/CMakeLists.txt similarity index 50% rename from src/hyld9767/CMakeLists.txt rename to src/loudness/CMakeLists.txt index a4efef07..49e6af60 100644 --- a/src/hyld9767/CMakeLists.txt +++ b/src/loudness/CMakeLists.txt @@ -1,5 +1,5 @@ -set (libname "hyld9767") -set (libdescription "upm DFRobot loudness sensor") +set (libname "loudness") +set (libdescription "upm loudness sensors") set (module_src ${libname}.cxx) set (module_h ${libname}.h) upm_module_init() diff --git a/src/loudness/javaupm_loudness.i b/src/loudness/javaupm_loudness.i new file mode 100644 index 00000000..caaebab1 --- /dev/null +++ b/src/loudness/javaupm_loudness.i @@ -0,0 +1,8 @@ +%module javaupm_loudness +%include "../upm.i" + +%{ + #include "loudness.h" +%} + +%include "loudness.h" diff --git a/src/loudness/jsupm_loudness.i b/src/loudness/jsupm_loudness.i new file mode 100644 index 00000000..5a3ed4fd --- /dev/null +++ b/src/loudness/jsupm_loudness.i @@ -0,0 +1,8 @@ +%module jsupm_loudness +%include "../upm.i" + +%{ + #include "loudness.h" +%} + +%include "loudness.h" diff --git a/src/hyld9767/hyld9767.cxx b/src/loudness/loudness.cxx similarity index 92% rename from src/hyld9767/hyld9767.cxx rename to src/loudness/loudness.cxx index d1980445..d16610f8 100644 --- a/src/hyld9767/hyld9767.cxx +++ b/src/loudness/loudness.cxx @@ -24,23 +24,23 @@ #include -#include "hyld9767.h" +#include "loudness.h" using namespace std; using namespace upm; -HYLD9767::HYLD9767(int pin, float aref) : +Loudness::Loudness(int pin, float aref) : m_aio(pin) { m_aRes = m_aio.getBit(); m_aref = aref; } -HYLD9767::~HYLD9767() +Loudness::~Loudness() { } -float HYLD9767::loudness() +float Loudness::loudness() { int val = m_aio.read(); diff --git a/src/hyld9767/hyld9767.h b/src/loudness/loudness.h similarity index 71% rename from src/hyld9767/hyld9767.h rename to src/loudness/loudness.h index c7e81b5e..526eaf2d 100644 --- a/src/hyld9767/hyld9767.h +++ b/src/loudness/loudness.h @@ -27,54 +27,54 @@ #include #include -// EZ series is volts/512 -#define HYLD9767_RES 512 - namespace upm { /** - * @brief DFRobot Loudness Sensor V2 - * @defgroup hyld9767 libupm-hyld9767 - * @ingroup dfrobot analog sound + * @brief Generic loudness sensors + * @defgroup loudness libupm-loudness + * @ingroup dfrobot seeed analog sound */ /** - * @library hyld9767 - * @sensor hyld9767 - * @comname DFRobot Loudness Sensor V2 - * @altname HYLD9767 + * @library loudness + * @sensor loudness + * @comname Loudness Sensor + * @altname Grove loudness hyld9767 * @type sound - * @man dfrobot + * @man dfrobot seeed * @web http://www.dfrobot.com/index.php?route=product/product&product_id=83 * @con analog * - * @brief API for the DFRobot Loudness Sensor V2 + * @brief API for the Loudness Sensor * - * This sensor returns an analog voltage proportional to the + * This sensor family returns an analog voltage proportional to the * loudness of the ambient environment. It's output does not - * correspond to a particular sound level in decibels. + * correspond to a particular sound level in decibels. The higher + * the output voltage, the louder the ambient noise level. * - * This device uses an HYLD9767 electret microphone for sound input. + * This device uses an electret microphone for sound input. * * This driver was developed using the DFRobot Loudness Sensor V2 + * and the Grove Loudness sensor. * - * @snippet hyld9767.cxx Interesting + * @image html groveloudness.jpg + * @snippet loudness.cxx Interesting */ - class HYLD9767 { + class Loudness { public: /** - * HYLD9767 constructor + * Loudness constructor * * @param pin Analog pin to use * @param aref Analog reference voltage; default is 5.0 V */ - HYLD9767(int pin, float aref=5.0); + Loudness(int pin, float aref=5.0); /** - * HYLD9767 destructor + * Loudness destructor */ - ~HYLD9767(); + ~Loudness(); /** * Returns the voltage detected on the analog pin diff --git a/src/loudness/pyupm_loudness.i b/src/loudness/pyupm_loudness.i new file mode 100644 index 00000000..dfdd26de --- /dev/null +++ b/src/loudness/pyupm_loudness.i @@ -0,0 +1,9 @@ +%module pyupm_loudness +%include "../upm.i" + +%feature("autodoc", "3"); + +%include "loudness.h" +%{ + #include "loudness.h" +%}