sim_adc.h Source File

yasimavr: sim_adc.h Source File
yasimavr
Loading...
Searching...
No Matches
sim_adc.h
Go to the documentation of this file.
1/*
2 * sim_adc.h
3 *
4 * Copyright 2021-2026 Clement Savergne <csavergne@yahoo.com>
5
6 This file is part of yasim-avr.
7
8 yasim-avr is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 yasim-avr is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with yasim-avr. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22//=======================================================================================
23
24#ifndef __YASIMAVR_ADC_H__
25#define __YASIMAVR_ADC_H__
26
27#include "../core/sim_peripheral.h"
28#include "../core/sim_pin.h"
29#include "../core/sim_types.h"
30
32
33
34//=======================================================================================
50#define AVR_CTLREQ_ADC_SET_TEMP (AVR_CTLREQ_BASE + 1)
51
58#define AVR_CTLREQ_ADC_TRIGGER (AVR_CTLREQ_BASE + 2)
59
62
63
64//=======================================================================================
119
120
122
123#endif //__YASIMAVR_ADC_H__
Generic ADC definitions.
Definition sim_adc.h:72
Channel
Definition sim_adc.h:77
@ Channel_IntRef
Internal bandgap reference voltage.
Definition sim_adc.h:85
@ Channel_Differential
Differential analog input.
Definition sim_adc.h:81
@ Channel_Zero
Ground reference channel.
Definition sim_adc.h:83
@ Channel_Temperature
Internal temperature sensor voltage.
Definition sim_adc.h:87
@ Channel_AcompRef
Analog comparator reference input (used on ATMega0 and ATMega1 series)
Definition sim_adc.h:89
@ Channel_SingleEnded
Single-ended analog input.
Definition sim_adc.h:79
SignalId
Definition sim_adc.h:108
@ Signal_AboutToSample
Definition sim_adc.h:113
@ Signal_ConversionComplete
Raised when the conversion is complete and the CPU is notified that the conversion result is ready.
Definition sim_adc.h:115
@ Signal_ConversionStarted
Raised at the start of a conversion.
Definition sim_adc.h:110
#define YASIMAVR_BEGIN_NAMESPACE
Definition sim_globals.h:58
#define YASIMAVR_END_NAMESPACE
Definition sim_globals.h:59
YASIMAVR_BEGIN_NAMESPACE typedef sim_id_t pin_id_t
Definition sim_pin.h:34
Definition sim_adc.h:95
unsigned int gain
Measurement gain applied to the voltage value. Must be non-zero.
Definition sim_adc.h:105
pin_id_t pin_n
Pin ID used as negative input for differential channels, unused for other channel types.
Definition sim_adc.h:101
char per_num
Used for Channel_AcompRef, index of the ACP peripheral to get the reference value from.
Definition sim_adc.h:103
pin_id_t pin_p
Pin ID used for single-ended channels or as positive input for differential channels.
Definition sim_adc.h:99
Channel type
Channel type.
Definition sim_adc.h:97
Definition sim_peripheral.h:252