File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
include/zephyr/drivers/haptics
samples/drivers/haptics/drv2605/src Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,28 @@ extern "C" {
26
26
* @{
27
27
*/
28
28
29
+ /**
30
+ * @name Helpers
31
+ * @{
32
+ */
33
+
29
34
/** Maximum number of waveforms that can be stored in the sequencer */
30
35
#define DRV2605_WAVEFORM_SEQUENCER_MAX 8
31
36
37
+ /**
38
+ * @brief Creates a wait/delay value for the waveform sequencer.
39
+ *
40
+ * @details This macro generates a byte value that, when placed in the drv2605_rom_data::seq_regs
41
+ * array, instructs the DRV2605 playback engine to idle for a specified duration.
42
+ *
43
+ * @param ms The desired delay in milliseconds (rounded down to the nearest 10ms). Valid range is
44
+ * 10 to 1270.
45
+ * @return A byte literal representing the wait time for the sequencer.
46
+ */
47
+ #define DRV2605_WAVEFORM_SEQUENCER_WAIT_MS (ms ) (0x80 | ((ms) / 10))
48
+
49
+ /** @} */
50
+
32
51
/**
33
52
* @brief Effect libraries
34
53
*
Original file line number Diff line number Diff line change @@ -27,11 +27,11 @@ static struct drv2605_rom_data rom_data = {
27
27
.sustain_pos_time = 0 ,
28
28
.trigger = DRV2605_MODE_INTERNAL_TRIGGER ,
29
29
.seq_regs [0 ] = 1 ,
30
- .seq_regs [1 ] = 10 | 0x80 ,
30
+ .seq_regs [1 ] = DRV2605_WAVEFORM_SEQUENCER_WAIT_MS ( 100 ) ,
31
31
.seq_regs [2 ] = 2 ,
32
- .seq_regs [3 ] = 10 | 0x80 ,
32
+ .seq_regs [3 ] = DRV2605_WAVEFORM_SEQUENCER_WAIT_MS ( 100 ) ,
33
33
.seq_regs [4 ] = 3 ,
34
- .seq_regs [5 ] = 10 | 0x80 ,
34
+ .seq_regs [5 ] = DRV2605_WAVEFORM_SEQUENCER_WAIT_MS ( 100 ) ,
35
35
.seq_regs [6 ] = 4 ,
36
36
};
37
37
You can’t perform that action at this time.
0 commit comments