Files
libpigpio/pigstate.cpp
2025-08-05 22:33:23 +02:00

68 lines
1.2 KiB
C++

/*****************************************************************************
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 <iostream>
#include <pigstate.h>
pigState::pigState( bool state )
: _state{ state }
{
}
bool pigState::state()
{
return _state;
}
void pigState::set_state( bool newState )
{
_state = newState;
}
void pigState::toggle_state()
{
change_state( !state() );
}
/*
void pigState::change_state( bool newState )
{
if( newState == state() )
return;
set_state( newState );
sigState( _state );
}
*/
/*
void pigState::connect( pigState& listener )
{
sigState.connect( [&](bool state) { listener.change_state( state ); } );
}
*/