Skip to content

Commit 712b393

Browse files
committed
some updates
1 parent bdbd98d commit 712b393

File tree

6 files changed

+489
-38
lines changed

6 files changed

+489
-38
lines changed

api_drivers/common_api_drivers/display/ili9488/_ili9488_init.py

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,34 +35,25 @@ def init(self):
3535
self.set_params(_SLPOUT)
3636
time.sleep_ms(120) # NOQA
3737

38-
param_buf[:15] = bytearray(
39-
[
40-
0x00, 0x03, 0x09, 0x08, 0x16,
41-
0x0A, 0x3F, 0x78, 0x4C, 0x09,
42-
0x0A, 0x08, 0x16, 0x1A, 0x0F
43-
]
44-
)
38+
param_buf[:15] = bytearray([
39+
0x00, 0x03, 0x09, 0x08, 0x16, 0x0A, 0x3F, 0x78,
40+
0x4C, 0x09, 0x0A, 0x08, 0x16, 0x1A, 0x0F
41+
])
4542
self.set_params(_PGC, param_mv[:15])
4643

47-
param_buf[:15] = bytearray(
48-
[
49-
0x00, 0x16, 0x19, 0x03, 0x0F,
50-
0x05, 0x32, 0x45, 0x46, 0x04,
51-
0x0E, 0x0D, 0x35, 0x37, 0x0F
52-
]
53-
)
44+
param_buf[:15] = bytearray([
45+
0x00, 0x16, 0x19, 0x03, 0x0F, 0x05, 0x32, 0x45,
46+
0x46, 0x04, 0x0E, 0x0D, 0x35, 0x37, 0x0F
47+
])
5448
self.set_params(_NGC, param_mv[:15])
5549

56-
param_buf[0] = 0x17
57-
param_buf[1] = 0x15
50+
param_buf[:2] = bytearray([0x17, 0x15])
5851
self.set_params(_PWR1, param_mv[:2])
5952

6053
param_buf[0] = 0x41
6154
self.set_params(_PWR2, param_mv[:1])
6255

63-
param_buf[0] = 0x00
64-
param_buf[1] = 0x12
65-
param_buf[3] = 0x80
56+
param_buf[:3] = bytearray([0x00, 0x12, 0x80])
6657
self.set_params(_VCMPCTL, param_mv[:3])
6758

6859
param_buf[0] = (
@@ -110,19 +101,13 @@ def init(self):
110101
param_buf[0] = 0x02
111102
self.set_params(_DIC, param_mv[:1])
112103

113-
param_buf[0] = 0x02
114-
param_buf[1] = 0x02
115-
param_buf[2] = 0x3B
104+
param_buf[:3] = bytearray([0x02, 0x02, 0x3B])
116105
self.set_params(_DFC, param_mv[:3])
117106

118107
param_buf[0] = 0xC6
119108
self.set_params(_EM, param_mv[:1])
120109

121-
param_buf[:4] = bytearray(
122-
[
123-
0xA9, 0x51, 0x2C, 0x02
124-
]
125-
)
110+
param_buf[:4] = bytearray([0xA9, 0x51, 0x2C, 0x02])
126111
self.set_params(_AC3, param_mv[:4])
127112

128113
self.set_params(_DISPON)

ext_mod/threading/unix/common/inc/thread_thread.h

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,31 @@
4747
void *thread_entry_cb(mp_obj_thread_thread_t *th);
4848
void thread_attr_func(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
4949

50-
#endif
50+
#endif
51+
52+
pthread_atfork(3),
53+
pthread_attr_init(3),
54+
pthread_cancel(3),
55+
pthread_cleanup_push(3),
56+
pthread_cond_signal(3),
57+
pthread_cond_wait(3),
58+
pthread_create(3),
59+
pthread_detach(3),
60+
pthread_equal(3),
61+
pthread_exit(3),
62+
pthread_key_create(3),
63+
pthread_kill(3),
64+
pthread_mutex_lock(3),
65+
pthread_mutex_unlock(3),
66+
pthread_mutexattr_destroy(3),
67+
pthread_mutexattr_init(3),
68+
pthread_once(3),
69+
pthread_spin_init(3),
70+
pthread_spin_lock(3),
71+
pthread_rwlockattr_setkind_np(3),
72+
pthread_setcancelstate(3),
73+
pthread_setcanceltype(3),
74+
pthread_setspecific(3),
75+
pthread_sigmask(3),
76+
pthread_sigqueue(3),
77+
pthread_testcancel(3)

ext_mod/threading/unix/multiprocessing/src/multiprocessing_process.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
#include "py/obj.h"
33
#include "py/runtime.h"
44

5-
#include "freertos/FreeRTOS.h"
6-
#include "freertos/idf_additions.h"
7-
#include "freertos/task.h"
8-
#include "freertos/semphr.h"
9-
105
#include "thread_common.h"
116
#include "thread_thread.h"
127

@@ -15,6 +10,10 @@
1510

1611
#include <string.h>
1712
#include <pthread.h>
13+
#include <sys/sysinfo.h>
14+
15+
static uint8_t core_nums_used[64];
16+
1817

1918
static mp_obj_t multiprocessing_process_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args)
2019
{
@@ -36,12 +35,32 @@ static mp_obj_t multiprocessing_process_make_new(const mp_obj_type_t *type, size
3635
args
3736
);
3837

39-
uint16_t core_id = (uint16_t)xTaskGetCoreID(xTaskGetCurrentTaskHandle());
40-
int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize,
41-
cpu_set_t *cpuset);
38+
cpu_set_t cpuset;
39+
pthread_t thread = pthread_self();
40+
CPU_ZERO(&cpuset);
41+
42+
for (int j = 0; j < CPU_SETSIZE; j++) {
43+
CPU_SET(j, &cpuset);
44+
}
45+
46+
pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
47+
48+
int core_id = -1;
49+
50+
for (int j = 0; j < CPU_SETSIZE; j++) {
51+
if (CPU_ISSET(j, &cpuset)) {
52+
core_id = j;
53+
break;
54+
}
55+
}
56+
57+
if (core_id == -1) {
58+
// raise error
59+
}
4260

61+
int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize, const cpu_set_t *cpuset);
4362

44-
int16_t new_core_id = -1;
63+
int new_core_id = -1;
4564

4665
for (uint16_t i=0;i<2;i++) {
4766
if (core_id == i) {

micropy_updates/esp32/mpthreadport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
#if MICROPY_PY_THREAD
3737
#include "esp_task.h"
38-
#include "../../../../ext_mod/threading/common/inc/thread_common.h"
38+
#include "../../../../ext_mod/threading/esp32/common/inc/thread_common.h"
3939

4040

4141
#define MP_THREAD_MIN_STACK_SIZE (4 * 1024)

0 commit comments

Comments
 (0)