Skip to content

Instantly share code, notes, and snippets.

@cpldcpu
cpldcpu / chronoikos.md
Last active May 11, 2024 13:17
Chronoikos

Chronoikos

You are presented with an infinite number of clocks, each featuring a dial that displays positions from 0 to 59. Each clock is equipped with a button on top that, when pressed, advances the clock by one increment. If the dial transitions from 59 back to 0, a bell within the clock will sound once.

The dials of these clocks are concealed, allowing interaction only through the button and the audible bell. A special instruction allows reading the positions of the dials to read out the result of computations.

Basic Language

An instruction sheet provides sequences in which the clocks should be manipulated. The following operations can be performed:

@cpldcpu
cpldcpu / LowPowerLEDflasher.c
Created February 7, 2021 02:10
Low Power LED Flasher on PFS154
/* ---------------------------------------------------
Ultra Low Power LED flasher
LED is connected to PA4 and is high active.
Jan 16th, 2021, CPLDCPU - Initial version
---------------------------------------------------- */
#include <stdint.h>
@cpldcpu
cpldcpu / lightsensor.c
Created September 29, 2019 09:46
Light sensor on PFS154
/* ---------------------------------------------------------------
ligthsensor.c
LED is connected to PA0 (anode) and PA4 (cathode).
Sep 21, 2019 cpldcpu - first release
Sep 29, 2019 cpldcpu - last iteration after many tries. It appears the PFS154
is too noisy for this to work.
------------------------------------------------------------------ */
@cpldcpu
cpldcpu / candleasm.s
Created September 23, 2019 19:29
Electronic candle based on Padauk PMS150C
;--------------------------------------------------------
; Electronic candle for Padauk PMS150C and SDASPDK (SDCC toolchain)
; LED is connected to PA4, Timer2 is used to drive LED
; Implements algorithm from:
; https://github.com/cpldcpu/CandleLEDhack/blob/master/Emulator/CandeflickerLED.c
;
; cpldcpu Jan 2019
;--------------------------------------------------------
.module blinky
.optsdcc -mpdk14
@cpldcpu
cpldcpu / gist:8387639
Created January 12, 2014 17:20
WS2812_SCAN - Exercise a WS2812 LED with different timing parameters. For each set of timing parameters (j,k) the following is performed: - Wait 10µs to reset the WS2812 LED - Emit 48 pulses with the given timing Compiles with AVR-GCC for ATtiny85. LED is connected on PB1.
/*
* WS2812_SCAN.c
*
* Created: 10.01.2014 20:46:20
* Author: tim
*/
#include <avr/io.h>
int main(void)