6
6
7
7
#include "common-hal/microcontroller/Pin.h"
8
8
#include "hardware/gpio.h"
9
+ #include "py/mphal.h"
9
10
#include "shared-bindings/usb_host/Port.h"
10
11
#include "supervisor/board.h"
11
12
12
13
#include "common-hal/picodvi/__init__.h"
13
14
14
15
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
15
16
17
+ #define I2S_RESET_PIN_NUMBER 22
16
18
17
19
#if defined(DEFAULT_USB_HOST_5V_POWER )
18
20
bool board_reset_pin_number (uint8_t pin_number ) {
@@ -28,7 +30,7 @@ bool board_reset_pin_number(uint8_t pin_number) {
28
30
return true;
29
31
}
30
32
// Set I2S out of reset.
31
- if (pin_number == 22 ) {
33
+ if (pin_number == I2S_RESET_PIN_NUMBER ) {
32
34
gpio_put (pin_number , 1 );
33
35
gpio_set_dir (pin_number , GPIO_OUT );
34
36
gpio_set_function (pin_number , GPIO_FUNC_SIO );
@@ -40,6 +42,13 @@ bool board_reset_pin_number(uint8_t pin_number) {
40
42
#endif
41
43
42
44
void 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
+
43
52
#if defined(DEFAULT_USB_HOST_DATA_PLUS )
44
53
common_hal_usb_host_port_construct (DEFAULT_USB_HOST_DATA_PLUS , DEFAULT_USB_HOST_DATA_MINUS );
45
54
#endif
0 commit comments