This is a collection of switchable clock sources for use in electronic applications such as computers and games. All clocks are limited to be no shorter than the decay time of a normal BRAY (30 frames). The internal DLAYs here are all set to 32 frames, which should be a good value for ARAY-based electronics.
Feel free to use any of these components.
I have some of the pins connected to WIFI for demo. There are no critical WIFIs here, just get rid of them if you want to use the component.
DEMO USAGE:
There is an on/toggle/off button in the top left of the save that is connected with WIFI to all of the "simple" and "protected" type power supplies (details below). You can press these buttons to see those power supplies work, or you can just spark the PSCNs on the input pins directly, although the buttons are probably easier. Toggle will not work correctly for circuits that do not support toggling (see below).
You can also turn all the fully built power supplies at the bottom on and off and see their output.
POWER SUPPLY CIRCUITS:
The top (red) grid is a collection of power supply circuits. There are two basic types. All types send out an init spark (when turned on), clock sparks, and a shutdown spark (when turned off). Init/shutdown output sparks are sync'd to the clock. The difference between the two basic types are:
Type A: No spark is sent out the clock line when an init or shutdown spark is set (init only, then clock[s], then shutdown only).
Type B: A spark is sent out the clock line when an init or shutdown spark is set (init+clock, then just clock[s], then shutdown+clock).
Also there are two clock options:
Internal: The clock source is a DLAY inside the power supply (marked with "XTAL" so you can find it if you want to change it).
External: The clock source is must be provided on the clock input pin. Useful for syncing multiple power supplies. The demo has a clock up near the top that is sent through WIFI to all the external clock pins. Notice that they are all synchronized, unlike the internal clock versions.
Additionally, in the last column, there are power supplies that must be plugged in to a power source (lol). These are completely gratuitous. You can cut + paste the wall socket over the plug, or attach a BTRY to the narrower of the two pins. These are Type A power supplies with some extra logic to simulate being unplugged: When input power is cut, the power supply is reset to the "off" state, and no shutdown spark is sent. When power is restored, the power supply will be off, and turning it on will output an init spark as normal.
There are three on/off switch options, corresponding to the rows in the red grid:
Base design: These are the core circuits only. Shoot an ARAY into the red/green ports on top to turn it off/on. The ARAY must be triggered by an INST so that it passes through the conductors inside. If you send an ON signal when it is already on, you will trigger another init spark output. If you send an OFF signal when it is already off, you will trigger another shutdown spark output. Usually this isn't desired. If you send an ON + OFF signal at the same time, generally strange things will happen (such as an init and shutdown spark being sent out at the same time).
Simple: These are the same as a base design except input pins are provided.
Protected: These have a flip-flop in the on/off pins that prevents the behavior described above -- if you send an ON signal when it is already on, it will be ignored, and if you send an OFF signal when it is already off, it will also be ignored. Additionally, these support toggling the on/off state: If you send an ON + OFF signal at the same time, the state will be toggled. These are probably the ones you want to use.
Generally, you'd only use the non-protected designs if a) you don't care, or b) you already have some external logic that manages on/off state and you don't want to take up the extra space of the protected circuit.
ON/OFF SWITCHES:
I've also provided pre-made modules complete with on/off switches that are ready to be used right away. The pre-made modules are all Protected Input, Internal Clock circuits. On the bottom left there are versions with on/off switches and undecorated circuits.
In the blue grid on the right, I have decorated the circuits and provided alternate power switches, as well as a template to create your own power switch (see below).
The top row contains switch modules (which you can use for whatever other purpose). The blank one on the left is a template you can put your own power switch in and attach it directly to one of the power supply modules in the first column.
The first column contains a Type A and Type B power supply, decorated, with no on/off button module attached.
The other six cells have all the switches attached and are fully build components ready to use. The pinouts aren't labelled but they are the same as everywhere else. Try them!
ATTACHING SWITCHES, CREATING FROM TEMPLATE:
To attach a switch module to a power supply, remove the four INSTs + PSCN/NSCNs sticking out the sides of each half, then copy + paste them together so the edge lines up exactly (see the preassembled ones for examples).
To create your own, build your switches in the template box. You can go all the way up to and including the dotted line on the right (which you can delete), and your input/output pins must match. Turn off decorations and look at the premade switches for examples. Then attach your switch to the power supply as I just described.
Sending out the ON output will turn the power supply on (if it is not already on). Sending out the OFF output will turn the power supply off (if it is not already off). When the power supply is turned on a spark will come in the ON input. When the power supply is turned off a spark will come in the OFF input. You can use these inputs to change the state of power lights.
You can experiment by pressing the buttons and sparking the PSCN's on the existing switch and power supply modules.
You don't actually have to stick to the size of the template box; just make sure your pins line up.
Note that I've put a layer of insulation, colored a very dark gray, around all of the assembled power supplies. This just prevents it from interacting with any nearby electronics, since there are decorated conductors right at the edge of the box.
If you want to make a toggle button, send to both the on+off outputs at exactly the same time.
Hopefully somebody finds these components useful. Let me know if you have any problems or questions, and if you come up with any cool power switch designs, share them!! =)