| BlueNRG-1 SDK drivers APIs

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

LPS25HB.h
Go to the documentation of this file.
1
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef __LPS25HB_H
41 #define __LPS25HB_H
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 /* Includes ------------------------------------------------------------------*/
48 #include <stdint.h>
49
50
67 #ifndef NULL
68 #define NULL (void *) 0
69 #endif
70
71
72 /******************************************************************************/
73 /*************************** START REGISTER MAPPING **************************/
74 /******************************************************************************/
75
76
86 #define LPS25HB_REF_P_XL_ADDR 0x08
87
97 #define LPS25HB_REF_P_L_ADDR 0x09
98
108 #define LPS25HB_REF_P_H_ADDR 0x0A
109
119 #define LPS25HB_WHO_AM_I_ADDR 0x0F
120
131 #define LPS25HB_RES_CONF_ADDR 0x10
132
158 #define LPS25HB_CTRL_REG1_ADDR 0x20
159
174 #define LPS25HB_CTRL_REG2_ADDR 0x21
175
196 #define LPS25HB_CTRL_REG3_ADDR 0x22
197
213 #define LPS25HB_CTRL_REG4_ADDR 0x23
214
226 #define LPS25HB_INT_CFG_REG_ADDR 0x24
227
239 #define LPS25HB_INT_SOURCE_REG_ADDR 0x25
240
251 #define LPS25HB_THS_P_LOW_REG_ADDR 0x30
252
263 #define LPS25HB_THS_P_HIGH_REG_ADDR 0x31
264
278 #define LPS25HB_STATUS_REG_ADDR 0x27
279
290 #define LPS25HB_PRESS_POUT_XL_ADDR 0x28
291
302 #define LPS25HB_PRESS_OUT_L_ADDR 0x29
303
314 #define LPS25HB_PRESS_OUT_H_ADDR 0x2A
315
325 #define LPS25HB_TEMP_OUT_L_ADDR 0x2B
326
336 #define LPS25HB_TEMP_OUT_H_ADDR 0x2C
337
366 #define LPS25HB_CTRL_FIFO_ADDR 0x2E
367
379 #define LPS25HB_STATUS_FIFO_ADDR 0x2F
380
389 #define LPS25HB_RPDS_TRIM_L_ADDR 0x39
390
399 #define LPS25HB_RPDS_TRIM_H_ADDR 0x3A
400
401 /******************************************************************************/
402 /**************************** END REGISTER MAPPING ***************************/
403 /******************************************************************************/
404
408 #define LPS25HB_I2C_MULTIPLEBYTE_CMD ((uint8_t)0x80)
409
413 //#define LPS25HB_ADDRESS_LOW 0xB8
414 //#define LPS25HB_ADDRESS_HIGH 0xBA
415 #define LPS25HB_ADDRESS_LOW 0x5C
416 #define LPS25HB_ADDRESS_HIGH 0x5B
417
418
422 #define I_AM_LPS25HB ((uint8_t)0xBD)
423
427 #define LPS25HB_MODE_POWERDOWN ((uint8_t)0x00)
428 #define LPS25HB_MODE_ACTIVE ((uint8_t)0x80)
429
430 #define LPS25HB_MODE_MASK ((uint8_t)0x80)
431
438 #define LPS25HB_ODR_ONE_SHOT ((uint8_t)0x00)
439 #define LPS25HB_ODR_1Hz ((uint8_t)0x10)
440 #define LPS25HB_ODR_7Hz ((uint8_t)0x20)
441 #define LPS25HB_ODR_12_5Hz ((uint8_t)0x30)
442 #define LPS25HB_ODR_25Hz ((uint8_t)0x40)
444 #define LPS25HB_ODR_MASK ((uint8_t)0x70)
445
452 #define LPS25HB_DIFF_DISABLE ((uint8_t)0x00)
453 #define LPS25HB_DIFF_ENABLE ((uint8_t)0x08)
455 #define LPS25HB_DIFF_EN_MASK ((uint8_t)0x08)
456
463 #define LPS25HB_BDU_CONT ((uint8_t)0x00)
464 #define LPS25HB_BDU_READ ((uint8_t)0x04)
466 #define LPS25HB_BDU_MASK ((uint8_t)0x04)
467
474 #define LPS25HB_SPI_SIM_4W ((uint8_t)0x00)
475 #define LPS25HB_SPI_SIM_3W ((uint8_t)0x01)
477 #define LPS25HB_SPI_SIM_MASK ((uint8_t)0x01)
478
485 #define LPS25HB_NORMAL_MODE ((uint8_t)0x00)
486 #define LPS25HB_RESET_MEMORY ((uint8_t)0x80)
487
488 #define LPS25HB_RESET_MEMORY_MASK ((uint8_t)0x80)
489
496 #define LPS25HB_P_RES_AVG_8 ((uint8_t)0x00)
497 #define LPS25HB_P_RES_AVG_32 ((uint8_t)0x01)
498 #define LPS25HB_P_RES_AVG_128 ((uint8_t)0x02)
499 #define LPS25HB_P_RES_AVG_512 ((uint8_t)0x03)
500
501 #define LPS25HB_P_RES_MASK ((uint8_t)0x03)
502
509 #define LPS25HB_T_RES_AVG_8 ((uint8_t)0x00)
510 #define LPS25HB_T_RES_AVG_16 ((uint8_t)0x04)
511 #define LPS25HB_T_RES_AVG_32 ((uint8_t)0x08)
512 #define LPS25HB_T_RES_AVG_64 ((uint8_t)0x0C)
513
514 #define LPS25HB_T_RES_MASK ((uint8_t)0x0C)
515
519 #define LPS25HB_SA0_LOW ((uint8_t)0x00)
520 #define LPS25HB_SA0_HIGH ((uint8_t)0x01)
521
533 typedef struct
534 {
535 uint8_t OutputDataRate;
536 uint8_t PressureResolution;
537 uint8_t TemperatureResolution;
538 uint8_t DiffEnable;
539 uint8_t BlockDataUpdate;
540 uint8_t SPIMode;
541 } PRESSURE_InitTypeDef;
542
546 typedef enum {
547 PRESSURE_OK = 0,
548 PRESSURE_ERROR = 1,
549 PRESSURE_TIMEOUT = 2,
550 PRESSURE_NOT_IMPLEMENTED = 3
551 } PRESSURE_StatusTypeDef;
552
556 typedef enum {
557 PRESSURE_NONE_COMPONENT = 0,
558 PRESSURE_LPS25H_COMPONENT = 1,
559 PRESSURE_LPS25HB_DIL24_COMPONENT = 2
560 } PRESSURE_ComponentTypeDef;
561
565 typedef struct {
566 PRESSURE_ComponentTypeDef id; /* This id must be unique for each component belonging to this class that wants to extend common class */
567 void *pData; /* This pointer is specific for each component */
568 }PRESSURE_DrvExtTypeDef;
569
573 typedef struct
574 {
575 PRESSURE_StatusTypeDef (*Init)(PRESSURE_InitTypeDef *);
576 PRESSURE_StatusTypeDef (*PowerOff)(void);
577 PRESSURE_StatusTypeDef (*ReadID)(uint8_t *);
578 PRESSURE_StatusTypeDef (*Reset)(void);
579 void (*ConfigIT)(uint16_t);
580 void (*EnableIT)(uint8_t);
581 void (*DisableIT)(uint8_t);
582 uint8_t (*ITStatus)(uint16_t, uint16_t);
583 void (*ClearIT)(uint16_t, uint16_t);
584 PRESSURE_StatusTypeDef (*GetPressure)(float *);
585 PRESSURE_StatusTypeDef (*GetTemperature)(float *);
586 void (*SlaveAddrRemap)(uint8_t);
587 PRESSURE_DrvExtTypeDef *extData;
588 }PRESSURE_DrvTypeDef;
589
598 /* Pressure sensor IO functions */
599 extern PRESSURE_StatusTypeDef LPS25HB_IO_Init(void);
600 extern PRESSURE_StatusTypeDef LPS25HB_IO_Write(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToWrite);
601 extern PRESSURE_StatusTypeDef LPS25HB_IO_Read(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToRead);
602 extern PRESSURE_StatusTypeDef LPS25HB_IO_ITConfig( void );
603
608 /* ------------------------------------------------------- */
609 /* Here you should declare the internal struct of */
610 /* extended features of LPS25HB. See the example of */
611 /* LSM6DS3 in lsm6ds3.h */
612 /* ------------------------------------------------------- */
613
618 /* Pressure sensor driver structure */
619 extern PRESSURE_DrvTypeDef LPS25HBDrv;
620
621
638 #ifdef __cplusplus
639 }
640 #endif
641
642 #endif /* __LPS25HB_H */
643
644 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
PRESSURE_TIMEOUT
Definition: LPS25HB.h:549
PRESSURE_LPS25HB_DIL24_COMPONENT
Definition: LPS25HB.h:559
PRESSURE_ERROR
Definition: LPS25HB.h:548
PRESSURE_InitTypeDef::BlockDataUpdate
uint8_t BlockDataUpdate
Definition: LPS25HB.h:539
PRESSURE_LPS25H_COMPONENT
Definition: LPS25HB.h:558
PRESSURE_InitTypeDef::OutputDataRate
uint8_t OutputDataRate
Definition: LPS25HB.h:535
PRESSURE_ComponentTypeDef
PRESSURE_ComponentTypeDef
PRESSURE component id enumerator definition.
Definition: LPS25HB.h:556
LPS25HB_IO_Init
PRESSURE_StatusTypeDef LPS25HB_IO_Init(void)
LPS25HB_IO_ITConfig
PRESSURE_StatusTypeDef LPS25HB_IO_ITConfig(void)
PRESSURE_InitTypeDef
PRESSURE init structure definition.
Definition: LPS25HB.h:533
PRESSURE_DrvExtTypeDef::pData
void * pData
Definition: LPS25HB.h:567
PRESSURE_DrvTypeDef
PRESSURE driver structure definition.
Definition: LPS25HB.h:573
PRESSURE_OK
Definition: LPS25HB.h:547
PRESSURE_DrvExtTypeDef
PRESSURE driver extended structure definition.
Definition: LPS25HB.h:565
PRESSURE_DrvTypeDef::extData
PRESSURE_DrvExtTypeDef * extData
Definition: LPS25HB.h:587
PRESSURE_InitTypeDef::DiffEnable
uint8_t DiffEnable
Definition: LPS25HB.h:538
PRESSURE_StatusTypeDef
PRESSURE_StatusTypeDef
PRESSURE status enumerator definition.
Definition: LPS25HB.h:546
PRESSURE_InitTypeDef::TemperatureResolution
uint8_t TemperatureResolution
Definition: LPS25HB.h:537
LPS25HBDrv
PRESSURE_DrvTypeDef LPS25HBDrv
Definition: LPS25HB.c:67
PRESSURE_DrvExtTypeDef::id
PRESSURE_ComponentTypeDef id
Definition: LPS25HB.h:566
LPS25HB_IO_Read
PRESSURE_StatusTypeDef LPS25HB_IO_Read(uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToRead)
PRESSURE_NOT_IMPLEMENTED
Definition: LPS25HB.h:550
PRESSURE_InitTypeDef::SPIMode
uint8_t SPIMode
Definition: LPS25HB.h:540
PRESSURE_InitTypeDef::PressureResolution
uint8_t PressureResolution
Definition: LPS25HB.h:536
LPS25HB_IO_Write
PRESSURE_StatusTypeDef LPS25HB_IO_Write(uint8_t *pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToWrite)
PRESSURE_NONE_COMPONENT
Definition: LPS25HB.h:557