Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
light-ziglet.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010, Swedish Institute of Computer Science.
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
* \file
35
* Device drivers header file for light ziglet sensor in Zolertia Z1 WSN Platform.
36
* \author
37
* Antonio Lignan, Zolertia <alinan@zolertia.com>
38
* Marcus Lundén, SICS <mlunden@sics.se>
39
*/
40
41
#ifndef LIGHT_ZIGLET_H_
42
#define LIGHT_ZIGLET_H_
43
#include <stdio.h>
44
#include "
i2cmaster.h
"
45
46
/* Init the light ziglet sensor: ports, pins, I2C, interrupts */
47
void
light_ziglet_init(
void
);
48
49
/* Write to a register.
50
args:
51
reg register to write to
52
val value to write
53
*/
54
void
tsl2563_write_reg(uint8_t reg, uint16_t val);
55
56
/* Read one register.
57
args:
58
reg what register to read
59
returns the value of the read register
60
*/
61
uint16_t tsl2563_read_reg(uint8_t reg);
62
63
/* Takes a single light reading
64
args: none
65
returns a lux value
66
*/
67
uint16_t light_ziglet_read();
68
69
/* Calculates the lux values from the calibration table
70
args: raw values from sensor
71
returns a lux value
72
*/
73
uint16_t calculateLux(uint16_t *readRaw);
74
75
/* Turns the light ziglet ON and polls the sensor for a light reading */
76
uint16_t light_ziglet_on(
void
);
77
78
/* -------------------------------------------------------------------------- */
79
/* Reference definitions */
80
81
/* TSL2563 slave address */
82
#define TSL2563_ADDR 0x39
83
84
/* Registers */
85
#define TSL2563_READ 0xAC
86
#define TSL2563_PWRN 0x03
87
88
/* Calibration settings */
89
#define K1T 0X0040
90
#define B1T 0x01f2
91
#define M1T 0x01b2
92
93
#define K2T 0x0080
94
#define B2T 0x0214
95
#define M2T 0x02d1
96
97
#define K3T 0x00c0
98
#define B3T 0x023f
99
#define M3T 0x037b
100
101
#define K4T 0x0100
102
#define B4T 0x0270
103
#define M4T 0x03fe
104
105
#define K5T 0x0138
106
#define B5T 0x016f
107
#define M5T 0x01fc
108
109
#define K6T 0x019a
110
#define B6T 0x00d2
111
#define M6T 0x00fb
112
113
#define K7T 0x029a
114
#define B7T 0x0018
115
#define M7T 0x0012
116
117
#define K8T 0x029a
118
#define B8T 0x0000
119
#define M8T 0x0000
120
121
/* -------------------------------------------------------------------------- */
122
#endif
/* ifndef LIGHT_ZIGLET_H_ */
123
i2cmaster.h
I2C communication device driver header file for Zolertia Z1 sensor node.
arch
platform
z1
dev
light-ziglet.h
Generated on
for Contiki-NG by
1.17.0