21
21
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
22
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
23
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
24
+ * THE SOFTWARE .
25
25
*/
26
26
27
27
#include "shared-bindings/displayio/ParallelBus.h"
33
33
#include "shared-bindings/digitalio/DigitalInOut.h"
34
34
#include "shared-bindings/microcontroller/__init__.h"
35
35
36
- void common_hal_displayio_parallelbus_construct (displayio_parallelbus_obj_t * self ,
37
- const mcu_pin_obj_t * data0 , const mcu_pin_obj_t * command , const mcu_pin_obj_t * chip_select ,
38
- const mcu_pin_obj_t * write , const mcu_pin_obj_t * read , const mcu_pin_obj_t * reset , uint32_t frequency ) {
36
+ void common_hal_displayio_parallelbus_construct (displayio_parallelbus_obj_t * self ,
37
+ const mcu_pin_obj_t * data0 , const mcu_pin_obj_t * command , const mcu_pin_obj_t * chip_select ,
38
+ const mcu_pin_obj_t * write , const mcu_pin_obj_t * read , const mcu_pin_obj_t * reset , uint32_t frequency ) {
39
39
40
40
uint8_t data_pin = data0 -> number ;
41
41
if (data_pin % 8 != 0 ) {
@@ -55,7 +55,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel
55
55
wrconfig |= 0xff << (data_pin % 32 );
56
56
}
57
57
g -> WRCONFIG .reg = wrconfig ;
58
- self -> bus = ((uint8_t * ) & g -> OUT .reg ) + (data0 -> number % 32 / 8 );
58
+ self -> bus = ((uint8_t * ) & g -> OUT .reg ) + (data0 -> number % 32 / 8 );
59
59
60
60
self -> command .base .type = & digitalio_digitalinout_type ;
61
61
common_hal_digitalio_digitalinout_construct (& self -> command , command );
@@ -95,7 +95,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel
95
95
}
96
96
}
97
97
98
- void common_hal_displayio_parallelbus_deinit (displayio_parallelbus_obj_t * self ) {
98
+ void common_hal_displayio_parallelbus_deinit (displayio_parallelbus_obj_t * self ) {
99
99
for (uint8_t i = 0 ; i < 8 ; i ++ ) {
100
100
reset_pin_number (self -> data0_pin + i );
101
101
}
@@ -108,7 +108,7 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self)
108
108
}
109
109
110
110
bool common_hal_displayio_parallelbus_reset (mp_obj_t obj ) {
111
- displayio_parallelbus_obj_t * self = MP_OBJ_TO_PTR (obj );
111
+ displayio_parallelbus_obj_t * self = MP_OBJ_TO_PTR (obj );
112
112
if (self -> reset .base .type == & mp_type_NoneType ) {
113
113
return false;
114
114
}
@@ -124,17 +124,17 @@ bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
124
124
}
125
125
126
126
bool common_hal_displayio_parallelbus_begin_transaction (mp_obj_t obj ) {
127
- displayio_parallelbus_obj_t * self = MP_OBJ_TO_PTR (obj );
127
+ displayio_parallelbus_obj_t * self = MP_OBJ_TO_PTR (obj );
128
128
common_hal_digitalio_digitalinout_set_value (& self -> chip_select , false);
129
129
return true;
130
130
}
131
131
132
132
void common_hal_displayio_parallelbus_send (mp_obj_t obj , display_byte_type_t byte_type ,
133
133
display_chip_select_behavior_t chip_select , const uint8_t * data , uint32_t data_length ) {
134
- displayio_parallelbus_obj_t * self = MP_OBJ_TO_PTR (obj );
134
+ displayio_parallelbus_obj_t * self = MP_OBJ_TO_PTR (obj );
135
135
common_hal_digitalio_digitalinout_set_value (& self -> command , byte_type == DISPLAY_DATA );
136
- uint32_t * clear_write = (uint32_t * ) & self -> write_group -> OUTCLR .reg ;
137
- uint32_t * set_write = (uint32_t * ) & self -> write_group -> OUTSET .reg ;
136
+ uint32_t * clear_write = (uint32_t * ) & self -> write_group -> OUTCLR .reg ;
137
+ uint32_t * set_write = (uint32_t * ) & self -> write_group -> OUTSET .reg ;
138
138
uint32_t mask = self -> write_mask ;
139
139
for (uint32_t i = 0 ; i < data_length ; i ++ ) {
140
140
* clear_write = mask ;
@@ -144,6 +144,6 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt
144
144
}
145
145
146
146
void common_hal_displayio_parallelbus_end_transaction (mp_obj_t obj ) {
147
- displayio_parallelbus_obj_t * self = MP_OBJ_TO_PTR (obj );
147
+ displayio_parallelbus_obj_t * self = MP_OBJ_TO_PTR (obj );
148
148
common_hal_digitalio_digitalinout_set_value (& self -> chip_select , true);
149
149
}
0 commit comments