first re-commit.

This commit is contained in:
2025-08-05 22:33:23 +02:00
commit e1ff579d1a
295 changed files with 107130 additions and 0 deletions

65
pigbuzzer.cpp Normal file
View File

@@ -0,0 +1,65 @@
/*****************************************************************************
source::worx libPiGPio
Copyright © 2022 c.holzheuer
chris@sourceworx.org
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 2 of the License, or
(at your option) any later version.
Uses:
pigpiod_if2 by joan2937, pigpio @ abyz.me.uk
https://abyz.me.uk/rpi/pigpio
sigslot by 2017 Pierre-Antoine Lacaze
https://github.com/palacaze/sigslot
***************************************************************************/
#include <chrono>
#include <thread>
#include <pigbuzzer.h>
#include <pignodeout.h>
#include <pigstate.h>
pigBuzzer::pigBuzzer( bcm_t bcmNo )
: pigNodeOut( bcmNo , pull_off )
{
}
pigBuzzer::~pigBuzzer()
{
}
void pigBuzzer::buzz( int millisOn, int millisOff )
{
/*
std::thread thrd(
[=]()
{
_pinOut.set_level( high );
std::this_thread::sleep_for( std::chrono::milliseconds( millisOn ) );
_pinOut.set_level( low );
if( millisOff )
std::this_thread::sleep_for( std::chrono::milliseconds( millisOff ) );
} );
thrd.detach();
*/
_pinOut.set_level( high );
std::this_thread::sleep_for( std::chrono::milliseconds( millisOn ) );
_pinOut.set_level( low );
if( millisOff )
std::this_thread::sleep_for( std::chrono::milliseconds( millisOff ) );
}