### Install WSL Version 1 Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Installs WSL version 1 and sets it as the default for easier COM port access. ```bash wsl --set-version Ubuntu 1 wsl --set-default-version 1 ``` -------------------------------- ### Install and Configure Minicom Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Installs minicom for serial communication and configures it to listen to the COM port. ```bash sudo apt install minicom minicom -s minicom ``` -------------------------------- ### Clone Micro-ROS Setup Repository Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Clones the micro-ROS setup repository into the workspace. Ensure the ROS_DISTRO environment variable is set. ```bash mkdir microros_ws cd microros_ws git clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup ``` -------------------------------- ### Install and Update ROS Dependencies Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Installs rosdep and updates dependencies for the micro-ROS workspace. ```bash sudo apt install python3-rosdep2 sudo apt update && rosdep update rosdep install --from-paths src --ignore-src -y ``` -------------------------------- ### Build Micro-ROS Tools Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Installs pip and colcon extensions, then builds the micro-ROS tools. ```bash sudo apt-get install python3-pip sudo apt install python3-colcon-common-extensions colcon build source install/local_setup.bash ``` -------------------------------- ### Start Raise to Wake Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the Raise to Wake algorithm and registers an interrupt handler. Parameters are optional; if omitted, no handler is registered. ```C++ volatile bool irq_received = false; void irq_handler(void) { irq_received = true; } // APEX Tap enabled, irq on pin 2 IMU.startRaiseToWake(2,irq_handler); ``` -------------------------------- ### Start Pedometer Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the pedometer algorithm and registers an interrupt handler. Ensure the Accel ODR is set to 50 Hz and APEX Pedometer is enabled. ```C++ volatile uint8_t irq_received = 0; void irq_handler(void) { irq_received = 1; } // Accel ODR = 50 Hz and APEX Pedometer enabled IMU.startPedometer(2,irq_handler); ``` -------------------------------- ### Start Wake on Motion Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the Wake on Motion algorithm and registers an interrupt handler. Movement detection triggers the handler. ```C++ volatile bool wake_up = false; void irq_handler(void) { wake_up = true; } // APEX WoM enabled, irq on pin 2 IMU.startWakeOnMotion(2,irq_handler); ``` -------------------------------- ### Create and Build Micro-ROS Agent Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Creates and builds the micro-ROS agent packages. Ensure to source the local setup after building. ```bash ros2 run micro_ros_setup create_agent_ws.sh ros2 run micro_ros_setup build_agent.sh source ~/microros_ws/install/local_setup.bash ``` -------------------------------- ### Start Accelerometer Logging Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts accelerometer logging with specified output data rate and full-scale range. Defaults are 100 Hz ODR and 16 G FSR. ```C++ IMU.startAccel(100,16); ``` -------------------------------- ### Start Tap Detection Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the tap detection algorithm and registers an interrupt handler. Parameters are optional; if omitted, no handler is registered. ```C++ volatile bool irq_received = false; void irq_handler(void) { irq_received = true; } // APEX Tap enabled, irq on pin 2 IMU.startTap(2,irq_handler); ``` -------------------------------- ### Start Tilt Detection Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the tilt detection algorithm and registers an interrupt handler. Ensure the Accel ODR is set to 50 Hz and APEX Tilt is enabled. ```C++ void irq_handler(void) { Serial.println("TILT"); } // Accel ODR = 50 Hz and APEX Tilt enabled IMU.startTiltDetection(2,irq_handler); ``` -------------------------------- ### Run Micro-ROS Agent Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Starts the Micro-ROS agent in a WSL window, connecting to the Arduino board via serial. The -b option sets the baudrate, and --dev specifies the serial device. ```bash source /opt/ros/iron/setup.bash source ~/microros_ws/install/local_setup.bash ros2 run micro_ros_agent micro_ros_agent serial -b 1000000 --dev /dev/tty ``` -------------------------------- ### Start Gyroscope Logging Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts gyroscope logging with specified output data rate and full-scale range. Defaults are 100 Hz ODR and 2000 dps FSR. ```C++ IMU.startGyro(100,2000); ``` -------------------------------- ### startRaiseToWake Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the Raise to Wake algorithm. The provided handler is called when a Raise to Wake event is detected. Any interruptable pin can be used for intpin. Parameters are optional. ```APIDOC ## startRaiseToWake ### Description Starts the Raise to Wake algorithm. The provided handler is called when a Raise to Wake event is detected. Any interruptable pin can be used for intpin. Parameters are optional. ### Method Signature `int startRaiseToWake(uint8_t intpin, ICM456xx_irq_handler handler)` ### Parameters * **intpin** (uint8_t) - The interrupt pin to use. * **handler** (ICM456xx_irq_handler) - The function to call when a Raise to Wake event is detected. ### Example ```C++ volatile bool irq_received = false; void irq_handler(void) { irq_received = true; } // APEX Tap enabled, irq on pin 2 IMU.startRaiseToWake(2,irq_handler); ``` ``` -------------------------------- ### startWakeOnMotion Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the Wake on Motion algorithm. The provided handler is called when a movement is detected. Any interruptable pin can be used for intpin. ```APIDOC ## startWakeOnMotion ### Description Starts the Wake on Motion algorithm. The provided handler is called when a movement is detected. Any interruptable pin can be used for intpin. ### Method Signature `int startWakeOnMotion(uint8_t intpin, ICM456xx_irq_handler handler)` ### Parameters * **intpin** (uint8_t) - The interrupt pin to use. * **handler** (ICM456xx_irq_handler) - The function to call when movement is detected. ### Example ```C++ volatile bool wake_up = false; void irq_handler(void) { wake_up = true; } // APEX WoM enabled, irq on pin 2 IMU.startWakeOnMotion(2,irq_handler); ``` ``` -------------------------------- ### startTap Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the Tap detection algorithm. The provided handler is called when a Tap event is detected. Any interruptable pin can be used for intpin. Parameters are optional. ```APIDOC ## startTap ### Description Starts the Tap detection algorithm. The provided handler is called when a Tap event is detected. Any interruptable pin can be used for intpin. Parameters are optional. ### Method Signature `int startTap(uint8_t intpin, ICM456xx_irq_handler handler)` ### Parameters * **intpin** (uint8_t) - The interrupt pin to use. * **handler** (ICM456xx_irq_handler) - The function to call when a tap event is detected. ### Example ```C++ volatile bool irq_received = false; void irq_handler(void) { irq_received = true; } // APEX Tap enabled, irq on pin 2 IMU.startTap(2,irq_handler); ``` ``` -------------------------------- ### startAccel Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts logging with the accelerometer, using the specified full scale range and output data rate. Supported ODRs range from 1 to 6400 Hz, and supported full scale ranges are 2 to 32 G. Values outside these ranges default to 100 Hz and 16 G respectively. ```APIDOC ## startAccel ### Description Starts logging with the accelerometer, using the specified full scale range and output data rate. ### Method Signature `int startAccel(uint16_t odr, uint16_t fsr)` ### Parameters #### Path Parameters - **odr** (uint16_t) - Output Data Rate in Hz. Defaults to 100 Hz if an unsupported value is provided. - **fsr** (uint16_t) - Full Scale Range in G. Defaults to 16 G if an unsupported value is provided. ### Request Example ```C++ IMU.startAccel(100,16); ``` ``` -------------------------------- ### getTap Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Gets the tap algorithm output, including tap count, axis, and direction. ```APIDOC ## getTap ### Description Gets the tap algorithm output. The tap algorithm returns the number of taps as *tap count*, the tap axis as the *axis* and the tap direction *direction*. ### Method Signature `int getTap(uint8_t& tap_count, uint8_t& axis, uint8_t& direction)` ### Parameters * **tap_count** (uint8_t&) - Output parameter for the number of taps. * **axis** (uint8_t&) - Output parameter for the tap axis (0: X, 1: Y, 2: Z). * **direction** (uint8_t&) - Output parameter for the tap direction (0: +, 1: -). ### Example ```C++ const char* axis_str[3] = {"X", "Y", "Z"}; const char* direction_str[2] = {"+", "-"}; uint8_t tap_count=0; uint8_t axis=0; uint8_t direction=0; IMU.getTap(tap_count,axis,direction); Serial.print("Tap count:"); Serial.println(tap_count); Serial.print("Axis:"); Serial.println(axis_str[axis]); Serial.print("Direction:"); Serial.println(direction_str[direction]); ``` ``` -------------------------------- ### startTiltDetection Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the tilt detection algorithm. The provided handler is called when a tilt event is detected. Any interruptable pin can be used for intpin. Parameters are optional. ```APIDOC ## startTiltDetection ### Description Starts the tilt detection algorithm. The provided handler is called when a tilt event is detected. Any interruptable pin can be used for intpin. Parameters are optional. ### Method Signature `int startTiltDetection(uint8_t intpin, ICM456xx_irq_handler handler)` ### Parameters * **intpin** (uint8_t) - The interrupt pin to use. * **handler** (ICM456xx_irq_handler) - The function to call when a tilt event is detected. ### Example ```C++ void irq_handler(void) { Serial.println("TILT"); } // Accel ODR = 50 Hz and APEX Tilt enabled IMU.startTiltDetection(2,irq_handler); ``` ``` -------------------------------- ### startPedometer Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts the pedometer algorithm. The provided handler is called when a pedometer event is detected. Any interruptable pin can be used for intpin. Parameters are optional. ```APIDOC ## startPedometer ### Description Starts the pedometer algorithm. The provided handler is called when a pedometer event is detected. Any interruptable pin can be used for intpin. Parameters are optional. ### Method Signature `int startPedometer(uint8_t intpin, ICM456xx_irq_handler handler)` ### Parameters * **intpin** (uint8_t) - The interrupt pin to use. * **handler** (ICM456xx_irq_handler) - The function to call when a pedometer event is detected. ### Example ```C++ volatile uint8_t irq_received = 0; void irq_handler(void) { irq_received = 1; } // Accel ODR = 50 Hz and APEX Pedometer enabled IMU.startPedometer(2,irq_handler); ``` ``` -------------------------------- ### getRaiseToWake Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Gets the Raise to Wake value. Returns 1 for wake, 0 for sleep. ```APIDOC ## getRaiseToWake ### Description Gets the Raise to Wake value: 1 for *wake*, 0 for *sleep*. ### Method Signature `int getRaiseToWake(void)` ### Return Value * `1` if the device is awake. * `0` if the device is sleeping. ### Example ```C++ if(IMU.getRaiseToWake()) { Serial.println("Wake-up"); } else { Serial.println("Going to sleep"); } ``` ``` -------------------------------- ### startGyro Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Starts logging with the gyroscope, using the specified full scale range and output data rate. Supported ODRs range from 1 to 6400 Hz, and supported full scale ranges are 16 to 4000 dps. Values outside these ranges default to 100 Hz and 2000 dps respectively. ```APIDOC ## startGyro ### Description Starts logging with the gyroscope, using the specified full scale range and output data rate. ### Method Signature `int startGyro(uint16_t odr, uint16_t fsr)` ### Parameters #### Path Parameters - **odr** (uint16_t) - Output Data Rate in Hz. Defaults to 100 Hz if an unsupported value is provided. - **fsr** (uint16_t) - Full Scale Range in dps. Defaults to 2000 dps if an unsupported value is provided. ### Request Example ```C++ IMU.startGyro(100,2000); ``` ``` -------------------------------- ### getPedometer Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Gets the pedometer algorithm output, including step count, step cadence, and activity. ```APIDOC ## getPedometer ### Description Gets the pedometer algorithm output. The pedometer algorithm returns the number of steps as *step count*, the number of steps per seconds as the *step cadence* and the walk/run *activity*. ### Method Signature `int getPedometer(uint16_t& step_count, float& step_cadence, char*& activity)` ### Parameters * **step_count** (uint16_t&) - Output parameter for the number of steps. * **step_cadence** (float&) - Output parameter for the number of steps per second. * **activity** (char*&) - Output parameter for the walk/run activity. ### Example ```C++ uint16_t step_count=0; float step_cadence=0; char* activity; IMU.getPedometer(step_count,step_cadence,activity); Serial.print("Step count:"); Serial.println(step_count); Serial.print("Step cadence:"); Serial.println(step_cadence); Serial.print("activity:"); Serial.println(activity); ``` ``` -------------------------------- ### Get Pedometer Data Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Retrieves the pedometer algorithm's output, including step count, step cadence, and activity. ```C++ uint16_t step_count=0; float step_cadence=0; char* activity; IMU.getPedometer(step_count,step_cadence,activity); Serial.print("Step count:"); Serial.println(step_count); Serial.print("Step cadence:"); Serial.println(step_cadence); Serial.print("activity:"); Serial.println(activity); ``` -------------------------------- ### Get Raise to Wake Status Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Retrieves the Raise to Wake status. Returns 1 for wake and 0 for sleep. ```C++ if(IMU.getRaiseToWake()) { Serial.println("Wake-up"); } else { Serial.println("Going to sleep"); } ``` -------------------------------- ### Get Sensor Data from Registers Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Reads raw sensor data (accelerometer, gyroscope, temperature) from registers and populates the inv_imu_sensor_data_t structure. Temperature is in Degrees Centigrade. ```C++ inv_imu_sensor_data_t imu_data; IMU.getDataFromRegisters(imu_data); Serial.print("AccelX:"); Serial.println(imu_data.accel_data[0]); Serial.print("AccelY:"); Serial.println(imu_data.accel_data[1]); Serial.print("AccelZ:"); Serial.println(imu_data.accel_data[2]); Serial.print("GyroX:"); Serial.println(imu_data.gyro_data[0]); Serial.print("GyroY:"); Serial.println(imu_data.gyro_data[1]); Serial.print("GyroZ:"); Serial.println(imu_data.gyro_data[2]); Serial.print("Temperature:"); Serial.println(imu_data.temp_data); ``` -------------------------------- ### getTilt Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Gets the Tilt detection algorithm status. Returns true if a Tilt was detected since the last call to this function. ```APIDOC ## getTilt ### Description Gets the Tilt detection algorithm status. It returns true if a Tilt was detected since the last call to this function. ### Method Signature `bool getTilt(void)` ### Return Value * `true` if a tilt was detected. * `false` otherwise. ### Example ```C++ if(IMU.getTilt()) { Serial.println("Tilt"); } ``` ``` -------------------------------- ### Get Tilt Detection Status Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Retrieves the status of the tilt detection algorithm. Returns true if a tilt was detected since the last call. ```C++ if(IMU.getTilt()) { Serial.println("Tilt"); } ``` -------------------------------- ### Get Sensor Data from FIFO Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Reads sensor data samples stored in the FIFO and populates the inv_imu_fifo_data_t structure. Raw data can be translated using configured FSR. Temperature is in Degrees Centigrade. ```C++ inv_imu_fifo_data_t imu_data; IMU.getDataFromFifo(imu_data); // Format data for Serial Plotter Serial.print("AccelX:"); Serial.println(imu_data.byte_16.accel_data[0]); Serial.print("AccelY:"); Serial.println(imu_data.byte_16.accel_data[1]); Serial.print("AccelZ:"); Serial.println(imu_data.byte_16.accel_data[2]); Serial.print("GyroX:"); Serial.println(imu_data.byte_16.gyro_data[0]); Serial.print("GyroY:"); Serial.println(imu_data.byte_16.gyro_data[1]); Serial.print("GyroZ:"); Serial.println(imu_data.byte_16.gyro_data[2]); Serial.print("Temperature:"); Serial.println(imu_data.byte_16.temp_data); ``` -------------------------------- ### Get Tap Detection Data Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Retrieves the tap algorithm's output, including tap count, axis, and direction. The axis and direction are returned as numerical indices. ```C++ const char* axis_str[3] = {"X", "Y", "Z"}; const char* direction_str[2] = {"+", "-"}; uint8_t tap_count=0; uint8_t axis=0; uint8_t direction=0; IMU.getTap(tap_count,axis,direction); Serial.print("Tap count:"); Serial.println(tap_count); Serial.print("Axis:"); Serial.println(axis_str[axis]); Serial.print("Direction:"); Serial.println(direction_str[direction]); ``` -------------------------------- ### begin() Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Initializes the ICM456xx sensor. This method must be called after creating an instance to prepare the sensor for communication and usage. ```APIDOC ## int begin() ### Description Initializes all the required parameters in order to communicate and use the ICM456xx. ### Method `begin` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp IMU.begin(); ``` ### Response #### Success Response (0) - **int** - Returns 0 on success. #### Response Example ```cpp 0 ``` ``` -------------------------------- ### Initialize ICM456xx Sensor Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Call the begin method to execute the ICM456xx initialization routine. This method initializes all required parameters for communication and sensor usage. ```C++ IMU.begin(); ``` -------------------------------- ### Create ICM456xx Instance with SPI Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Instantiate the ICM456xx sensor using the SPI interface. The IO number for the chip select must be specified. The default SPI clock is 6MHz. ```C++ ICM456xx IMU(SPI,8); ``` -------------------------------- ### Enable FIFO Interrupt Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Initializes the FIFO and sets up an interrupt that triggers when the FIFO reaches a specified watermark. The provided handler function is called upon interrupt. Any Arduino interruptable pin can be used. ```C++ uint8_t irq_received = 0; void irq_handler(void) { irq_received = 1; } ... // Enable interrupt on pin 2, Fifo watermark=10 IMU.enableFifoInterrupt(2,irq_handler,10); ``` -------------------------------- ### ICM456xx Constructor (I2C) Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Creates an instance of the ICM456xx sensor using the I2C interface. Allows setting the I2C address LSB and optionally the I2C clock frequency. ```APIDOC ## ICM456xx(TwoWire &i2c, bool lsb) ### Description Creates an instance of the ICM456xx that will be accessed using the specified I2C. The LSB of the I2C address can be set to 0 or 1. I2C default clock is 400kHz. ### Method Constructor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp ICM456xx IMU(Wire,0); ``` ## ICM456xx(TwoWire &i2c, bool lsb, uint32_t freq) ### Description Same as above, specifying the I2C clock frequency (must be between 100kHz and 1MHz). ### Method Constructor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp ICM456xx IMU(Wire,0,1000000); ``` ``` -------------------------------- ### Verify Micro-ROS Communication Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Lists the topics registered on the ROS network and subscribes to the IMU_publisher topic to receive messages. ```bash ros2 topic list ros2 topic echo /IMU_publisher ``` -------------------------------- ### Create ICM456xx Instance with I2C Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Instantiate the ICM456xx sensor using the I2C interface. The LSB of the I2C address can be set to 0 or 1. The default I2C clock is 400kHz. ```C++ ICM456xx IMU(Wire,0); ``` -------------------------------- ### ICM456xx Constructor (SPI) Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Creates an instance of the ICM456xx sensor using the SPI interface. Allows setting the chip select ID and optionally the SPI clock frequency. ```APIDOC ## ICM456xx(SPIClass &spi, uint8_t cs_id) ### Description Creates an instance of the ICM456xx that will be accessed using the specified SPI. The IO number to be used as chip select must be specified. SPI default clock is 6MHz. ### Method Constructor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp ICM456xx IMU(SPI,8); ``` ## ICM456xx(SPIClass &spi, uint8_t cs_id, uint32_t freq) ### Description Same as above, specifying the SPI clock frequency (must be between 100kHz and 24MHz). ### Method Constructor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp ICM456xx IMU(SPI,8,12000000); ``` ``` -------------------------------- ### Create ICM456xx Instance with SPI and Custom Frequency Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Instantiate the ICM456xx sensor using the SPI interface with a specified clock frequency. The frequency must be between 100kHz and 24MHz. ```C++ ICM456xx IMU(SPI,8,12000000); ``` -------------------------------- ### Create ICM456xx Instance with I2C and Custom Frequency Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Instantiate the ICM456xx sensor using the I2C interface with a specified clock frequency. The frequency must be between 100kHz and 1MHz. ```C++ ICM456xx IMU(Wire,0,1000000); ``` -------------------------------- ### setI2CM_FIFO Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Sets the AUX1 in I2CM mode and reads external data (compass) in FIFO ES0 frame. (Host can be in I3C/I2C/SPI) ```APIDOC ## setI2CM_FIFO ### Description Sets the AUX1 in I2CM mode and reads external data (compass) in FIFO ES0 frame. (Host can be in I3C/I2C/SPI) ### Method Signature `int setI2CM_FIFO(uint8_t intpin, ICM456xx_irq_handler handler)` ### Parameters * **intpin** (uint8_t) - The interrupt pin to use. * **handler** (ICM456xx_irq_handler) - The function to call when data is available. ``` -------------------------------- ### Increase Serial Baudrate in Micro-ROS Arduino Library Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Modifies the default_transport.cpp file to increase the serial interface baudrate for faster communication. ```cpp bool arduino_transport_open(struct uxrCustomTransport * transport) { Serial.begin(1000000); return true; } ``` -------------------------------- ### setI2CMPassThrough Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Sets the AUX1 in I2CM bypass mode when the host is not in SPI. (Host can be in I3C/I2C) ```APIDOC ## setI2CMPassThrough ### Description Sets the AUX1 in I2CM bypass mode when the host is not in SPI. (Host can be in I3C/I2C) ### Method Signature `int setI2CMPassThrough(void)` ``` -------------------------------- ### getDataFromPassThrough Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md When the I2CM is in pass-through mode, the host on AP interface can access external sensor directly. ```APIDOC ## getDataFromPassThrough ### Description When the I2CM is in pass-through mode, the host on AP interface can access external sensor directly. ### Method Signature `int getDataFromPassThrough(uint8_t reg, uint8_t& data)` ### Parameters * **reg** (uint8_t) - The register to read from. * **data** (uint8_t&) - Output parameter for the data read from the register. ``` -------------------------------- ### enableFifoInterrupt Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Initializes the FIFO and the interrupt of the ICM456xx. The interrupt is triggered when the FIFO reaches a specified watermark, and a provided handler function is called. Any interruptable pin on the Arduino can be used. ```APIDOC ## enableFifoInterrupt ### Description Initializes the FIFO and the interrupt of the ICM456xx. The interrupt is triggered each time there is enough samples in the FIFO (as specified by fifo_watermark), and the provided handler is called. Any interruptable pin of the Arduino can be used for intpin. ### Method Signature `int enableFifoInterrupt(uint8_t intpin, ICM456xx_irq_handler handler, uint8_t fifo_watermark)` ### Parameters #### Path Parameters - **intpin** (uint8_t) - The interrupt pin to use on the Arduino. - **handler** (ICM456xx_irq_handler) - The callback function to be executed when the interrupt is triggered. - **fifo_watermark** (uint8_t) - The number of samples in the FIFO that will trigger the interrupt. ### Request Example ```C++ uint8_t irq_received = 0; void irq_handler(void) { irq_received = 1; } ... // Enable interrupt on pin 2, Fifo watermark=10 IMU.enableFifoInterrupt(2,irq_handler,10); ``` ``` -------------------------------- ### getDataFromRegisters Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Reads the ICM456xx sensor data from registers and fills the provided event structure with sensor raw data. Raw data can be translated to the International System using the configured FSR for each sensor. Temperature is in Degrees Centigrade. ```APIDOC ## getDataFromRegisters ### Description Reads the ICM456xx sensor data from registers and fills the provided event structure with sensor raw data. Raw data can be translated to International System using the configured FSR for each sensor. Temperature in Degrees Centigrade = (TEMP_DATA / 128) + 25 ### Method Signature `int getDataFromRegisters(inv_imu_sensor_data_t& imu_data)` ### Parameters #### Path Parameters - **imu_data** (inv_imu_sensor_data_t&) - A reference to a structure to be filled with sensor raw data. ### Response #### Success Response (0) - **imu_data** (inv_imu_sensor_data_t) - Structure containing raw sensor data: - **accel_data[3]** (int16_t) - 3-axis accelerometer raw data. - **gyro_data[3]** (int16_t) - 3-axis gyroscope raw data. - **temp_data** (int16_t) - Temperature raw data. ### Request Example ```C++ inv_imu_sensor_data_t imu_data; IMU.getDataFromRegisters(imu_data); Serial.print("AccelX:"); Serial.println(imu_data.accel_data[0]); Serial.print("AccelY:"); Serial.println(imu_data.accel_data[1]); Serial.print("AccelZ:"); Serial.println(imu_data.accel_data[2]); Serial.print("GyroX:"); Serial.println(imu_data.gyro_data[0]); Serial.print("GyroY:"); Serial.println(imu_data.gyro_data[1]); Serial.print("GyroZ:"); Serial.println(imu_data.gyro_data[2]); Serial.print("Temperature:"); Serial.println(imu_data.temp_data); ``` ``` -------------------------------- ### Read Data from I2CM Pass Through Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Accesses external sensor data directly when the I2CM is in pass-through mode. ```C++ uint8_t data; IMU.getDataFromPassThrough(0x01, data); ``` -------------------------------- ### Set ROS_DOMAIN_ID Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/examples/MicroROS_Publisher/MicroROS_README.md Sets the ROS_DOMAIN_ID to 0 and exports it to the .bashrc file for persistence. ```bash export ROS_DOMAIN_ID=0 echo "export ROS_DOMAIN_ID=0" >> ~/.bashrc ``` -------------------------------- ### Add Authorship Information to Source Files Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/CONTRIBUTING.md Include these lines in source files to preserve authorship information for significant changes. Specify contributors and copyright details. ```c++ // Contributors: // Copyright: (c) , (c) ``` -------------------------------- ### Set APEX Interrupt Handler Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Registers a general interrupt handler for the IMU. This can be used after enabling specific APEX algorithms. ```C++ // Pedometer enabled IMU.startPedometer(); // Tilt enabled IMU.startTiltDetection(); // Enable interrupt IMU.setApexInterrupt(2, irq_handler); ``` -------------------------------- ### getDataFromFifo Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Reads the ICM456xx sensor data samples stored in the FIFO. Raw data can be translated to the International System using the configured FSR for each sensor. Temperature is in Degrees Centigrade. ```APIDOC ## getDataFromFifo ### Description Reads the ICM456xx sensor data samples stored in the FIFO. Raw data can be translated to International System using the configured FSR for each sensor. Temperature in Degrees Centigrade = (TEMP_DATA / 2) + 25 ### Method Signature `int getDataFromFifo(inv_imu_fifo_data_t& imu_data)` ### Parameters #### Path Parameters - **imu_data** (inv_imu_fifo_data_t&) - A reference to a structure to be filled with FIFO raw sensor data. ### Response #### Success Response (0) - **imu_data** (inv_imu_fifo_data_t) - Structure containing raw FIFO sensor data. The exact fields available depend on the FIFO configuration and header mask. - **byte_16.accel_data[3]** (int16_t) - 3-axis accelerometer raw data (16 bits). - **byte_16.gyro_data[3]** (int16_t) - 3-axis gyroscope raw data (16 bits). - **byte_16.temp_data** (int16_t) - Temperature raw data (1 byte). ### Request Example ```C++ inv_imu_fifo_data_t imu_data; IMU.getDataFromFifo(imu_data); // Format data for Serial Plotter Serial.print("AccelX:"); Serial.println(imu_data.byte_16.accel_data[0]); Serial.print("AccelY:"); Serial.println(imu_data.byte_16.accel_data[1]); Serial.print("AccelZ:"); Serial.println(imu_data.byte_16.accel_data[2]); Serial.print("GyroX:"); Serial.println(imu_data.byte_16.gyro_data[0]); Serial.print("GyroY:"); Serial.println(imu_data.byte_16.gyro_data[1]); Serial.print("GyroZ:"); Serial.println(imu_data.byte_16.gyro_data[2]); Serial.print("Temperature:"); Serial.println(imu_data.byte_16.temp_data); ``` ``` -------------------------------- ### Set I2CM FIFO Mode Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Configures the AUX1 pin for I2CM mode to read external data (e.g., compass) using FIFO ES0 frames. Supports host communication in I3C/I2C/SPI. ```C++ void irq_handler(void) {} IMU.setI2CM_FIFO(2, irq_handler); ``` -------------------------------- ### Set I2CM Pass Through Mode Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Sets the AUX1 pin to I2CM bypass mode. This is applicable when the host is not in SPI mode (e.g., I3C/I2C). ```C++ IMU.setI2CMPassThrough(); ``` -------------------------------- ### setApexInterrupt Source: https://github.com/tdk-invn-oss/motion.arduino.icm45686/blob/main/README.md Registers an interrupt for the IMU. The provided handler is called when an interrupt occurs. Any interruptable pin can be used for intpin. ```APIDOC ## setApexInterrupt ### Description Registers an interrupt for the IMU. The provided handler is called when an interrupt occurs. Any interruptable pin can be used for intpin. ### Method Signature `int setApexInterrupt(uint8_t intpin, ICM456xx_irq_handler handler)` ### Parameters * **intpin** (uint8_t) - The interrupt pin to use. * **handler** (ICM456xx_irq_handler) - The function to call when an interrupt occurs. ### Example ```C++ // Pedometer enabled IMU.startPedometer(); // Tilt enabled IMU.startTiltDetection(); // Enable interrupt IMU.setApexInterrupt(2, irq_handler); ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.