diff --git a/src/img/foto_tomatimer.png b/src/img/foto_tomatimer.png new file mode 100644 index 0000000..b8eb05e Binary files /dev/null and b/src/img/foto_tomatimer.png differ diff --git a/src/log.txt b/src/log.txt index 1932e07..3d560b6 100644 --- a/src/log.txt +++ b/src/log.txt @@ -1,3 +1,4 @@ +2021-12-17T14:00:00-06:00 built the tomatimer, a pomodoro timer on an attiny85 programmed with avr-asm {tomatimer} 2021-12-03T16:00:00-06:00 qiudanz technique in the slomoco fall gathering {qiudanz devlog} 2021-12-01T00:30:00-06:00 started advent of code 2021 using awk {advent of code 2021} 2021-11-26T16:00:00-06:00 fourth qiudanz technique mini workshop {qiudanz devlog} diff --git a/src/low-level.gmo b/src/low-level.gmo index 78622e3..226a487 100644 --- a/src/low-level.gmo +++ b/src/low-level.gmo @@ -17,6 +17,11 @@ writing code closer to the machine(s) => ./nibble_dice_tracker.gmi {nibble dice tracker} => ./darena.gmi {darena} +## avr-asm + +=> ./tomatimer.gmi {tomatimer} +=> ./avr-asm.gmi {avr-asm} + ## mu => ./mu.gmi {mu} @@ -24,8 +29,7 @@ writing code closer to the machine(s) => ./forth.gmi {forth} -## others -=> ./avr-asm.gmi {avr-asm} + # command-line interface notes diff --git a/src/tomatimer.gmo b/src/tomatimer.gmo new file mode 100644 index 0000000..5e8a43e --- /dev/null +++ b/src/tomatimer.gmo @@ -0,0 +1,347 @@ +# tomatimer + +a small pomodoro timer on an attiny85, programmed with {avr-asm}. + +part of the {s-camino} practice. + +=> ./img/foto_tomatimer.png photo of the tomatimer: a small circuit with two leds, a buzzer, the attiny85, all of them over a plastic card. + +# about + +tomatimer works as a 25 and 5 minutes timer, cycling between them. + +a couple of LEDs indicate via blinking which one of the two timers is active at a given moment. + +at the end of each timer, a buzzer plays an alarm during some seconds. + +all the durations can be reconfigured via the source code if needed. + +# connections + +```diagrama de pines + ┌──────┐ + │1 8│ VCC + │2 7│ PB2: LED state 1 + │3 6│ PB1: LED state 0 +GND │4 5│ PB0: Buzzer + └──────┘ +``` + +LEDs are connected such that an output of "high" will turn them on. + +# source code + +with billingual comments + +``` +; tomatimer.S +#include + +; TIMER1 tiene su reloj a clk/512 (~1953 Hz) +; contando 244 pulsos se va a 8Hz (frame freq) +; i.e. 8 frames son 1 segundo +; r16 y r17 se usan como registros auxiliares + +; duraciones en minutos de los timers +#define DUR_TIMER0 25 +#define DUR_TIMER1 5 +; duraciones en segundos de la alarma +#define DUR_ALARMA0 3 +#define DUR_ALARMA1 5 + +; más chico es más agudo +#define WAVE_PERIOD0 3 +#define WAVE_PERIOD1 6 + +; teórico: 244 +#define TIMER1_PERIOD 240 + +#define rFrames r20 +#define rSegundos r21 +#define rMinutos r22 +#define rFlags r23 + +#define fAlarmOn 0 +#define fAlarmLevel 1 +#define fCualTimer 2 + +#define pinAlarm PB0 +#define pinState0 PB1 +#define pinState1 PB2 + +; para hacer fast modulo 8 +#define MASK_FRAMES 0x07 + +; *********************** +; vectores de interrupts: +; *********************** +; Reset +.org 0x0000 + rjmp main + +; dirección 0x0003 * 2 +.org 0x0006 + rjmp timer1compareA_isr + +; dirección 0x0009 * 2 +.org 0x0012 + rjmp timer1compareB_isr + +; *********************** +; Main +; *********************** +.org 0x001E +main: + ;---------------------------------- + ; configuración general + ;---------------------------------- + + ; habilita interrupciones + sei + + ; pin PB0 como pin de salida + ldi r16, (1<