1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Magba is licensed under The 3-Clause BSD, see LICENSE.
* Copyright 2025 Sira Pornsiriprasert <code@psira.me>
*/
use ;
/// Computes the digital state of a Hall effect latch.
///
/// # Arguments
///
/// - `b_field`: The 3D magnetic flux density vector at the sensor (T)
/// - `sensitive_axis`: A normalized vector representing the sensing direction
/// - `b_op`: The magnetic operate point (T)
/// - `b_rp`: The magnetic release point (T)
/// - `current_state`: The current state of the switch
///
/// # Returns
///
/// - If the projected field exceeds `b_op`, the state becomes `true` (Active).
/// - If the projected field falls below `b_rp`, the state becomes `false` (Inactive).
/// - If the field is between the two, the `current_state` is maintained