Contiki 3.x
leds-arch.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Zolertia - http://www.zolertia.com
3  * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30  * OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /**
33  * \addtogroup zoul
34  * @{
35  *
36  * \defgroup zoul-leds Zoul LED driver
37  *
38  * LED driver implementation for the Zoul-based platforms
39  * @{
40  *
41  * \file
42  * LED driver implementation for the Zoul-based platforms
43  */
44 #include "contiki.h"
45 #include "reg.h"
46 #include "dev/leds.h"
47 #include "dev/ioc.h"
48 #include "dev/gpio.h"
49 /*---------------------------------------------------------------------------*/
50 #define LEDS_GPIO_PIN_MASK LEDS_ALL
51 /*---------------------------------------------------------------------------*/
52 void
54 {
55  GPIO_SET_OUTPUT(GPIO_D_BASE, LEDS_GPIO_PIN_MASK);
56 
57  int i;
58  for (i = 0; i < 8; i++) {
59  if (LEDS_GPIO_PIN_MASK & (1 << i)) {
61  }
62  }
63 }
64 /*---------------------------------------------------------------------------*/
65 unsigned char
66 leds_arch_get(void)
67 {
68  return GPIO_READ_PIN(GPIO_D_BASE, LEDS_GPIO_PIN_MASK);
69 }
70 /*---------------------------------------------------------------------------*/
71 void
72 leds_arch_set(unsigned char leds)
73 {
74  GPIO_WRITE_PIN(GPIO_D_BASE, LEDS_GPIO_PIN_MASK, leds);
75 }
76 /*---------------------------------------------------------------------------*/
77 
78 /**
79  * @}
80  * @}
81  */
Header file with register manipulation macro definitions.
#define IOC_OVERRIDE_OE
Output Enable.
Definition: ioc.h:222
#define GPIO_D_NUM
GPIO_D: 3.
Definition: gpio.h:82
#define GPIO_READ_PIN(PORT_BASE, PIN_MASK)
Read pins with PIN_MASK of port with PORT_BASE.
Definition: gpio.h:148
#define GPIO_WRITE_PIN(PORT_BASE, PIN_MASK, value)
Set pins with PIN_MASK of port with PORT_BASE to value.
Definition: gpio.h:135
#define GPIO_SET_OUTPUT(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to output.
Definition: gpio.h:100
Header file with declarations for the I/O Control module.
void leds_arch_init(void)
Leds implementation.
Definition: leds-arch.c:48
#define GPIO_D_BASE
GPIO_D.
Definition: gpio.h:73
void ioc_set_over(uint8_t port, uint8_t pin, uint8_t over)
Set Port:Pin override function.
Definition: ioc.c:54