Files
seedbox/firmware/app/app.h
Gee 2196633ed5
Some checks failed
check / check (push) Has been cancelled
Seedbox v0.1 + firmware, generic kit/synth, ROOT/SCALE pages
First commit of the repo. Contents beyond the v0.1 simulator and layout:

- Full Pico 2 W firmware (firmware/app, drivers, engine port, host test).
- BANK page and 404 mode A/B removed; learned pads play exactly what was learned.
- 404/MiniFreak renamed to KIT/SYNTH throughout (jacks, code, sim, docs,
  layout labels; wiring rebuilt).
- ROLL returns to page select after a re-roll; a freshly learned track turns on.
- LCD contrast 66.
- ROOT and SCALE pages: 21 scales, AUTO = the seed picks; global and sticky.

Intended music change: the scale table grew from 8 to 21 and AUTO picks from
all of them, so every seed's scale changed. Vectors regenerated with
npm run vectors, plus new key-override cases. Flash record is now version 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 20:39:36 +03:00

46 lines
1.6 KiB
C

/* Seedbox firmware: state shared between core 0 (UI) and core 1 (sequencer). Mirrors sim/app.js. */
#ifndef SEEDBOX_APP_H
#define SEEDBOX_APP_H
#include <stdint.h>
#include "pico/critical_section.h"
#include "pico/util/queue.h"
#include "engine.h"
#define NKIT 7 /* kit tracks are 0..6 (lane 0); LEARN index = track index */
#define NSLOTS 8
typedef struct { uint8_t used, ch, note; } pad_t; /* learned pad: ch 0..15 */
/* Everything the sequencer reads. Core 0 writes it under g_live_lock; core 1 copies it under the same lock. */
typedef struct {
sb_state state;
int gen, energy, drift, bpm;
int scale, root; /* ROOT / SCALE pages: -1 = AUTO (the seed picks) */
uint8_t on[SB_NT], inv[SB_NT]; /* inv: flipped while the button is held */
pad_t learn[NKIT];
int mono_ch; /* synth channel 1..16 */
int mono_oct; /* -3..3 */
int clock; /* send clock + start/stop */
} live_t;
extern live_t g_live;
extern critical_section_t g_live_lock;
/* core 0 -> core 1 */
enum { CMD_START, CMD_STOP, CMD_RELEASE_TRACK, CMD_BPM };
typedef struct { uint8_t cmd; int16_t arg; } cmd_t;
extern queue_t g_cmdq;
/* core 1 -> core 0, for the screen */
extern volatile int g_running;
extern volatile int g_cur_bar; /* bar being heard, -1 if none */
extern volatile uint32_t g_hit_until_ms[SB_NT];
void seq_core1_main(void);
/* app.js learned(): the channel and note a kit track was learned with. Returns 0 if not learned. */
int learned(const live_t *L, int tr, int *ch, int *note);
#endif