fin practica 2
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="647843719379509656" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-696352624643696132" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
@@ -16,7 +16,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="647843719379509656" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-696352624643696132" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
||||
@@ -21,11 +21,8 @@ typedef struct
|
||||
} LED_Config;
|
||||
|
||||
void CreateLedTask();
|
||||
void LedToggleTask(void* pArgs);
|
||||
|
||||
void LedAnimationTask(void* pArgs);
|
||||
void ButtonTask(void* pArgs);
|
||||
void LedAnimationTask1(void* pArgs);
|
||||
void LedAnimationTask2(void* pArgs);
|
||||
void LedAnimationTask3(void* pArgs);
|
||||
|
||||
#endif /* INC_LED_TASK_H_ */
|
||||
|
||||
@@ -7,51 +7,27 @@
|
||||
|
||||
#include "led_task.h"
|
||||
|
||||
TaskHandle_t hButtonTask;
|
||||
TaskHandle_t tH[3];
|
||||
|
||||
void CreateLedTask()
|
||||
{
|
||||
/* EJERCICIOS 1/2/3
|
||||
LED_Config* cfg = pvPortMalloc(sizeof(LED_Config));
|
||||
|
||||
if (cfg != NULL)
|
||||
{
|
||||
cfg->led = 0;
|
||||
cfg->delay = 200;
|
||||
}
|
||||
|
||||
xTaskCreate(
|
||||
LedToggleTask,
|
||||
"LedToggleTask_1",
|
||||
128,
|
||||
(void*) cfg,
|
||||
1,
|
||||
NULL
|
||||
);
|
||||
*/
|
||||
|
||||
/* EJERCICIO 4
|
||||
xTaskCreate(
|
||||
LedAnimationTask,
|
||||
"LedAnimationTask",
|
||||
ButtonTask,
|
||||
"ButtonTask",
|
||||
128,
|
||||
NULL,
|
||||
1,
|
||||
NULL
|
||||
&hButtonTask
|
||||
);
|
||||
*/
|
||||
|
||||
/* EJERCICIO 5
|
||||
* - con la misma prioridad alternan continuamente entre ellas y son animaciones
|
||||
* sin sentido
|
||||
* - con prioridades distintas, visualmente y con un delay un poco más alto
|
||||
* podría parecer que se hacen una detrás de otra (en orden de prioridad)
|
||||
*/
|
||||
xTaskCreate(
|
||||
LedAnimationTask1,
|
||||
"LedAnimationTask1",
|
||||
128,
|
||||
NULL,
|
||||
1,
|
||||
NULL
|
||||
&tH[0]
|
||||
);
|
||||
|
||||
xTaskCreate(
|
||||
@@ -59,67 +35,28 @@ void CreateLedTask()
|
||||
"LedAnimationTask2",
|
||||
128,
|
||||
NULL,
|
||||
2,
|
||||
NULL
|
||||
1,
|
||||
&tH[1]
|
||||
);
|
||||
|
||||
xTaskCreate(
|
||||
LedAnimationTask3,
|
||||
"LedAnimationTask3",
|
||||
128,
|
||||
NULL,
|
||||
1,
|
||||
&tH[2]
|
||||
);
|
||||
}
|
||||
|
||||
void LedToggleTask(void* pArgs)
|
||||
{
|
||||
LED_Config* cfg = (LED_Config*) pArgs;
|
||||
uint8_t counter = 5;
|
||||
for(;;)
|
||||
{
|
||||
if(cfg->led > 2)
|
||||
{
|
||||
cfg->led = 0;
|
||||
}
|
||||
|
||||
while (counter > 0)
|
||||
{
|
||||
LED_Toggle(cfg->led);
|
||||
vTaskDelay(cfg->delay);
|
||||
counter--;
|
||||
}
|
||||
|
||||
cfg->led++;
|
||||
|
||||
xTaskCreate(
|
||||
LedToggleTask,
|
||||
"LedToggleTask_New",
|
||||
128,
|
||||
(void*) cfg,
|
||||
1,
|
||||
NULL
|
||||
);
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void LedAnimationTask(void* pArgs)
|
||||
void ButtonTask(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
switch(ReadJoy())
|
||||
{
|
||||
case 0:
|
||||
// stand-by
|
||||
LED_Off(0);
|
||||
LED_Off(1);
|
||||
LED_Off(2);
|
||||
break;
|
||||
case 1:
|
||||
animation1();
|
||||
break;
|
||||
case 2:
|
||||
animation2();
|
||||
break;
|
||||
case 3:
|
||||
animation3();
|
||||
break;
|
||||
}
|
||||
vTaskDelay(50);
|
||||
uint8_t key = ReadJoy();
|
||||
if(key)
|
||||
xTaskNotifyGive(tH[key - 1]);
|
||||
vTaskDelay(100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +64,7 @@ void LedAnimationTask1(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
int i;
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
@@ -147,6 +85,7 @@ void LedAnimationTask2(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
int i, j;
|
||||
for(j = 0; j < 5; j++)
|
||||
{
|
||||
@@ -167,6 +106,7 @@ void LedAnimationTask3(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
int i;
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
@@ -180,3 +120,4 @@ void LedAnimationTask3(void* pArgs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
../Core/Src/led_task.c:10:6:CreateLedTask 1
|
||||
../Core/Src/led_task.c:64:6:LedToggleTask 3
|
||||
../Core/Src/led_task.c:97:6:LedAnimationTask 5
|
||||
../Core/Src/led_task.c:123:6:LedAnimationTask1 3
|
||||
../Core/Src/led_task.c:143:6:LedAnimationTask2 4
|
||||
../Core/Src/led_task.c:163:6:LedAnimationTask3 3
|
||||
../Core/Src/led_task.c:13:6:CreateLedTask 1
|
||||
../Core/Src/led_task.c:52:6:ButtonTask 2
|
||||
../Core/Src/led_task.c:63:6:LedAnimationTask1 3
|
||||
../Core/Src/led_task.c:84:6:LedAnimationTask2 4
|
||||
../Core/Src/led_task.c:105:6:LedAnimationTask3 3
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
../Core/Src/led_task.c:10:6:CreateLedTask 16 static
|
||||
../Core/Src/led_task.c:64:6:LedToggleTask 32 static
|
||||
../Core/Src/led_task.c:97:6:LedAnimationTask 16 static
|
||||
../Core/Src/led_task.c:123:6:LedAnimationTask1 24 static
|
||||
../Core/Src/led_task.c:143:6:LedAnimationTask2 24 static
|
||||
../Core/Src/led_task.c:163:6:LedAnimationTask3 24 static
|
||||
../Core/Src/led_task.c:13:6:CreateLedTask 16 static
|
||||
../Core/Src/led_task.c:52:6:ButtonTask 24 static
|
||||
../Core/Src/led_task.c:63:6:LedAnimationTask1 24 static
|
||||
../Core/Src/led_task.c:84:6:LedAnimationTask2 24 static
|
||||
../Core/Src/led_task.c:105:6:LedAnimationTask3 24 static
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -64,8 +64,8 @@ all: main-build
|
||||
main-build: P2_SETR2.elf secondary-outputs
|
||||
|
||||
# Tool invocations
|
||||
P2_SETR2.elf P2_SETR2.map: $(OBJS) $(USER_OBJS) /home/jomaa/git/setr2-monorepo/P2_SETR2/STM32L475VGTX_FLASH.ld makefile objects.list $(OPTIONAL_TOOL_DEPS)
|
||||
arm-none-eabi-gcc -o "P2_SETR2.elf" @"objects.list" $(USER_OBJS) $(LIBS) -mcpu=cortex-m4 -T"/home/jomaa/git/setr2-monorepo/P2_SETR2/STM32L475VGTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="P2_SETR2.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
|
||||
P2_SETR2.elf P2_SETR2.map: $(OBJS) $(USER_OBJS) /home/jomaa/Projects/git/setr2-monorepo/P2_SETR2/STM32L475VGTX_FLASH.ld makefile objects.list $(OPTIONAL_TOOL_DEPS)
|
||||
arm-none-eabi-gcc -o "P2_SETR2.elf" @"objects.list" $(USER_OBJS) $(LIBS) -mcpu=cortex-m4 -T"/home/jomaa/Projects/git/setr2-monorepo/P2_SETR2/STM32L475VGTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="P2_SETR2.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
|
||||
@echo 'Finished building target: $@'
|
||||
@echo ' '
|
||||
|
||||
|
||||
185
P2_SETR2/ejercicios/parte1.txt
Normal file
185
P2_SETR2/ejercicios/parte1.txt
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* led_task.c
|
||||
*
|
||||
* Created on: Oct 6, 2025
|
||||
* Author: jomaa
|
||||
*/
|
||||
|
||||
#include "led_task.h"
|
||||
|
||||
TaskHandle_t hButtonTask;
|
||||
TaskHandle_t hLedTask;
|
||||
|
||||
void CreateLedTask()
|
||||
{
|
||||
/* EJERCICIOS 1/2/3
|
||||
LED_Config* cfg = pvPortMalloc(sizeof(LED_Config));
|
||||
|
||||
if (cfg != NULL)
|
||||
{
|
||||
cfg->led = 0;
|
||||
cfg->delay = 200;
|
||||
}
|
||||
|
||||
xTaskCreate(
|
||||
LedToggleTask,
|
||||
"LedToggleTask_1",
|
||||
128,
|
||||
(void*) cfg,
|
||||
1,
|
||||
NULL
|
||||
);
|
||||
*/
|
||||
|
||||
/* EJERCICIO 4
|
||||
xTaskCreate(
|
||||
LedAnimationTask,
|
||||
"LedAnimationTask",
|
||||
128,
|
||||
NULL,
|
||||
1,
|
||||
NULL
|
||||
);
|
||||
*/
|
||||
|
||||
/* EJERCICIO 5
|
||||
* - con la misma prioridad alternan continuamente entre ellas y son animaciones
|
||||
* sin sentido
|
||||
* - con prioridades distintas, visualmente y con un delay un poco más alto
|
||||
* podría parecer que se hacen una detrás de otra (en orden de prioridad)
|
||||
|
||||
xTaskCreate(
|
||||
LedAnimationTask1,
|
||||
"LedAnimationTask1",
|
||||
128,
|
||||
NULL,
|
||||
1,
|
||||
NULL
|
||||
);
|
||||
|
||||
xTaskCreate(
|
||||
LedAnimationTask2,
|
||||
"LedAnimationTask2",
|
||||
128,
|
||||
NULL,
|
||||
2,
|
||||
NULL
|
||||
);*/
|
||||
}
|
||||
|
||||
void LedToggleTask(void* pArgs)
|
||||
{
|
||||
LED_Config* cfg = (LED_Config*) pArgs;
|
||||
uint8_t counter = 5;
|
||||
for(;;)
|
||||
{
|
||||
if(cfg->led > 2)
|
||||
{
|
||||
cfg->led = 0;
|
||||
}
|
||||
|
||||
while (counter > 0)
|
||||
{
|
||||
LED_Toggle(cfg->led);
|
||||
vTaskDelay(cfg->delay);
|
||||
counter--;
|
||||
}
|
||||
|
||||
cfg->led++;
|
||||
|
||||
xTaskCreate(
|
||||
LedToggleTask,
|
||||
"LedToggleTask_New",
|
||||
128,
|
||||
(void*) cfg,
|
||||
1,
|
||||
NULL
|
||||
);
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void LedAnimationTask(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
switch(ReadJoy())
|
||||
{
|
||||
case 0:
|
||||
// stand-by
|
||||
LED_Off(0);
|
||||
LED_Off(1);
|
||||
LED_Off(2);
|
||||
break;
|
||||
case 1:
|
||||
animation1();
|
||||
break;
|
||||
case 2:
|
||||
animation2();
|
||||
break;
|
||||
case 3:
|
||||
animation3();
|
||||
break;
|
||||
}
|
||||
vTaskDelay(50);
|
||||
}
|
||||
}
|
||||
|
||||
void LedAnimationTask1(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
LED_On(i);
|
||||
vTaskDelay(150);
|
||||
LED_Off(i);
|
||||
}
|
||||
for(i = 1; i > 0; i--)
|
||||
{
|
||||
LED_On(i);
|
||||
vTaskDelay(150);
|
||||
LED_Off(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LedAnimationTask2(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
int i, j;
|
||||
for(j = 0; j < 5; j++)
|
||||
{
|
||||
for(i = 0; i < 3; i++)
|
||||
LED_On(i);
|
||||
|
||||
vTaskDelay(100);
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
LED_Off(i);
|
||||
|
||||
vTaskDelay(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LedAnimationTask3(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
LED_On(i);
|
||||
vTaskDelay(150);
|
||||
}
|
||||
for(i = 2; i >= 0; i--)
|
||||
{
|
||||
LED_Off(i);
|
||||
vTaskDelay(150);
|
||||
}
|
||||
}
|
||||
}
|
||||
123
P2_SETR2/ejercicios/parte2-notify.txt
Normal file
123
P2_SETR2/ejercicios/parte2-notify.txt
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* led_task.c
|
||||
*
|
||||
* Created on: Oct 6, 2025
|
||||
* Author: jomaa
|
||||
*/
|
||||
|
||||
#include "led_task.h"
|
||||
|
||||
TaskHandle_t hButtonTask;
|
||||
TaskHandle_t tH[3];
|
||||
|
||||
void CreateLedTask()
|
||||
{
|
||||
xTaskCreate(
|
||||
ButtonTask,
|
||||
"ButtonTask",
|
||||
128,
|
||||
NULL,
|
||||
1,
|
||||
&hButtonTask
|
||||
);
|
||||
|
||||
xTaskCreate(
|
||||
LedAnimationTask1,
|
||||
"LedAnimationTask1",
|
||||
128,
|
||||
NULL,
|
||||
1,
|
||||
&tH[0]
|
||||
);
|
||||
|
||||
xTaskCreate(
|
||||
LedAnimationTask2,
|
||||
"LedAnimationTask2",
|
||||
128,
|
||||
NULL,
|
||||
1,
|
||||
&tH[1]
|
||||
);
|
||||
|
||||
xTaskCreate(
|
||||
LedAnimationTask3,
|
||||
"LedAnimationTask3",
|
||||
128,
|
||||
NULL,
|
||||
1,
|
||||
&tH[2]
|
||||
);
|
||||
}
|
||||
|
||||
void ButtonTask(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
uint8_t key = ReadJoy();
|
||||
if(key)
|
||||
xTaskNotifyGive(tH[key - 1]);
|
||||
vTaskDelay(100);
|
||||
}
|
||||
}
|
||||
|
||||
void LedAnimationTask1(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
int i;
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
LED_On(i);
|
||||
vTaskDelay(150);
|
||||
LED_Off(i);
|
||||
}
|
||||
for(i = 1; i > 0; i--)
|
||||
{
|
||||
LED_On(i);
|
||||
vTaskDelay(150);
|
||||
LED_Off(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LedAnimationTask2(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
int i, j;
|
||||
for(j = 0; j < 5; j++)
|
||||
{
|
||||
for(i = 0; i < 3; i++)
|
||||
LED_On(i);
|
||||
|
||||
vTaskDelay(100);
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
LED_Off(i);
|
||||
|
||||
vTaskDelay(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LedAnimationTask3(void* pArgs)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
int i;
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
LED_On(i);
|
||||
vTaskDelay(150);
|
||||
}
|
||||
for(i = 2; i >= 0; i--)
|
||||
{
|
||||
LED_Off(i);
|
||||
vTaskDelay(150);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user