> For the complete documentation index, see [llms.txt](https://mwx.twelite.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mwx.twelite.info/latest_en/sensor_object/mc3630.md).

# MC3630 - Accel sensor

Accelerometer using SPI bus.

{% hint style="warning" %}
Available only when board BEHAVIOR `<PAL_MOT>` `<PAL_NOTICE>` is loaded. Procedures of common methods except `begin(), available()` are executed in board BEHAVIOR.
{% endhint %}

## Operation flow

1.`.begin()`: Sensor operation starts 2. 2.`PIN_SNS_INT` interrupt or `available()`: FIFO queue reaches the specified number 3. 3.`.get_que()`: Get data from the FIFO queue

## Procedures required for operation

### SPI bus

None in particular.

### Sleep procedure

To wake up by PIN\_SNS\_INT interrupt, the following settings must be made before sleep.

```cpp
pinMode(PAL_MOT::PIN_SNS_INT, WAKE_FALLING);
```

### Procedures for waking up from sleep

A call to the `.wakeup()` method is required. This process is executed in the `<PAL_MOT>` board BEHAVIOR.

{% hint style="warning" %}
If the semiconductor's internal FIFO queue is full and no read is performed, the data acquisition is terminated and no new values are stored.
{% endhint %}

## Data Structure

Each sample is stored in a queue [`smplque`](/latest_en/api-reference/classes/smplque.md) whose elements are [`axis_xyzt`](/latest_en/api-reference/classes/axis_xyzt.md) structures. The members x,y,z correspond to the X, Y, and Z axes, respectively.

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

The value of each axis is stored as a value where 1G is 1000. The `t` is the sample number, which is assigned to each sample in order from `0`.

## Methods

### read()

```cpp
uint8_t read()
```

Reads data from a semiconductor FIFO queue. The number of bytes read is returned, but be sure to read the number of data stored in the size of the queue referenced by `.get_que()`.

{% hint style="warning" %}
After returning from sleep, `<PAL_MOT>` will do `read()`.
{% endhint %}

### get\_que()

```cpp
smplque<axis_xyzt>& get_que()
```

Get a sample of the acceleration. The queue is [`smplque`](/latest_en/api-reference/classes/smplque.md) with [`axis_xyzt`](/latest_en/api-reference/classes/axis_xyzt.md) as an element; the queue should be emptied as soon as it is available.

## Common methods

### setup()

```cpp
void setup() 
```

This sensor does not use `setup()`.

### begin(), end()

```cpp
void begin(uint32_t conf)
void end()
```

Initialize with the settings specified in `conf`.

`conf[0:15]` (bit0-15): sampling mode, `conf[16:23]` (bit16-23): range of acceleration, `conf[24:31]` (bit24-31): number of samples until interrupt occurs.

| conf\[0:15] sample mode  | contents                           |
| ------------------------ | ---------------------------------- |
| `MODE_LP_1HZ_UNOFFICIAL` | 1Hz Low Power (unofficial setting) |
| `MODE_LP_2HZ_UNOFFICIAL` | 2Hz Low Power (unofficial setting) |
| `MODE_LP_7HZ_UNOFFICIAL` | 7Hz Low Power (unofficial setting) |
| `MODE_LP_14HZ`           | 14Hz Low Power (default)           |
| `MODE_LP_28HZ`           | 28Hz Low Power                     |
| `MODE_LP_54HZ`           | 54Hz Low Power                     |
| `MODE_LP_105HZ`          | 105Hz Low Power                    |
| `MODE_LP_210HZ`          | 210Hz Low Power                    |
| `MODE_LP_400HZ`          | 400Hz Low Power                    |
| `MODE_ULP_25HZ`          | 25Hz Ultra Low Power               |
| `MODE_ULP_50HZ`          | 50Hz Ultra Low Power               |
| `MODE_ULP_100HZ`         | 100Hz Ultra Low Power              |
| `MODE_ULP_190HZ`         | 190Hz Ultra Low Power              |
| `MODE_ULP_380HZ`         | 380Hz Ultra Low Power              |

{% hint style="warning" %}
**Unofficial settings** are not described in the MC3630 datasheet and their behavior is **undefined**. Please check the behavior of the settings before using them. We are not able to answer any questions or problems related to the unofficial settings.
{% endhint %}

| conf\[16:23] Acceleration range | Contents      |
| ------------------------------- | ------------- |
| `RANGE_PLUS_MINUS_8G`           | ±8G (default) |
| `RANGE_PLUS_MINUS_4G`           | ±4G           |
| `RANGE_PLUS_MINUS_2G`           | ±2G           |
| `RANGE_PLUS_MINUS_1G`           | ±1G           |

### process\_ev()

```cpp
void process_ev(uint32_t arg1, uint32_t arg2 = 0)
```

This sensor does not use `process_ev()`.

### available()

```cpp
bool available()
```

Returns `true` if data is read out to the sensor and stored in the internal queue.

### probe()

```cpp
bool probe()
```

You cannot use `probe()` with this sensor.

### wakeup()

```cpp
void wakeup()
```

Reinitializes the SPI bus after sleep recovery and reads acceleration data.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mwx.twelite.info/latest_en/sensor_object/mc3630.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
