Contiki-NG
ac-dimmer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016, Zolertia - http://www.zolertia.com
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the Institute nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * This file is part of the Contiki operating system.
30 *
31 */
32/*---------------------------------------------------------------------------*/
33/**
34 * \addtogroup zoul-sensors
35 * @{
36 *
37 * \defgroup zoul-ac-dimmer AC light dimmer with zero-crossing driver
38 *
39 * Driver for an AC light dimmer with zero-crossing driver
40 * @{
41 *
42 * \file
43 * Header file for an AC light dimmer with zero-crossing driver
44 */
45/*---------------------------------------------------------------------------*/
46#ifndef AC_DIMMER_H_
47#define AC_DIMMER_H_
48/* -------------------------------------------------------------------------- */
49/**
50 * \name AC dimmer default pins, ports and interrupt vector
51 * @{
52 */
53#ifdef DIMMER_SYNC_CONF_PIN
54#define DIMMER_SYNC_PIN DIMMER_SYNC_CONF_PIN
55#else
56#define DIMMER_SYNC_PIN 5
57#endif
58#ifdef DIMMER_SYNC_CONF_PORT
59#define DIMMER_SYNC_PORT DIMMER_SYNC_CONF_PORT
60#else
61#define DIMMER_SYNC_PORT GPIO_A_NUM
62#endif
63#ifdef DIMMER_GATE_CONF_PIN
64#define DIMMER_GATE_PIN DIMMER_GATE_CONF_PIN
65#else
66#define DIMMER_GATE_PIN 4
67#endif
68#ifdef DIMMER_GATE_CONF_PORT
69#define DIMMER_GATE_PORT DIMMER_GATE_CONF_PORT
70#else
71#define DIMMER_GATE_PORT GPIO_A_NUM
72#endif
73#ifdef DIMMER_CONF_INT_VECTOR
74#define DIMMER_INT_VECTOR DIMMER_CONF_INT_VECTOR
75#else
76#define DIMMER_INT_VECTOR GPIO_A_IRQn
77#endif
78/** @} */
79/* -------------------------------------------------------------------------- */
80/**
81 * \name AC dimmer values
82 * @{
83 */
84#define DIMMER_DEFAULT_START_VALUE 50
85#define DIMMER_DEFAULT_GATE_PULSE_US 15
86#define DIMMER_DEFAULT_MIN_DIMM_VALUE 10
87#define DIMMER_DEFAULT_MAX_DIMM_VALUE 80
88/** @} */
89/* -------------------------------------------------------------------------- */
90/**
91 * \name AC dimmer return types
92 * @{
93 */
94#define DIMMER_ERROR (-1)
95#define DIMMER_SUCCESS 0x00
96/** @} */
97/* -------------------------------------------------------------------------- */
98#define AC_DIMMER_ACTUATOR "AC light dimmer zero-cross"
99/* -------------------------------------------------------------------------- */
100extern const struct sensors_sensor ac_dimmer;
101/* -------------------------------------------------------------------------- */
102/* -------------------------------------------------------------------------- */
103#endif /* RELAY_H_ */
104/* -------------------------------------------------------------------------- */
105/**
106 * @}
107 * @}
108 */