My Project
Macros | Variables
lab4_define.h File Reference

Lab 4 : FREERTOS Scheduling and multitasking. More...

#include <Arduino_FreeRTOS.h>
#include <arduinoFFT.h>
#include <queue.h>
#include <stdio.h>

Go to the source code of this file.

Macros

#define SPEAKERDDR   DDRH
 speaker ddr More...
 
#define TIMERPPR   PRR1
 timer Power reduction register More...
 
#define LEDPORT   PORTL
 
#define LEDDDR   DDRL
 
#define SETLEDDDR   LEDDDR |= BIT_2
 
#define SETLEDPORT   LEDPORT |= BIT_2
 
#define CLEARLEDPORT   LEDPORT &= !(BIT_2)
 
#define SETSPEAKERDDR   SPEAKERDDR |= BIT_3
 
#define BIT_0   1
 
#define BIT_1   1<<1
 
#define BIT_2   1<<2
 
#define BIT_3   1<<3
 
#define BIT_4   1<<4
 
#define BIT_5   1<<5
 
#define BIT_6   1<<6
 
#define BIT_7   1<<7
 
#define SEVENSEGPORT1   PORTA
 
#define SEVENSEGDDR1   DDRA
 
#define SEVENSEGPORT2   PORTC
 
#define SEVENSEGDDR2   DDRC
 
#define SETSEVSEGDDR1   SEVENSEGDDR1 |= BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0
 
#define SETSEVSEGDDR2   SEVENSEGDDR2 |= BIT_7 | BIT_6 | BIT_5
 
#define TIMERCOMPARE4A   OCR4A
 
#define TIMERCOMPARE3A   OCR3A
 
#define TIMER3VAL   TCNT3
 
#define TIMER4_ON_BIT   1<<PRTIM4
 
#define TIMER3_ON_BIT   1<<PRTIM3
 
#define TIMER4ON   TIMERPPR &= !(TIMER4_ON_BIT)
 
#define TIMER3ON   TIMERPPR &= !(TIMER3_ON_BIT)
 
#define TIMER3OFF   TIMERPPR |= (TIMER3_ON_BIT)
 
#define TIMER4REGA   TCCR4A
 
#define TIMER4REGB   TCCR4B
 
#define TIMER3REGA   TCCR3A
 
#define TIMER3REGB   TCCR3B
 
#define WGM4_BIT_0   1<<WGM40
 
#define WGM4_BIT_1   1<<WGM41
 
#define WGM4_BIT_2   1<<WGM42
 
#define WGM4_BIT_3   1<<WGM43
 
#define WGM3_BIT_0   1<<WGM30
 
#define WGM3_BIT_1   1<<WGM31
 
#define WGM3_BIT_2   1<<WGM32
 
#define WGM3_BIT_3   1<<WGM33
 
#define PSCALE4_BIT_0   1<<CS40
 
#define PSCALE4_BIT_1   1<<CS41
 
#define PSCALE4_BIT_2   1<<CS42
 
#define PSCALE3_BIT_0   1<<CS30
 
#define PSCALE3_BIT_1   1<<CS31
 
#define PSCALE3_BIT_2   1<<CS32
 
#define SETTIMER4REGA   TIMER4REGA |= WGM4_BIT_0 | WGM4_BIT_1 | COMPARE_MODE4
 
#define SETTIMER4REGB   TIMER4REGB |= WGM4_BIT_2 | WGM4_BIT_3 | PSCALE4_BIT_0
 
#define SETTIMER3REGA   TIMER3REGA |= WGM3_BIT_0 | WGM3_BIT_1 | COMPARE_MODE3
 
#define SETTIMER3REGB   TIMER3REGB |= WGM3_BIT_2 | WGM3_BIT_3 | PSCALE3_BIT_0
 
#define CLOCKFREQ   16000000
 
#define TWO   2
 
#define THREE   3
 
#define TEN   10
 
#define HUNDRED   100
 
#define THOUSAND   1000
 
#define COMPARE_2000   16000
 
#define COMPARE_293   27304
 
#define COMPARE_329   24316
 
#define COMPARE_261   30651
 
#define COMPARE_130   61538
 
#define COMPARE_196   40816
 
#define COMPARE_NONE   0
 
#define COMPARE_1   62500
 
#define COMPARE_MODE4   1<<COM4A0
 
#define COMPARE_MODE3   1<<COM3A0
 
#define SIXSECINMILLIS   6000
 
#define FOURSECINMILLIS   4000
 
#define THREESECINMILLIS   3000
 
#define TWOSECINMILLIS   2000
 
#define SECINMILLIS   1000
 
#define HALFSECINMILLIS   500
 
#define QUARSECINMILLIS   250
 
#define THREEQUARSECINMILLIS   750
 
#define STATREG   SREG
 
#define STATREGINTON   STATREG |= BIT_7
 
#define STATREGINTOFF   STATREG &= !BIT_7
 

Variables

int i
 iterators More...
 
int j
 
int k
 
volatile byte segbits [7] = {7, 0, 5, 3, 1, 6, 7}
 
volatile uint8_t * segports [7] = {&PORTC, &PORTA, &PORTA, &PORTA, &PORTA, &PORTA, &PORTA}
 
volatile uint8_t * segddrs [7] = {&DDRC, &DDRA, &DDRA, &DDRA, &DDRA, &DDRA, &DDRA}
 
uint8_t digbits [4] = {5, 4, 2, 6}
 
volatile uint8_t * digports [4] = {&PORTC, &PORTA, &PORTA, &PORTC}
 
volatile uint8_t * digddrs [4] = {&DDRC, &DDRA, &DDRA, &DDRC}
 
#define ROTARYPORT   LEDPORT
 
#define clkIN   52
 
#define dtIN   50
 
int currentStateClk
 
int previousStateClk
 
int carPosition = 3
 
int lastRow = B00000000
 
#define TIMER3INTREG   TIMSK3
 
#define TIMER3INTBIT   1<<OCIE3A
 
#define TIMER3INTVEC   TIMER3_COMPA_vect
 
#define TIMER3INTON   TIMER3INTREG |= TIMER3INTBIT
 
#define TIMER3INTOFF   TIMER3INTREG &= !TIMER3INTBIT
 
#define OP_DECODEMODE   8
 
#define OP_SCANLIMIT   10
 
#define OP_SHUTDOWN   11
 
#define OP_DISPLAYTEST   14
 
#define OP_INTENSITY   10
 
#define DIN   42
 
#define CS   44
 
#define CLK   46
 
#define ROWS   8
 
#define COLS   8
 
#define CLEARROW   0b00000000
 
#define ROUNDERR   0.47
 
byte spidata [16]
 
void spiTransfer (volatile byte row, volatile byte data)
 
#define ULONG_MAX   0xFFFFFFFFUL
 
arduinoFFT FFT = arduinoFFT()
 
const uint16_t samples = 256
 
int pseudoArray [samples]
 
const double signalFrequency = 1000
 
const double samplingFrequency = 5000
 
double vReal [samples]
 
double vImag [samples]
 
#define leds0   B11000011
 
int leds [8] = {leds0, leds0, leds0, leds0, leds0, leds0, leds0, leds0}
 
uint8_t objects [9]
 
#define NOTE_B0   31
 
#define NOTE_C1   33
 
#define NOTE_CS1   35
 
#define NOTE_D1   37
 
#define NOTE_DS1   39
 
#define NOTE_E1   41
 
#define NOTE_F1   44
 
#define NOTE_FS1   46
 
#define NOTE_G1   49
 
#define NOTE_GS1   52
 
#define NOTE_A1   55
 
#define NOTE_AS1   58
 
#define NOTE_B1   62
 
#define NOTE_C2   65
 
#define NOTE_CS2   69
 
#define NOTE_D2   73
 
#define NOTE_DS2   78
 
#define NOTE_E2   82
 
#define NOTE_F2   87
 
#define NOTE_FS2   93
 
#define NOTE_G2   98
 
#define NOTE_GS2   104
 
#define NOTE_A2   110
 
#define NOTE_AS2   117
 
#define NOTE_B2   123
 
#define NOTE_C3   131
 
#define NOTE_CS3   139
 
#define NOTE_D3   147
 
#define NOTE_DS3   156
 
#define NOTE_E3   165
 
#define NOTE_F3   175
 
#define NOTE_FS3   185
 
#define NOTE_G3   196
 
#define NOTE_GS3   208
 
#define NOTE_A3   220
 
#define NOTE_AS3   233
 
#define NOTE_B3   247
 
#define NOTE_C4   262
 
#define NOTE_CS4   277
 
#define NOTE_D4   294
 
#define NOTE_DS4   311
 
#define NOTE_E4   330
 
#define NOTE_F4   349
 
#define NOTE_FS4   370
 
#define NOTE_G4   392
 
#define NOTE_GS4   415
 
#define NOTE_A4   440
 
#define NOTE_AS4   466
 
#define NOTE_B4   494
 
#define NOTE_C5   523
 
#define NOTE_CS5   554
 
#define NOTE_D5   587
 
#define NOTE_DS5   622
 
#define NOTE_E5   659
 
#define NOTE_F5   698
 
#define NOTE_FS5   740
 
#define NOTE_G5   784
 
#define NOTE_GS5   831
 
#define NOTE_A5   880
 
#define NOTE_AS5   932
 
#define NOTE_B5   988
 
#define NOTE_C6   1047
 
#define NOTE_CS6   1109
 
#define NOTE_D6   1175
 
#define NOTE_DS6   1245
 
#define NOTE_E6   1319
 
#define NOTE_F6   1397
 
#define NOTE_FS6   1480
 
#define NOTE_G6   1568
 
#define NOTE_GS6   1661
 
#define NOTE_A6   1760
 
#define NOTE_AS6   1865
 
#define NOTE_B6   1976
 
#define NOTE_C7   2093
 
#define NOTE_CS7   2217
 
#define NOTE_D7   2349
 
#define NOTE_DS7   2489
 
#define NOTE_E7   2637
 
#define NOTE_F7   2794
 
#define NOTE_FS7   2960
 
#define NOTE_G7   3136
 
#define NOTE_GS7   3322
 
#define NOTE_A7   3520
 
#define NOTE_AS7   3729
 
#define NOTE_B7   3951
 
#define NOTE_C8   4186
 
#define NOTE_CS8   4435
 
#define NOTE_D8   4699
 
#define NOTE_DS8   4978
 
int melody []
 
int tempo []
 
int underworld_melody []
 
int underworld_tempo []
 
int thisNote = 0
 
int thisNoteEnd = 0
 
TaskHandle_t RT1handle
 
TaskHandle_t RT2handle
 
TaskHandle_t RT3handle
 
TaskHandle_t RT3p0handle
 
TaskHandle_t RT3p1handle
 
TaskHandle_t RT4handle
 
TaskHandle_t Task_Counterhandle
 
TaskHandle_t playDrivingGamehandle
 
TaskHandle_t readRotaryEncoderhandle
 
TaskHandle_t setLedshandle
 
TaskHandle_t setLedhandle
 
TaskHandle_t playMusichandle
 
TaskHandle_t readButtonshandle
 
TaskHandle_t RTtaskshandle
 
TaskHandle_t restarthandle
 
TaskHandle_t playMusicEndhandle
 
void RT1 (void *pvParameters)
 
void RT2 (void *pvParameters)
 
void RT3 (void *pvParameters)
 
void RT4 (void *pvParameters)
 
void Task_Counter (void *pvParameters)
 
void useEncoderWithMatrix (void **pvParameters)
 
void readRotaryEncoder (void **pvParameters)
 
void setLed (void **pvParameters)
 
void crash (void **pvParameters)
 

Detailed Description

Lab 4 : FREERTOS Scheduling and multitasking.

Author
Connor Lowe Leonard Dul
Date
9-June-2021

This is the defines for our lab4.

Macro Definition Documentation

◆ BIT_0

#define BIT_0   1

bitmasks for leds on port L and speaker port H and 7 seg

◆ BIT_1

#define BIT_1   1<<1

◆ BIT_2

#define BIT_2   1<<2

◆ BIT_3

#define BIT_3   1<<3

◆ BIT_4

#define BIT_4   1<<4

◆ BIT_5

#define BIT_5   1<<5

◆ BIT_6

#define BIT_6   1<<6

◆ BIT_7

#define BIT_7   1<<7

◆ CLEARLEDPORT

#define CLEARLEDPORT   LEDPORT &= !(BIT_2)

◆ CLEARROW

#define CLEARROW   0b00000000

◆ CLK

#define CLK   46

◆ clkIN

#define clkIN   52

◆ CLOCKFREQ

#define CLOCKFREQ   16000000

for compare count and speaker

◆ COLS

#define COLS   8

◆ COMPARE_1

#define COMPARE_1   62500

◆ COMPARE_130

#define COMPARE_130   61538

◆ COMPARE_196

#define COMPARE_196   40816

◆ COMPARE_2000

#define COMPARE_2000   16000

◆ COMPARE_261

#define COMPARE_261   30651

◆ COMPARE_293

#define COMPARE_293   27304

◆ COMPARE_329

#define COMPARE_329   24316

◆ COMPARE_MODE3

#define COMPARE_MODE3   1<<COM3A0

◆ COMPARE_MODE4

#define COMPARE_MODE4   1<<COM4A0

◆ COMPARE_NONE

#define COMPARE_NONE   0

◆ CS

#define CS   44

◆ DIN

#define DIN   42

◆ dtIN

#define dtIN   50

◆ FOURSECINMILLIS

#define FOURSECINMILLIS   4000

◆ HALFSECINMILLIS

#define HALFSECINMILLIS   500

◆ HUNDRED

#define HUNDRED   100

◆ LEDDDR

#define LEDDDR   DDRL

◆ LEDPORT

#define LEDPORT   PORTL

led pin outputs

◆ leds0

#define leds0   B11000011

For game matrix

◆ NOTE_A1

#define NOTE_A1   55

◆ NOTE_A2

#define NOTE_A2   110

◆ NOTE_A3

#define NOTE_A3   220

◆ NOTE_A4

#define NOTE_A4   440

◆ NOTE_A5

#define NOTE_A5   880

◆ NOTE_A6

#define NOTE_A6   1760

◆ NOTE_A7

#define NOTE_A7   3520

◆ NOTE_AS1

#define NOTE_AS1   58

◆ NOTE_AS2

#define NOTE_AS2   117

◆ NOTE_AS3

#define NOTE_AS3   233

◆ NOTE_AS4

#define NOTE_AS4   466

◆ NOTE_AS5

#define NOTE_AS5   932

◆ NOTE_AS6

#define NOTE_AS6   1865

◆ NOTE_AS7

#define NOTE_AS7   3729

◆ NOTE_B0

#define NOTE_B0   31

For playing music - medlody and temp given by Linonel Tellem Youtube Arduino Tutorial 3 Edited by Connor Lowe and Leonard Dul to suit our game implementation

◆ NOTE_B1

#define NOTE_B1   62

◆ NOTE_B2

#define NOTE_B2   123

◆ NOTE_B3

#define NOTE_B3   247

◆ NOTE_B4

#define NOTE_B4   494

◆ NOTE_B5

#define NOTE_B5   988

◆ NOTE_B6

#define NOTE_B6   1976

◆ NOTE_B7

#define NOTE_B7   3951

◆ NOTE_C1

#define NOTE_C1   33

◆ NOTE_C2

#define NOTE_C2   65

◆ NOTE_C3

#define NOTE_C3   131

◆ NOTE_C4

#define NOTE_C4   262

◆ NOTE_C5

#define NOTE_C5   523

◆ NOTE_C6

#define NOTE_C6   1047

◆ NOTE_C7

#define NOTE_C7   2093

◆ NOTE_C8

#define NOTE_C8   4186

◆ NOTE_CS1

#define NOTE_CS1   35

◆ NOTE_CS2

#define NOTE_CS2   69

◆ NOTE_CS3

#define NOTE_CS3   139

◆ NOTE_CS4

#define NOTE_CS4   277

◆ NOTE_CS5

#define NOTE_CS5   554

◆ NOTE_CS6

#define NOTE_CS6   1109

◆ NOTE_CS7

#define NOTE_CS7   2217

◆ NOTE_CS8

#define NOTE_CS8   4435

◆ NOTE_D1

#define NOTE_D1   37

◆ NOTE_D2

#define NOTE_D2   73

◆ NOTE_D3

#define NOTE_D3   147

◆ NOTE_D4

#define NOTE_D4   294

◆ NOTE_D5

#define NOTE_D5   587

◆ NOTE_D6

#define NOTE_D6   1175

◆ NOTE_D7

#define NOTE_D7   2349

◆ NOTE_D8

#define NOTE_D8   4699

◆ NOTE_DS1

#define NOTE_DS1   39

◆ NOTE_DS2

#define NOTE_DS2   78

◆ NOTE_DS3

#define NOTE_DS3   156

◆ NOTE_DS4

#define NOTE_DS4   311

◆ NOTE_DS5

#define NOTE_DS5   622

◆ NOTE_DS6

#define NOTE_DS6   1245

◆ NOTE_DS7

#define NOTE_DS7   2489

◆ NOTE_DS8

#define NOTE_DS8   4978

◆ NOTE_E1

#define NOTE_E1   41

◆ NOTE_E2

#define NOTE_E2   82

◆ NOTE_E3

#define NOTE_E3   165

◆ NOTE_E4

#define NOTE_E4   330

◆ NOTE_E5

#define NOTE_E5   659

◆ NOTE_E6

#define NOTE_E6   1319

◆ NOTE_E7

#define NOTE_E7   2637

◆ NOTE_F1

#define NOTE_F1   44

◆ NOTE_F2

#define NOTE_F2   87

◆ NOTE_F3

#define NOTE_F3   175

◆ NOTE_F4

#define NOTE_F4   349

◆ NOTE_F5

#define NOTE_F5   698

◆ NOTE_F6

#define NOTE_F6   1397

◆ NOTE_F7

#define NOTE_F7   2794

◆ NOTE_FS1

#define NOTE_FS1   46

◆ NOTE_FS2

#define NOTE_FS2   93

◆ NOTE_FS3

#define NOTE_FS3   185

◆ NOTE_FS4

#define NOTE_FS4   370

◆ NOTE_FS5

#define NOTE_FS5   740

◆ NOTE_FS6

#define NOTE_FS6   1480

◆ NOTE_FS7

#define NOTE_FS7   2960

◆ NOTE_G1

#define NOTE_G1   49

◆ NOTE_G2

#define NOTE_G2   98

◆ NOTE_G3

#define NOTE_G3   196

◆ NOTE_G4

#define NOTE_G4   392

◆ NOTE_G5

#define NOTE_G5   784

◆ NOTE_G6

#define NOTE_G6   1568

◆ NOTE_G7

#define NOTE_G7   3136

◆ NOTE_GS1

#define NOTE_GS1   52

◆ NOTE_GS2

#define NOTE_GS2   104

◆ NOTE_GS3

#define NOTE_GS3   208

◆ NOTE_GS4

#define NOTE_GS4   415

◆ NOTE_GS5

#define NOTE_GS5   831

◆ NOTE_GS6

#define NOTE_GS6   1661

◆ NOTE_GS7

#define NOTE_GS7   3322

◆ OP_DECODEMODE

#define OP_DECODEMODE   8

◆ OP_DISPLAYTEST

#define OP_DISPLAYTEST   14

◆ OP_INTENSITY

#define OP_INTENSITY   10

◆ OP_SCANLIMIT

#define OP_SCANLIMIT   10

◆ OP_SHUTDOWN

#define OP_SHUTDOWN   11

◆ PSCALE3_BIT_0

#define PSCALE3_BIT_0   1<<CS30

◆ PSCALE3_BIT_1

#define PSCALE3_BIT_1   1<<CS31

◆ PSCALE3_BIT_2

#define PSCALE3_BIT_2   1<<CS32

◆ PSCALE4_BIT_0

#define PSCALE4_BIT_0   1<<CS40

for prescaler

◆ PSCALE4_BIT_1

#define PSCALE4_BIT_1   1<<CS41

◆ PSCALE4_BIT_2

#define PSCALE4_BIT_2   1<<CS42

◆ QUARSECINMILLIS

#define QUARSECINMILLIS   250

◆ ROTARYPORT

#define ROTARYPORT   LEDPORT

rotary encoder inputs

◆ ROUNDERR

#define ROUNDERR   0.47

◆ ROWS

#define ROWS   8

◆ SECINMILLIS

#define SECINMILLIS   1000

◆ SETLEDDDR

#define SETLEDDDR   LEDDDR |= BIT_2

◆ SETLEDPORT

#define SETLEDPORT   LEDPORT |= BIT_2

◆ SETSEVSEGDDR1

#define SETSEVSEGDDR1   SEVENSEGDDR1 |= BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0

◆ SETSEVSEGDDR2

#define SETSEVSEGDDR2   SEVENSEGDDR2 |= BIT_7 | BIT_6 | BIT_5

◆ SETSPEAKERDDR

#define SETSPEAKERDDR   SPEAKERDDR |= BIT_3

◆ SETTIMER3REGA

#define SETTIMER3REGA   TIMER3REGA |= WGM3_BIT_0 | WGM3_BIT_1 | COMPARE_MODE3

◆ SETTIMER3REGB

#define SETTIMER3REGB   TIMER3REGB |= WGM3_BIT_2 | WGM3_BIT_3 | PSCALE3_BIT_0

◆ SETTIMER4REGA

#define SETTIMER4REGA   TIMER4REGA |= WGM4_BIT_0 | WGM4_BIT_1 | COMPARE_MODE4

set timer definitions

◆ SETTIMER4REGB

#define SETTIMER4REGB   TIMER4REGB |= WGM4_BIT_2 | WGM4_BIT_3 | PSCALE4_BIT_0

◆ SEVENSEGDDR1

#define SEVENSEGDDR1   DDRA

◆ SEVENSEGDDR2

#define SEVENSEGDDR2   DDRC

◆ SEVENSEGPORT1

#define SEVENSEGPORT1   PORTA

seven seg outputs

◆ SEVENSEGPORT2

#define SEVENSEGPORT2   PORTC

◆ SIXSECINMILLIS

#define SIXSECINMILLIS   6000

timing constants

◆ SPEAKERDDR

#define SPEAKERDDR   DDRH

speaker ddr

◆ STATREG

#define STATREG   SREG

FOR INTERRUPT status register

◆ STATREGINTOFF

#define STATREGINTOFF   STATREG &= !BIT_7

◆ STATREGINTON

#define STATREGINTON   STATREG |= BIT_7

◆ TEN

#define TEN   10

◆ THOUSAND

#define THOUSAND   1000

◆ THREE

#define THREE   3

◆ THREEQUARSECINMILLIS

#define THREEQUARSECINMILLIS   750

◆ THREESECINMILLIS

#define THREESECINMILLIS   3000

◆ TIMER3_ON_BIT

#define TIMER3_ON_BIT   1<<PRTIM3

◆ TIMER3INTBIT

#define TIMER3INTBIT   1<<OCIE3A

◆ TIMER3INTOFF

#define TIMER3INTOFF   TIMER3INTREG &= !TIMER3INTBIT

◆ TIMER3INTON

#define TIMER3INTON   TIMER3INTREG |= TIMER3INTBIT

◆ TIMER3INTREG

#define TIMER3INTREG   TIMSK3

interrupt timer on

◆ TIMER3INTVEC

#define TIMER3INTVEC   TIMER3_COMPA_vect

◆ TIMER3OFF

#define TIMER3OFF   TIMERPPR |= (TIMER3_ON_BIT)

◆ TIMER3ON

#define TIMER3ON   TIMERPPR &= !(TIMER3_ON_BIT)

◆ TIMER3REGA

#define TIMER3REGA   TCCR3A

◆ TIMER3REGB

#define TIMER3REGB   TCCR3B

◆ TIMER3VAL

#define TIMER3VAL   TCNT3

◆ TIMER4_ON_BIT

#define TIMER4_ON_BIT   1<<PRTIM4

timer on bit

◆ TIMER4ON

#define TIMER4ON   TIMERPPR &= !(TIMER4_ON_BIT)

◆ TIMER4REGA

#define TIMER4REGA   TCCR4A

timer register

◆ TIMER4REGB

#define TIMER4REGB   TCCR4B

◆ TIMERCOMPARE3A

#define TIMERCOMPARE3A   OCR3A

◆ TIMERCOMPARE4A

#define TIMERCOMPARE4A   OCR4A

timer compare register

◆ TIMERPPR

#define TIMERPPR   PRR1

timer Power reduction register

◆ TWO

#define TWO   2

◆ TWOSECINMILLIS

#define TWOSECINMILLIS   2000

◆ ULONG_MAX

#define ULONG_MAX   0xFFFFFFFFUL

◆ WGM3_BIT_0

#define WGM3_BIT_0   1<<WGM30

◆ WGM3_BIT_1

#define WGM3_BIT_1   1<<WGM31

◆ WGM3_BIT_2

#define WGM3_BIT_2   1<<WGM32

◆ WGM3_BIT_3

#define WGM3_BIT_3   1<<WGM33

◆ WGM4_BIT_0

#define WGM4_BIT_0   1<<WGM40

waveform generation

◆ WGM4_BIT_1

#define WGM4_BIT_1   1<<WGM41

◆ WGM4_BIT_2

#define WGM4_BIT_2   1<<WGM42

◆ WGM4_BIT_3

#define WGM4_BIT_3   1<<WGM43

Function Documentation

◆ crash()

void crash ( void **  pvParameters)

◆ readRotaryEncoder()

void readRotaryEncoder ( void **  pvParameters)

◆ RT1()

void RT1 ( void *  pvParameters)

RT1(void *p) This funciton blinks an on board led on for 1000ms then off for 200ms.

Author
Connor Lowe, Leonard Dul

◆ RT2()

void RT2 ( void *  pvParameters)

RT2(void *p) This funciton plays the 5 note tune from close encounters of the third kind for 2 seconds, then rests for 1.5 seconds, then repeats.
After repeating 2 times, the tune stops.

Author
Connor Lowe, Leonard Dul

◆ RT3()

void RT3 ( void *  pvParameters)

RT3(void *p) This funciton computes a 256 sample FFT 5 times and reports the average time back on the serial line in milliseconds.

Author
Connor Lowe, Leonard Dul

◆ RT4()

void RT4 ( void *  pvParameters)

RT4(void *p) This funciton computes a 256 sample FFT reports back to RT4 when done.

Author
Connor Lowe, Leonard Dul

◆ setLed()

void setLed ( void **  pvParameters)

◆ spiTransfer()

void spiTransfer ( volatile byte  opcode,
volatile byte  data 
)

for LED matrix driving game spiTransfer(volatile byte opcode, volatile byte data) Given code for writing data to led matrix with spi protocol.

Author
: Ishaan Bhimani

◆ Task_Counter()

void Task_Counter ( void *  pvParameters)

for Task Counter - display driving time Task_Counter(void *pvParameters) Counts for seconds driving.

Author
Blake Hannaford

◆ useEncoderWithMatrix()

void useEncoderWithMatrix ( void **  pvParameters)

Variable Documentation

◆ carPosition

int carPosition = 3

◆ currentStateClk

int currentStateClk

◆ digbits

uint8_t digbits[4] = {5, 4, 2, 6}

◆ digddrs

volatile uint8_t* digddrs[4] = {&DDRC, &DDRA, &DDRA, &DDRC}

◆ digports

volatile uint8_t* digports[4] = {&PORTC, &PORTA, &PORTA, &PORTC}

◆ FFT

arduinoFFT FFT = arduinoFFT()

For FFT

◆ i

int i

iterators

◆ j

int j

◆ k

int k

◆ lastRow

int lastRow = B00000000

◆ leds

int leds[8] = {leds0, leds0, leds0, leds0, leds0, leds0, leds0, leds0}

◆ melody

int melody[]
Initial value:
= { 0, 0,
0, NOTE_C7, NOTE_E7, 0,
NOTE_G7, 0, 0, 0,
NOTE_G6, 0, 0, 0,
NOTE_C7, 0, 0, NOTE_G6,
0, 0, NOTE_E6, 0,
0, NOTE_A6, 0, NOTE_B6,
0, NOTE_AS6, NOTE_A6, 0,
0, NOTE_E7, 0, NOTE_C7,
NOTE_D7, NOTE_B6, 0, 0,
NOTE_C7, 0, 0, NOTE_G6,
0, 0, NOTE_E6, 0,
0, NOTE_A6, 0, NOTE_B6,
0, NOTE_AS6, NOTE_A6, 0,
0, NOTE_E7, 0, NOTE_C7,
}
#define NOTE_A6
Definition: lab4_define.h:328
#define NOTE_C7
Definition: lab4_define.h:331
#define NOTE_E6
Definition: lab4_define.h:323
#define NOTE_A7
Definition: lab4_define.h:340
#define NOTE_B6
Definition: lab4_define.h:330
#define NOTE_E7
Definition: lab4_define.h:335
#define NOTE_F7
Definition: lab4_define.h:336
#define NOTE_AS6
Definition: lab4_define.h:329
#define NOTE_G6
Definition: lab4_define.h:326
#define NOTE_D7
Definition: lab4_define.h:333
#define NOTE_G7
Definition: lab4_define.h:338

◆ objects

uint8_t objects[9]
Initial value:
= {B00000000, B10000000, B01000000, B00100000, B00010000,
B00001000, B00000100, B00000010, B00000001}

◆ playDrivingGamehandle

TaskHandle_t playDrivingGamehandle

◆ playMusicEndhandle

TaskHandle_t playMusicEndhandle

◆ playMusichandle

TaskHandle_t playMusichandle

◆ previousStateClk

int previousStateClk

◆ pseudoArray

int pseudoArray[samples]

◆ readButtonshandle

TaskHandle_t readButtonshandle

◆ readRotaryEncoderhandle

TaskHandle_t readRotaryEncoderhandle

◆ restarthandle

TaskHandle_t restarthandle

◆ RT1handle

TaskHandle_t RT1handle

for FREERTOS scheduling

◆ RT2handle

TaskHandle_t RT2handle

◆ RT3handle

TaskHandle_t RT3handle

◆ RT3p0handle

TaskHandle_t RT3p0handle

◆ RT3p1handle

TaskHandle_t RT3p1handle

◆ RT4handle

TaskHandle_t RT4handle

◆ RTtaskshandle

TaskHandle_t RTtaskshandle

◆ samples

const uint16_t samples = 256

◆ samplingFrequency

const double samplingFrequency = 5000

◆ segbits

volatile byte segbits[7] = {7, 0, 5, 3, 1, 6, 7}

for 4 digit seven seg

◆ segddrs

volatile uint8_t* segddrs[7] = {&DDRC, &DDRA, &DDRA, &DDRA, &DDRA, &DDRA, &DDRA}

◆ segports

volatile uint8_t* segports[7] = {&PORTC, &PORTA, &PORTA, &PORTA, &PORTA, &PORTA, &PORTA}

◆ setLedhandle

TaskHandle_t setLedhandle

◆ setLedshandle

TaskHandle_t setLedshandle

◆ signalFrequency

const double signalFrequency = 1000

◆ spidata

byte spidata[16]

for matrix spi

◆ Task_Counterhandle

TaskHandle_t Task_Counterhandle

◆ tempo

int tempo[]
Initial value:
= { 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
9, 9, 9,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
9, 9, 9,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
}

◆ thisNote

int thisNote = 0

◆ thisNoteEnd

int thisNoteEnd = 0

◆ underworld_melody

int underworld_melody[]
Initial value:
= {
0,
0,
0,
0, 0, 0
}
#define NOTE_DS3
Definition: lab4_define.h:286
#define NOTE_F3
Definition: lab4_define.h:288
#define NOTE_E3
Definition: lab4_define.h:287
#define NOTE_AS3
Definition: lab4_define.h:293
#define NOTE_FS4
Definition: lab4_define.h:301
#define NOTE_A4
Definition: lab4_define.h:304
#define NOTE_G3
Definition: lab4_define.h:290
#define NOTE_D4
Definition: lab4_define.h:297
#define NOTE_DS4
Definition: lab4_define.h:298
#define NOTE_C5
Definition: lab4_define.h:307
#define NOTE_A3
Definition: lab4_define.h:292
#define NOTE_D3
Definition: lab4_define.h:285
#define NOTE_B3
Definition: lab4_define.h:294
#define NOTE_AS4
Definition: lab4_define.h:305
#define NOTE_GS4
Definition: lab4_define.h:303
#define NOTE_C4
Definition: lab4_define.h:295
#define NOTE_GS3
Definition: lab4_define.h:291
#define NOTE_CS4
Definition: lab4_define.h:296
#define NOTE_F4
Definition: lab4_define.h:300

◆ underworld_tempo

int underworld_tempo[]
Initial value:
= {
12, 12, 12, 12,
12, 12, 6,
3,
12, 12, 12, 12,
12, 12, 6,
3,
12, 12, 12, 12,
12, 12, 6,
3,
12, 12, 12, 12,
12, 12, 6,
6, 18, 18, 18,
6, 6,
6, 6,
6, 6,
18, 18, 18, 18, 18, 18,
10, 10, 10,
10, 10, 10,
3, 3, 3
}

◆ vImag

double vImag[samples]

◆ vReal

double vReal[samples]