66
77#include "common-hal/microcontroller/Pin.h"
88#include "hardware/gpio.h"
9+ #include "py/mphal.h"
910#include "shared-bindings/usb_host/Port.h"
1011#include "supervisor/board.h"
1112
1213#include "common-hal/picodvi/__init__.h"
1314
1415// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
1516
17+ #define I2S_RESET_PIN_NUMBER 22
1618
1719#if defined(DEFAULT_USB_HOST_5V_POWER )
1820bool board_reset_pin_number (uint8_t pin_number ) {
@@ -28,7 +30,7 @@ bool board_reset_pin_number(uint8_t pin_number) {
2830 return true;
2931 }
3032 // Set I2S out of reset.
31- if (pin_number == 22 ) {
33+ if (pin_number == I2S_RESET_PIN_NUMBER ) {
3234 gpio_put (pin_number , 1 );
3335 gpio_set_dir (pin_number , GPIO_OUT );
3436 gpio_set_function (pin_number , GPIO_FUNC_SIO );
@@ -40,6 +42,13 @@ bool board_reset_pin_number(uint8_t pin_number) {
4042#endif
4143
4244void board_init (void ) {
45+ // Reset the DAC to put it in a known state.
46+ gpio_put (I2S_RESET_PIN_NUMBER , 0 );
47+ gpio_set_dir (I2S_RESET_PIN_NUMBER , GPIO_OUT );
48+ gpio_set_function (I2S_RESET_PIN_NUMBER , GPIO_FUNC_SIO );
49+ mp_hal_delay_us (1 );
50+ board_reset_pin_number (I2S_RESET_PIN_NUMBER );
51+
4352 #if defined(DEFAULT_USB_HOST_DATA_PLUS )
4453 common_hal_usb_host_port_construct (DEFAULT_USB_HOST_DATA_PLUS , DEFAULT_USB_HOST_DATA_MINUS );
4554 #endif
0 commit comments