Rohm / rohm-bh1790glc-driver

Dependents:   rohm-bh1790glc-hello rohm-SensorShield-example ECE568_Project2_Final

Fork of BH1790GLC by Hideki Tanaka

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers bh1790glc_registers.h Source File

bh1790glc_registers.h

00001 /*
00002 The MIT License (MIT)
00003 Copyright (c) 2017 Rohm Semiconductor
00004 
00005 Permission is hereby granted, free of charge, to any person obtaining a
00006 copy of this software and associated documentation files (the
00007 "Software"), to deal in the Software without restriction, including
00008 without limitation the rights to use, copy, modify, merge, publish,
00009 distribute, sublicense, and/or sell copies of the Software, and to
00010 permit persons to whom the Software is furnished to do so, subject to
00011 the following conditions:
00012 
00013 The above copyright notice and this permission notice shall be included
00014 in all copies or substantial portions of the Software.
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00017 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00018 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00019 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00020 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00021 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00022 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023 */
00024 
00025 #ifndef __BH1790GLC_REGISTERS_H__
00026 #define __BH1790GLC_REGISTERS_H__
00027 /* registers */
00028 #define BH1790GLC_REGISTER_DUMP_START 0x0F
00029 #define BH1790GLC_MANUFACTURER_ID 0x0F
00030 #define BH1790GLC_PART_ID 0x10
00031 // Soft reset
00032 #define BH1790GLC_RESET 0x40
00033 // System control setting
00034 #define BH1790GLC_MEAS_CONTROL1 0x41
00035 // Measurement control setting
00036 #define BH1790GLC_MEAS_CONTROL2 0x42
00037 // Measurement start
00038 #define BH1790GLC_MEAS_START 0x43
00039 #define BH1790GLC_DATAOUT_LEDOFF_L 0x54
00040 #define BH1790GLC_DATAOUT_LEDOFF_H 0x55
00041 #define BH1790GLC_DATAOUT_LEDON_L 0x56
00042 // Restarts measurement.
00043 #define BH1790GLC_DATAOUT_LEDON_H 0x57
00044 #define BH1790GLC_REGISTER_DUMP_END 0x57
00045 /* registers bits */
00046 // WHO_AM_I -value
00047 #define BH1790GLC_PART_ID_WIA_ID (0x0D << 0)
00048 // 1 : Software reset is performed
00049 #define BH1790GLC_RESET_SWRESET (0x01 << 7)
00050 // OSC block is inactive
00051 #define BH1790GLC_MEAS_CONTROL1_RDY_DISABLE (0x00 << 7)
00052 // OSC block is active
00053 #define BH1790GLC_MEAS_CONTROL1_RDY_ENABLE (0x01 << 7)
00054 #define BH1790GLC_MEAS_CONTROL1_LED_LIGHTING_FREQ_128HZ (0x00 << 2)
00055 #define BH1790GLC_MEAS_CONTROL1_LED_LIGHTING_FREQ_64HZ (0x01 << 2)
00056 #define BH1790GLC_MEAS_CONTROL1_RCYCLE_PROHIBITED1 (0x00 << 0)
00057 #define BH1790GLC_MEAS_CONTROL1_RCYCLE_64HZ (0x01 << 0)
00058 #define BH1790GLC_MEAS_CONTROL1_RCYCLE_32HZ (0x02 << 0)
00059 #define BH1790GLC_MEAS_CONTROL1_RCYCLE_PROHIBITED2 (0x03 << 0)
00060 #define BH1790GLC_MEAS_CONTROL2_LED2_EN_PULSED (0x00 << 7)
00061 #define BH1790GLC_MEAS_CONTROL2_LED2_EN_CONSTANT (0x01 << 7)
00062 #define BH1790GLC_MEAS_CONTROL2_LED1_EN_PULSED (0x00 << 6)
00063 #define BH1790GLC_MEAS_CONTROL2_LED1_EN_CONSTANT (0x01 << 6)
00064 // us
00065 #define BH1790GLC_MEAS_CONTROL2_LED_ON_TIME_216T_OSC (0x00 << 5)
00066 // us
00067 #define BH1790GLC_MEAS_CONTROL2_LED_ON_TIME_432T_OSC (0x01 << 5)
00068 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_0MA (0x00 << 0)
00069 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_1MA (0x08 << 0)
00070 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_2MA (0x09 << 0)
00071 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_3MA (0x0A << 0)
00072 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_6MA (0x0B << 0)
00073 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_10MA (0x0C << 0)
00074 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_20MA (0x0D << 0)
00075 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_30MA (0x0E << 0)
00076 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_60MA (0x0F << 0)
00077 #define BH1790GLC_MEAS_START_MEAS_ST_STOP (0x00 << 0)
00078 #define BH1790GLC_MEAS_START_MEAS_ST_START (0x01 << 0)
00079  /*registers bit masks */
00080 #define BH1790GLC_PART_ID_WIA_MASK 0xFF
00081 // 1 : OSC block is active
00082 #define BH1790GLC_MEAS_CONTROL1_RDY_MASK 0x80
00083 // Select LED omitting frequency
00084 #define BH1790GLC_MEAS_CONTROL1_LED_LIGHTING_FREQ_MASK 0x04
00085 #define BH1790GLC_MEAS_CONTROL1_RCYCLE_MASK 0x03
00086 #define BH1790GLC_MEAS_CONTROL2_LED2_EN_MASK 0x80
00087 #define BH1790GLC_MEAS_CONTROL2_LED1_EN_MASK 0x40
00088 #define BH1790GLC_MEAS_CONTROL2_LED_ON_TIME_MASK 0x20
00089 // LED lighting current
00090 #define BH1790GLC_MEAS_CONTROL2_LED_CURRENT_MASK 0x0F
00091 #define BH1790GLC_MEAS_START_MEAS_ST_MASK 0x01
00092 #endif
00093 
00094