Contiki-NG
Macros | Functions

Driver for the Sensortag OPT-3001 light sensor. More...

#include "contiki.h"
#include "lib/sensors.h"
#include "sys/ctimer.h"
#include "board-conf.h"
#include "opt-3001-sensor.h"
#include <Board.h>
#include <ti/drivers/I2C.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>

Go to the source code of this file.

Macros

#define CFG_RN   0x00F0
 [15..12] Range Number
 
#define CFG_CT   0x0008
 [11] Conversion Time
 
#define CFG_M   0x0006
 [10..9] Mode of Conversion
 
#define CFG_OVF   0x0001
 [8] Overflow
 
#define CFG_CRF   0x8000
 [7] Conversion Ready Field
 
#define CFG_FH   0x4000
 [6] Flag High
 
#define CFG_FL   0x2000
 [5] Flag Low
 
#define CFG_L   0x1000
 [4] Latch
 
#define CFG_POL   0x0800
 [3] Polarity
 
#define CFG_ME   0x0400
 [2] Mask Exponent
 
#define CFG_FC   0x0300
 [1..0] Fault Count
 

Functions

static bool i2c_write_read (void *wbuf, size_t wcount, void *rbuf, size_t rcount)
 Setup and peform an I2C transaction. More...
 
static bool i2c_write (void *wbuf, size_t wcount)
 Peform a write only I2C transaction. More...
 
static bool i2c_read (void *rbuf, size_t rcount)
 Peform a read only I2C transaction. More...
 
static bool sensor_init (void)
 Initialize the OPT-3001 sensor driver. More...
 
static bool sensor_enable (bool enable)
 Turn the sensor on/off. More...
 
static void notify_ready_cb (void *unused)
 Callback when sensor is ready to read data from.
 
static int value (int type)
 Returns a reading from the sensor. More...
 
static int configure (int type, int enable)
 Configuration function for the OPT3001 sensor. More...
 
static int status (int type)
 Returns the status of the sensor. More...
 

Detailed Description

Driver for the Sensortag OPT-3001 light sensor.

Author
Edvard Pettersen e.pet.nosp@m.ters.nosp@m.en@ti.nosp@m..com

Definition in file opt-3001-sensor.c.