stm32f1/lib/sensor_gm1351.h

40 lines
1.5 KiB
C

/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/** library to read measurements from GM1351 sound level meter
* @file
* @author King Kévin <kingkevin@cuvoodoo.info>
* @date 2020
* @note peripherals used: GPIO @ref sensor_gm1351_gpio, SPI @ref sensor_gm1351_spi
*/
/** measurement displayed on meter LCD, in deci-dBa
* @warning value is only valid if decoding is successful
*/
extern uint16_t sensor_gm1351_decidba;
/** flag set when LCD data has been received */
extern volatile bool sensor_gm1351_received_flag;
/** initialise interface to GM1351 sound level meter */
void sensor_gm1351_setup(void);
/** switch power of meter
* @warning the device will power off after 10 minutes
*/
void sensor_gm1351_power_toggle(void);
/** decode LCD data to displayed number
* @return if number has been decoded correctly
* @warning should be done before the next LCD data is being received (e.g. right after the flag is set)
*/
bool sensor_gm1351_decode(void);