-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsgeq7.h
executable file
·65 lines (54 loc) · 1.04 KB
/
msgeq7.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// msgeq7.h
//
//
// Created by Drew Dunne on 4/29/17.
//
//
#ifndef msgeq7_h
#define msgeq7_h
#include "analog.h"
#include "gpio.h"
#include <fsl_clock_manager.h>
#include <stdio.h>
#define CHIP_LETTER C
#define CHIP_STROBE_PIN 17
#define CHIP_RESET_PIN 16
#define FREQ_ALPHA 10
/**
* BANDS: 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz, 16kHz
*/
/**
* State machine states for reading from the MSGEQ7 chip
*/
typedef enum MSGEQ7_state {
RESET_ON,
RESET_OFF,
STROBE_ON,
STROBE_OFF,
READ
} ReadState;
/**
* State of the MSGEQ7 chip
* Holds the previously read data for each band
* Holds the next state in the state machine
* And holds the next band to read
*/
typedef struct MSGEQ7 {
uint16_t data[7];
ReadState readState;
uint8_t index;
} MSGEQ7_t;
/**
* Inits the chip data to 0.
*/
void initMSGEQ7(MSGEQ7_t *chip);
/**
* Sets up and starts the timers to begin analog read in of data
*/
void beginMSGEQ7(MSGEQ7_t *chip);
/**
* Stops the timers and data reads.
*/
void endMSGEQ7(MSGEQ7_t *chip);
#endif /* msgeq7_h */