sx9500 driver
Dependents: Senet NAMote scpi_sx127x NAMote72_Utility scpi_sx127x_firstTest
sx9500.h@0:d46a1b9267a3, 2015-03-18 (annotated)
- Committer:
- dudmuck
- Date:
- Wed Mar 18 00:57:23 2015 +0000
- Revision:
- 0:d46a1b9267a3
- Child:
- 1:aa30dc96dc77
sx9500 driver
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudmuck | 0:d46a1b9267a3 | 1 | #include "mbed.h" |
dudmuck | 0:d46a1b9267a3 | 2 | |
dudmuck | 0:d46a1b9267a3 | 3 | |
dudmuck | 0:d46a1b9267a3 | 4 | #define SX9500_REG_IRQSRC 0x00 |
dudmuck | 0:d46a1b9267a3 | 5 | #define SX9500_REG_STAT 0x01 |
dudmuck | 0:d46a1b9267a3 | 6 | #define SX9500_REG_IRQMSK 0x03 |
dudmuck | 0:d46a1b9267a3 | 7 | #define SX9500_REG_PROXCTRL0 0x06 |
dudmuck | 0:d46a1b9267a3 | 8 | #define SX9500_REG_PROXCTRL1 0x07 |
dudmuck | 0:d46a1b9267a3 | 9 | #define SX9500_REG_PROXCTRL2 0x08 |
dudmuck | 0:d46a1b9267a3 | 10 | #define SX9500_REG_PROXCTRL3 0x09 |
dudmuck | 0:d46a1b9267a3 | 11 | #define SX9500_REG_PROXCTRL4 0x0A |
dudmuck | 0:d46a1b9267a3 | 12 | #define SX9500_REG_PROXCTRL5 0x0B |
dudmuck | 0:d46a1b9267a3 | 13 | #define SX9500_REG_PROXCTRL6 0x0C |
dudmuck | 0:d46a1b9267a3 | 14 | #define SX9500_REG_PROXCTRL7 0x0D |
dudmuck | 0:d46a1b9267a3 | 15 | #define SX9500_REG_PROXCTRL8 0x0E |
dudmuck | 0:d46a1b9267a3 | 16 | #define SX9500_REG_SENSORSEL 0x20 |
dudmuck | 0:d46a1b9267a3 | 17 | #define SX9500_REG_USEMSB 0x21 |
dudmuck | 0:d46a1b9267a3 | 18 | #define SX9500_REG_USELSB 0x22 |
dudmuck | 0:d46a1b9267a3 | 19 | #define SX9500_REG_AVGMSB 0x23 |
dudmuck | 0:d46a1b9267a3 | 20 | #define SX9500_REG_AVGLSB 0x24 |
dudmuck | 0:d46a1b9267a3 | 21 | #define SX9500_REG_DIFFMSB 0x25 |
dudmuck | 0:d46a1b9267a3 | 22 | #define SX9500_REG_DIFFLSB 0x26 |
dudmuck | 0:d46a1b9267a3 | 23 | #define SX9500_REG_OFFSETMSB 0x27 |
dudmuck | 0:d46a1b9267a3 | 24 | #define SX9500_REG_OFFSETLSB 0x28 |
dudmuck | 0:d46a1b9267a3 | 25 | #define SX9500_REG_RESET 0x7F |
dudmuck | 0:d46a1b9267a3 | 26 | |
dudmuck | 0:d46a1b9267a3 | 27 | #define SX9500_RESET_CMD 0xDE |
dudmuck | 0:d46a1b9267a3 | 28 | |
dudmuck | 0:d46a1b9267a3 | 29 | class SX9500 { |
dudmuck | 0:d46a1b9267a3 | 30 | public: |
dudmuck | 0:d46a1b9267a3 | 31 | SX9500(I2C& r, PinName en_pin); |
dudmuck | 0:d46a1b9267a3 | 32 | ~SX9500(); |
dudmuck | 0:d46a1b9267a3 | 33 | //void try_read(void); |
dudmuck | 0:d46a1b9267a3 | 34 | uint8_t read_single(uint8_t addr); |
dudmuck | 0:d46a1b9267a3 | 35 | void read(uint8_t addr, uint8_t *dst_buf, int length); |
dudmuck | 0:d46a1b9267a3 | 36 | void write(uint8_t addr, uint8_t data); |
dudmuck | 0:d46a1b9267a3 | 37 | void reset(void); |
dudmuck | 0:d46a1b9267a3 | 38 | uint16_t get_sensor(void); |
dudmuck | 0:d46a1b9267a3 | 39 | void standby(void); |
dudmuck | 0:d46a1b9267a3 | 40 | |
dudmuck | 0:d46a1b9267a3 | 41 | private: |
dudmuck | 0:d46a1b9267a3 | 42 | I2C& m_i2c; |
dudmuck | 0:d46a1b9267a3 | 43 | DigitalOut m_txen; |
dudmuck | 0:d46a1b9267a3 | 44 | }; |
dudmuck | 0:d46a1b9267a3 | 45 |