This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52832 bmi160 read interrupt orient-recognize

void BMI_INT_init (void)
{

  /* Select the Interrupt channel/pin */
  int_config.int_channel = BMI160_INT_CHANNEL_1;// Interrupt channel/pin 1

  /* Select the Interrupt type */
  int_config.int_type = BMI160_ACC_ORIENT_INT;// Choosing Any motion interrupt

  /* Select the interrupt channel/pin settings */
  int_config.int_pin_settg.output_en = 1;   /* 0- output disabled ,1- output enabled */
  int_config.int_pin_settg.output_mode = 0;  /*! 0 - push-pull 1- open drain,only valid if output_en is set 1 */
  int_config.int_pin_settg.output_type = 0; /*! 0 - active low , 1 - active high level.
                                             * if output_en is 1,this applies to interrupts,else PMU_trigger */
  int_config.int_pin_settg.edge_ctrl = 1;   /*! 0 - level trigger , 1 - edge trigger  */
  int_config.int_pin_settg.input_en = BMI160_DISABLE;// Disabling interrupt pin to act as input
  int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_NONE;// non-latched output

  /* Select the Any-motion interrupt parameters */
  int_config.int_type_cfg.acc_orient_int.orient_mode = 3;// 1- Enable the any-motion, 0- disable any-motion 
  int_config.int_type_cfg.acc_orient_int.orient_blocking = 3;// Enabling x-axis for any motion interrupt
  int_config.int_type_cfg.acc_orient_int.orient_hyst = BMI160_ENABLE;// Enabling y-axis for any motion interrupt
  int_config.int_type_cfg.acc_orient_int.orient_theta = BMI160_ENABLE;// Enabling z-axis for any motion interrupt
  int_config.int_type_cfg.acc_orient_int.orient_ud_en = 1;// any-motion duration
  int_config.int_type_cfg.acc_orient_int.axes_ex = 1;// (2-g range) -> (slope_thr) * 3.91 mg, (4-g range) -> (slope_thr) * 7.81 mg, (8-g range) ->(slope_thr) * 15.63 mg, (16-g range) -> (slope_thr) * 31.25 mg 
  int_config.int_type_cfg.acc_orient_int.orient_en = 1;// (2-g range) -> (slope_thr) * 3.91 mg, (4-g range) -> (slope_thr) * 7.81 mg, (8-g range) ->(slope_thr) * 15.63 mg, (16-g range) -> (slope_thr) * 31.25 mg 

  

  
  /* Set the Any-motion interrupt */
   rslt = bmi160_set_int_config(&int_config, &sensor); /* sensor is an instance of the structure bmi160_dev  */
   APP_ERROR_CHECK(rslt);

    if(rslt == BMI160_OK){
    NRF_LOG_INFO("interrupt Initialized...");
    } else {
    NRF_LOG_INFO("interrupt not Initialized...");
    }NRF_LOG_FLUSH();

    int_status_sel = BMI160_INT_STATUS_ALL;
    bmi160_get_int_status(int_status_sel, &int_status, &sensor);

i want to use orientation interrupt of bmi160. but i don't know how to read interrupt data. I wrote it after looking at the data sheet, but I want you to let me know if there's anything lacking.

Parents Reply Children
No Data
Related