Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added simple_mosfet #116

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/any_circuit_element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const any_circuit_element = z.union([
src.source_simple_pin_header,
src.source_simple_resonator,
src.source_simple_transistor,
src.source_simple_mosfet,
src.source_simple_potentiometer,
src.source_simple_push_button,
pcb.pcb_component,
Expand Down
2 changes: 2 additions & 0 deletions src/source/any_source_component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { source_simple_crystal } from "./source_simple_crystal"
import { source_simple_pin_header } from "./source_simple_pin_header"
import { source_simple_resonator } from "./source_simple_resonator"
import { source_simple_transistor } from "./source_simple_transistor"
import { source_simple_mosfet } from "./source_simple_mosfet"

export const any_source_component = z.union([
source_simple_resistor,
Expand All @@ -33,6 +34,7 @@ export const any_source_component = z.union([
source_simple_pin_header,
source_simple_resonator,
source_simple_transistor,
source_simple_mosfet,
])

export type AnySourceComponent = z.infer<typeof any_source_component>
1 change: 1 addition & 0 deletions src/source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export * from "./source_simple_crystal"
export * from "./source_simple_pin_header"
export * from "./source_simple_resonator"
export * from "./source_simple_transistor"
export * from "./source_simple_mosfet"
29 changes: 29 additions & 0 deletions src/source/source_simple_mosfet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { z } from "zod"
import {
source_component_base,
type SourceComponentBase,
} from "src/source/base/source_component_base"
import { expectTypesMatch } from "src/utils/expect-types-match"

export const source_simple_mosfet = source_component_base.extend({
ftype: z.literal("simple_mosfet"),
channel_type: z.enum(["n", "p"]),
mosfet_mode: z.enum(["enhancement", "depletion"]),
})

export type SourceSimpleMosfetInput = z.input<typeof source_simple_mosfet>
type InferredSourceSimpleMosfet = z.infer<typeof source_simple_mosfet>

/**
* Defines a simple mosfet component
* This is a three-pin semiconductor device (source, gate, drain)
* Pin configuration is handled by the schematic port system
*/

export interface SourceSimpleMosfet extends SourceComponentBase {
ftype: "simple_mosfet"
channel_type: "n" | "p"
mosfet_mode: "enhancement" | "depletion"
}

expectTypesMatch<SourceSimpleMosfet, InferredSourceSimpleMosfet>(true)
Loading