Skip to content

Commit

Permalink
some updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kdschlosser committed Nov 5, 2024
1 parent bdbd98d commit 712b393
Show file tree
Hide file tree
Showing 6 changed files with 489 additions and 38 deletions.
39 changes: 12 additions & 27 deletions api_drivers/common_api_drivers/display/ili9488/_ili9488_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,25 @@ def init(self):
self.set_params(_SLPOUT)
time.sleep_ms(120) # NOQA

param_buf[:15] = bytearray(
[
0x00, 0x03, 0x09, 0x08, 0x16,
0x0A, 0x3F, 0x78, 0x4C, 0x09,
0x0A, 0x08, 0x16, 0x1A, 0x0F
]
)
param_buf[:15] = bytearray([
0x00, 0x03, 0x09, 0x08, 0x16, 0x0A, 0x3F, 0x78,
0x4C, 0x09, 0x0A, 0x08, 0x16, 0x1A, 0x0F
])
self.set_params(_PGC, param_mv[:15])

param_buf[:15] = bytearray(
[
0x00, 0x16, 0x19, 0x03, 0x0F,
0x05, 0x32, 0x45, 0x46, 0x04,
0x0E, 0x0D, 0x35, 0x37, 0x0F
]
)
param_buf[:15] = bytearray([
0x00, 0x16, 0x19, 0x03, 0x0F, 0x05, 0x32, 0x45,
0x46, 0x04, 0x0E, 0x0D, 0x35, 0x37, 0x0F
])
self.set_params(_NGC, param_mv[:15])

param_buf[0] = 0x17
param_buf[1] = 0x15
param_buf[:2] = bytearray([0x17, 0x15])
self.set_params(_PWR1, param_mv[:2])

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

param_buf[0] = 0x00
param_buf[1] = 0x12
param_buf[3] = 0x80
param_buf[:3] = bytearray([0x00, 0x12, 0x80])
self.set_params(_VCMPCTL, param_mv[:3])

param_buf[0] = (
Expand Down Expand Up @@ -110,19 +101,13 @@ def init(self):
param_buf[0] = 0x02
self.set_params(_DIC, param_mv[:1])

param_buf[0] = 0x02
param_buf[1] = 0x02
param_buf[2] = 0x3B
param_buf[:3] = bytearray([0x02, 0x02, 0x3B])
self.set_params(_DFC, param_mv[:3])

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

param_buf[:4] = bytearray(
[
0xA9, 0x51, 0x2C, 0x02
]
)
param_buf[:4] = bytearray([0xA9, 0x51, 0x2C, 0x02])
self.set_params(_AC3, param_mv[:4])

self.set_params(_DISPON)
Expand Down
29 changes: 28 additions & 1 deletion ext_mod/threading/unix/common/inc/thread_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,31 @@
void *thread_entry_cb(mp_obj_thread_thread_t *th);
void thread_attr_func(mp_obj_t self_in, qstr attr, mp_obj_t *dest);

#endif
#endif

pthread_atfork(3),
pthread_attr_init(3),
pthread_cancel(3),
pthread_cleanup_push(3),
pthread_cond_signal(3),
pthread_cond_wait(3),
pthread_create(3),
pthread_detach(3),
pthread_equal(3),
pthread_exit(3),
pthread_key_create(3),
pthread_kill(3),
pthread_mutex_lock(3),
pthread_mutex_unlock(3),
pthread_mutexattr_destroy(3),
pthread_mutexattr_init(3),
pthread_once(3),
pthread_spin_init(3),
pthread_spin_lock(3),
pthread_rwlockattr_setkind_np(3),
pthread_setcancelstate(3),
pthread_setcanceltype(3),
pthread_setspecific(3),
pthread_sigmask(3),
pthread_sigqueue(3),
pthread_testcancel(3)
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
#include "py/obj.h"
#include "py/runtime.h"

#include "freertos/FreeRTOS.h"
#include "freertos/idf_additions.h"
#include "freertos/task.h"
#include "freertos/semphr.h"

#include "thread_common.h"
#include "thread_thread.h"

Expand All @@ -15,6 +10,10 @@

#include <string.h>
#include <pthread.h>
#include <sys/sysinfo.h>

static uint8_t core_nums_used[64];


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)
{
Expand All @@ -36,12 +35,32 @@ static mp_obj_t multiprocessing_process_make_new(const mp_obj_type_t *type, size
args
);

uint16_t core_id = (uint16_t)xTaskGetCoreID(xTaskGetCurrentTaskHandle());
int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize,
cpu_set_t *cpuset);
cpu_set_t cpuset;
pthread_t thread = pthread_self();
CPU_ZERO(&cpuset);

for (int j = 0; j < CPU_SETSIZE; j++) {
CPU_SET(j, &cpuset);
}

pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);

int core_id = -1;

for (int j = 0; j < CPU_SETSIZE; j++) {
if (CPU_ISSET(j, &cpuset)) {
core_id = j;
break;
}
}

if (core_id == -1) {
// raise error
}

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

int16_t new_core_id = -1;
int new_core_id = -1;

for (uint16_t i=0;i<2;i++) {
if (core_id == i) {
Expand Down
2 changes: 1 addition & 1 deletion micropy_updates/esp32/mpthreadport.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#if MICROPY_PY_THREAD
#include "esp_task.h"
#include "../../../../ext_mod/threading/common/inc/thread_common.h"
#include "../../../../ext_mod/threading/esp32/common/inc/thread_common.h"


#define MP_THREAD_MIN_STACK_SIZE (4 * 1024)
Expand Down
Loading

0 comments on commit 712b393

Please sign in to comment.