forked from AeroZealous4/Wireless-control-of-home-appliances
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplug.c
More file actions
60 lines (51 loc) · 1.38 KB
/
plug.c
File metadata and controls
60 lines (51 loc) · 1.38 KB
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
/**
* \file plug.c
* \ingroup WiControl
* \brief Driver for controlling two plugs.
* \author Akshay Pampatwar
* \version 0.0
* \date 15th April 2020
*/
#include "plug.h"
#include <stdint.h>
#include <stdbool.h>
#include "inc/tm4c123gh6pm.h"
#include "inc/hw_ints.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "pinmap.h"
//void plug1_init(void);
//void plug2_init(void);
void Plug_Init()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
//* * * * * * Setting Ouput for plug1 * * * * * * * *
GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, Plug1_Op);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, Plug1_State);
// * * * * * * Setting Ouput for plug2* * * * * * *
GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, Plug2_Op);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, Plug2_State);
}
void Plug1on()
{
GPIOPinWrite(GPIO_PORTC_BASE,(Plug1_Op),Plug1_Op);
GPIOPinWrite(GPIO_PORTF_BASE,(Plug1_State),Plug1_State);
}
void Plug1off()
{
GPIOPinWrite(GPIO_PORTC_BASE,(Plug1_Op),~Plug1_Op);
GPIOPinWrite(GPIO_PORTF_BASE,(Plug1_State),~Plug1_State);
}
void Plug2on()
{
GPIOPinWrite(GPIO_PORTC_BASE,(Plug2_Op),Plug2_Op);
GPIOPinWrite(GPIO_PORTF_BASE,(Plug2_State),Plug2_State);
}
void Plug2off()
{
GPIOPinWrite(GPIO_PORTC_BASE,(Plug2_Op),~Plug2_Op);
GPIOPinWrite(GPIO_PORTF_BASE,(Plug2_State),~Plug2_State);
}