Skip to content
Snippets Groups Projects
Commit db4b0645 authored by moon2's avatar moon2 :speech_balloon: Committed by q3k
Browse files

scope is alive again!

parent 1e394891
No related branches found
No related tags found
No related merge requests found
......@@ -9,13 +9,11 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
//#include <audio.h>
#include "scope.h"
#include "esp_system.h"
uint16_t *pixels;
#include "decode_image.h"
typedef struct leds_cfg {
bool active_paddles[10];
......@@ -27,20 +25,7 @@ static void display_task(TimerHandle_t aaaaa);
static void _display_init() {
GC9A01_Init();
#if 0
uint16_t Color;
for(;;)
{
Color=rand();
GC9A01_FillRect(0,0,239,239,Color);
GC9A01_Update();
vTaskDelay(1000/portTICK_PERIOD_MS);
}
#endif
//decode_image(&pixels);
GC9A01_Screen_Load(0,0,240,240,pixels);
// GC9A01_Screen_Load(0,0,240,240,pixels);
GC9A01_Update();
/*
......@@ -48,74 +33,39 @@ static void _display_init() {
TaskHandle_t handle;
xTaskCreate(&display_task, "Display", 4096, NULL, configMAX_PRIORITIES - 3, &handle);
*/
TimerHandle_t aa = xTimerCreate("Display", pdMS_TO_TICKS(100), pdTRUE, (void *) 0, *display_task);
if( xTimerStart(aa, 0 ) != pdPASS )
{
}
}
//static void display_task(void* arg) {
static void display_task(TimerHandle_t aaaaa) {
display_cfg_t display_;
// printf("hewo!");
//static const int paddle_pos[10][2] = {{120, 240}, {190, 217}, {234, 157}, {234, 82}, {190, 22}, {120, 0}, {49, 22}, {5, 82}, {5, 157}, {49, 217}};
void display_draw_scope(){
//display_cfg_t display_;
uint16_t line[240];
//while(true) {
/*
printf("waiting...\n");
xQueueReceive(display_queue, &display_, portMAX_DELAY);
printf("go...\n");
bool any_active = false;
for(int i=0; i<10; i++) {
any_active |= display_.active_paddles[i];
}
/*
printf("waiting...\n");
xQueueReceive(display_queue, &display_, portMAX_DELAY);
printf("go...\n");
*/
//uint32_t t0 = esp_log_timestamp();
begin_scope_read();
if(any_active) {
*/
// printf("hewwo!");
if(1) {
uint32_t t0 = esp_log_timestamp();
/*
for(int y=0; y<240; y++) {
for(int x=0; x<240; x++) {
uint16_t Color=0;
for(int i=0; i<10; i++) {
if(display_.active_paddles[i]) {
int x_d = x - paddle_pos[i][0];
int y_d = y - paddle_pos[i][1];
for(int y=0; y<240; y++){
read_line_from_scope(&(line[0]), y);
memcpy(&ScreenBuff[y * 240], line, sizeof(line));
}
end_scope_read();
int dist = (x_d * x_d + y_d * y_d) / 64;
Color += dist;
}
}
line[x] = Color;
}
memcpy(&ScreenBuff[y * 240], line, sizeof(line));
}
*/
begin_scope_read();
for(int y=0; y<240; y++){
read_line_from_scope(&(line[0]), y);
memcpy(&ScreenBuff[y * 240], line, sizeof(line));
}
end_scope_read();
uint32_t td = esp_log_timestamp() - t0;
// printf("it took %lu\n", td);
//uint32_t td = esp_log_timestamp() - t0;
// printf("it took %lu\n", td);
} else {
GC9A01_Screen_Load(0,0,240,240,pixels);
}
GC9A01_Update();
//}
GC9A01_Update();
}
//static void display_task(void* arg) {
static void display_task(TimerHandle_t aaaaa) {
display_draw_scope();
}
void display_init() { _display_init(); }
void display_show(bool active_paddles[10]) {
display_cfg_t display = {0,};
memcpy(display.active_paddles, active_paddles, sizeof(active_paddles[0]) * 10);
xQueueOverwrite(display_queue, &display);
}
......@@ -3,4 +3,4 @@
#include <stdbool.h>
void display_init();
void display_show(bool active_paddles[10]);
void display_draw_scope();
......@@ -48,20 +48,23 @@ void os_app_main(void)
ESP_ERROR_CHECK(i2c_master_init());
ESP_LOGI(TAG, "I2C initialized successfully");
vTaskDelay(1000 / portTICK_PERIOD_MS);
set_global_vol_dB(0);
set_global_vol_dB(-90);
audio_init();
leds_init();
//display_init();
captouch_init();
vTaskDelay(2000 / portTICK_PERIOD_MS);
//set_global_vol_dB(0);
mp_hal_stdout_tx_str("task inits done\n\r");
display_init();
mp_hal_stdout_tx_str("display init done\n\r");
while(1) {
manual_captouch_readout(1);
vTaskDelay((CAPTOUCH_POLLING_PERIOD) / portTICK_PERIOD_MS);
manual_captouch_readout(0);
vTaskDelay((CAPTOUCH_POLLING_PERIOD) / portTICK_PERIOD_MS);
//display_draw_scope();
}
ESP_ERROR_CHECK(i2c_driver_delete(I2C_MASTER_NUM));
......
......@@ -18,4 +18,60 @@ CONFIG_GC9A01_BUFFER_MODE=y
# end of GC9A01 LCD Config
#
CONFIG_SOC_SPI_PERIPH_NUM=3
CONFIG_SOC_SPI_MAX_CS_NUM=6
CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64
CONFIG_SOC_SPI_SUPPORT_DDRCLK=y
CONFIG_SOC_SPI_SLAVE_SUPPORT_SEG_TRANS=y
CONFIG_SOC_SPI_SUPPORT_CD_SIG=y
CONFIG_SOC_SPI_SUPPORT_CONTINUOUS_TRANS=y
CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2=y
CONFIG_SOC_SPI_PERIPH_SUPPORT_CONTROL_DUMMY_OUT=y
CONFIG_SOC_MEMSPI_IS_INDEPENDENT=y
CONFIG_SOC_SPI_MAX_PRE_DIVIDER=16
CONFIG_SOC_SPI_SUPPORT_OCT=y
CONFIG_SOC_MEMSPI_SRC_FREQ_120M=y
CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y
CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y
CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y
CONFIG_SOC_SPIRAM_SUPPORTED=y
CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE=y
CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND=y
CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_RESUME=y
CONFIG_SOC_SPI_MEM_SUPPORT_SW_SUSPEND=y
CONFIG_SOC_SPI_MEM_SUPPORT_OPI_MODE=y
CONFIG_SOC_SPI_MEM_SUPPORT_TIME_TUNING=y
CONFIG_SOC_SPI_MEM_SUPPORT_CONFIG_GPIO_BY_EFUSE=y
# CONFIG_SPI_MASTER_IN_IRAM is not set
CONFIG_SPI_MASTER_ISR_IN_IRAM=y
# CONFIG_SPI_SLAVE_IN_IRAM is not set
CONFIG_SPI_SLAVE_ISR_IN_IRAM=y
# end of SPI Configuration
CONFIG_SOC_LEDC_SUPPORT_APB_CLOCK=y
CONFIG_SOC_LEDC_SUPPORT_XTAL_CLOCK=y
CONFIG_SOC_LEDC_CHANNEL_NUM=8
CONFIG_SOC_LEDC_TIMER_BIT_WIDE_NUM=14
CONFIG_SOC_LEDC_SUPPORT_FADE_STOP=y
CONFIG_SOC_GPIO_PORT=1
CONFIG_SOC_GPIO_PIN_COUNT=49
CONFIG_SOC_GPIO_SUPPORT_RTC_INDEPENDENT=y
CONFIG_SOC_GPIO_SUPPORT_FORCE_HOLD=y
CONFIG_SOC_GPIO_VALID_GPIO_MASK=0x1FFFFFFFFFFFF
CONFIG_SOC_GPIO_SUPPORT_SLP_SWITCH=y
CONFIG_SOC_MCPWM_GROUPS=2
CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3
CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3
CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2
CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2
CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2
CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3
CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y
CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3
CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3
CONFIG_SOC_MCPWM_SWSYNC_CAN_PROPAGATE=y
......@@ -236,11 +236,11 @@ void boardctrl_startup(void) {
void app_main(void) {
// Hook for a board to run code at start up.
// This defaults to initialising NVS.
MICROPY_BOARD_STARTUP();
// Create and transfer control to the MicroPython task.
//xTaskCreatePinnedToCore(mp_task, "mp_task", MP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, MP_TASK_PRIORITY, &mp_main_task_handle, MP_TASK_COREID);
xTaskCreate(mp_task, "mp_task", (MP_TASK_STACK_SIZE / sizeof(StackType_t)) / 2, NULL, configMAX_PRIORITIES-3, &mp_main_task_handle);
xTaskCreatePinnedToCore(mp_task, "mp_task", (MP_TASK_STACK_SIZE / sizeof(StackType_t)) / 2, NULL, MP_TASK_PRIORITY, &mp_main_task_handle, MP_TASK_COREID);
os_app_main(); // ./badge23/ entry point
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment