Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
sif_ltr303als.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Cascoda, Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
25 #ifndef SIF_LTR303ALS_H
26 #define SIF_LTR303ALS_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /* slave addresses */
33 #define SIF_SAD_LTR303ALS 0x29
34 
35 /* part id and manufacturer id */
36 #define SIF_LTR303ALS_PARTID 0xA0
37 #define SIF_LTR303ALS_MANFID 0x05
38 
39 /* master measurement (read access) modes */
41 {
42  SIF_LTR303ALS_MODE_POLL_ONE_SHOT, /* one-shot conversion - sensor in standby mode otherwise */
43  SIF_LTR303ALS_MODE_CONTINUOUS, /* continuous conversion - sensor always active */
44 };
45 
46 /* measurement mode */
47 #define SIF_LTR303ALS_MODE SIF_LTR303ALS_MODE_POLL_ONE_SHOT
48 
49 /* startup times */
50 #define SIF_LTR303ALS_TSTUP_POWERUP_MS 100 /* startup time [ms] after power-up */
51 #define SIF_LTR303ALS_TSTUP_STANDBY_MS 10 /* startup time [ms] standby to active */
52 
53 /* register addresses */
55 {
71 };
72 
73 /* ALS gain */
75 {
82 };
83 
84 /* ALS integration time [ms] (default 100) */
86 {
95 };
96 
97 /* ALS measurement time (period) [ms] (default 500) */
99 {
106 };
107 
108 /* gain, measurement time and integration period default setting */
109 #define SIF_LTR303ALS_GAIN LTR303ALS_GAIN_1X
110 #define SIF_LTR303ALS_TINT LTR303ALS_TINT_100
111 #define SIF_LTR303ALS_TMEAS LTR303ALS_TMEAS_200
112 
113 /* functions */
114 
115 /******************************************************************************/
116 /***************************************************************************/
122 u8_t SIF_LTR303ALS_Initialise(void); /* initialise sensor, shutdown mode */
123 
124 /******************************************************************************/
125 /***************************************************************************/
135 u8_t SIF_LTR303ALS_Configure(u8_t gain, u8_t tint, u8_t tmeas); /* configure sensor */
136 
137 /******************************************************************************/
138 /***************************************************************************/
147 u8_t SIF_LTR303ALS_ReadLight(u16_t *ch0, u16_t *ch1); /* measure light */
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
157 #endif // SIF_LTR303ALS_H
sif_ltr303als_reg_address
Definition: ambient8_click.h:72
unsigned char u8_t
Definition: cascoda_types.h:46
unsigned short u16_t
Definition: cascoda_types.h:48
sif_ltr303als_tint
Definition: sif_ltr303als.h:86
u8_t SIF_LTR303ALS_ReadLight(u16_t *ch0, u16_t *ch1)
LTR303ALS: Read Light Measurement.
Definition: sif_ltr303als.c:170
sif_ltr303als_tmeas
Definition: sif_ltr303als.h:99
u8_t SIF_LTR303ALS_Initialise(void)
LTR303ALS: Initialise Sensor.
Definition: sif_ltr303als.c:108
sif_ltr303als_gain
Definition: sif_ltr303als.h:75
sif_ltr303als_mode
Definition: sif_ltr303als.h:41
u8_t SIF_LTR303ALS_Configure(u8_t gain, u8_t tint, u8_t tmeas)
LTR303ALS: Configure Sensor.
Definition: sif_ltr303als.c:150
@ LTR303ALS_TINT_150
Definition: sif_ltr303als.h:89
@ LTR303ALS_TINT_200
Definition: sif_ltr303als.h:90
@ LTR303ALS_TINT_50
Definition: sif_ltr303als.h:87
@ LTR303ALS_TINT_250
Definition: sif_ltr303als.h:91
@ LTR303ALS_TINT_350
Definition: sif_ltr303als.h:93
@ LTR303ALS_TINT_300
Definition: sif_ltr303als.h:92
@ LTR303ALS_TINT_100
Definition: sif_ltr303als.h:88
@ LTR303ALS_TINT_400
Definition: sif_ltr303als.h:94
@ REG_LTR303ALS_THRES_UP_1
Definition: sif_ltr303als.h:67
@ REG_LTR303ALS_STATUS
Definition: sif_ltr303als.h:64
@ REG_LTR303ALS_DATA_CH0_0
Definition: sif_ltr303als.h:62
@ REG_LTR303ALS_THRES_LOW_0
Definition: sif_ltr303als.h:68
@ REG_LTR303ALS_PART_ID
Definition: sif_ltr303als.h:58
@ REG_LTR303ALS_INTERRUPT
Definition: sif_ltr303als.h:65
@ REG_LTR303ALS_MEAS_RATE
Definition: sif_ltr303als.h:57
@ REG_LTR303ALS_MANUFAC_ID
Definition: sif_ltr303als.h:59
@ REG_LTR303ALS_DATA_CH1_0
Definition: sif_ltr303als.h:60
@ REG_LTR303ALS_CONTR
Definition: sif_ltr303als.h:56
@ REG_LTR303ALS_DATA_CH1_1
Definition: sif_ltr303als.h:61
@ REG_LTR303ALS_THRES_LOW_1
Definition: sif_ltr303als.h:69
@ REG_LTR303ALS_INT_PERS
Definition: sif_ltr303als.h:70
@ REG_LTR303ALS_DATA_CH0_1
Definition: sif_ltr303als.h:63
@ REG_LTR303ALS_THRES_UP_0
Definition: sif_ltr303als.h:66
@ LTR303ALS_TMEAS_50
Definition: sif_ltr303als.h:100
@ LTR303ALS_TMEAS_500
Definition: sif_ltr303als.h:103
@ LTR303ALS_TMEAS_200
Definition: sif_ltr303als.h:102
@ LTR303ALS_TMEAS_100
Definition: sif_ltr303als.h:101
@ LTR303ALS_TMEAS_2000
Definition: sif_ltr303als.h:105
@ LTR303ALS_TMEAS_1000
Definition: sif_ltr303als.h:104
@ LTR303ALS_GAIN_1X
Definition: sif_ltr303als.h:76
@ LTR303ALS_GAIN_48X
Definition: sif_ltr303als.h:80
@ LTR303ALS_GAIN_2X
Definition: sif_ltr303als.h:77
@ LTR303ALS_GAIN_4X
Definition: sif_ltr303als.h:78
@ LTR303ALS_GAIN_96X
Definition: sif_ltr303als.h:81
@ LTR303ALS_GAIN_8X
Definition: sif_ltr303als.h:79
@ SIF_LTR303ALS_MODE_POLL_ONE_SHOT
Definition: sif_ltr303als.h:42
@ SIF_LTR303ALS_MODE_CONTINUOUS
Definition: sif_ltr303als.h:43