-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.h
65 lines (57 loc) · 1.82 KB
/
init.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
/**
*@file init.h
*@author Dirk Dubois, Alain Slak
*@date February 6th, 2013
*@brief A set of functions that intialize the user button LEDs and temperature sensor.
*
*/
#ifndef __INIT_H
#define __INIT_H
/*Includes*/
#include <stdint.h>
/*Defines*/
/**@defgroup TIM3_SCALERS
*@{
*/
#define PRESCALER 41999 /**<A prescaler value for TIM3*/
#define PERIOD 19 /**<A period value for TIM3*/
/**
*@}
*/
/**
* @brief An intialization funtion for the IO Ports.
* This function sets pins 12-15 as outputs on GPIOD to drive STM32FDiscovery boards LEDS.
* It also sets pin 0 as input on GPIOA, with weak pull down, for active high user button
* on STM32FDiscovery board.
* @note In order for GPIO banks A & D to function correctly, their peripheral clocks are enabled.
* @retval None
*/
void initIO(void);
/**
* @brief A initialzation function for the ADC on channel 16 for built in temp sensor.
* The following function initializes the ADC, without interupts, DMA, or continous scanning,
* for use with the built in temperature sensor on ADC channel 16. The data is right aligned, and
* the resolution is set to 12 bits.
* @note The software convertion is started in this function, activating sampling right after this function returns.
* @note In order for the ADC to function correctly, its peripheral clock is enabled.
* @retval None
*/
void initTempADC(void);
/**
*@brief A function that intilizes Timer3 for use with the acclerometer.
*The timer will trip an interupt every 10 ms for a rate of 100Hz. This function
*enables the NVIC and sets TIM3 to a subpriority of 0 with a preemption priority of 0.
*@retval None
*/
void initTim3(void);
/**
*@brief A function that intializes DMA for use with the accelerometer.
*@retval None
*/
void initDMA(void);
/**
*@brief A function that enables EXTI for the button
*@retval None
*/
void initEXTIButton(void);
#endif