HF-TMC9660 Driver
Hardware Agnostic C++ Driver for the TMC9660
Loading...
Searching...
No Matches
tmc9660_ramDebug.hpp
Go to the documentation of this file.
1#ifndef TMC9660_RAMDEBUG_HPP
2#define TMC9660_RAMDEBUG_HPP
3
4#include <cstdint>
5
15namespace TMC9660 {
16namespace RAMDebug {
17
19static constexpr uint8_t RAMDEBUG_BLOCK = 31;
21static constexpr uint8_t RAMDEBUG_UART_CMD = 142;
22
24
27enum class RamDebugSub : uint8_t {
28 Init = 0,
29 SetSampleCount = 1,
30 SetPrescaler = 3,
31 SetChannel = 4,
34 TriggerStart = 7,
35 GetState = 8,
36 ReadSample = 9,
37 GetInfo = 10,
38 GetChannelType = 11,
42};
43
45
48enum class InfoSelect : uint8_t {
49 MaxChannels = 0,
50 MaxSamples = 1,
51 FrequencyHz = 2,
52 CapturedSamples = 3,
54};
55
57
60enum class RamDebugState : uint8_t {
61 Idle = 0,
62 Trigger = 1,
63 Capture = 2,
64 Complete = 3,
65 PreTrigger = 4
66};
67
69
72enum class TriggerType : uint8_t {
73 NoTrigger = 0,
74 RisingEdgeS = 1,
75 FallingEdgeS = 2,
76 AnyEdgeS = 3,
77 RisingEdgeU = 4,
78 FallingEdgeU = 5,
79 AnyEdgeU = 6
80};
81
90static inline uint16_t ramDebugOffset(RamDebugSub sub, uint8_t index = 0) {
91 return static_cast<uint16_t>((static_cast<uint8_t>(sub) << 6) | (index & 0x3F));
92}
93
94} // namespace RAMDebug
95} // namespace TMC9660
96
97#endif // TMC9660_RAMDEBUG_HPP
static constexpr uint8_t RAMDEBUG_UART_CMD
UART command number for RAMDebug.
Definition tmc9660_ramDebug.hpp:21
static constexpr uint8_t RAMDEBUG_BLOCK
Block number for RAMDebug (SPI interface)
Definition tmc9660_ramDebug.hpp:19
InfoSelect
RAMDebug info selections (for subcommand GetInfo)
Definition tmc9660_ramDebug.hpp:48
@ CapturedSamples
Number of samples already captured.
@ PrescalerOnTrigger
Prescaler value at the trigger event.
@ FrequencyHz
RAMDebug frequency in Hz.
@ MaxSamples
Maximum number of samples supported.
@ MaxChannels
Maximum number of channels supported.
static uint16_t ramDebugOffset(RamDebugSub sub, uint8_t index=0)
Construct the RAMDebug register offset for a given subcommand and index.
Definition tmc9660_ramDebug.hpp:90
RamDebugSub
RAMDebug subcommands.
Definition tmc9660_ramDebug.hpp:27
@ GetPreTriggerCount
Read the total number of pretrigger samples.
@ TriggerStart
Set trigger type and start measurement.
@ SetSampleCount
Set the total number of samples to collect.
@ SetTriggerChannel
Configure the trigger channel.
@ GetChannelType
Read the configured channel type.
@ SetPrescaler
Set the prescaler (divider = value + 1).
@ GetChannelAddress
Read the configured channel address.
@ SetPreTriggerCount
Set the total number of pretrigger samples.
@ Init
Initialize and reset RAMDebug.
@ SetTriggerMaskShift
Set mask and shift before trigger evaluation.
@ GetState
Read the current RAMDebug state.
@ GetInfo
Read general RAMDebug information.
@ ReadSample
Read a captured sample by index.
@ SetChannel
Configure a capture channel.
RamDebugState
RAMDebug states (returned by GetState)
Definition tmc9660_ramDebug.hpp:60
@ PreTrigger
Capturing pretrigger samples.
@ Capture
Capturing samples after the trigger.
@ Complete
Capture is complete, samples can be downloaded.
@ Idle
RAMDebug is not running and can be configured.
@ Trigger
Waiting for the trigger event.
TriggerType
Trigger types (for TriggerStart)
Definition tmc9660_ramDebug.hpp:72
@ FallingEdgeU
Trigger on unsigned falling edge.
@ AnyEdgeU
Trigger on any unsigned edge.
@ FallingEdgeS
Trigger on signed falling edge.
@ RisingEdgeU
Trigger on unsigned rising edge.
@ RisingEdgeS
Trigger on signed rising edge.
@ AnyEdgeS
Trigger on any signed edge.
Definition tmc9660_adc.hpp:12