|
| | Adc (Tmc9660Handler &parent) |
| | Construct the ADC wrapper.
|
| |
| | ~Adc () noexcept override=default |
| | Default destructor.
|
| |
|
| bool | Initialize () noexcept override |
| | Initialize ADC wrapper (no-op; TMC9660 ADC is always available).
|
| |
| bool | Deinitialize () noexcept override |
| | Deinitialize ADC wrapper (no-op).
|
| |
| hf_u8_t | GetMaxChannels () const noexcept override |
| | Returns the total number of readable channels (15).
|
| |
| bool | IsChannelAvailable (hf_channel_id_t channel_id) const noexcept override |
| | Check if a channel ID is valid per the TMC9660 channel scheme.
|
| |
| hf_adc_err_t | ReadChannelV (hf_channel_id_t channel_id, float &channel_reading_v, hf_u8_t numOfSamplesToAvg=1, hf_time_t timeBetweenSamples=0) noexcept override |
| | Read a channel and return the voltage.
|
| |
| hf_adc_err_t | ReadChannelCount (hf_channel_id_t channel_id, hf_u32_t &channel_reading_count, hf_u8_t numOfSamplesToAvg=1, hf_time_t timeBetweenSamples=0) noexcept override |
| | Read a channel and return the raw count.
|
| |
| hf_adc_err_t | ReadChannel (hf_channel_id_t channel_id, hf_u32_t &channel_reading_count, float &channel_reading_v, hf_u8_t numOfSamplesToAvg=1, hf_time_t timeBetweenSamples=0) noexcept override |
| | Read a channel and return both raw count and voltage.
|
| |
| hf_adc_err_t | ReadMultipleChannels (const hf_channel_id_t *channel_ids, hf_u8_t num_channels, hf_u32_t *readings, float *voltages) noexcept override |
| | Read multiple channels in a batch.
|
| |
| hf_adc_err_t | GetStatistics (hf_adc_statistics_t &statistics) noexcept override |
| | Get accumulated ADC statistics (conversion counts, timing).
|
| |
| hf_adc_err_t | GetDiagnostics (hf_adc_diagnostics_t &diagnostics) noexcept override |
| | Get ADC health diagnostics (error counts, health status).
|
| |
| hf_adc_err_t | ResetStatistics () noexcept override |
| | Reset all accumulated statistics to zero.
|
| |
| hf_adc_err_t | ResetDiagnostics () noexcept override |
| | Reset diagnostics counters and health flags.
|
| |
|
Direct accessors for specific TMC9660 ADC channel types.
|
| hf_adc_err_t | ReadAinChannel (uint8_t ain_channel, hf_u32_t &raw_value, float &voltage) noexcept |
| | Read an external analog input (AIN) channel.
|
| |
| hf_adc_err_t | ReadCurrentSenseChannel (uint8_t current_channel, hf_u32_t &raw_value, float &voltage) noexcept |
| | Read a phase current sense channel.
|
| |
| hf_adc_err_t | ReadVoltageChannel (uint8_t voltage_channel, hf_u32_t &raw_value, float &voltage) noexcept |
| | Read a voltage monitoring channel.
|
| |
| hf_adc_err_t | ReadTemperatureChannel (uint8_t temp_channel, hf_u32_t &raw_value, float &voltage) noexcept |
| | Read a temperature channel.
|
| |
| hf_adc_err_t | ReadMotorDataChannel (uint8_t motor_channel, hf_u32_t &raw_value, float &voltage) noexcept |
| | Read a motor data channel.
|
| |
BaseAdc adapter for all TMC9660 ADC channels.
Provides a unified BaseAdc interface for reading the TMC9660's various analog and telemetry data channels. Channels are identified by a numeric ID scheme:
| Channel ID Range | Type | Description |
| 0 - 3 | AIN channels | External analog inputs (GPIO5) |
| 10 - 13 | Current sense | Phase current ADC (I0-I3) |
| 20 - 21 | Voltage monitor | 20=supply, 21=driver voltage |
| 30 - 31 | Temperature | 30=chip, 31=external NTC |
| 40 - 42 | Motor data | 40=current, 41=velocity, 42=pos |
The wrapper includes thread-safe statistics and diagnostics tracking via RtosMutex. Voltage conversions use a default 3.3V / 16-bit scale; for temperature and motor data channels, the "voltage" field contains the physical value directly (degrees Celsius, mA, etc.).
- Note
- This inner class is owned by the handler. For manager-layer ownership, use Tmc9660AdcWrapper which delegates to this instance.
- See also
- Tmc9660AdcWrapper Thin delegation wrapper for AdcManager ownership
| hf_u8_t Tmc9660Handler::Adc::GetMaxChannels |
( |
| ) |
const |
|
overridenoexcept |
Returns the total number of readable channels (15).
The TMC9660 uses a non-contiguous channel ID scheme (0-3, 10-13, 20-21, 30-31, 40-42). Since IDs are sparse, callers should use IsChannelAvailable(channel_id) to validate specific channel IDs rather than iterating 0..GetMaxChannels()-1.
- Returns
- 15 (the count of all valid channel IDs across all ranges).