心拍・酸素飽和度モニタモジュール MAXREFDES117から取得した心拍の値をシリアルコンソールに表示するプログラムです。
Fork of microbit-component-display by
MAX30102/MAX30102.h@1:83ace7df2c63, 2018-04-16 (annotated)
- Committer:
- JKsoft_main
- Date:
- Mon Apr 16 16:52:36 2018 +0000
- Revision:
- 1:83ace7df2c63
??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JKsoft_main | 1:83ace7df2c63 | 1 | #ifndef MAX30102_H_ |
JKsoft_main | 1:83ace7df2c63 | 2 | #define MAX30102_H_ |
JKsoft_main | 1:83ace7df2c63 | 3 | |
JKsoft_main | 1:83ace7df2c63 | 4 | #include "mbed.h" |
JKsoft_main | 1:83ace7df2c63 | 5 | |
JKsoft_main | 1:83ace7df2c63 | 6 | class MAX30102 |
JKsoft_main | 1:83ace7df2c63 | 7 | { |
JKsoft_main | 1:83ace7df2c63 | 8 | public: |
JKsoft_main | 1:83ace7df2c63 | 9 | MAX30102(PinName sda, PinName scl) : _i2c(sda, scl) { |
JKsoft_main | 1:83ace7df2c63 | 10 | |
JKsoft_main | 1:83ace7df2c63 | 11 | } |
JKsoft_main | 1:83ace7df2c63 | 12 | bool init(); |
JKsoft_main | 1:83ace7df2c63 | 13 | bool read_fifo(uint32_t *pun_red_led, uint32_t *pun_ir_led); |
JKsoft_main | 1:83ace7df2c63 | 14 | bool reset(); |
JKsoft_main | 1:83ace7df2c63 | 15 | |
JKsoft_main | 1:83ace7df2c63 | 16 | private: |
JKsoft_main | 1:83ace7df2c63 | 17 | static const uint8_t I2C_ADDR = 0xAE; |
JKsoft_main | 1:83ace7df2c63 | 18 | |
JKsoft_main | 1:83ace7df2c63 | 19 | static const uint8_t REG_INTR_STATUS_1 = 0x00; |
JKsoft_main | 1:83ace7df2c63 | 20 | static const uint8_t REG_INTR_STATUS_2 = 0x01; |
JKsoft_main | 1:83ace7df2c63 | 21 | static const uint8_t REG_INTR_ENABLE_1 = 0x02; |
JKsoft_main | 1:83ace7df2c63 | 22 | static const uint8_t REG_INTR_ENABLE_2 = 0x03; |
JKsoft_main | 1:83ace7df2c63 | 23 | static const uint8_t REG_FIFO_WR_PTR = 0x04; |
JKsoft_main | 1:83ace7df2c63 | 24 | static const uint8_t REG_OVF_COUNTER = 0x05; |
JKsoft_main | 1:83ace7df2c63 | 25 | static const uint8_t REG_FIFO_RD_PTR = 0x06; |
JKsoft_main | 1:83ace7df2c63 | 26 | static const uint8_t REG_FIFO_DATA = 0x07; |
JKsoft_main | 1:83ace7df2c63 | 27 | static const uint8_t REG_FIFO_CONFIG = 0x08; |
JKsoft_main | 1:83ace7df2c63 | 28 | static const uint8_t REG_MODE_CONFIG = 0x09; |
JKsoft_main | 1:83ace7df2c63 | 29 | static const uint8_t REG_SPO2_CONFIG = 0x0A; |
JKsoft_main | 1:83ace7df2c63 | 30 | static const uint8_t REG_LED1_PA = 0x0C; |
JKsoft_main | 1:83ace7df2c63 | 31 | static const uint8_t REG_LED2_PA = 0x0D; |
JKsoft_main | 1:83ace7df2c63 | 32 | static const uint8_t REG_PILOT_PA = 0x10; |
JKsoft_main | 1:83ace7df2c63 | 33 | static const uint8_t REG_MULTI_LED_CTRL1 = 0x11; |
JKsoft_main | 1:83ace7df2c63 | 34 | static const uint8_t REG_MULTI_LED_CTRL2 = 0x12; |
JKsoft_main | 1:83ace7df2c63 | 35 | static const uint8_t REG_TEMP_INTR = 0x1F; |
JKsoft_main | 1:83ace7df2c63 | 36 | static const uint8_t REG_TEMP_FRAC = 0x20; |
JKsoft_main | 1:83ace7df2c63 | 37 | static const uint8_t REG_TEMP_CONFIG = 0x21; |
JKsoft_main | 1:83ace7df2c63 | 38 | static const uint8_t REG_PROX_INT_THRESH = 0x30; |
JKsoft_main | 1:83ace7df2c63 | 39 | static const uint8_t REG_REV_ID = 0xFE; |
JKsoft_main | 1:83ace7df2c63 | 40 | static const uint8_t REG_PART_ID = 0xFF; |
JKsoft_main | 1:83ace7df2c63 | 41 | |
JKsoft_main | 1:83ace7df2c63 | 42 | I2C _i2c; |
JKsoft_main | 1:83ace7df2c63 | 43 | |
JKsoft_main | 1:83ace7df2c63 | 44 | bool write_reg(uint8_t uch_addr, uint8_t uch_data); |
JKsoft_main | 1:83ace7df2c63 | 45 | bool read_reg(uint8_t uch_addr, uint8_t *puch_data); |
JKsoft_main | 1:83ace7df2c63 | 46 | |
JKsoft_main | 1:83ace7df2c63 | 47 | }; |
JKsoft_main | 1:83ace7df2c63 | 48 | |
JKsoft_main | 1:83ace7df2c63 | 49 | #endif /* MAX30102_H_ */ |