Project

General

Profile

Statistics
| Branch: | Revision:

pse-2015-16-grupo-3 / tpf / io.c @ e433afbc

History | View | Annotate | Download (1.96 KB)

1
/* 
2
 * File:   io.c
3
 * Author: gustavobica
4
 *
5
 * Created on 02 November 2015, 16:49
6
 */
7

    
8
#include <stdio.h>
9
#include <stdlib.h>
10
#include "config.h"
11
#include <wiringPi.h>
12
/*
13
 * 
14
 */
15

    
16

    
17
    
18
    uint8_t turnOnLight(){
19
        digitalWrite (INSIDE_LIGHT, HIGH) ;
20
        return 0;
21
    }
22
    uint8_t turnOffLight(){
23
        digitalWrite(INSIDE_LIGHT,LOW);
24
        return 0;
25
    }
26
     uint8_t turnOffMegatron(){
27
        digitalWrite(WAVE_LED,LOW);
28
        return 0;
29
    }
30
     uint8_t turnOnMegatron(){
31
        digitalWrite(WAVE_LED,HIGH);
32
        return 0;
33
    }
34
    uint8_t IsDoorOpen(uint8_t* state){
35
        
36
        
37
        if(digitalRead(DOOR_SWITCH)==HIGH)
38
        {
39
            *state=1;
40
            
41
        }else{
42
            *state=0;
43
        }
44
        return 0;
45
    }
46
    uint8_t getONOFFSwitch(uint8_t* state){
47
        
48
         if(digitalRead(ON_OFF_SWITCH)==HIGH)
49
        {
50
            *state=1;
51
            
52
        }else{
53
            *state=0;
54
        }
55
        return 0;
56
    }
57
    
58
    uint8_t turnOnPower(uint8_t* state){
59
        *state=1;
60
        return 0;
61
    }
62
    uint8_t turnOffPower(uint8_t* state){
63
        *state=0;
64
        return 0;
65
    }
66
    uint8_t getTemperatureSwitch(uint8_t* state){
67
        
68
         if(digitalRead(TEMPERATURE_SWITCH)==HIGH)
69
        {
70
            *state=1;
71
            
72
        }else{
73
            *state=0;
74
        }
75
        return 0;
76
    }
77
    
78
     
79
uint8_t getPlusButton(uint8_t* state){  
80
    
81
    if(digitalRead(PLUS_BTN)==HIGH)
82
        {
83
            *state=1;
84
            
85
        }else{
86
            *state=0;
87
        }
88
        return 0;
89

    
90
}
91

    
92
uint8_t getMinusButton(uint8_t* state){
93
    
94
    if(digitalRead(MINUS_BTN)==HIGH)
95
        {
96
            *state=1;
97
            
98
        }else{
99
            *state=0;
100
        }
101
        return 0;
102
}
103

    
104
uint8_t getStartStop(uint8_t* state)
105
{
106
     if(digitalRead(START_STOP)==HIGH)
107
        {
108
            *state=1;
109
            
110
        }else{
111
            *state=0;
112
        }
113
        return 0;
114

    
115
}
116
    
117
    
118
    
119
    
120
    
121
   
122