discoLight
Loading...
Searching...
No Matches
SWE4211RPi::PulsedGPIOPin Class Reference
Inheritance diagram for SWE4211RPi::PulsedGPIOPin:
Collaboration diagram for SWE4211RPi::PulsedGPIOPin:

Public Types

enum  PULSE_TYPE { ONE_SHOT , CONTINUOUS }
 

Public Member Functions

 PulsedGPIOPin (int number, std::string threadName, uint32_t period, PULSE_TYPE type=CONTINUOUS, GPIO::DIRECTION dir=GPIO::GPIO_OUT, GPIO::VALUE val=GPIO::GPIO_LOW)
 
virtual void setValue (GPIO::VALUE)
 
virtual void setpulseDuration (int duration)
 
virtual void taskMethod ()
 
void stopThreadExecution ()
 
- Public Member Functions inherited from SWE4211RPi::PeriodicTask
 PeriodicTask (std::string threadName, uint32_t period, int priority=1)
 
virtual ~PeriodicTask ()
 
virtual void setTaskPeriod (uint32_t period) final
 
virtual uint32_t getTaskPeriod () final
 
void run () final
 
virtual void printInformation ()
 
virtual double getCPUUsageInfo ()
 
virtual void resetThreadDiagnostics ()
 
- Public Member Functions inherited from SWE4211RPi::RunnableClass
 RunnableClass (std::string threadName, int priority=0)
 
virtual ~RunnableClass ()
 
virtual pid_t getThreadID ()
 
virtual void start () final
 
virtual void setPriority (int priority) final
 
virtual int getPriority () final
 
virtual bool isShutdown () final
 
virtual bool isStarted () final
 
virtual void waitForShutdown ()
 

Private Member Functions

void delayedToggleAndSleep (long specificDelay, SWE4211RPi::GPIO::VALUE value)
 

Private Attributes

GPIO & gpioPinInstance
 
int pulseDuration = 0
 
SWE4211RPi::GPIO::VALUE initialValue = SWE4211RPi::GPIO::GPIO_LOW
 
PulsedGPIOPin::PULSE_TYPE type = PULSE_TYPE::CONTINUOUS
 
bool firePulse = false
 

Additional Inherited Members

- Static Public Member Functions inherited from SWE4211RPi::RunnableClass
static void printThreads ()
 
static void resetAllThreadInformation ()
 
- Protected Member Functions inherited from SWE4211RPi::PeriodicTask
virtual void startChildRunnables () final
 
virtual void stopChildRunnables () final
 
virtual void startChildTasks ()
 
virtual void stopChildTasks ()
 
- Protected Attributes inherited from SWE4211RPi::PeriodicTask
uint32_t taskPeriod = 100000
 
- Protected Attributes inherited from SWE4211RPi::RunnableClass
std::thread * myThread = NULL
 
pthread_t executingThread = 0
 
pid_t myOSThreadID = 0
 
std::string myName
 
bool keepGoing = true
 
bool runCompleted = false
 
bool runStarted = false
 
int priority = -1
 
- Static Protected Attributes inherited from SWE4211RPi::RunnableClass
static std::list< RunnableClass * > runningThreads
 

Member Enumeration Documentation

◆ PULSE_TYPE

This enumeration sets up the pin to either be an input or an output pin.

Constructor & Destructor Documentation

◆ PulsedGPIOPin()

PulsedGPIOPin::PulsedGPIOPin ( int  number,
std::string  threadName,
uint32_t  period,
PULSE_TYPE  type = CONTINUOUS,
GPIO::DIRECTION  dir = GPIO::GPIO_OUT,
GPIO::VALUE  val = GPIO::GPIO_LOW 
)

This will setup a GPIO pin to be pulsed.

Parameters
numberThis is the GPIO pin that is to be pulsed.
threadNameThis si the name of the thread for the pin.
periodThis is the period of the task that is to cause a pulse.
typeThis is the type of the pulse, either One Shot, which fires once, or COntinuous, which will have a given pulse every period units of time.
dirThis si the direction for the pin - out for it to be meaningful.
valThis is the default pin state value, which tends to be low.

Member Function Documentation

◆ delayedToggleAndSleep()

void PulsedGPIOPin::delayedToggleAndSleep ( long  specificDelay,
SWE4211RPi::GPIO::VALUE  value 
)
private

This method will cause a sleep to occur and then delay after that period of time.

Parameters
specificDelay
value
Here is the call graph for this function:

◆ setpulseDuration()

void PulsedGPIOPin::setpulseDuration ( int  duration)
virtual

This method will set the pulse duration, or nhow long the pulse should be on.

Parameters
durationThis is the time on.
Here is the caller graph for this function:

◆ setValue()

void PulsedGPIOPin::setValue ( GPIO::VALUE  value)
virtual

This method will drive an output pin to the appropriate value.

Parameters
Thisis the value that is to be written to the pin.

◆ stopThreadExecution()

void PulsedGPIOPin::stopThreadExecution ( )
virtual

this method will stop the thread and its execution. In the case of this particular class, it will also shutdown the network socket.

Reimplemented from SWE4211RPi::RunnableClass.

Here is the call graph for this function:

◆ taskMethod()

void PulsedGPIOPin::taskMethod ( )
virtual

This is the overridden taskMethod that is periodically invoked.

Implements SWE4211RPi::PeriodicTask.

Here is the call graph for this function:

Member Data Documentation

◆ initialValue

SWE4211RPi::GPIO::VALUE SWE4211RPi::PulsedGPIOPin::initialValue = SWE4211RPi::GPIO::GPIO_LOW
private

The initial value for the GPIO pin.

◆ pulseDuration

int SWE4211RPi::PulsedGPIOPin::pulseDuration = 0
private

The duration of each pulse.

◆ type

PulsedGPIOPin::PULSE_TYPE SWE4211RPi::PulsedGPIOPin::type = PULSE_TYPE::CONTINUOUS
private

This defines the type of the pulse.


The documentation for this class was generated from the following files: