File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/modm/platform/gpio/sam Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -278,6 +278,7 @@ template<class... PinConfigs>
278278struct PinCfgMixin
279279{
280280 inline static void set(uint8_t){};
281+ inline static void set(uint8_t, uint8_t){};
281282};
282283
283284template<class PinConfig, class... PinConfigs>
@@ -292,6 +293,18 @@ struct PinCfgMixin<PinConfig, PinConfigs...>
292293%% endfor
293294 PinCfgMixin<PinConfigs...>::set(cfg);
294295 }
296+
297+ inline static void
298+ set(uint8_t setBits, uint8_t clearMask)
299+ {
300+ %% for port in ports
301+ if constexpr (PinConfig::port == PortName::{{ port }}) {
302+ auto& reg = PORT->Group[{{loop.index0}}].PINCFG[PinConfig::pin].reg;
303+ reg = (reg & (~clearMask)) | setBits;
304+ }
305+ %% endfor
306+ PinCfgMixin<PinConfigs...>::set(setBits, clearMask);
307+ }
295308};
296309
297310template<class... PinConfigs>
@@ -371,7 +384,7 @@ public:
371384 configure(InputType type)
372385 {
373386 set(type == InputType::PullUp);
374- PinCfg::set(PORT_PINCFG_INEN | (type != InputType::Floating) << PORT_PINCFG_PULLEN_Pos);
387+ PinCfg::set(PORT_PINCFG_INEN | (type != InputType::Floating) << PORT_PINCFG_PULLEN_Pos, PORT_PINCFG_PULLEN );
375388 }
376389
377390 static void
You can’t perform that action at this time.
0 commit comments