-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
70 lines (56 loc) · 1.48 KB
/
main.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
66
67
68
69
70
/*
* main.h
*
* Created on: Oct 5, 2014
* Author: Lab
*/
#ifndef MAIN_H_
#define MAIN_H_
#include "nrf24l01.h"
#include "spi.h"
#include "adg731.h"
// ADC sampling frequency
#define SAMPLE_FREQ 20000UL
// Buffer modes
#define MODE_A 0
#define MODE_B 1
#define NUM_CHANNEL 2
#define WINDOW_SIZE 256
// Define pin to LED color mapping.
#define LED_0 GPIO_PIN_0
#define LED_1 GPIO_PIN_1
#define LED_2 GPIO_PIN_2
#define LED_3 GPIO_PIN_3
// Function prototypes
void ConfigureUART(void);
void IRQInterruptHandler(void);
void TimerIntHandler(void);
void IRQInitialize(void);
void ConfigureTimer(void);
void BufferInit(void);
// Global variables
// Ping Pong buffers for ADC
unsigned char **bufferA;
unsigned char **bufferB;
//unsigned char bufferA[NUM_CHANNEL][WINDOW_SIZE];
//unsigned char bufferB[NUM_CHANNEL][WINDOW_SIZE];
// Buffers for RF RX and TX
uint8_t ui8TxBuffer[MAX_PLOAD];
uint8_t ui8RxBuffer[MAX_PLOAD];
// configuration parameters
volatile uint8_t ui32NumOfChannels;
volatile uint32_t ui32WindowSize;
volatile uint32_t ui32SamplingFrequency;
volatile uint8_t ui32BufferMode;
volatile uint32_t ui32GainSetting;
// Channels to sample from
volatile uint8_t *channelIndex;
// Flag indicating if initial parameters have been received
volatile bool isConfigured;
// Flag indicating transfer window
volatile bool transmitOn;
// Flag indicating current packet has been transferred
volatile bool RFPacketSent;
volatile bool BufferAEmpty;
volatile bool BufferBEmpty;
#endif /* MAIN_H_ */