MC3630
<PAL_MOT>
or <PAL_NOTICE> <CUE>
is loaded. Procedures for common methods other than begin()
and available()
are executed within the board behavior.Operation Flow
.begin()
: Start sensor operationPIN_SNS_INT
interrupt oravailable()
: FIFO queue reaches the specified number of samples.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.
read()
is executed after waking from sleep in <PAL_MOT>
.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 Mode | Description |
---|---|
MODE_LP_1HZ_UNOFFICIAL | 1Hz Low Power (unofficial) |
MODE_LP_2HZ_UNOFFICIAL | 2Hz Low Power (unofficial) |
MODE_LP_7HZ_UNOFFICIAL | 7Hz Low Power (unofficial) |
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 |
conf[16:23] Acceleration Range | Description |
---|---|
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.