HF-TMC9660 Driver 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC9660
Loading...
Searching...
No Matches
tmc9660_ramDebug.hpp
Go to the documentation of this file.
1
6#pragma once
7#include <cstdint>
8
18namespace tmc9660 {
19namespace register_mode {
29namespace RAMDebug {
30
37static constexpr uint8_t RAMDEBUG_BLOCK = 31;
44static constexpr uint8_t RAMDEBUG_UART_CMD = 142;
45
47
58enum class RamDebugSub : uint8_t {
59 Init = 0,
60 SetSampleCount = 1,
61 SetPrescaler = 3,
62 SetChannel = 4,
65 TriggerStart = 7,
66 GetState = 8,
67 ReadSample = 9,
68 GetInfo = 10,
69 GetChannelType = 11,
73};
74
76
84enum class InfoSelect : uint8_t {
85 MaxChannels = 0,
86 MaxSamples = 1,
87 FrequencyHz = 2,
88 CapturedSamples = 3,
90};
91
93
101enum class RamDebugState : uint8_t {
102 Idle = 0,
103 Trigger = 1,
104 Capture = 2,
105 Complete = 3,
106 PreTrigger = 4
107};
108
110
118enum class TriggerType : uint8_t {
119 NoTrigger = 0,
120 RisingEdgeS = 1,
121 FallingEdgeS = 2,
122 AnyEdgeS = 3,
123 RisingEdgeU = 4,
124 FallingEdgeU = 5,
125 AnyEdgeU = 6
126};
127
140static inline uint16_t ramDebugOffset(RamDebugSub sub, uint8_t index = 0) {
141 return static_cast<uint16_t>((static_cast<uint8_t>(sub) << 6) | (index & 0x3F));
142}
143
144} // namespace RAMDebug
145} // namespace register_mode
146} // namespace tmc9660
static constexpr uint8_t RAMDEBUG_BLOCK
Block number identifier for RAMDebug operations via SPI interface.
Definition tmc9660_ramDebug.hpp:37
static constexpr uint8_t RAMDEBUG_UART_CMD
UART command number for RAMDebug operations via UART interface.
Definition tmc9660_ramDebug.hpp:44
static uint16_t ramDebugOffset(RamDebugSub sub, uint8_t index=0)
Construct RAMDebug register offset from subcommand and index parameters.
Definition tmc9660_ramDebug.hpp:140
RamDebugSub
RAMDebug subcommands.
Definition tmc9660_ramDebug.hpp:58
@ 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.
TriggerType
Trigger types (for TriggerStart)
Definition tmc9660_ramDebug.hpp:118
@ 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.
RamDebugState
RAMDebug states (returned by GetState)
Definition tmc9660_ramDebug.hpp:101
@ 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.
InfoSelect
RAMDebug info selections (for subcommand GetInfo)
Definition tmc9660_ramDebug.hpp:84
@ 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.
Definition bootloader_config.hpp:9