Moved registers defines of the various I2C drivers I wrote from the header file to the source file because they do not need to be exposed. Started to write/port the Heart Rate Sensor (MAX30102) driver

This commit is contained in:
Th3maz1ng 2023-05-07 08:50:23 +02:00
parent e863899d11
commit 3cfbfdc843
8 changed files with 101 additions and 67 deletions

View File

@ -4,6 +4,43 @@
#include "wm_osal.h" #include "wm_osal.h"
#include "FreeRTOS.h" #include "FreeRTOS.h"
/* Device i2c address */
#define BMP280_I2C_ADDR 0x76
/* Device ID */
#define BMP280_ID 0x58
#define BMP280_RESET_CODE 0xB6
/* Device registers list */
#define BMP280_TEMP_XLSB 0xFC
#define BMP280_TEMP_LSB 0xFB
#define BMP280_TEMP_MSB 0xFA
#define BMP280_PRESS_XLSB 0xF9
#define BMP280_PRESS_LSB 0xF8
#define BMP280_PRESS_MSB 0xF7
#define BMP280_CONFIG 0xF5
#define BMP280_CTRL_MEAS 0xF4
#define BMP280_STATUS 0xF3
#define BMP280_RESET 0xE0
#define BMP280_ID_REG 0xD0
/* Device calibration registers list */
#define BMP280_DIG_T1 0x88
#define BMP280_DIG_T2 0x8A
#define BMP280_DIG_T3 0x8C
#define BMP280_DIG_P1 0x8E
#define BMP280_DIG_P2 0x90
#define BMP280_DIG_P3 0x92
#define BMP280_DIG_P4 0x94
#define BMP280_DIG_P5 0x96
#define BMP280_DIG_P6 0x98
#define BMP280_DIG_P7 0x9A
#define BMP280_DIG_P8 0x9C
#define BMP280_DIG_P9 0x9E
/* Field masks */
typedef struct BMP280_calibration_data typedef struct BMP280_calibration_data
{ {
uint16_t dig_T1; uint16_t dig_T1;

View File

@ -1,43 +1,6 @@
#ifndef BMP280_H #ifndef BMP280_H
#define BMP280_H #define BMP280_H
/* Device i2c address */
#define BMP280_I2C_ADDR 0x76
/* Device ID */
#define BMP280_ID 0x58
#define BMP280_RESET_CODE 0xB6
/* Device registers list */
#define BMP280_TEMP_XLSB 0xFC
#define BMP280_TEMP_LSB 0xFB
#define BMP280_TEMP_MSB 0xFA
#define BMP280_PRESS_XLSB 0xF9
#define BMP280_PRESS_LSB 0xF8
#define BMP280_PRESS_MSB 0xF7
#define BMP280_CONFIG 0xF5
#define BMP280_CTRL_MEAS 0xF4
#define BMP280_STATUS 0xF3
#define BMP280_RESET 0xE0
#define BMP280_ID_REG 0xD0
/* Device calibration registers list */
#define BMP280_DIG_T1 0x88
#define BMP280_DIG_T2 0x8A
#define BMP280_DIG_T3 0x8C
#define BMP280_DIG_P1 0x8E
#define BMP280_DIG_P2 0x90
#define BMP280_DIG_P3 0x92
#define BMP280_DIG_P4 0x94
#define BMP280_DIG_P5 0x96
#define BMP280_DIG_P6 0x98
#define BMP280_DIG_P7 0x9A
#define BMP280_DIG_P8 0x9C
#define BMP280_DIG_P9 0x9E
/* Field masks */
/* Configuration enumerations */ /* Configuration enumerations */
typedef enum BMP280_Mode typedef enum BMP280_Mode
{ {

View File

@ -5,6 +5,18 @@
#include "app_log.h" #include "app_log.h"
#include "CST816D.h" #include "CST816D.h"
/* Device i2c address */
#define CST816D_I2C_ADDR 0x15
/* Device registers list */
#define CST816D_00 0x00
#define CST816D_GESTURE 0x01
#define CST816D_TOUCH_POINTS 0x02
#define CST816D_TOUCH_X_MSB 0x03
#define CST816D_TOUCH_X_LSB 0x04
#define CST816D_TOUCH_Y_MSB_AND_ID 0x05
#define CST816D_TOUCH_Y_LSB 0x06
bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data) bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data)
{ {
if(!touch_data) return false; if(!touch_data) return false;

View File

@ -1,19 +1,6 @@
#ifndef CST816D_H #ifndef CST816D_H
#define CST816D_H #define CST816D_H
/* Device i2c address */
#define CST816D_I2C_ADDR 0x15
/* Device registers list */
#define CST816D_00 0x00
#define CST816D_GESTURE 0x01
#define CST816D_TOUCH_POINTS 0x02
#define CST816D_TOUCH_X_MSB 0x03
#define CST816D_TOUCH_X_LSB 0x04
#define CST816D_TOUCH_Y_MSB_AND_ID 0x05
#define CST816D_TOUCH_Y_LSB 0x06
typedef enum CST816D_Gesture typedef enum CST816D_Gesture
{ {
CST816D_Gesture_None = 0, CST816D_Gesture_None = 0,

View File

@ -2,6 +2,23 @@
#include "i2c.h" #include "i2c.h"
#include "QMC5883L.h" #include "QMC5883L.h"
/* Device i2c address */
#define QMC5883L_I2C_ADDR 0x0D
/* Device registers list */
#define QMC5883L_DATA_X_LSB_REG 0x00
#define QMC5883L_STATUS_REG 0x06
#define QMC5883L_TEMP_LSB_REG 0x07
#define QMC5883L_TEMP_MSB_REG 0x08
#define QMC5883L_CTRL1_REG 0x09
#define QMC5883L_CTRL2_REG 0x0A
#define QMC5883L_SETRES_REG 0x0B
/* Field masks */
#define QMC5883L_DRDY_BIT 0x01
#define QMC5883L_OVL_BIT 0x02
#define QMC5883L_DOR_BIT 0x04
typedef struct typedef struct
{ {
int16_t x_min; int16_t x_min;

View File

@ -1,23 +1,6 @@
#ifndef QMC5883L_H #ifndef QMC5883L_H
#define QMC5883L_H #define QMC5883L_H
/* Device i2c address */
#define QMC5883L_I2C_ADDR 0x0D
/* Device registers list */
#define QMC5883L_DATA_X_LSB_REG 0x00
#define QMC5883L_STATUS_REG 0x06
#define QMC5883L_TEMP_LSB_REG 0x07
#define QMC5883L_TEMP_MSB_REG 0x08
#define QMC5883L_CTRL1_REG 0x09
#define QMC5883L_CTRL2_REG 0x0A
#define QMC5883L_SETRES_REG 0x0B
/* Field masks */
#define QMC5883L_DRDY_BIT 0x01
#define QMC5883L_OVL_BIT 0x02
#define QMC5883L_DOR_BIT 0x04
/* Configuration enumerations */ /* Configuration enumerations */
typedef enum QMC5883L_Mode_Control typedef enum QMC5883L_Mode_Control
{ {

View File

@ -0,0 +1,31 @@
#include "i2c.h"
#include "max3010X.h"
/* Device i2c address */
#define MAX3010X_I2C_ADDR 0x57
/* Device registers list */
/* Status Regs */
#define MAX3010X_INT_STATUS1 0x00
#define MAX3010X_INT_STATUS2 0x01
#define MAX3010X_INT_EN1 0x02
#define MAX3010X_INT_EN2 0x03
#define MAX3010X_FIFO_WR_PTR 0x04
#define MAX3010X_FIFO_OVERFLOW_CNT 0x05
#define MAX3010X_FIFO_RD_PTR 0x06
#define MAX3010X_FIFO_DATA_REG 0x07
/* Configuration Regs */
#define MAX3010X_FIFO_CFG 0x08
#define MAX3010X_MODE_CFG 0x09
#define MAX3010X_SPO2_CFG 0x0A
#define MAX3010X_LED1_PULSE_AMP 0x0C
#define MAX3010X_LED2_PULSE_AMP 0x0D
#define MAX3010X_MULTI_LED_MODE_CTRL_SLOT1_2 0x11
#define MAX3010X_MULTI_LED_MODE_CTRL_SLOT3_4 0x12
/* Die Temperature Regs */
#define MAX3010X_DIE_TEMP_INT 0x1F
#define MAX3010X_DIE_TEMP_FRACT 0x20
#define MAX3010X_DIE_TEMP_CFG 0x21
/* Part ID Regs */
#define MAX3010X_REV_ID 0xFE
#define MAX3010X_PART_ID 0xFF

View File

@ -0,0 +1,4 @@
#ifndef MAX3010X_H
#define MAX3010X_H
#endif //MAX3010X_H