@@ -62,12 +62,16 @@ public:
62
62
%% elif target["family"] in ["l4", "g4"]
63
63
Temperature = 17,
64
64
BatDiv3 = 18,
65
+ %% elif target["family"] in ["l5"]
66
+ InternalReference = 0,
67
+ Temperature = 17,
68
+ BatDiv3 = 18,
65
69
%% endif
66
70
%% elif id == 2
67
71
%% if target["family"] in ["f3"]
68
72
Opamp2 = 17,
69
73
InternalReference = 18,
70
- %% elif target["family"] in ["l4", "g4"]
74
+ %% elif target["family"] in ["l4", "l5", " g4"]
71
75
Dac1 = 17,
72
76
Dac2 = 18,
73
77
%% endif
@@ -107,16 +111,18 @@ public:
107
111
NoClock = 0, // No clock selected.
108
112
%% if target["family"] in ["g4"]
109
113
%% if id in [1, 2]
110
- Pll = RCC_CCIPR_ADC12SEL_0 , // PLL “P” clock selected as ADC clock
111
- SystemClock = RCC_CCIPR_ADC12SEL_1 , // System clock selected as ADCs clock
114
+ Pll = RCC_{{ ccipr }}_ADC12SEL_0 , // PLL “P” clock selected as ADC clock
115
+ SystemClock = RCC_{{ ccipr }}_ADC12SEL_1 , // System clock selected as ADCs clock
112
116
%% elif id in [3, 4, 5]
113
- Pll = RCC_CCIPR_ADC345SEL_0 , // PLL “P” clock selected as ADC clock
114
- SystemClock = RCC_CCIPR_ADC345SEL_1 , // System clock selected as ADCs clock
117
+ Pll = RCC_{{ ccipr }}_ADC345SEL_0 , // PLL “P” clock selected as ADC clock
118
+ SystemClock = RCC_{{ ccipr }}_ADC345SEL_1 , // System clock selected as ADCs clock
115
119
%% endif
116
120
%% else
117
- PllSai1 = RCC_CCIPR_ADCSEL_0, // PLLSAI1 "R" clock (PLLADC1CLK) selected as ADCs clock
118
- PllSai2 = RCC_CCIPR_ADCSEL_1, // PLLSAI2 "R" clock (PLLADC2CLK) selected as ADCs clock
119
- SystemClock = RCC_CCIPR_ADCSEL_1 | RCC_CCIPR_ADCSEL_0, // System clock selected as ADCs clock
121
+ PllSai1 = RCC_{{ ccipr }}_ADCSEL_0, // PLLSAI1 "R" clock (PLLADC1CLK) selected as ADCs clock
122
+ %% if target["family"] != "l5"
123
+ PllSai2 = RCC_{{ ccipr }}_ADCSEL_1, // PLLSAI2 "R" clock (PLLADC2CLK) selected as ADCs clock
124
+ %% endif
125
+ SystemClock = RCC_{{ ccipr }}_ADCSEL_1 | RCC_{{ ccipr }}_ADCSEL_0, // System clock selected as ADCs clock
120
126
%% endif
121
127
};
122
128
%% endif
@@ -139,7 +145,7 @@ public:
139
145
Div128 = RCC_CFGR2_{{ adc_pre }}_DIV128,
140
146
Div256 = RCC_CFGR2_{{ adc_pre }}_DIV256,
141
147
Div256AllBits = RCC_CFGR2_{{ adc_pre }}, // for bit clear
142
- %% elif target["family"] in ["l4", "g4"]
148
+ %% elif target["family"] in ["l4", "l5", " g4"]
143
149
Div1 = 0,
144
150
Div2 = ADC_CCR_PRESC_0,
145
151
Div4 = ADC_CCR_PRESC_1,
@@ -156,7 +162,7 @@ public:
156
162
%% endif
157
163
};
158
164
159
- %% if target["family"] in ["l4", "g4"]
165
+ %% if target["family"] in ["l4", "l5", " g4"]
160
166
enum class SampleTime : uint8_t // TODO: What is the best type?
161
167
{
162
168
Cycles2 = 0b000, //! 1.5 ADC clock cycles
@@ -190,7 +196,7 @@ public:
190
196
191
197
enum class VoltageRegulatorState : uint32_t
192
198
{
193
- %% if target["family"] in ["l4", "g4"]
199
+ %% if target["family"] in ["l4", "l5", " g4"]
194
200
Enabled = ADC_CR_ADVREGEN,
195
201
%% elif target["family"] in ["f3"]
196
202
// Intermediate state is needed to move from enabled to disabled
0 commit comments