Moved to the bma456h lib
This commit is contained in:
parent
de747ef463
commit
50586f2b50
16
main/i2c.c
16
main/i2c.c
@ -1,6 +1,6 @@
|
||||
#include "i2c.h"
|
||||
#include "bma4.h"
|
||||
#include "bma456w.h"
|
||||
#include "bma456h.h"
|
||||
#include "bma4_defs.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/i2c_master.h"
|
||||
@ -138,7 +138,7 @@ void read_sensor_task(void *params) {
|
||||
if (interrupt_status) {
|
||||
ESP_LOGI("INTERRUPT", "Da war der Interrupt resetting");
|
||||
interrupt_status = 0;
|
||||
ret = bma456w_read_int_status(&int_status, &bma456_struct);
|
||||
ret = bma456h_read_int_status(&int_status, &bma456_struct);
|
||||
bma4_error_codes_print_result("bma456w_step_counter_output status", ret);
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ void init_bma456() {
|
||||
int8_t ret;
|
||||
bma456_struct.chip_id = 0;
|
||||
|
||||
ret = bma456w_init(&bma456_struct);
|
||||
ret = bma456h_init(&bma456_struct);
|
||||
bma4_error_codes_print_result("I2C Init", ret);
|
||||
|
||||
ESP_LOGI("I2C", "Chip Init ausgelesene CHIP ID %d", bma456_struct.chip_id);
|
||||
@ -184,20 +184,21 @@ void init_bma456() {
|
||||
ESP_LOGI("I2C", "Config Pointer %p", bma456_struct.config_file_ptr);
|
||||
|
||||
ESP_LOGI("I2C", "Starte Config-File Upload...");
|
||||
ret = bma456w_write_config_file(&bma456_struct);
|
||||
ret = bma456h_write_config_file(&bma456_struct);
|
||||
bma4_error_codes_print_result("bma4_write_config_file", ret);
|
||||
|
||||
/* Enable the accelerometer */
|
||||
ret = bma4_set_accel_enable(BMA4_ENABLE, &bma456_struct);
|
||||
bma4_error_codes_print_result("bma4_set_accel_enable status", ret);
|
||||
|
||||
ret = bma456w_feature_enable(BMA456W_STEP_CNTR, BMA4_ENABLE, &bma456_struct);
|
||||
ret = bma456h_feature_enable((BMA456H_DOUBLE_TAP_EN), BMA4_ENABLE,
|
||||
&bma456_struct);
|
||||
bma4_error_codes_print_result("bma456w_feature_enable status", ret);
|
||||
|
||||
/* Setting watermark level 1, the output step resolution is 20 steps.
|
||||
* Eg: 1 means, 1 * 20 = 20. Every 20 steps once output triggers
|
||||
*/
|
||||
ret = bma456w_step_counter_set_watermark(1, &bma456_struct);
|
||||
ret = bma456h_step_counter_set_watermark(1, &bma456_struct);
|
||||
bma4_error_codes_print_result("bma456w_step_counter_set_watermark status",
|
||||
ret);
|
||||
|
||||
@ -207,8 +208,9 @@ void init_bma456() {
|
||||
ret = bma4_get_int_pin_config(&pin_config, int_line, &bma456_struct);
|
||||
bma4_error_codes_print_result("bma4_get_int_pin_config status", ret);
|
||||
|
||||
ret = bma456w_map_interrupt(int_line, BMA456W_STEP_CNTR_INT, BMA4_ENABLE,
|
||||
ret = bma456h_map_interrupt(int_line, BMA456H_TAP_OUT_INT, BMA4_ENABLE,
|
||||
&bma456_struct);
|
||||
|
||||
bma4_error_codes_print_result("bma456w_map_interrupt status", ret);
|
||||
|
||||
pin_config.edge_ctrl = BMA4_EDGE_TRIGGER;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user