ME 305 Group 6 Documentation
Functions
led_blinks.py File Reference

On button activation, cycles through Square, Sinewave, and Sawtooth blink pattern. More...

Functions

def led_blinks.main ()
 Upon button activation, cycles through Square, Sine, and Sawtooth blink patterns. More...
 
def led_blinks.squarePattern (t)
 Outputs the value of a square wave pattern dependent on t. More...
 
def led_blinks.sinePattern (t)
 Outputs the value of a sine wave pattern dependent on t. More...
 
def led_blinks.sawtoothPattern (t)
 Outputs the value of a sawtooth wave pattern dependent on t. More...
 
def led_blinks.onButtonPressCallback (IRQ_src)
 The callback function triggered by the physical button press. More...
 

Detailed Description

On button activation, cycles through Square, Sinewave, and Sawtooth blink pattern.

When run, launches the main() function. Upon first booting/run, the program waits to receive the first button press input. While waiting, the LED output is off. After the first button press, the program will cycle through Square, Sine, and Sawtooth wave blink patterns. Each time a new pattern is activated, it will restart the pattern from the beginning. To quit the program while running, press the Keyboard Interrupt.

For more information on how the program is structured and runs, review the diagrams below.
state diagrams for program

Author
Chris Linthacum
Caleb Savard
Date
January 20, 2021 @license This package is licensed under the CC BY-NC-SA 4.0 Please visit https://creativecommons.org/licenses/by-nc-sa/4.0/ for terms and conditions of the license.

Function Documentation

◆ main()

def led_blinks.main ( )

Upon button activation, cycles through Square, Sine, and Sawtooth blink patterns.

Upon first run, the program waits to receive the first button press input. After the first button press, the LED output will cycle through a Square, Sine, and Sawtooth blink pattern on each press of the input button.

Parameters
None
Returns
None

◆ onButtonPressCallback()

def led_blinks.onButtonPressCallback (   IRQ_src)

The callback function triggered by the physical button press.

Sets buttonPressed flag to True.

When the physical input button is pressed on the device, this callback function sets the global buttonPressed flag to True

Parameters
IRQ_srcThe interrupt Source Register. Not used by this function, but contains the register responsible for the interrupt.

◆ sawtoothPattern()

def led_blinks.sawtoothPattern (   t)

Outputs the value of a sawtooth wave pattern dependent on t.

From a value t (ticks in ms) from the initial wave activation, the function returns an output value equal to the amplitude of a sawtooth wave at the given time t. The square wave cycle has a period of 1 second, and an amplitude of 100. The sawtooth pattern increases at a rate of 100 per second, and resets each time it reaches the peak of 100.

Parameters
tThe number of ticks in miliseconds since the start (or zero point) of the pattern.
Returns
brt The amplitude of the wave pattern at the input time 't'

◆ sinePattern()

def led_blinks.sinePattern (   t)

Outputs the value of a sine wave pattern dependent on t.

From a value t (ticks in ms) from the initial wave activation, the function returns an output value equal to the amplitude of a sine wave at the given time t. The sine wave cycle has a period of 10 seconds, and a peak-to-peak amplitude of 100 with an offset of +50.

Parameters
tThe number of ticks in miliseconds since the start (or zero point) of the pattern.
Returns
brt The amplitude of the wave pattern at the input time 't'

◆ squarePattern()

def led_blinks.squarePattern (   t)

Outputs the value of a square wave pattern dependent on t.

From a value t (ticks in ms) from the initial wave activation, the function returns an output value equal to the amplitude of a square wave at the given time t. The square wave cycle has a period of 1 second, and an amplitude of 100.

Parameters
tThe number of ticks in miliseconds since the start (or zero point) of the pattern.
Returns
brt The amplitude of the wave pattern at the input time 't'