Embedded System Design 2 - Project
pm.c
Go to the documentation of this file.
1
/* ____ ____ _ __ __ ____ ___
2
* | _ \| _ \ / \ | \/ |/ ___/ _ \
3
* | | | | |_) | / _ \ | |\/| | | | | | |
4
* | |_| | _ < / ___ \| | | | |__| |_| |
5
* |____/|_| \_\/_/ \_\_| |_|\____\___/
6
* research group
7
* dramco.be/
8
*
9
* KU Leuven - Technology Campus Gent,
10
* Gebroeders De Smetstraat 1,
11
* B-9000 Gent, Belgium
12
*
13
* File: pm.c
14
* Created: 2018-03-21
15
* Author: Geoffrey Ottoy
16
*
17
* Description: Power management functions. Allows you to enable/disable
18
* certain subsystems of the LoRa extension board.
19
*/
20
21
#include <em_gpio.h>
22
23
#include "
pm.h
"
/* Corresponding header file */
24
#include "
delay.h
"
/* Delay functionality */
25
#include "
pin_mapping.h
"
/* PORT and PIN definitions */
26
27
void
PM_Init
(
void
){
28
//GPIO_PinModeSet(PM_SENS_GECKO_PORT, PM_SENS_GECKO_PIN, gpioModePushPull, 0);
29
GPIO_PinModeSet(
PM_SENS_EXT_PORT
,
PM_SENS_EXT_PIN
, gpioModePushPull, 0);
30
GPIO_PinModeSet(
PM_RN2483_PORT
,
PM_RN2483_PIN
, gpioModePushPull, 0);
31
}
32
33
void
PM_Enable
(
PM_SubSystem_t
pmss){
34
switch
(pmss){
35
case
PM_SENS_GECKO
: {
36
//GPIO_PinOutSet(PM_SENS_GECKO_PORT, PM_SENS_GECKO_PIN);
37
//DelayMs(40); /* Give sensor time to power up */
38
}
break
;
39
case
PM_SENS_EXT
: {
40
GPIO_PinOutSet(
PM_SENS_EXT_PORT
,
PM_SENS_EXT_PIN
);
41
delay
(40);
/* Give sensor time to power up */
42
}
break
;
43
case
PM_RN2483
: {
44
GPIO_PinOutSet(
PM_RN2483_PORT
,
PM_RN2483_PIN
);
45
}
break
;
46
case
PM_ALL
: {
47
//GPIO_PinOutSet(PM_SENS_GECKO_PORT, PM_SENS_GECKO_PIN);
48
GPIO_PinOutSet(
PM_SENS_EXT_PORT
,
PM_SENS_EXT_PIN
);
49
delay
(40);
/* Give sensor time to power up */
50
GPIO_PinOutSet(
PM_RN2483_PORT
,
PM_RN2483_PIN
);
51
}
break
;
52
default
: {
53
return
;
54
}
55
}
56
}
57
58
void
PM_Disable
(
PM_SubSystem_t
pmss){
59
switch
(pmss){
60
case
PM_SENS_GECKO
: {
61
//GPIO_PinOutClear(PM_SENS_GECKO_PORT, PM_SENS_GECKO_PIN);
62
}
break
;
63
case
PM_SENS_EXT
: {
64
GPIO_PinOutClear(
PM_SENS_EXT_PORT
,
PM_SENS_EXT_PIN
);
65
}
break
;
66
case
PM_RN2483
: {
67
GPIO_PinOutClear(
PM_RN2483_PORT
,
PM_RN2483_PIN
);
68
}
break
;
69
case
PM_ALL
: {
70
//GPIO_PinOutClear(PM_SENS_GECKO_PORT, PM_SENS_GECKO_PIN);
71
GPIO_PinOutClear(
PM_SENS_EXT_PORT
,
PM_SENS_EXT_PIN
);
72
GPIO_PinOutClear(
PM_RN2483_PORT
,
PM_RN2483_PIN
);
73
}
break
;
74
default
: {
75
}
break
;
76
}
77
}
PM_Enable
void PM_Enable(PM_SubSystem_t pmss)
Definition:
pm.c:33
PM_RN2483_PIN
#define PM_RN2483_PIN
Definition:
pin_mapping.h:134
PM_SENS_EXT_PIN
#define PM_SENS_EXT_PIN
Definition:
pin_mapping.h:136
PM_SubSystem_t
enum PM_subsystems PM_SubSystem_t
pm.h
PM_Init
void PM_Init(void)
Definition:
pm.c:27
PM_RN2483_PORT
#define PM_RN2483_PORT
Definition:
pin_mapping.h:133
PM_Disable
void PM_Disable(PM_SubSystem_t pmss)
Definition:
pm.c:58
pin_mapping.h
The pin definitions for the regular and custom Happy Gecko board.
delay.h
Delay functionality.
PM_SENS_EXT
Definition:
pm.h:25
delay
void delay(uint32_t msDelay)
Wait for a certain amount of milliseconds in EM2/3.
Definition:
delay.c:124
PM_SENS_GECKO
Definition:
pm.h:24
PM_ALL
Definition:
pm.h:27
PM_SENS_EXT_PORT
#define PM_SENS_EXT_PORT
Definition:
pin_mapping.h:135
PM_RN2483
Definition:
pm.h:26
EFM32HG-Embedded2-project
lora
pm.c
Generated on Sun Dec 8 2019 14:48:10 for Embedded System Design 2 - Project by
1.8.13