Sample program for communicating with Fujitsuu IoT Platform using HTTP
Dependencies: AsciiFont GR-PEACH_video GraphicsFramework LCD_shield_config R_BSP USBHost_custom easy-connect-gr-peach mbed-http picojson BM1383GLV KX022 rohm-sensor-hal rohm-bh1745
BH1745NUC.h
00001 /***************************************************************************** 00002 BH1745NUC.h 00003 00004 Copyright (c) 2016 ROHM Co.,Ltd. 00005 00006 Permission is hereby granted, free of charge, to any person obtaining a copy 00007 of this software and associated documentation files (the "Software"), to deal 00008 in the Software without restriction, including without limitation the rights 00009 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00010 copies of the Software, and to permit persons to whom the Software is 00011 furnished to do so, subject to the following conditions: 00012 00013 The above copyright notice and this permission notice shall be included in 00014 all copies or substantial portions of the Software. 00015 00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00019 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00020 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00021 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00022 THE SOFTWARE. 00023 ******************************************************************************/ 00024 #ifndef _BH1745NUC_H_ 00025 #define _BH1745NUC_H_ 00026 00027 #define BH1745NUC_DEVICE_ADDRESS_38 (0x38) // 7bit Addrss 00028 #define BH1745NUC_DEVICE_ADDRESS_39 (0x39) // 7bit Addrss 00029 #define BH1745NUC_PART_ID_VAL (0x0B) 00030 #define BH1745NUC_MANUFACT_ID_VAL (0xE0) 00031 00032 #define BH1745NUC_SYSTEM_CONTROL (0x40) 00033 #define BH1745NUC_MODE_CONTROL1 (0x41) 00034 #define BH1745NUC_MODE_CONTROL2 (0x42) 00035 #define BH1745NUC_MODE_CONTROL3 (0x44) 00036 #define BH1745NUC_RED_DATA_LSB (0x50) 00037 #define BH1745NUC_MANUFACTURER_ID (0x92) 00038 00039 #define BH1745NUC_MODE_CONTROL1_MEAS_TIME160MS (0x00) 00040 00041 #define BH1745NUC_MODE_CONTROL2_ADC_GAIN_X1 (0) 00042 #define BH1745NUC_MODE_CONTROL2_ADC_GAIN_X2 (1) 00043 #define BH1745NUC_MODE_CONTROL2_ADC_GAIN_X16 (2) 00044 #define BH1745NUC_MODE_CONTROL2_RGBC_EN (1 << 4) 00045 00046 #define BH1745NUC_MODE_CONTROL1_VAL (BH1745NUC_MODE_CONTROL1_MEAS_TIME160MS) 00047 #define BH1745NUC_MODE_CONTROL2_VAL (BH1745NUC_MODE_CONTROL2_RGBC_EN | BH1745NUC_MODE_CONTROL2_ADC_GAIN_X16) 00048 #define BH1745NUC_MODE_CONTROL3_VAL (0x02) 00049 00050 class BH1745NUC 00051 { 00052 public: 00053 BH1745NUC(int slave_address); 00054 unsigned char init(void) ; 00055 unsigned char get_rawval(unsigned char *data); 00056 unsigned char get_val(unsigned short *data); 00057 unsigned char write(unsigned char memory_address, unsigned char *data, unsigned char size); 00058 unsigned char read(unsigned char memory_address, unsigned char *data, int size); 00059 private: 00060 int _device_address; 00061 }; 00062 00063 #endif // _BH1745NUC_H_ 00064
Generated on Wed Jul 13 2022 06:45:29 by 1.7.2