STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
STAR_ISM330DH.h
>
4
5
#include <cstdint>
6
7
// SPI bus pins (per board schematic)
8
#define ISM330_SCLK_PIN 2
9
#define ISM330_MOSI_PIN 3
10
#define ISM330_MISO_PIN 16
11
#define ISM330_CS_PIN 20
12
13
// IMU interrupt pins
14
#define ISM330_INT1_PIN 21
15
#define ISM330_INT2_PIN 22
16
17
// SPI clock for the IMU (datasheet allows up to 10 MHz)
18
#define ISM330_SPI_HZ 3000000
19
20
// Accelerometer full scale — keep ISM330_ACCEL_FS_G in sync for wake-up math
21
#define ISM330_ACCEL_FS ISM_16g
22
#define ISM330_ACCEL_FS_G 16.0f
23
24
// Wake-up threshold in g (similar role to LIS3DH INTERRUPT_THRESHOLD_G)
25
#define ISM330_WAKEUP_THRESHOLD_G 2.5f
26
27
// Wake duration field 0–3 (1 LSB = 1 / ODR)
28
#define ISM330_WAKEUP_DUR 2
29
30
// If true, XL/GYRO data-ready also pulse INT1 (very chatty at high ODR)
31
#define ISM330_ROUTE_DRDY_TO_INT1 false
32
33
// ST driver: wake LSB weight FS/64 → mg per threshold step
34
static
constexpr
uint8_t
ISM330_WKUP_THS
= []() -> uint8_t {
35
constexpr
float
mgPerLsb = (
ISM330_ACCEL_FS_G
* 1000.0f) / 64.0f;
36
float
raw = (
ISM330_WAKEUP_THRESHOLD_G
* 1000.0f) / mgPerLsb;
37
uint8_t v = (raw > 63.0f) ? 63 :
static_cast<
uint8_t
>
(raw);
38
return
(v < 1) ? 1 : v;
39
}();
ISM330_ACCEL_FS_G
#define ISM330_ACCEL_FS_G
Definition
main.h:22
ISM330_WAKEUP_THRESHOLD_G
#define ISM330_WAKEUP_THRESHOLD_G
Definition
main.h:25
STAR_ISM330DH.h
ISM330_WKUP_THS
static constexpr uint8_t ISM330_WKUP_THS
Definition
config.h:68
firmware
IC_Testing
ISM330DH
src
main.h
Generated by
1.15.0