This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Library: Add basis of has_kicad_symbol_...
- Loading branch information
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This file is part of the faebryk project | ||
# SPDX-License-Identifier: MIT | ||
|
||
import faebryk.library._F as F | ||
|
||
|
||
class has_kicad_manual_symbol(F.has_kicad_symbol.impl()): | ||
def __init__(self, str, pinmap: dict[F.Pad, str]) -> None: | ||
super().__init__() | ||
self.str = str | ||
self.pinmap = pinmap | ||
|
||
def get_kicad_symbol(self): | ||
return self.str | ||
|
||
def get_pin_names(self): | ||
return self.pinmap |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file is part of the faebryk project | ||
# SPDX-License-Identifier: MIT | ||
|
||
from abc import abstractmethod | ||
from typing import TYPE_CHECKING | ||
|
||
import faebryk.library._F as F | ||
|
||
if TYPE_CHECKING: | ||
from faebryk.library.Pad import Pad | ||
|
||
|
||
class has_kicad_symbol(F.Symbol.TraitT): | ||
@abstractmethod | ||
def get_kicad_symbol(self) -> str: ... | ||
|
||
@abstractmethod | ||
def get_pin_names(self) -> dict["Pad", str]: ... | ||
|
||
def get_kicad_symbol_name(self) -> str: | ||
return self.get_kicad_symbol().split(":")[-1] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# This file is part of the faebryk project | ||
# SPDX-License-Identifier: MIT | ||
|
||
import faebryk.library._F as F | ||
|
||
|
||
class has_kicad_symbol_equal_ifs(F.has_kicad_symbol.impl()): | ||
def get_pin_names(self): | ||
return self.obj.get_trait(F.has_equal_pins).get_pin_map() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This file is part of the faebryk project | ||
# SPDX-License-Identifier: MIT | ||
|
||
import faebryk.library._F as F | ||
|
||
|
||
class has_kicad_symbol_equal_ifs_defined(F.has_kicad_symbol_equal_ifs): | ||
def __init__(self, str) -> None: | ||
super().__init__() | ||
self.str = str | ||
|
||
def get_kicad_symbol(self): | ||
return self.str |