3
3
4
4
#include "mphalport.h"
5
5
6
- #include "shared-bindings/bitbangio /SPI.h"
6
+ #include "shared-bindings/nativeio /SPI.h"
7
7
#include "shared-bindings/nativeio/DigitalInOut.h"
8
8
#include "shared-bindings/neopixel_write/__init__.h"
9
- #include "shared-module/bitbangio /types.h"
9
+ #include "common-hal/nativeio /types.h"
10
10
#include "rgb_led_status.h"
11
11
#include "samd21_pins.h"
12
12
@@ -16,8 +16,8 @@ static nativeio_digitalinout_obj_t status_neopixel;
16
16
#endif
17
17
18
18
#if defined(MICROPY_HW_APA102_MOSI ) && defined(MICROPY_HW_APA102_SCK )
19
- static uint8_t status_apa102_color [12 ] = {0 , 0 , 0 , 0 , 0xff , 0 , 0 , 0 };
20
- static bitbangio_spi_obj_t status_apa102 ;
19
+ static uint8_t status_apa102_color [12 ] = {0 , 0 , 0 , 0 , 0xff , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
20
+ static nativeio_spi_obj_t status_apa102 ;
21
21
#endif
22
22
23
23
#if defined(MICROPY_HW_NEOPIXEL ) || (defined(MICROPY_HW_APA102_MOSI ) && defined(MICROPY_HW_APA102_SCK ))
@@ -30,12 +30,14 @@ void rgb_led_status_init() {
30
30
common_hal_nativeio_digitalinout_switch_to_output (& status_neopixel , false, DRIVE_MODE_PUSH_PULL );
31
31
#endif
32
32
#if defined(MICROPY_HW_APA102_MOSI ) && defined(MICROPY_HW_APA102_SCK )
33
- shared_module_bitbangio_spi_construct (& status_apa102 ,
34
- MICROPY_HW_APA102_SCK ,
35
- MICROPY_HW_APA102_MOSI ,
36
- NULL );
37
- shared_module_bitbangio_spi_try_lock (& status_apa102 );
38
- shared_module_bitbangio_spi_configure (& status_apa102 , 100000 , 0 , 1 , 8 );
33
+
34
+ port_pin_set_output_level (PIN_PA17 , true);
35
+ common_hal_nativeio_spi_construct (& status_apa102 ,
36
+ MICROPY_HW_APA102_SCK ,
37
+ MICROPY_HW_APA102_MOSI ,
38
+ NULL );
39
+ //common_hal_nativeio_spi_try_lock(&status_apa102);
40
+ //common_hal_nativeio_spi_configure(&status_apa102, 100000, 0, 1, 8);
39
41
#endif
40
42
}
41
43
@@ -57,7 +59,7 @@ void new_status_color(uint32_t rgb) {
57
59
status_apa102_color [5 ] = rgb & 0xff ;
58
60
status_apa102_color [6 ] = (rgb >> 8 ) & 0xff ;
59
61
status_apa102_color [7 ] = (rgb >> 16 ) & 0xff ;
60
- shared_module_bitbangio_spi_write (& status_apa102 , status_apa102_color , 8 );
62
+ //common_hal_nativeio_spi_write (&status_apa102, status_apa102_color, 8);
61
63
#endif
62
64
}
63
65
@@ -67,8 +69,8 @@ void temp_status_color(uint32_t rgb) {
67
69
common_hal_neopixel_write (& status_neopixel , colors , 3 , true);
68
70
#endif
69
71
#if defined(MICROPY_HW_APA102_MOSI ) && defined(MICROPY_HW_APA102_SCK )
70
- uint8_t colors [12 ] = {0 , 0 , 0 , 0 , 0xff , rgb & 0xff , (rgb >> 8 ) & 0xff , (rgb >> 16 ) & 0xff , 0x0 , 0x0 , 0x0 , 0x0 };
71
- shared_module_bitbangio_spi_write (& status_apa102 , colors , 8 );
72
+ // uint8_t colors[12] = {0, 0, 0, 0, 0xff, rgb & 0xff, (rgb >> 8) & 0xff, (rgb >> 16) & 0xff, 0x0, 0x0, 0x0, 0x0};
73
+ //common_hal_nativeio_spi_write (&status_apa102, colors, 8);
72
74
#endif
73
75
}
74
76
@@ -77,7 +79,7 @@ void clear_temp_status() {
77
79
common_hal_neopixel_write (& status_neopixel , status_neopixel_color , 3 , true);
78
80
#endif
79
81
#if defined(MICROPY_HW_APA102_MOSI ) && defined(MICROPY_HW_APA102_SCK )
80
- shared_module_bitbangio_spi_write (& status_apa102 , status_apa102_color , 12 );
82
+ //common_hal_nativeio_spi_write (&status_apa102, status_apa102_color, 12);
81
83
#endif
82
84
}
83
85
0 commit comments