This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pins! { | |
PA2 => { | |
AF1: TxPin<USART1>, | |
AF1: TxPin<USART2>, | |
}, | |
PA3 => { | |
AF1: RxPin<USART1>, | |
AF1: RxPin<USART2>, | |
}, | |
PA5 => {AF0: SckPin<SPI1>}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<GPIO_Pin PortName="PB" Name="PB9"> | |
<SpecificParameter Name="GPIO_Pin"> | |
<PossibleValue>GPIO_PIN_9</PossibleValue> | |
</SpecificParameter> | |
<PinSignal Name="CAN_TX"> | |
<SpecificParameter Name="GPIO_AF"> | |
<PossibleValue>GPIO_AF4_CAN</PossibleValue> | |
</SpecificParameter> | |
</PinSignal> | |
<PinSignal Name="EVENTOUT"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo: | |
@classmethod | |
def my_list(cls): | |
if hasattr(cls, 'mylist'): | |
return cls.mylist | |
cls.mylist = [] | |
return cls.mylist | |
class Bar(Foo): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def enum_step(seq, start=0, step=1): | |
""" | |
Like the builtin enumerate(seq), but with adjustable stepping. Useful for backwards enumeration: | |
for idx,x in enum_step(reversed(seq), len(seq)-1, -1): | |
... | |
""" | |
for i, x in enumerate(seq): | |
yield (start + (i*step), x) |