Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d8bbe2a
mtm_computer: Add DAC audio out module
todbot Mar 21, 2026
38b0233
mtm_hardware.c added
todbot Mar 21, 2026
a5f9f3b
mtm_hardware.dacout: add gain=1 or gain=2 argument
todbot Mar 23, 2026
02675cb
rework mcp4822 module from mtm_hardware.DACOut
todbot Mar 23, 2026
3b9eaf9
mtm_computer: Add DAC audio out module
todbot Mar 21, 2026
f63ea5c
mtm_hardware.c added
todbot Mar 21, 2026
c7fc0c0
mtm_hardware.dacout: add gain=1 or gain=2 argument
todbot Mar 23, 2026
2e4fc89
rework mcp4822 module from mtm_hardware.DACOut
todbot Mar 23, 2026
9fdf9dc
Merge branch 'mtm_computer_dac_audio' of github.com:todbot/circuitpyt…
todbot Mar 23, 2026
6651ac1
restore deleted circuitpython.pot, update translation
todbot Mar 23, 2026
8bf51db
mtm_computer: set DAC gain 2x
todbot Mar 23, 2026
bde1ee4
Revert "mtm_computer: set DAC gain 2x"
todbot Mar 24, 2026
c2395d9
fix zephyr builds by running update_boardnfo.py
todbot Mar 24, 2026
2de067b
mcp4822 gain argument fix, as per requested
todbot Mar 24, 2026
ad21609
mcp4822 gain argument fix, as per requested
todbot Mar 24, 2026
dd1c957
mtm_computer: make board.DAC() an actual singleton
todbot Mar 24, 2026
5bd2a42
mtm_computer: make sure board.DAC() gets deallocated on board deinit
todbot Mar 24, 2026
13d6fea
mcp4822 CS/MOSI argument fix, as per requested
todbot Mar 24, 2026
62ffc25
mcp4822 CS/MOSI argument fix, as per requested
todbot Mar 24, 2026
bec871e
mtm_computer: Add DAC audio out module
todbot Mar 21, 2026
7e66d51
mtm_hardware.c added
todbot Mar 21, 2026
eb3fd70
mtm_hardware.dacout: add gain=1 or gain=2 argument
todbot Mar 23, 2026
8d282d5
rework mcp4822 module from mtm_hardware.DACOut
todbot Mar 23, 2026
d0e286a
restore deleted circuitpython.pot, update translation
todbot Mar 23, 2026
a20f1f9
mtm_computer: set DAC gain 2x
todbot Mar 23, 2026
2793baa
Revert "mtm_computer: set DAC gain 2x"
todbot Mar 24, 2026
32165ce
fix zephyr builds by running update_boardnfo.py
todbot Mar 24, 2026
b66baec
mcp4822 gain argument fix, as per requested
todbot Mar 24, 2026
16285c1
mcp4822 gain argument fix, as per requested
todbot Mar 24, 2026
afb64e0
mtm_computer: make board.DAC() an actual singleton
todbot Mar 24, 2026
072c277
mtm_computer: make sure board.DAC() gets deallocated on board deinit
todbot Mar 24, 2026
8309a23
mcp4822 CS/MOSI argument fix, as per requested
todbot Mar 24, 2026
74aee24
mcp4822 CS/MOSI argument fix, as per requested
todbot Mar 24, 2026
981a818
Merge branch 'mtm_computer_dac_audio' of github.com:todbot/circuitpyt…
todbot Mar 25, 2026
4439b66
Merge branch 'adafruit:main' into mtm_computer_dac_audio
todbot Mar 25, 2026
0f690b7
fix zephyr builds by running update_boardnfo.py
todbot Mar 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 19 additions & 23 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ msgstr ""

#: ports/espressif/common-hal/espulp/ULP.c
#: ports/espressif/common-hal/mipidsi/Bus.c
#: ports/espressif/common-hal/qspibus/QSPIBus.c
#: ports/mimxrt10xx/common-hal/audiobusio/__init__.c
#: ports/mimxrt10xx/common-hal/usb_host/Port.c
#: ports/raspberrypi/common-hal/picodvi/Framebuffer_RP2040.c
Expand All @@ -135,6 +136,7 @@ msgstr ""

#: ports/analog/common-hal/busio/SPI.c ports/analog/common-hal/busio/UART.c
#: shared-bindings/digitalio/DigitalInOutProtocol.c
#: shared-module/busdisplay/BusDisplay.c
msgid "%q init failed"
msgstr ""

Expand Down Expand Up @@ -622,6 +624,7 @@ msgstr ""

#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
#: ports/raspberrypi/common-hal/mcp4822/MCP4822.c
msgid "Audio source error"
msgstr ""

Expand Down Expand Up @@ -856,8 +859,7 @@ msgstr ""
msgid "Coordinate arrays types have different sizes"
msgstr ""

#: shared-module/usb/core/Device.c
#: ports/espressif/common-hal/qspibus/QSPIBus.c
#: ports/espressif/common-hal/qspibus/QSPIBus.c shared-module/usb/core/Device.c
msgid "Could not allocate DMA capable buffer"
msgstr ""

Expand Down Expand Up @@ -1023,10 +1025,6 @@ msgstr ""
msgid "Failed to buffer the sample"
msgstr ""

#: ports/zephyr-cp/common-hal/_bleio/Adapter.c
msgid "Failed to connect"
msgstr ""

#: ports/espressif/common-hal/_bleio/Adapter.c
#: ports/nordic/common-hal/_bleio/Adapter.c
#: ports/zephyr-cp/common-hal/_bleio/Adapter.c
Expand Down Expand Up @@ -1242,8 +1240,8 @@ msgstr ""
msgid "Internal define error"
msgstr ""

#: ports/espressif/common-hal/qspibus/QSPIBus.c
#: shared-bindings/pwmio/PWMOut.c supervisor/shared/settings.c
#: ports/espressif/common-hal/qspibus/QSPIBus.c shared-bindings/pwmio/PWMOut.c
#: supervisor/shared/settings.c
msgid "Internal error"
msgstr ""

Expand Down Expand Up @@ -1518,8 +1516,7 @@ msgstr ""
#: ports/stm/common-hal/busio/UART.c shared-bindings/fourwire/FourWire.c
#: shared-bindings/i2cdisplaybus/I2CDisplayBus.c
#: shared-bindings/paralleldisplaybus/ParallelBus.c
#: shared-bindings/qspibus/QSPIBus.c
#: shared-module/bitbangio/SPI.c
#: shared-bindings/qspibus/QSPIBus.c shared-module/bitbangio/SPI.c
msgid "No %q pin"
msgstr ""

Expand All @@ -1537,6 +1534,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
#: ports/raspberrypi/common-hal/mcp4822/MCP4822.c
msgid "No DMA channel found"
msgstr ""

Expand Down Expand Up @@ -1651,7 +1649,7 @@ msgid "Not connected"
msgstr ""

#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c shared-bindings/mcp4822/MCP4822.c
msgid "Not playing"
msgstr ""

Expand Down Expand Up @@ -2168,6 +2166,7 @@ msgid "Too many channels in sample"
msgstr ""

#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c
#: ports/raspberrypi/common-hal/mcp4822/MCP4822.c
msgid "Too many channels in sample."
msgstr ""

Expand Down Expand Up @@ -2266,6 +2265,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
#: ports/raspberrypi/common-hal/mcp4822/MCP4822.c
msgid "Unable to allocate buffers for signed conversion"
msgstr ""

Expand Down Expand Up @@ -3040,6 +3040,10 @@ msgstr ""
msgid "cross is defined for 1D arrays of length 3"
msgstr ""

#: ports/raspberrypi/common-hal/mcp4822/MCP4822.c
msgid "cs pin must be 1-4 positions above mosi pin"
Comment thread
todbot marked this conversation as resolved.
Outdated
msgstr ""

#: extmod/ulab/code/scipy/optimize/optimize.c
msgid "data must be iterable"
msgstr ""
Expand Down Expand Up @@ -3237,10 +3241,6 @@ msgstr ""
msgid "float unsupported"
msgstr ""

#: shared-bindings/_stage/Text.c
msgid "font must be 2048 bytes long"
msgstr ""

#: extmod/moddeflate.c
msgid "format"
msgstr ""
Expand Down Expand Up @@ -3310,6 +3310,10 @@ msgstr ""
msgid "function takes %d positional arguments but %d were given"
msgstr ""

#: shared-bindings/mcp4822/MCP4822.c
msgid "gain must be 1 or 2"
Comment thread
todbot marked this conversation as resolved.
Outdated
msgstr ""

#: py/objgenerator.c
msgid "generator already executing"
msgstr ""
Expand All @@ -3322,10 +3326,6 @@ msgstr ""
msgid "generator raised StopIteration"
msgstr ""

#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr ""

#: extmod/modhashlib.c
msgid "hash is final"
msgstr ""
Expand Down Expand Up @@ -4047,10 +4047,6 @@ msgstr ""
msgid "pack expected %d items for packing (got %d)"
msgstr ""

#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
msgstr ""

#: py/emitinlinerv32.c
msgid "parameters must be registers in sequence a0 to a3"
msgstr ""
Expand Down
19 changes: 19 additions & 0 deletions ports/raspberrypi/boards/mtm_computer/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,24 @@
// SPDX-License-Identifier: MIT

#include "supervisor/board.h"
#include "shared-bindings/mcp4822/MCP4822.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "peripherals/pins.h"
#include "py/runtime.h"

// board.DAC() — factory function that constructs an mcp4822.MCP4822 with
// the MTM Workshop Computer's DAC pins (GP18=SCK, GP19=SDI, GP21=CS).
static mp_obj_t board_dac_factory(void) {
Comment thread
todbot marked this conversation as resolved.
mcp4822_mcp4822_obj_t *dac = mp_obj_malloc_with_finaliser(
mcp4822_mcp4822_obj_t, &mcp4822_mcp4822_type);
common_hal_mcp4822_mcp4822_construct(
dac,
&pin_GPIO18, // clock (SCK)
&pin_GPIO19, // mosi (SDI)
&pin_GPIO21, // cs
1); // gain 1x
return MP_OBJ_FROM_PTR(dac);
}
MP_DEFINE_CONST_FUN_OBJ_0(board_dac_obj, board_dac_factory);

// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
1 change: 1 addition & 0 deletions ports/raspberrypi/boards/mtm_computer/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"
CIRCUITPY_AUDIOEFFECTS = 1
CIRCUITPY_IMAGECAPTURE = 0
CIRCUITPY_PICODVI = 0
CIRCUITPY_MCP4822 = 1
6 changes: 5 additions & 1 deletion ports/raspberrypi/boards/mtm_computer/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "shared-bindings/board/__init__.h"

extern const mp_obj_fun_builtin_fixed_t board_dac_obj;

static const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS

Expand All @@ -21,7 +23,6 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PULSE_2_IN), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) },


{ MP_ROM_QSTR(MP_QSTR_NORM_PROBE), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) },

Expand Down Expand Up @@ -105,6 +106,9 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) },
{ MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) },

// Factory function: dac = board.DAC() returns a configured mcp4822.MCP4822
{ MP_ROM_QSTR(MP_QSTR_DAC), MP_ROM_PTR(&board_dac_obj) },

// { MP_ROM_QSTR(MP_QSTR_EEPROM_I2C), MP_ROM_PTR(&board_i2c_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
Loading
Loading