Skip to content

SUKU I2S codec component with TEK1 integration#317

Draft
SukuWc wants to merge 9 commits intomasterfrom
SUKU-i2s-codec-component
Draft

SUKU I2S codec component with TEK1 integration#317
SukuWc wants to merge 9 commits intomasterfrom
SUKU-i2s-codec-component

Conversation

@SukuWc
Copy link
Member

@SukuWc SukuWc commented Feb 10, 2026

Summary

  • Added new `grid_esp32_codec` component implementing I2S TDM simplex TX driver
  • Lua API: `gaon()` / `gaoff()` for lazy init/deinit of the I2S peripheral, `gac(freq, vol, shape)` to configure frequency, volume (0.0–1.0), and waveform shape

Example

if self:button_state() > 0 then
  gaon()
  print("On")
  local shape_triangle = { 0, 0, 0 }
  local freq = 400
  local volume = 0.25
  gac(freq, volume, shape_triangle)
else
  gaoff()
  print(0)
end

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SukuWc and others added 8 commits February 10, 2026 18:24
Integrate stb_hexwave (double precision) for band-limited waveform
generation. Sound plays continuously while endless encoder button is
held, with frequency sweeping from 220Hz to 4kHz. Changed I2S to
16-bit 2-slot TDM config for NS4168 amplifier.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Generate samples one at a time for smooth continuous frequency sweep.
Keep I2S channel always enabled and write zeros when idle to avoid
DC offset power draw on NS4168.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add gaon/gaoff/gac Lua functions with macros in grid_protocol.h
- Replace hardcoded sweep with configurable freq/volume/waveform state
- Add grid_lua_api_codec component files and wire into grid_module.c
- Move codec init/ownership to app_main, decoupled from tek1 driver

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…onent

# Conflicts:
#	grid_esp/components/grid_esp32_module_vsnx/CMakeLists.txt
#	grid_esp/main/grid_fw.c
- gaon/gaoff map directly to init/deinit, removing enable/disable layer
- init guarded by tx_chan NULL check; deinit resets tx_chan to NULL
- removed enabled flag and zero-fill ISR branch
- volume range changed from 0-127 to 0.0-1.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant