Project

General

Profile

Statistics
| Branch: | Revision:

pse-2015-16-grupo-3 / tpf / config.c @ 687e9f18

History | View | Annotate | Download (2.58 KB)

1
/*
2
 * blink.c:
3
 *        Standard "blink" program in wiringPi. Blinks an LED connected
4
 *        to the first GPIO pin.
5
 *
6
 * Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
7
 ***********************************************************************
8
 * This file is part of wiringPi:
9
 *        https://projects.drogon.net/raspberry-pi/wiringpi/
10
 *
11
 *    wiringPi is free software: you can redistribute it and/or modify
12
 *    it under the terms of the GNU Lesser General Public License as published by
13
 *    the Free Software Foundation, either version 3 of the License, or
14
 *    (at your option) any later version.
15
 *
16
 *    wiringPi is distributed in the hope that it will be useful,
17
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 *    GNU Lesser General Public License for more details.
20
 *
21
 *    You should have received a copy of the GNU Lesser General Public License
22
 *    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
23
 ***********************************************************************
24
 */
25

    
26
#include <stdio.h>
27
#include <stdint.h>
28
#include <wiringPi.h>
29
#include <lcd.h>
30
#include "config.h"
31

    
32
static int lcdHandler = -99;
33

    
34
uint8_t initBoard(){
35
    
36
    wiringPiSetup () ;
37
    
38
    /**
39
     * inputs
40
     */
41
    //power button
42
    pinMode (POWER_BTN, INPUT);
43
    //time button
44
    pinMode (TIME_BTN, INPUT);
45
    //+ button
46
    pinMode (PLUS_BTN, INPUT);
47
    //- button
48
    pinMode (MINUS_BTN, INPUT);
49
    //door switch (open/closed)
50
    pinMode (DOOR_SWITCH, INPUT);
51
    //on/off switch
52
    pinMode (ON_OFF_SWITCH, INPUT);
53
    
54
    /**
55
     * outputs 
56
     */
57
    //magnetron resistor
58
    pinMode (WAVE_LED, OUTPUT);
59
    //light inside the hoven
60
    pinMode(INSIDE_LIGHT, OUTPUT);
61
    
62
    //if using 7_SEGMENT display
63
#ifndef LCD_NOT_SEG
64
    
65
    pinMode (7_SEG_DIS0, OUTPUT);
66
    pinMode (7_SEG_DIS1, OUTPUT);
67
    pinMode (7_SEG_DIS2, OUTPUT);
68
    pinMode (7_SEG_DIS3, OUTPUT);
69
    pinMode (7_SEG_S0, OUTPUT);
70
    pinMode (7_SEG_S1, OUTPUT);
71
    pinMode (7_SEG_S2, OUTPUT);
72
    pinMode (7_SEG_S3, OUTPUT);
73
    pinMode (7_SEG_S4, OUTPUT);
74
    pinMode (7_SEG_S5, OUTPUT);
75
    pinMode (7_SEG_S6, OUTPUT);
76
    
77
#endif
78
    
79
#ifdef LCD_NOT_SEG
80
    
81
    lcdHandler = lcdInit (LCD_PIN0, LCD_PIN1, LCD_PIN2, LCD_PIN3, LCD_PIN4, LCD_PIN5, LCD_PIN6, LCD_PIN7, LCD_PIN8, 0, 0, 0, 0) ;
82
    
83
#endif
84
    
85
    return 0;
86
    
87
}
88

    
89
uint8_t getLCDHandler(int* LCDHandl)
90
{
91
    uint8_t result;
92
    
93
    if(lcdHandler == -99)
94
    {
95
        result = -1;
96
    }
97
    else
98
    {
99
        *LCDHandl = lcdHandler;
100
        result = 0;
101
    }
102
    
103
    return result;
104
}
105