File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 2
2
#define MICROPY_HW_MCU_NAME "samd21e18"
3
3
4
4
// Rev B - Black
5
- // #define MICROPY_HW_APA102_MOSI (&pin_PA00)
6
- // #define MICROPY_HW_APA102_SCK (&pin_PA01)
5
+ #define MICROPY_HW_APA102_MOSI (&pin_PA00)
6
+ #define MICROPY_HW_APA102_SCK (&pin_PA01)
7
7
8
8
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA24 | PORT_PA25)
9
9
#define MICROPY_PORT_B (0)
Original file line number Diff line number Diff line change 34
34
#include "hal/include/hal_gpio.h"
35
35
#include "hal/include/hal_spi_m_sync.h"
36
36
#include "hal/include/hpl_spi_m_sync.h"
37
+ #include "supervisor/shared/rgb_led_status.h"
37
38
38
39
#include "peripherals.h"
39
40
#include "pins.h"
@@ -59,7 +60,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
59
60
if (potential_sercom == NULL ||
60
61
#if defined(MICROPY_HW_APA102_SCK ) & & defined (MICROPY_HW_APA102_MOSI ) && !defined (CIRCUITPY_BITBANG_APA102 )
61
62
(potential_sercom -> SPI .CTRLA .bit .ENABLE != 0 &&
62
- potential_sercom != status_apa102 .spi_master_instance . hw &&
63
+ potential_sercom != status_apa102 .spi_desc . dev . prvt &&
63
64
!apa102_sck_in_use )) {
64
65
#else
65
66
potential_sercom -> SPI .CTRLA .bit .ENABLE != 0 ) {
@@ -113,6 +114,10 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
113
114
// Set up SPI clocks on SERCOM.
114
115
samd_peripherals_sercom_clock_init (sercom , sercom_index );
115
116
117
+ #if defined(MICROPY_HW_APA102_SCK ) && defined(MICROPY_HW_APA102_MOSI ) && !defined(CIRCUITPY_BITBANG_APA102 )
118
+ // if we're re-using the dotstar sercom, make sure it is disabled or the init will fail out
119
+ hri_sercomspi_clear_CTRLA_ENABLE_bit (sercom );
120
+ #endif
116
121
if (spi_m_sync_init (& self -> spi_desc , sercom ) != ERR_NONE ) {
117
122
mp_raise_OSError (MP_EIO );
118
123
}
Original file line number Diff line number Diff line change @@ -70,11 +70,11 @@ void rgb_led_status_init() {
70
70
MICROPY_HW_APA102_MOSI ,
71
71
mp_const_none );
72
72
#else
73
- if (status_apa102 . current_baudrate > 0 ) {
73
+ if (! common_hal_busio_spi_deinited ( & status_apa102 ) ) {
74
74
// Don't use spi_deinit because that leads to infinite
75
75
// recursion because reset_pin may call
76
76
// rgb_led_status_init.
77
- spi_disable (& status_apa102 .spi_master_instance );
77
+ spi_m_sync_disable (& status_apa102 .spi_desc );
78
78
}
79
79
common_hal_busio_spi_construct (& status_apa102 ,
80
80
MICROPY_HW_APA102_SCK ,
You can’t perform that action at this time.
0 commit comments