JDI_MIP on ThunderBoardSense2(Silicon-Labs)

JDI_MIP (LPM013M126A) Sample on ThunderBoard2(Silicon-Labs)

/media/uploads/STakayama/mip8_tb2_sample0_.jpg LPM013M126A /media/uploads/STakayama/mip8_tb2_sample1.jpg

Links

https://os.mbed.com/teams/JapanDisplayInc/

https://os.mbed.com/teams/JapanDisplayInc/wiki/MIP-reflective-color-display

Committer:
STakayama
Date:
Tue Jan 22 10:23:39 2019 +0000
Revision:
13:9fb661dd4b2a
Parent:
10:525bcf8907fc
BackColor = Cyan

Who changed what in which revision?

UserRevisionLine numberNew contents of line
STakayama 10:525bcf8907fc 1 /***************************************************************************//**
STakayama 10:525bcf8907fc 2 * @file Si1133.h
STakayama 10:525bcf8907fc 3 *******************************************************************************
STakayama 10:525bcf8907fc 4 * @section License
STakayama 10:525bcf8907fc 5 * <b>(C) Copyright 2017 Silicon Labs, http://www.silabs.com</b>
STakayama 10:525bcf8907fc 6 *******************************************************************************
STakayama 10:525bcf8907fc 7 *
STakayama 10:525bcf8907fc 8 * SPDX-License-Identifier: Apache-2.0
STakayama 10:525bcf8907fc 9 *
STakayama 10:525bcf8907fc 10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
STakayama 10:525bcf8907fc 11 * not use this file except in compliance with the License.
STakayama 10:525bcf8907fc 12 * You may obtain a copy of the License at
STakayama 10:525bcf8907fc 13 *
STakayama 10:525bcf8907fc 14 * http://www.apache.org/licenses/LICENSE-2.0
STakayama 10:525bcf8907fc 15 *
STakayama 10:525bcf8907fc 16 * Unless required by applicable law or agreed to in writing, software
STakayama 10:525bcf8907fc 17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
STakayama 10:525bcf8907fc 18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
STakayama 10:525bcf8907fc 19 * See the License for the specific language governing permissions and
STakayama 10:525bcf8907fc 20 * limitations under the License.
STakayama 10:525bcf8907fc 21 *
STakayama 10:525bcf8907fc 22 ******************************************************************************/
STakayama 10:525bcf8907fc 23
STakayama 10:525bcf8907fc 24 #ifndef SI1133_H
STakayama 10:525bcf8907fc 25 #define SI1133_H
STakayama 10:525bcf8907fc 26
STakayama 10:525bcf8907fc 27 #include "mbed.h"
STakayama 10:525bcf8907fc 28
STakayama 10:525bcf8907fc 29 /** Si1133 class.
STakayama 10:525bcf8907fc 30 * Used for taking Light level and UV index measurements.
STakayama 10:525bcf8907fc 31 *
STakayama 10:525bcf8907fc 32 * Example:
STakayama 10:525bcf8907fc 33 * @code
STakayama 10:525bcf8907fc 34 * #include "mbed.h"
STakayama 10:525bcf8907fc 35 * #include "Si1133.h"
STakayama 10:525bcf8907fc 36 *
STakayama 10:525bcf8907fc 37 * //Create an Si1133 object
STakayama 10:525bcf8907fc 38 * Si1133 sensor(PC4, PC5);
STakayama 10:525bcf8907fc 39 *
STakayama 10:525bcf8907fc 40 * int main()
STakayama 10:525bcf8907fc 41 * {
STakayama 10:525bcf8907fc 42 * //Try to open the Si1133
STakayama 10:525bcf8907fc 43 * if (sensor.open()) {
STakayama 10:525bcf8907fc 44 * printf("Device detected!\n");
STakayama 10:525bcf8907fc 45 *
STakayama 10:525bcf8907fc 46 * while (1) {
STakayama 10:525bcf8907fc 47 * //Print the current light level
STakayama 10:525bcf8907fc 48 * printf("Lux = %.3f\n", (float)sensor.get_light_level());
STakayama 10:525bcf8907fc 49 * //Print the current UV index
STakayama 10:525bcf8907fc 50 * printf("UV index = %.3f\n", (float)sensor.get_uv_index());
STakayama 10:525bcf8907fc 51 *
STakayama 10:525bcf8907fc 52 * //Sleep for 0.5 seconds
STakayama 10:525bcf8907fc 53 * wait(0.5);
STakayama 10:525bcf8907fc 54 * }
STakayama 10:525bcf8907fc 55 * } else {
STakayama 10:525bcf8907fc 56 * error("Device not detected!\n");
STakayama 10:525bcf8907fc 57 * }
STakayama 10:525bcf8907fc 58 * }
STakayama 10:525bcf8907fc 59 * @endcode
STakayama 10:525bcf8907fc 60 */
STakayama 10:525bcf8907fc 61 class Si1133
STakayama 10:525bcf8907fc 62 {
STakayama 10:525bcf8907fc 63 public:
STakayama 10:525bcf8907fc 64
STakayama 10:525bcf8907fc 65 /** Create an Si1133 object connected to the specified I2C pins with the specified I2C slave address
STakayama 10:525bcf8907fc 66 *
STakayama 10:525bcf8907fc 67 * @param sda The I2C data pin.
STakayama 10:525bcf8907fc 68 * @param scl The I2C clock pin.
STakayama 10:525bcf8907fc 69 * @param hz The I2C bus frequency (defaults to 400kHz).
STakayama 10:525bcf8907fc 70 */
STakayama 10:525bcf8907fc 71 Si1133(PinName sda, PinName scl, int hz = 400000);
STakayama 10:525bcf8907fc 72
STakayama 10:525bcf8907fc 73 /**
STakayama 10:525bcf8907fc 74 * Si1133 destructor
STakayama 10:525bcf8907fc 75 */
STakayama 10:525bcf8907fc 76 ~Si1133(void);
STakayama 10:525bcf8907fc 77
STakayama 10:525bcf8907fc 78 /** Probe for the Si1133 and try to initialize the sensor
STakayama 10:525bcf8907fc 79 *
STakayama 10:525bcf8907fc 80 * @returns
STakayama 10:525bcf8907fc 81 * 'true' if the device exists on the bus,
STakayama 10:525bcf8907fc 82 * 'false' if the device doesn't exist on the bus.
STakayama 10:525bcf8907fc 83 */
STakayama 10:525bcf8907fc 84 bool open();
STakayama 10:525bcf8907fc 85
STakayama 10:525bcf8907fc 86 /** Measure the current light level (in lux) on the Si1133
STakayama 10:525bcf8907fc 87 *
STakayama 10:525bcf8907fc 88 * @returns The current temperature measurement in Lux.
STakayama 10:525bcf8907fc 89 */
STakayama 10:525bcf8907fc 90 float get_light_level();
STakayama 10:525bcf8907fc 91
STakayama 10:525bcf8907fc 92 /** Measure the current UV Index on the Si1133
STakayama 10:525bcf8907fc 93 *
STakayama 10:525bcf8907fc 94 * @returns The current UV index measurement.
STakayama 10:525bcf8907fc 95 */
STakayama 10:525bcf8907fc 96 float get_uv_index();
STakayama 10:525bcf8907fc 97
STakayama 10:525bcf8907fc 98 /** Do a combined measurement and return both the light level and UV index
STakayama 10:525bcf8907fc 99 *
STakayama 10:525bcf8907fc 100 * @param[out] light_level Measured light level in Lux
STakayama 10:525bcf8907fc 101 * @param[out] uv_index Measured UV index
STakayama 10:525bcf8907fc 102 *
STakayama 10:525bcf8907fc 103 * @returns true if measurement was successful
STakayama 10:525bcf8907fc 104 */
STakayama 10:525bcf8907fc 105 bool get_light_and_uv(float *light_level, float *uv_index);
STakayama 10:525bcf8907fc 106
STakayama 10:525bcf8907fc 107 #ifdef MBED_OPERATORS
STakayama 10:525bcf8907fc 108 /** A shorthand for get_light_level()
STakayama 10:525bcf8907fc 109 *
STakayama 10:525bcf8907fc 110 * @returns The current temperature measurement in Lux.
STakayama 10:525bcf8907fc 111 */
STakayama 10:525bcf8907fc 112 operator float();
STakayama 10:525bcf8907fc 113 #endif
STakayama 10:525bcf8907fc 114
STakayama 10:525bcf8907fc 115 private:
STakayama 10:525bcf8907fc 116 /**
STakayama 10:525bcf8907fc 117 * @name I2C Registers
STakayama 10:525bcf8907fc 118 * @{
STakayama 10:525bcf8907fc 119 */
STakayama 10:525bcf8907fc 120 enum Register {
STakayama 10:525bcf8907fc 121 REG_PART_ID = 0x00, /**< Part ID */
STakayama 10:525bcf8907fc 122 REG_HW_ID = 0x01, /**< Hardware ID */
STakayama 10:525bcf8907fc 123 REG_REV_ID = 0x02, /**< Hardware revision */
STakayama 10:525bcf8907fc 124 REG_HOSTIN0 = 0x0A, /**< Data for parameter table on PARAM_SET write to COMMAND register */
STakayama 10:525bcf8907fc 125 REG_COMMAND = 0x0B, /**< Initiated action in Sensor when specific codes written here */
STakayama 10:525bcf8907fc 126 REG_IRQ_ENABLE = 0x0F, /**< Interrupt enable */
STakayama 10:525bcf8907fc 127 REG_RESPONSE1 = 0x10, /**< Contains the readback value from a query or a set command */
STakayama 10:525bcf8907fc 128 REG_RESPONSE0 = 0x11, /**< Chip state and error status */
STakayama 10:525bcf8907fc 129 REG_IRQ_STATUS = 0x12, /**< Interrupt status */
STakayama 10:525bcf8907fc 130 REG_HOSTOUT0 = 0x13, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 131 REG_HOSTOUT1 = 0x14, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 132 REG_HOSTOUT2 = 0x15, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 133 REG_HOSTOUT3 = 0x16, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 134 REG_HOSTOUT4 = 0x17, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 135 REG_HOSTOUT5 = 0x18, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 136 REG_HOSTOUT6 = 0x19, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 137 REG_HOSTOUT7 = 0x1A, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 138 REG_HOSTOUT8 = 0x1B, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 139 REG_HOSTOUT9 = 0x1C, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 140 REG_HOSTOUT10 = 0x1D, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 141 REG_HOSTOUT11 = 0x1E, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 142 REG_HOSTOUT12 = 0x1F, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 143 REG_HOSTOUT13 = 0x20, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 144 REG_HOSTOUT14 = 0x21, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 145 REG_HOSTOUT15 = 0x22, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 146 REG_HOSTOUT16 = 0x23, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 147 REG_HOSTOUT17 = 0x24, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 148 REG_HOSTOUT18 = 0x25, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 149 REG_HOSTOUT19 = 0x26, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 150 REG_HOSTOUT20 = 0x27, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 151 REG_HOSTOUT21 = 0x28, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 152 REG_HOSTOUT22 = 0x29, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 153 REG_HOSTOUT23 = 0x2A, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 154 REG_HOSTOUT24 = 0x2B, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 155 REG_HOSTOUT25 = 0x2C, /**< Captured Sensor Data */
STakayama 10:525bcf8907fc 156 };
STakayama 10:525bcf8907fc 157 /**@}*/
STakayama 10:525bcf8907fc 158
STakayama 10:525bcf8907fc 159 /**
STakayama 10:525bcf8907fc 160 * @name Parameters
STakayama 10:525bcf8907fc 161 * @{
STakayama 10:525bcf8907fc 162 */
STakayama 10:525bcf8907fc 163 enum Parameter {
STakayama 10:525bcf8907fc 164 PARAM_I2C_ADDR = 0x00, /**< I2C address */
STakayama 10:525bcf8907fc 165 PARAM_CH_LIST = 0x01, /**< Channel list */
STakayama 10:525bcf8907fc 166 PARAM_ADCCONFIG0 = 0x02, /**< ADC config for Channel 0 */
STakayama 10:525bcf8907fc 167 PARAM_ADCSENS0 = 0x03, /**< ADC sensitivity setting for Channel 0 */
STakayama 10:525bcf8907fc 168 PARAM_ADCPOST0 = 0x04, /**< ADC resolution, shift and threshold settings for Channel 0 */
STakayama 10:525bcf8907fc 169 PARAM_MEASCONFIG0 = 0x05, /**< ADC measurement counter selection for Channel 0 */
STakayama 10:525bcf8907fc 170 PARAM_ADCCONFIG1 = 0x06, /**< ADC config for Channel 1 */
STakayama 10:525bcf8907fc 171 PARAM_ADCSENS1 = 0x07, /**< ADC sensitivity setting for Channel 1 */
STakayama 10:525bcf8907fc 172 PARAM_ADCPOST1 = 0x08, /**< ADC resolution, shift and threshold settings for Channel 1 */
STakayama 10:525bcf8907fc 173 PARAM_MEASCONFIG1 = 0x09, /**< ADC measurement counter selection for Channel 1 */
STakayama 10:525bcf8907fc 174 PARAM_ADCCONFIG2 = 0x0A, /**< ADC config for Channel 2 */
STakayama 10:525bcf8907fc 175 PARAM_ADCSENS2 = 0x0B, /**< ADC sensitivity setting for Channel 2 */
STakayama 10:525bcf8907fc 176 PARAM_ADCPOST2 = 0x0C, /**< ADC resolution, shift and threshold settings for Channel 2 */
STakayama 10:525bcf8907fc 177 PARAM_MEASCONFIG2 = 0x0D, /**< ADC measurement counter selection for Channel 2 */
STakayama 10:525bcf8907fc 178 PARAM_ADCCONFIG3 = 0x0E, /**< ADC config for Channel 3 */
STakayama 10:525bcf8907fc 179 PARAM_ADCSENS3 = 0x0F, /**< ADC sensitivity setting for Channel 3 */
STakayama 10:525bcf8907fc 180 PARAM_ADCPOST3 = 0x10, /**< ADC resolution, shift and threshold settings for Channel 3 */
STakayama 10:525bcf8907fc 181 PARAM_MEASCONFIG3 = 0x11, /**< ADC measurement counter selection for Channel 3 */
STakayama 10:525bcf8907fc 182 PARAM_ADCCONFIG4 = 0x12, /**< ADC config for Channel 4 */
STakayama 10:525bcf8907fc 183 PARAM_ADCSENS4 = 0x13, /**< ADC sensitivity setting for Channel 4 */
STakayama 10:525bcf8907fc 184 PARAM_ADCPOST4 = 0x14, /**< ADC resolution, shift and threshold settings for Channel 4 */
STakayama 10:525bcf8907fc 185 PARAM_MEASCONFIG4 = 0x15, /**< ADC measurement counter selection for Channel 4 */
STakayama 10:525bcf8907fc 186 PARAM_ADCCONFIG5 = 0x16, /**< ADC config for Channel 5 */
STakayama 10:525bcf8907fc 187 PARAM_ADCSENS5 = 0x17, /**< ADC sensitivity setting for Channel 5 */
STakayama 10:525bcf8907fc 188 PARAM_ADCPOST5 = 0x18, /**< ADC resolution, shift and threshold settings for Channel 5 */
STakayama 10:525bcf8907fc 189 PARAM_MEASCONFIG5 = 0x19, /**< ADC measurement counter selection for Channel 5 */
STakayama 10:525bcf8907fc 190 PARAM_MEASRATE_H = 0x1A, /**< Main measurement rate counter MSB */
STakayama 10:525bcf8907fc 191 PARAM_MEASRATE_L = 0x1B, /**< Main measurement rate counter LSB */
STakayama 10:525bcf8907fc 192 PARAM_MEASCOUNT0 = 0x1C, /**< Measurement rate extension counter 0 */
STakayama 10:525bcf8907fc 193 PARAM_MEASCOUNT1 = 0x1D, /**< Measurement rate extension counter 1 */
STakayama 10:525bcf8907fc 194 PARAM_MEASCOUNT2 = 0x1E, /**< Measurement rate extension counter 2 */
STakayama 10:525bcf8907fc 195 PARAM_THRESHOLD0_H = 0x25, /**< Threshold level 0 MSB */
STakayama 10:525bcf8907fc 196 PARAM_THRESHOLD0_L = 0x26, /**< Threshold level 0 LSB */
STakayama 10:525bcf8907fc 197 PARAM_THRESHOLD1_H = 0x27, /**< Threshold level 1 MSB */
STakayama 10:525bcf8907fc 198 PARAM_THRESHOLD1_L = 0x28, /**< Threshold level 1 LSB */
STakayama 10:525bcf8907fc 199 PARAM_THRESHOLD2_H = 0x29, /**< Threshold level 2 MSB */
STakayama 10:525bcf8907fc 200 PARAM_THRESHOLD2_L = 0x2A, /**< Threshold level 2 LSB */
STakayama 10:525bcf8907fc 201 PARAM_BURST = 0x2B, /**< Burst enable and burst count */
STakayama 10:525bcf8907fc 202 };
STakayama 10:525bcf8907fc 203 /**@}*/
STakayama 10:525bcf8907fc 204
STakayama 10:525bcf8907fc 205 /**
STakayama 10:525bcf8907fc 206 * @name Commands
STakayama 10:525bcf8907fc 207 * @{
STakayama 10:525bcf8907fc 208 */
STakayama 10:525bcf8907fc 209 enum Command {
STakayama 10:525bcf8907fc 210 CMD_RESET_CMD_CTR = 0x00, /**< Resets the command counter */
STakayama 10:525bcf8907fc 211 CMD_RESET = 0x01, /**< Forces a Reset */
STakayama 10:525bcf8907fc 212 CMD_NEW_ADDR = 0x02, /**< Stores the new I2C address */
STakayama 10:525bcf8907fc 213 CMD_FORCE_CH = 0x11, /**< Initiates a set of measurements specified in CHAN_LIST parameter */
STakayama 10:525bcf8907fc 214 CMD_PAUSE_CH = 0x12, /**< Pauses autonomous measurements */
STakayama 10:525bcf8907fc 215 CMD_START = 0x13, /**< Starts autonomous measurements */
STakayama 10:525bcf8907fc 216 CMD_PARAM_SET = 0x80, /**< Sets a parameter */
STakayama 10:525bcf8907fc 217 CMD_PARAM_QUERY = 0x40, /**< Reads a parameter */
STakayama 10:525bcf8907fc 218 };
STakayama 10:525bcf8907fc 219 /**@}*/
STakayama 10:525bcf8907fc 220
STakayama 10:525bcf8907fc 221 /**
STakayama 10:525bcf8907fc 222 * @name Responses
STakayama 10:525bcf8907fc 223 * @{
STakayama 10:525bcf8907fc 224 */
STakayama 10:525bcf8907fc 225 enum Response {
STakayama 10:525bcf8907fc 226 RSP0_CHIPSTAT_MASK = 0xE0, /**< Chip state mask in Response0 register */
STakayama 10:525bcf8907fc 227 RSP0_COUNTER_MASK = 0x1F, /**< Command counter and error indicator mask in Response0 register */
STakayama 10:525bcf8907fc 228 RSP0_SLEEP = 0x20, /**< Sleep state indicator bit mask in Response0 register */
STakayama 10:525bcf8907fc 229 };
STakayama 10:525bcf8907fc 230 /**@}*/
STakayama 10:525bcf8907fc 231
STakayama 10:525bcf8907fc 232 /**
STakayama 10:525bcf8907fc 233 * @brief
STakayama 10:525bcf8907fc 234 * Structure to store the data measured by the Si1133
STakayama 10:525bcf8907fc 235 */
STakayama 10:525bcf8907fc 236 typedef struct {
STakayama 10:525bcf8907fc 237 uint8_t irq_status; /**< Interrupt status of the device */
STakayama 10:525bcf8907fc 238 int32_t ch0; /**< Channel 0 measurement data */
STakayama 10:525bcf8907fc 239 int32_t ch1; /**< Channel 1 measurement data */
STakayama 10:525bcf8907fc 240 int32_t ch2; /**< Channel 2 measurement data */
STakayama 10:525bcf8907fc 241 int32_t ch3; /**< Channel 3 measurement data */
STakayama 10:525bcf8907fc 242 } Samples_t;
STakayama 10:525bcf8907fc 243
STakayama 10:525bcf8907fc 244 /**
STakayama 10:525bcf8907fc 245 * @brief
STakayama 10:525bcf8907fc 246 * Structure to store the calculation coefficients
STakayama 10:525bcf8907fc 247 */
STakayama 10:525bcf8907fc 248 typedef struct {
STakayama 10:525bcf8907fc 249 int16_t info; /**< Info */
STakayama 10:525bcf8907fc 250 uint16_t mag; /**< Magnitude */
STakayama 10:525bcf8907fc 251 } Coeff_t;
STakayama 10:525bcf8907fc 252
STakayama 10:525bcf8907fc 253 /**
STakayama 10:525bcf8907fc 254 * @brief
STakayama 10:525bcf8907fc 255 * Structure to store the coefficients used for Lux calculation
STakayama 10:525bcf8907fc 256 */
STakayama 10:525bcf8907fc 257 typedef struct {
STakayama 10:525bcf8907fc 258 Coeff_t coeff_high[4]; /**< High amplitude coeffs */
STakayama 10:525bcf8907fc 259 Coeff_t coeff_low[9]; /**< Low amplitude coeffs */
STakayama 10:525bcf8907fc 260 } LuxCoeff_t;
STakayama 10:525bcf8907fc 261
STakayama 10:525bcf8907fc 262 /* Forward-declare constant coefficient table */
STakayama 10:525bcf8907fc 263 static const LuxCoeff_t lk;
STakayama 10:525bcf8907fc 264 static const Coeff_t uk[];
STakayama 10:525bcf8907fc 265
STakayama 10:525bcf8907fc 266 /* Private functions */
STakayama 10:525bcf8907fc 267 uint32_t read_register(enum Register reg, uint8_t *data);
STakayama 10:525bcf8907fc 268 uint32_t write_register(enum Register reg, uint8_t data);
STakayama 10:525bcf8907fc 269 uint32_t write_register_block(enum Register reg, uint8_t length, uint8_t *data);
STakayama 10:525bcf8907fc 270 uint32_t read_register_block(enum Register reg, uint8_t length, uint8_t *data);
STakayama 10:525bcf8907fc 271 uint32_t get_irq_status(uint8_t *irq_status);
STakayama 10:525bcf8907fc 272 uint32_t wait_until_sleep(void);
STakayama 10:525bcf8907fc 273 uint32_t reset(void);
STakayama 10:525bcf8907fc 274 uint32_t reset_cmd_counter (void);
STakayama 10:525bcf8907fc 275 uint32_t send_cmd(enum Command command);
STakayama 10:525bcf8907fc 276 uint32_t force_measurement (void);
STakayama 10:525bcf8907fc 277 uint32_t pause_measurement (void);
STakayama 10:525bcf8907fc 278 uint32_t start_measurement (void);
STakayama 10:525bcf8907fc 279 uint32_t set_parameter (enum Parameter address, uint8_t value);
STakayama 10:525bcf8907fc 280 uint32_t read_parameter (enum Parameter address);
STakayama 10:525bcf8907fc 281 uint32_t init (void);
STakayama 10:525bcf8907fc 282 uint32_t deinit (void);
STakayama 10:525bcf8907fc 283 uint32_t measure (Samples_t *samples);
STakayama 10:525bcf8907fc 284 int32_t get_uv (int32_t uv);
STakayama 10:525bcf8907fc 285 int32_t get_lux (int32_t vis_high, int32_t vis_low, int32_t ir);
STakayama 10:525bcf8907fc 286 uint32_t measure_lux_uv (float *lux, float *uvi);
STakayama 10:525bcf8907fc 287 uint32_t get_measurement (float *lux, float *uvi);
STakayama 10:525bcf8907fc 288 uint32_t get_hardware_id (uint8_t *hardware_id);
STakayama 10:525bcf8907fc 289
STakayama 10:525bcf8907fc 290 int32_t calculate_polynomial_helper (int32_t input, int8_t fraction, uint16_t mag, int8_t shift);
STakayama 10:525bcf8907fc 291 int32_t calculate_polynomial (int32_t x, int32_t y, uint8_t input_fraction, uint8_t output_fraction, uint8_t num_coeff, const Coeff_t *kp);
STakayama 10:525bcf8907fc 292
STakayama 10:525bcf8907fc 293 /* Member variables */
STakayama 10:525bcf8907fc 294 I2C m_I2C;
STakayama 10:525bcf8907fc 295 };
STakayama 10:525bcf8907fc 296
STakayama 10:525bcf8907fc 297 #endif