Embedded System Design 2 - Project
pm.c File Reference
#include <em_gpio.h>
#include "pm.h"
#include "delay.h"
#include "pin_mapping.h"

Go to the source code of this file.

Functions

void PM_Init (void)
 
void PM_Enable (PM_SubSystem_t pmss)
 
void PM_Disable (PM_SubSystem_t pmss)
 

Function Documentation

◆ PM_Disable()

void PM_Disable ( PM_SubSystem_t  pmss)

Definition at line 58 of file pm.c.

58  {
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 }
#define PM_RN2483_PIN
Definition: pin_mapping.h:134
#define PM_SENS_EXT_PIN
Definition: pin_mapping.h:136
#define PM_RN2483_PORT
Definition: pin_mapping.h:133
Definition: pm.h:25
Definition: pm.h:27
#define PM_SENS_EXT_PORT
Definition: pin_mapping.h:135
Definition: pm.h:26

◆ PM_Enable()

void PM_Enable ( PM_SubSystem_t  pmss)

Definition at line 33 of file pm.c.

33  {
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 }
#define PM_RN2483_PIN
Definition: pin_mapping.h:134
#define PM_SENS_EXT_PIN
Definition: pin_mapping.h:136
#define PM_RN2483_PORT
Definition: pin_mapping.h:133
Definition: pm.h:25
void delay(uint32_t msDelay)
Wait for a certain amount of milliseconds in EM2/3.
Definition: delay.c:124
Definition: pm.h:27
#define PM_SENS_EXT_PORT
Definition: pin_mapping.h:135
Definition: pm.h:26

◆ PM_Init()

void PM_Init ( void  )

Definition at line 27 of file pm.c.

27  {
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 }
#define PM_RN2483_PIN
Definition: pin_mapping.h:134
#define PM_SENS_EXT_PIN
Definition: pin_mapping.h:136
#define PM_RN2483_PORT
Definition: pin_mapping.h:133
#define PM_SENS_EXT_PORT
Definition: pin_mapping.h:135