Skip to content

Commit 12f64c7

Browse files
authored
Merge pull request #2352 from hierophect/stm32-displayio
STM32: Displayio
2 parents d50f930 + ab74f45 commit 12f64c7

File tree

5 files changed

+110
-3
lines changed

5 files changed

+110
-3
lines changed

ports/stm32f4/common-hal/busio/SPI.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
165165
self->baudrate = (get_busclock(SPIx)/16);
166166
self->prescaler = 16;
167167
self->polarity = 0;
168-
self->phase = 1;
168+
self->phase = 0;
169169
self->bits = 8;
170170

171171
claim_pin(sck);
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "shared-bindings/displayio/ParallelBus.h"
28+
29+
#include <stdint.h>
30+
31+
#include "common-hal/microcontroller/Pin.h"
32+
#include "py/runtime.h"
33+
#include "shared-bindings/digitalio/DigitalInOut.h"
34+
#include "shared-bindings/microcontroller/__init__.h"
35+
36+
#include "tick.h"
37+
38+
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* self,
39+
const mcu_pin_obj_t* data0, const mcu_pin_obj_t* command, const mcu_pin_obj_t* chip_select,
40+
const mcu_pin_obj_t* write, const mcu_pin_obj_t* read, const mcu_pin_obj_t* reset) {
41+
42+
mp_raise_NotImplementedError(translate("ParallelBus not yet supported"));
43+
}
44+
45+
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) {
46+
47+
}
48+
49+
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
50+
return false;
51+
}
52+
53+
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
54+
return false;
55+
}
56+
57+
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
58+
59+
return false;
60+
}
61+
62+
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) {
63+
64+
}
65+
66+
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
67+
68+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
28+
#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
29+
30+
#include "common-hal/digitalio/DigitalInOut.h"
31+
32+
typedef struct {
33+
mp_obj_base_t base;
34+
} displayio_parallelbus_obj_t;
35+
36+
#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_DISPLAYIO_PARALLELBUS_H

ports/stm32f4/mpconfigport.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ ifndef CIRCUITPY_NEOPIXEL_WRITE
6565
CIRCUITPY_NEOPIXEL_WRITE = 1
6666
endif
6767

68+
ifndef
69+
CIRCUITPY_DISPLAYIO = 1
70+
endif
6871

6972
#ifeq ($(MCU_SUB_VARIANT), stm32f412zx)
7073
#endif

shared-module/displayio/FourWire.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t* self,
4949
gc_never_free(self->bus);
5050

5151
self->frequency = baudrate;
52-
self->polarity = common_hal_busio_spi_get_polarity(spi);
53-
self->phase = common_hal_busio_spi_get_phase(spi);
52+
self->polarity = 0;
53+
self->phase = 0;
5454

5555
common_hal_digitalio_digitalinout_construct(&self->command, command);
5656
common_hal_digitalio_digitalinout_switch_to_output(&self->command, true, DRIVE_MODE_PUSH_PULL);

0 commit comments

Comments
 (0)