Library for Si114x optical sensors. Currently intended for the Si1146, although it will work also for the Si1145, and without full functionality for the Si1147
Dependents: Si114x_HelloWorld Hello-Uzuki-sensor-shield
Si114x_defs.h@0:971d705818e7, 2015-08-23 (annotated)
- Committer:
- Sissors
- Date:
- Sun Aug 23 16:58:36 2015 +0000
- Revision:
- 0:971d705818e7
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sissors | 0:971d705818e7 | 1 | #ifndef SI114X_DEFS_H |
Sissors | 0:971d705818e7 | 2 | #define SI114X_DEFS_H |
Sissors | 0:971d705818e7 | 3 | |
Sissors | 0:971d705818e7 | 4 | |
Sissors | 0:971d705818e7 | 5 | #define SI114x_ADDRESS (0x60 << 1) |
Sissors | 0:971d705818e7 | 6 | |
Sissors | 0:971d705818e7 | 7 | enum Si114x_reg { |
Sissors | 0:971d705818e7 | 8 | REG_PART_ID = 0x00, |
Sissors | 0:971d705818e7 | 9 | REG_REV_ID, |
Sissors | 0:971d705818e7 | 10 | REG_SEQ_ID, |
Sissors | 0:971d705818e7 | 11 | REG_INT_CFG, |
Sissors | 0:971d705818e7 | 12 | REG_IRQ_ENABLE, |
Sissors | 0:971d705818e7 | 13 | REG_HW_KEY = 0x07, |
Sissors | 0:971d705818e7 | 14 | REG_MEAS_RATE0, REG_MEAS_RATE1, |
Sissors | 0:971d705818e7 | 15 | REG_PS_LED21 = 0x0F, REG_PS_LED3, |
Sissors | 0:971d705818e7 | 16 | REG_UCOEF0 = 0x13, REG_UCOEF1, REG_UCOEF2, REG_UCOEF3, |
Sissors | 0:971d705818e7 | 17 | REG_PARAM_WR, |
Sissors | 0:971d705818e7 | 18 | REG_COMMAND, |
Sissors | 0:971d705818e7 | 19 | REG_RESPONSE = 0x20, |
Sissors | 0:971d705818e7 | 20 | REG_IRQ_STATUS, |
Sissors | 0:971d705818e7 | 21 | REG_ALS_VIS_DATA0, REG_ALS_VIS_DATA1, |
Sissors | 0:971d705818e7 | 22 | REG_ALS_IR_DATA0, REG_ALS_IR_DATA1, |
Sissors | 0:971d705818e7 | 23 | REG_PS1_DATA0, REG_PS1_DATA1, |
Sissors | 0:971d705818e7 | 24 | REG_PS2_DATA0, REG_PS2_DATA1, |
Sissors | 0:971d705818e7 | 25 | REG_PS3_DATA0 = 0x2A, REG_PS3_DATA1, |
Sissors | 0:971d705818e7 | 26 | REG_UV_INDEX0, REG_UV_INDEX1, |
Sissors | 0:971d705818e7 | 27 | REG_PARAM_RD, |
Sissors | 0:971d705818e7 | 28 | REG_CHIP_STAT = 0x30, |
Sissors | 0:971d705818e7 | 29 | REG_ANA_IN_KEY = 0x3B |
Sissors | 0:971d705818e7 | 30 | }; |
Sissors | 0:971d705818e7 | 31 | |
Sissors | 0:971d705818e7 | 32 | enum Si114x_commands { |
Sissors | 0:971d705818e7 | 33 | CMD_PARAM_QUERY = 0x80, |
Sissors | 0:971d705818e7 | 34 | CMD_PARAM_SET = 0xA0, |
Sissors | 0:971d705818e7 | 35 | CMD_NOP = 0x00, |
Sissors | 0:971d705818e7 | 36 | CMD_RESET = 0x01, |
Sissors | 0:971d705818e7 | 37 | CMD_BUS_ADDRESS = 0x02, |
Sissors | 0:971d705818e7 | 38 | CMD_PS_FORCE = 0x05, |
Sissors | 0:971d705818e7 | 39 | CMD_GET_CAL = 0x12, |
Sissors | 0:971d705818e7 | 40 | CMD_ALS_FORCE = 0x06, |
Sissors | 0:971d705818e7 | 41 | CMD_PLSALS_FORCE = 0x07, |
Sissors | 0:971d705818e7 | 42 | CMD_PS_AUTO = 0x0D, |
Sissors | 0:971d705818e7 | 43 | CMD_ALS_AUTO = 0x0E, |
Sissors | 0:971d705818e7 | 44 | CMD_PSALS_AUTO = 0x0F |
Sissors | 0:971d705818e7 | 45 | }; |
Sissors | 0:971d705818e7 | 46 | |
Sissors | 0:971d705818e7 | 47 | enum Si114x_ram_address { |
Sissors | 0:971d705818e7 | 48 | RAM_I2C_ADDR, |
Sissors | 0:971d705818e7 | 49 | RAM_CHLIST, |
Sissors | 0:971d705818e7 | 50 | RAM_PSLED12_SELECT, |
Sissors | 0:971d705818e7 | 51 | RAM_PSLED3_SELECT, |
Sissors | 0:971d705818e7 | 52 | RAM_PS_ENCODING, |
Sissors | 0:971d705818e7 | 53 | RAM_ALS_ENCODING, |
Sissors | 0:971d705818e7 | 54 | RAM_PS1_ADCMUX, |
Sissors | 0:971d705818e7 | 55 | RAM_PS2_ADCMUX, |
Sissors | 0:971d705818e7 | 56 | RAM_PS3_ADCMUX, |
Sissors | 0:971d705818e7 | 57 | RAM_PS_ADC_COUNTER, |
Sissors | 0:971d705818e7 | 58 | RAM_PS_ADC_GAIN, |
Sissors | 0:971d705818e7 | 59 | RAM_PS_ADC_MISC, |
Sissors | 0:971d705818e7 | 60 | RAM_RESERVED0, |
Sissors | 0:971d705818e7 | 61 | RAM_ALS_IR_ADCMUX, |
Sissors | 0:971d705818e7 | 62 | RAM_AUX_ADCMUX, |
Sissors | 0:971d705818e7 | 63 | RAM_ALS_VIS_ADC_COUNTER, |
Sissors | 0:971d705818e7 | 64 | RAM_ALS_VIS_ADC_GAIN, |
Sissors | 0:971d705818e7 | 65 | RAM_ALS_VIS_ADC_MISC, |
Sissors | 0:971d705818e7 | 66 | RAM_RESERVED1, |
Sissors | 0:971d705818e7 | 67 | RAM_RESERVED2, |
Sissors | 0:971d705818e7 | 68 | RAM_RESERVED3, |
Sissors | 0:971d705818e7 | 69 | RAM_LED_REC, |
Sissors | 0:971d705818e7 | 70 | RAM_IR_ADC_COUNTER, |
Sissors | 0:971d705818e7 | 71 | RAM_IR_ADC_GAIN, |
Sissors | 0:971d705818e7 | 72 | RAM_IR_ADC_MISC |
Sissors | 0:971d705818e7 | 73 | }; |
Sissors | 0:971d705818e7 | 74 | |
Sissors | 0:971d705818e7 | 75 | |
Sissors | 0:971d705818e7 | 76 | #endif |