This is the multi-page printable view of this section. Click here to print...

Return to the regular view of this page

As of 2025-07-24

MC3630

Accelerometer
    This is an accelerometer that uses the SPI bus.

    Operation Flow

    1. .begin(): Start sensor operation
    2. PIN_SNS_INT interrupt or available(): FIFO queue reaches the specified number of samples
    3. .get_que(): Retrieve data from the FIFO queue

    Required Procedures for Operation

    SPI Bus

    No special setup is required.

    Sleep Procedure

    To allow wake-up via PIN_SNS_INT interrupt, configure the following before entering sleep:

    pinMode(PAL_MOT::PIN_SNS_INT, WAKE_FALLING);

    Procedure Upon Wake-up

    Call the .wakeup() method. This process is handled within the <PAL_MOT> board behavior.

    Data Structure

    Each sample is stored in a queue smplque of axis_xyzt structures. The x, y, and z members represent the X, Y, and Z axes, respectively.

    struct axis_xyzt {
      int16_t x;
      int16_t y;
      int16_t z;
      uint16_t t;
    };

    Each axis value is stored with 1G equivalent to 1000. The t value represents the sample index, starting from 0 and incrementing with each sample.

    Methods

    read()

    uint8_t read()

    Reads data from the semiconductor’s FIFO queue. The return value is the number of bytes read. Use .get_que() to access the queue and retrieve the number of samples stored.

    get_que()

    smplque<axis_xyzt>& get_que()

    Retrieves acceleration samples. The queue is a smplque of axis_xyzt. Once available is true, promptly clear the queue.

    Common Methods

    setup()

    void setup()

    setup() is not used for this sensor.

    begin(), end()

    void begin(uint32_t conf)
    void end()

    Initializes the sensor with the specified conf.

    conf[0:15] (bit 0–15): Sampling mode, conf[16:23] (bit 16–23): Acceleration range, conf[24:31] (bit 24–31): Number of samples before triggering interrupt.

    conf[0:15] Sample ModeDescription
    MODE_LP_1HZ_UNOFFICIAL1Hz Low Power (unofficial)
    MODE_LP_2HZ_UNOFFICIAL2Hz Low Power (unofficial)
    MODE_LP_7HZ_UNOFFICIAL7Hz Low Power (unofficial)
    MODE_LP_14HZ14Hz Low Power (default)
    MODE_LP_28HZ28Hz Low Power
    MODE_LP_54HZ54Hz Low Power
    MODE_LP_105HZ105Hz Low Power
    MODE_LP_210HZ210Hz Low Power
    MODE_LP_400HZ400Hz Low Power
    MODE_ULP_25HZ25Hz Ultra Low Power
    MODE_ULP_50HZ50Hz Ultra Low Power
    MODE_ULP_100HZ100Hz Ultra Low Power
    MODE_ULP_190HZ190Hz Ultra Low Power
    MODE_ULP_380HZ380Hz Ultra Low Power
    conf[16:23] Acceleration RangeDescription
    RANGE_PLUS_MINUS_8G±8G (default)
    RANGE_PLUS_MINUS_4G±4G
    RANGE_PLUS_MINUS_2G±2G
    RANGE_PLUS_MINUS_1G±1G

    process_ev()

    void process_ev(uint32_t arg1, uint32_t arg2 = 0)

    process_ev() is not used for this sensor.

    available()

    bool available()

    Returns true when data has been read into the internal queue.

    probe()

    bool probe()

    probe() is not used for this sensor.

    wakeup()

    void wakeup()

    Reinitializes the SPI bus after waking from sleep and reads acceleration data.