Skip to content

Commit 072c277

Browse files
committed
mtm_computer: make sure board.DAC() gets deallocated on board deinit
1 parent afb64e0 commit 072c277

File tree

1 file changed

+6
-0
lines changed
  • ports/raspberrypi/boards/mtm_computer

1 file changed

+6
-0
lines changed

ports/raspberrypi/boards/mtm_computer/board.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@ static mp_obj_t board_dac_factory(void) {
3131
}
3232
MP_DEFINE_CONST_FUN_OBJ_0(board_dac_obj, board_dac_factory);
3333

34+
void board_deinit(void) {
35+
if (board_dac_singleton != MP_OBJ_NULL) {
36+
common_hal_mcp4822_mcp4822_deinit(MP_OBJ_TO_PTR(board_dac_singleton));
37+
board_dac_singleton = MP_OBJ_NULL;
38+
}
39+
}
3440
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.

0 commit comments

Comments
 (0)