|
1 | 1 | #include "common-hal/spitarget/SPITarget.h" |
2 | 2 |
|
| 3 | +#include "shared-bindings/spitarget/SPITarget.h" |
| 4 | +#include "shared-bindings/microcontroller/Pin.h" |
| 5 | +#include "py/mperrno.h" |
| 6 | +#include "py/runtime.h" |
| 7 | + |
| 8 | +#include "hpl_sercom_config.h" |
| 9 | +#include "peripheral_clk_config.h" |
| 10 | + |
| 11 | +#include "hal/include/hal_gpio.h" |
| 12 | +#include "hal/include/hal_spi_m_sync.h" |
| 13 | + |
3 | 14 | #include "hpl_sercom_config.h" |
4 | 15 | #include "samd/sercom.h" |
5 | 16 |
|
@@ -47,7 +58,7 @@ void common_hal_spitarget_spi_target_construct(spitarget_spi_target_obj_t *self, |
47 | 58 | if (potential_sercom->SPI.CTRLA.bit.ENABLE != 0) { |
48 | 59 | continue; |
49 | 60 | } |
50 | | - clock_pinmux = PINMUX(clock->number, (i == 0) ? MUX_C : MUX_D); |
| 61 | + clock_pinmux = PINMUX(sck->number, (i == 0) ? MUX_C : MUX_D); |
51 | 62 | clock_pad = clock->sercom[i].pad; |
52 | 63 | if (!samd_peripherals_valid_spi_clock_pad(clock_pad)) { |
53 | 64 | continue; |
@@ -120,7 +131,7 @@ void common_hal_spitarget_spi_target_construct(spitarget_spi_target_obj_t *self, |
120 | 131 | gpio_set_pin_direction(clock->number, GPIO_DIRECTION_IN); |
121 | 132 | gpio_set_pin_pull_mode(clock->number, GPIO_PULL_OFF); |
122 | 133 | gpio_set_pin_function(clock->number, clock_pinmux); |
123 | | - claim_pin(clock); |
| 134 | + claim_pin(sck); |
124 | 135 | self->clock_pin = clock->number; |
125 | 136 |
|
126 | 137 | gpio_set_pin_direction(mosi->number, GPIO_DIRECTION_IN); |
@@ -213,7 +224,7 @@ bool common_hal_spitarget_spi_target_transfer_is_finished(spitarget_spi_target_o |
213 | 224 | return self->running_dma.failure == 1 || shared_dma_transfer_finished(self->running_dma); |
214 | 225 | } |
215 | 226 |
|
216 | | -void common_hal_spitarget_spi_target_transfer_close(spitarget_spi_target_obj_t *self) { |
| 227 | +int common_hal_spitarget_spi_target_transfer_close(spitarget_spi_target_obj_t *self) { |
217 | 228 | if (self->running_dma.failure == 1) { |
218 | 229 | return 0; |
219 | 230 | } |
|
0 commit comments