LibDriver BMM150
Loading...
Searching...
No Matches
driver_bmm150.h File Reference

driver bmm150 header file More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for driver_bmm150.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bmm150_handle_s
 bmm150 handle structure definition More...
struct  bmm150_info_s
 bmm150 information structure definition More...

Macros

#define DRIVER_BMM150_LINK_INIT(HANDLE, STRUCTURE)
 initialize bmm150_handle_t structure
#define DRIVER_BMM150_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_BMM150_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_BMM150_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_BMM150_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_BMM150_LINK_SPI_INIT(HANDLE, FUC)
 link spi_init function
#define DRIVER_BMM150_LINK_SPI_DEINIT(HANDLE, FUC)
 link spi_deinit function
#define DRIVER_BMM150_LINK_SPI_READ(HANDLE, FUC)
 link spi_read function
#define DRIVER_BMM150_LINK_SPI_WRITE(HANDLE, FUC)
 link spi_write function
#define DRIVER_BMM150_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_BMM150_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function
#define DRIVER_BMM150_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
 link receive_callback function

Typedefs

typedef struct bmm150_handle_s bmm150_handle_t
 bmm150 handle structure definition
typedef struct bmm150_info_s bmm150_info_t
 bmm150 information structure definition

Enumerations

enum  bmm150_interface_t { BMM150_INTERFACE_IIC = 0x00 , BMM150_INTERFACE_SPI = 0x01 }
 bmm150 interface enumeration definition More...
enum  bmm150_address_t { BMM150_ADDRESS_CSB_SDO_00 = (0x10 << 1) , BMM150_ADDRESS_CSB_SDO_01 = (0x11 << 1) , BMM150_ADDRESS_CSB_SDO_10 = (0x12 << 1) , BMM150_ADDRESS_CSB_SDO_11 = (0x13 << 1) }
 bmm150 address enumeration definition More...
enum  bmm150_bool_t { BMM150_BOOL_FALSE = 0x00 , BMM150_BOOL_TRUE = 0x01 }
 bmm150 bool enumeration definition More...
enum  bmm150_interrupt_status_t {
  BMM150_INTERRUPT_STATUS_DATA_OVERRUN = 7 , BMM150_INTERRUPT_STATUS_OVERFLOW = 6 , BMM150_INTERRUPT_STATUS_HIGH_THRESHOLD_Z = 5 , BMM150_INTERRUPT_STATUS_HIGH_THRESHOLD_Y = 4 ,
  BMM150_INTERRUPT_STATUS_HIGH_THRESHOLD_X = 3 , BMM150_INTERRUPT_STATUS_LOW_THRESHOLD_Z = 2 , BMM150_INTERRUPT_STATUS_LOW_THRESHOLD_Y = 1 , BMM150_INTERRUPT_STATUS_LOW_THRESHOLD_X = 0
}
 bmm150 interrupt status enumeration definition More...
enum  bmm150_spi_wire_t { BMM150_SPI_WIRE_4 = 0x00 , BMM150_SPI_WIRE_3 = 0x01 }
 bmm150 spi wire enumeration definition More...
enum  bmm150_advanced_self_test_t { BMM150_ADVANCED_SELF_TEST_NORMAL = 0x00 , BMM150_ADVANCED_SELF_TEST_NEGATIVE = 0x02 , BMM150_ADVANCED_SELF_TEST_POSITIVE = 0x03 }
 bmm150 advanced self test enumeration definition More...
enum  bmm150_data_rate_t {
  BMM150_DATA_RATE_10HZ = 0x00 , BMM150_DATA_RATE_2HZ = 0x01 , BMM150_DATA_RATE_6HZ = 0x02 , BMM150_DATA_RATE_8HZ = 0x03 ,
  BMM150_DATA_RATE_15HZ = 0x04 , BMM150_DATA_RATE_20HZ = 0x05 , BMM150_DATA_RATE_25HZ = 0x06 , BMM150_DATA_RATE_30HZ = 0x07
}
 bmm150 data rate enumeration definition More...
enum  bmm150_mode_t { BMM150_MODE_NORMAL = 0x00 , BMM150_MODE_FORCED = 0x01 , BMM150_MODE_SLEEP = 0x03 }
 bmm150 mode enumeration definition More...
enum  bmm150_data_ready_pin_polarity_t { BMM150_DATA_READY_PIN_POLARITY_LOW = 0x00 , BMM150_DATA_READY_PIN_POLARITY_HIGH = 0x01 }
 bmm150 data ready pin polarity enumeration definition More...
enum  bmm150_interrupt_pin_polarity_t { BMM150_INTERRUPT_PIN_POLARITY_LOW = 0x00 , BMM150_INTERRUPT_PIN_POLARITY_HIGH = 0x01 }
 bmm150 interrupt pin polarity enumeration definition More...

Functions

uint8_t bmm150_info (bmm150_info_t *info)
 get chip's information
uint8_t bmm150_set_interface (bmm150_handle_t *handle, bmm150_interface_t interface)
 set the chip interface
uint8_t bmm150_get_interface (bmm150_handle_t *handle, bmm150_interface_t *interface)
 get the chip interface
uint8_t bmm150_set_addr_pin (bmm150_handle_t *handle, bmm150_address_t addr_pin)
 set the iic address pin
uint8_t bmm150_get_addr_pin (bmm150_handle_t *handle, bmm150_address_t *addr_pin)
 get the iic address pin
uint8_t bmm150_irq_handler (bmm150_handle_t *handle)
 irq handler
uint8_t bmm150_init (bmm150_handle_t *handle)
 initialize the chip
uint8_t bmm150_deinit (bmm150_handle_t *handle)
 close the chip
uint8_t bmm150_read (bmm150_handle_t *handle, int16_t raw[3], float ut[3])
 read data
uint8_t bmm150_get_self_test_x (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get self test x result
uint8_t bmm150_get_self_test_y (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get self test y result
uint8_t bmm150_get_self_test_z (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get self test z result
uint8_t bmm150_get_data_ready_status (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get data ready status
uint8_t bmm150_get_interrupt_status (bmm150_handle_t *handle, bmm150_interrupt_status_t status, bmm150_bool_t *enable)
 get interrupt status
uint8_t bmm150_soft_reset (bmm150_handle_t *handle)
 soft reset
uint8_t bmm150_set_power_on (bmm150_handle_t *handle, bmm150_bool_t enable)
 set power on
uint8_t bmm150_get_power_on (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get power on
uint8_t bmm150_set_spi_wire (bmm150_handle_t *handle, bmm150_spi_wire_t wire)
 set spi wire
uint8_t bmm150_get_spi_wire (bmm150_handle_t *handle, bmm150_spi_wire_t *wire)
 get spi wire
uint8_t bmm150_set_advanced_self_test (bmm150_handle_t *handle, bmm150_advanced_self_test_t test)
 set advanced self test
uint8_t bmm150_get_advanced_self_test (bmm150_handle_t *handle, bmm150_advanced_self_test_t *test)
 get advanced self test
uint8_t bmm150_set_data_rate (bmm150_handle_t *handle, bmm150_data_rate_t rate)
 set data rate
uint8_t bmm150_get_data_rate (bmm150_handle_t *handle, bmm150_data_rate_t *rate)
 get data rate
uint8_t bmm150_set_mode (bmm150_handle_t *handle, bmm150_mode_t mode)
 set mode
uint8_t bmm150_get_mode (bmm150_handle_t *handle, bmm150_mode_t *mode)
 get mode
uint8_t bmm150_set_self_test (bmm150_handle_t *handle, bmm150_bool_t enable)
 enable or disable self test
uint8_t bmm150_get_self_test (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get self test status
uint8_t bmm150_set_interrupt (bmm150_handle_t *handle, bmm150_interrupt_status_t status, bmm150_bool_t enable)
 enable or disable interrupt
uint8_t bmm150_get_interrupt (bmm150_handle_t *handle, bmm150_interrupt_status_t status, bmm150_bool_t *enable)
 get interrupt status
uint8_t bmm150_set_data_ready_pin (bmm150_handle_t *handle, bmm150_bool_t enable)
 enable or disable data ready pin
uint8_t bmm150_get_data_ready_pin (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get data ready pin status
uint8_t bmm150_set_interrupt_pin (bmm150_handle_t *handle, bmm150_bool_t enable)
 enable or disable interrupt pin
uint8_t bmm150_get_interrupt_pin (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get interrupt pin status
uint8_t bmm150_set_channel_z (bmm150_handle_t *handle, bmm150_bool_t enable)
 enable or disable channel z
uint8_t bmm150_get_channel_z (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get channel z status
uint8_t bmm150_set_channel_y (bmm150_handle_t *handle, bmm150_bool_t enable)
 enable or disable channel y
uint8_t bmm150_get_channel_y (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get channel y status
uint8_t bmm150_set_channel_x (bmm150_handle_t *handle, bmm150_bool_t enable)
 enable or disable channel x
uint8_t bmm150_get_channel_x (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get channel x status
uint8_t bmm150_set_data_ready_pin_polarity (bmm150_handle_t *handle, bmm150_data_ready_pin_polarity_t polarity)
 set data ready pin polarity
uint8_t bmm150_get_data_ready_pin_polarity (bmm150_handle_t *handle, bmm150_data_ready_pin_polarity_t *polarity)
 get data ready pin polarity
uint8_t bmm150_set_interrupt_latch (bmm150_handle_t *handle, bmm150_bool_t enable)
 enable or disable interrupt latch
uint8_t bmm150_get_interrupt_latch (bmm150_handle_t *handle, bmm150_bool_t *enable)
 get interrupt latch status
uint8_t bmm150_set_interrupt_pin_polarity (bmm150_handle_t *handle, bmm150_interrupt_pin_polarity_t polarity)
 set interrupt pin polarity
uint8_t bmm150_get_interrupt_pin_polarity (bmm150_handle_t *handle, bmm150_interrupt_pin_polarity_t *polarity)
 get interrupt pin polarity
uint8_t bmm150_set_low_threshold (bmm150_handle_t *handle, int8_t threshold)
 set low threshold
uint8_t bmm150_get_low_threshold (bmm150_handle_t *handle, int8_t *threshold)
 get low threshold
uint8_t bmm150_set_high_threshold (bmm150_handle_t *handle, int8_t threshold)
 set high threshold
uint8_t bmm150_get_high_threshold (bmm150_handle_t *handle, int8_t *threshold)
 get high threshold
uint8_t bmm150_set_repxy_number (bmm150_handle_t *handle, uint8_t number)
 set repxy number
uint8_t bmm150_get_repxy_number (bmm150_handle_t *handle, uint8_t *number)
 get repxy number
uint8_t bmm150_set_repz_number (bmm150_handle_t *handle, uint8_t number)
 set repz number
uint8_t bmm150_get_repz_number (bmm150_handle_t *handle, uint8_t *number)
 get repz number
uint8_t bmm150_interrupt_threshold_convert_to_register (bmm150_handle_t *handle, float ut, int8_t *reg)
 convert the interrupt threshold to the register raw data
uint8_t bmm150_interrupt_threshold_convert_to_data (bmm150_handle_t *handle, int8_t reg, float *ut)
 convert the register raw data to the interrupt threshold
uint8_t bmm150_set_reg (bmm150_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t bmm150_get_reg (bmm150_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver bmm150 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2025-12-23

history

Date Version Author Description
2025/12/23 1.0 Shifeng Li first upload

Definition in file driver_bmm150.h.