MBot Software Library
v1.0
An API documentation to mbot_firmware repository
|
driver on MCU for bhy More...
#include <mbot/imu/bhy_uc_driver.h>
Functions | |
void | trace_log (const char *fmt,...) |
BHY_RETURN_FUNCTION_TYPE | bhy_driver_init (const uint8_t *bhy_fw_data) |
This function initializes the driver, the API and loads the ram patch into the sensor. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_meta_event_set_config (bhy_meta_event_type_t meta_event_id, bhy_meta_event_fifo_type_t fifo_sel, uint8_t enable_state, uint8_t int_enable_state) |
this function configures meta event More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_meta_event_get_config (bhy_meta_event_type_t meta_event_id, bhy_meta_event_fifo_type_t fifo_sel, uint8_t *p_enable_state, uint8_t *p_int_enable_state) |
this function gets configuration from specific meta event More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_enable_virtual_sensor (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status, uint16_t sample_rate, uint16_t max_report_latency_ms, uint8_t flush_sensor, uint16_t change_sensitivity, uint16_t dynamic_range) |
this functions enables the selected virtual sensor More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_disable_virtual_sensor (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status) |
this functions disables the selected virtual sensor More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_read_fifo (uint8_t *buffer, uint16_t buffer_size, uint16_t *bytes_read, uint16_t *bytes_left) |
this functions retrieves the fifo data,it needs a buffer of at least (BHY_I2C_REG_BUFFER_LENGTH + 1) bytes to work. it outputs the data into the variable buffer. the number of bytes read. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_parse_next_fifo_packet (uint8_t **fifo_buffer, uint16_t *fifo_buffer_length, bhy_data_generic_t *fifo_data_output, bhy_data_type_t *fifo_data_type) |
this functions parse the packet in fifo and get the actual fifo data of sensors More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_update_system_timestamp (bhy_data_scalar_u16_t *timestamp_packet, uint32_t *system_timestamp) |
This function will detect the timestamp packet accordingly and update either the MSW or the LSW of the system timestamp. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_write_parameter_page (uint8_t page, uint8_t parameter, uint8_t *data, uint8_t length) |
This function writes arbitrary data to an arbitrary parameter page. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_read_parameter_page (uint8_t page, uint8_t parameter, uint8_t *data, uint8_t length) |
This function reads arbitrary data from an arbitrary parameter page. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_mapping_matrix_set (bhy_physical_sensor_index_type_t index, int8_t *mapping_matrix) |
This function set mapping matrix to a corresponding physical sensor. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_mapping_matrix_get (bhy_physical_sensor_index_type_t index, int8_t *mapping_matrix) |
This function get mapping matrix from a corresponding physical sensor. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_soft_passthru_write (uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg) |
Soft pass-through parameter write function. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_soft_passthru_read (uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg) |
Soft pass-through parameter read function. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_gp_register_write (bhy_gp_register_type_t gp_reg, uint8_t data) |
Write data to specific GP register. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_gp_register_read (bhy_gp_register_type_t gp_reg, uint8_t *data) |
Write data to specific GP register. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_get_sic_matrix (float *sic_matrix) |
This function reads out the current SIC matrix from BHy. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_sync_cus_evt_size (void) |
This function get all the custom sensor data length according reading information from hub. More... | |
int8_t | bhy_get_cus_evt_size (bhy_virtual_sensor_t sensor_id) |
This function get the specific custom sensor data length according reading information from hub. More... | |
BHY_RETURN_FUNCTION_TYPE | bhy_set_sic_matrix (float *sic_matrix) |
This function write a new SIC matrix to the BHy. More... | |
void | bhy_print_debug_packet (bhy_data_debug_t *packet, void(*debug_print_ptr)(const uint8_t *)) |
This function outputs the debug data to function pointer You need to provide a function that takes as argument a zero-terminated string and prints it. More... | |
Variables | |
uint8_t | _fifoSizes [] |
driver on MCU for bhy
Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
The information provided is believed to be accurate and reliable. The copyright holder assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of the copyright holder.
BHY_RETURN_FUNCTION_TYPE bhy_disable_virtual_sensor | ( | bhy_virtual_sensor_t | sensor_id, |
uint8_t | wakeup_status | ||
) |
this functions disables the selected virtual sensor
[in] | sensor_id | sensor ID |
[in] | wakeup_status | status of WAKEUP OR NONWAKEUP |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_driver_init | ( | const uint8_t * | bhy_fw_data | ) |
This function initializes the driver, the API and loads the ram patch into the sensor.
[in] | bhy_fw_data | pointer to the firmware of bhy |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_enable_virtual_sensor | ( | bhy_virtual_sensor_t | sensor_id, |
uint8_t | wakeup_status, | ||
uint16_t | sample_rate, | ||
uint16_t | max_report_latency_ms, | ||
uint8_t | flush_sensor, | ||
uint16_t | change_sensitivity, | ||
uint16_t | dynamic_range | ||
) |
this functions enables the selected virtual sensor
[in] | sensor_id | sensor ID |
[in] | wakeup_status | status after wakeup |
[in] | sample_rate | sample rate |
[in] | max_report_latency_ms | max report latency,unit is millisecond |
[in] | flush_sensor | how to flush the fifo of sensor |
[in] | change_sensitivity | whether to change the sensitivity |
[in] | dynamic_range | dynamic range |
result | of execution |
int8_t bhy_get_cus_evt_size | ( | bhy_virtual_sensor_t | sensor_id | ) |
This function get the specific custom sensor data length according reading information from hub.
[in] | sensor_id | pointer to sensor_id |
result | of data length |
BHY_RETURN_FUNCTION_TYPE bhy_get_sic_matrix | ( | float * | sic_matrix | ) |
This function reads out the current SIC matrix from BHy.
[in] | sic_matrix | pointer to SIC matrix |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_gp_register_read | ( | bhy_gp_register_type_t | gp_reg, |
uint8_t * | data | ||
) |
Write data to specific GP register.
[in] | gp_reg | GP register address |
[in] | data | pointer to receive buffer |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_gp_register_write | ( | bhy_gp_register_type_t | gp_reg, |
uint8_t | data | ||
) |
Write data to specific GP register.
[in] | gp_reg | GP register address |
[in] | data | data to be written to GP register |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_get | ( | bhy_physical_sensor_index_type_t | index, |
int8_t * | mapping_matrix | ||
) |
This function get mapping matrix from a corresponding physical sensor.
[in] | index | physical sensor index |
[in] | mapping_matrix | pointer to a int8_t mapping_matrix[9] |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_set | ( | bhy_physical_sensor_index_type_t | index, |
int8_t * | mapping_matrix | ||
) |
This function set mapping matrix to a corresponding physical sensor.
[in] | index | physical sensor index |
[in] | mapping_matrix | pointer to a int8_t mapping_matrix[9] |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_meta_event_get_config | ( | bhy_meta_event_type_t | meta_event_id, |
bhy_meta_event_fifo_type_t | fifo_sel, | ||
uint8_t * | p_enable_state, | ||
uint8_t * | p_int_enable_state | ||
) |
this function gets configuration from specific meta event
[in] | meta_event_id | ID of meta event |
[in] | fifo_sel | to choose the FIFO |
[in] | p_enable_state | pointer of enable state of bhy |
[in] | p_int_enable_state | pointer of the enable state of interrupt |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_meta_event_set_config | ( | bhy_meta_event_type_t | meta_event_id, |
bhy_meta_event_fifo_type_t | fifo_sel, | ||
uint8_t | enable_state, | ||
uint8_t | int_enable_state | ||
) |
this function configures meta event
[in] | meta_event_id | ID of meta event |
[in] | fifo_sel | to choose the FIFO |
[in] | enable_state | enable state of bhy |
[in] | int_enable_state | enable state of interrupt |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_parse_next_fifo_packet | ( | uint8_t ** | fifo_buffer, |
uint16_t * | fifo_buffer_length, | ||
bhy_data_generic_t * | fifo_data_output, | ||
bhy_data_type_t * | fifo_data_type | ||
) |
this functions parse the packet in fifo and get the actual fifo data of sensors
[in] | fifo_buffer | pointer of fifo |
[in] | fifo_buffer_length | size of the fifo |
[out] | fifo_data_output | the actual fifo data of sensors |
[out] | fifo_data_type | data type of fifo data |
result | of execution |
void bhy_print_debug_packet | ( | bhy_data_debug_t * | packet, |
void(*)(const uint8_t *) | debug_print_ptr | ||
) |
This function outputs the debug data to function pointer You need to provide a function that takes as argument a zero-terminated string and prints it.
[in] | packet | debug message |
[in] | debug_print_ptr | print function |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_read_fifo | ( | uint8_t * | buffer, |
uint16_t | buffer_size, | ||
uint16_t * | bytes_read, | ||
uint16_t * | bytes_left | ||
) |
this functions retrieves the fifo data,it needs a buffer of at least (BHY_I2C_REG_BUFFER_LENGTH + 1) bytes to work. it outputs the data into the variable buffer. the number of bytes read.
[in] | buffer | pointer of buffer |
[in] | buffer_size | size of the buffer in bytes |
[out] | bytes_read | the bytes in fifo which have been read |
[out] | bytes_left | the bytes left in fifo which have not been read |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_read_parameter_page | ( | uint8_t | page, |
uint8_t | parameter, | ||
uint8_t * | data, | ||
uint8_t | length | ||
) |
This function reads arbitrary data from an arbitrary parameter page.
[in] | page | select the page of parameter |
[in] | parameter | select the parameter |
[out] | data | data to be read from parameter |
[in] | length | length of data |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_set_sic_matrix | ( | float * | sic_matrix | ) |
This function write a new SIC matrix to the BHy.
[in] | sic_matrix | pointer to SIC matrix |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_read | ( | uint8_t | addr, |
uint8_t | reg, | ||
uint8_t * | data, | ||
uint8_t | length, | ||
uint8_t | increment_reg | ||
) |
Soft pass-through parameter read function.
[in] | addr | physical sensor index |
[in] | reg | register address to be written |
[out] | data | pointer to data to be written |
[in] | length | |
[in] | increment_reg | if true, the function will automatically increment the register between successive 4-bytes transfers |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_write | ( | uint8_t | addr, |
uint8_t | reg, | ||
uint8_t * | data, | ||
uint8_t | length, | ||
uint8_t | increment_reg | ||
) |
Soft pass-through parameter write function.
[in] | addr | physical sensor index |
[in] | reg | register address to be written |
[in] | data | pointer to data to be written |
[in] | length | |
[in] | increment_reg | if true, the function will automatically increment the register between successive 4-bytes transfers |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_sync_cus_evt_size | ( | void | ) |
This function get all the custom sensor data length according reading information from hub.
[in] | none |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_update_system_timestamp | ( | bhy_data_scalar_u16_t * | timestamp_packet, |
uint32_t * | system_timestamp | ||
) |
This function will detect the timestamp packet accordingly and update either the MSW or the LSW of the system timestamp.
system_timestamp is only valid after LSW comes.
[in] | timestamp_packet | timestamp of packets |
[in/out] | system_timestamp timestamp of system |
result | of execution |
BHY_RETURN_FUNCTION_TYPE bhy_write_parameter_page | ( | uint8_t | page, |
uint8_t | parameter, | ||
uint8_t * | data, | ||
uint8_t | length | ||
) |
This function writes arbitrary data to an arbitrary parameter page.
[in] | page | select the page of parameter |
[in] | parameter | select the parameter |
[in] | data | data to be written to parameter |
[in] | length | length of data |
result | of execution |
uint8_t _fifoSizes[] |