Skip to content

Conversation

@DiegoLizarraga
Copy link

parece que ya, digame si ya le sale

…ariables que mande a llamar para el c. tambien puse lo que me indico anita sobre los datos que recibimos de IMU, tambien en el .h puse para conseguir los datos de los sensores que se leen en spi. tambien ingrese las cosas del semaforo adaptado a freertos cmsis v2. en general puse todas las variables ultilizable con los metodos. asi que todo joya que dios lo bendiga
…ariables que mande a llamar para el c. tambien puse lo que me indico anita sobre los datos que recibimos de IMU, tambien en el .h puse para conseguir los datos de los sensores que se leen en spi. tambien ingrese las cosas del semaforo adaptado a freertos cmsis v2. en general puse todas las variables ultilizable con los metodos. asi que todo joya que dios lo bendiga
@JorgePerC JorgePerC self-requested a review February 18, 2025 20:24
Copy link
Contributor

@JorgePerC JorgePerC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fue una revisión de contenido. Una vez que el código esté más limpio, ya reviso que haga sentido, jeje



//---------------------------------------------------------------
//la cosa del semaforo que debo implementar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La cosa del semáforo, xdxd
Es un Interruption callback
Callback es una función que se manda a llamar en un momento específico.
Un interruption callback, llama a una función dependiendo de la interrupción que le llega al CPU. Y recuerda, una interrupción es una bandera que detiene lo que está procesando, y le dice que haga otra cosa

Tienes dos, una de Tx - Transmission y Rx - Receive

//Declaracion de funciones de SPI
int16_t INU_ReadResgister16(uinit8_t reg);

void ProcesarDatos(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo esta de procesar datos { /El código de adentro de las llaves/} va en el .c
Lo que va en el .h es la pura declaración

}


int main(void) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hay que quitar este main, y pasar lo que se ocupe al otro main (el de src)

app/src/main.c Outdated

osKernelInitialize();
osThreadNew(Task1, NULL, NULL);
osKernelStart();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta no va, literal está abajo, jeje

app/src/main.c Outdated
//esta parte para mandar a llamar al semaforo que esta guardado
I2C_semaphore = osSemaphoreNew(1, 0, NULL);

osKernelInitialize();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este no va

app/src/main.c Outdated
I2C_semaphore = osSemaphoreNew(1, 0, NULL);

osKernelInitialize();
osThreadNew(Task1, NULL, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisa cómo se cra un task, en la línea 113 está el ejemplo

FYI, estamos ocupando cmsis v1, creo te había dicho del v2, pero me equivoqué. Usamos el Freertos CMSIS V1

Copy link
Contributor

@JorgePerC JorgePerC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisar comentarios @fabianglz993 ayúdale, jeje

MX_SPI1_Init(); // lo copie directo spi.c esta declarado como una funcion ahi pero dice que no esta definida

MX_SPI1_Init();
osKernelInitialize();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este no va, xd

// Start the RTOS kernel
osKernelStart();
// Crear la tarea para procesar los datos del IMU
osThreadDef(Task_ProcessIMUData, Task_ProcessIMUData, osPriorityNormal, 0, 128);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esto va antes de los
osThreadCreate

osKernelStart();
// Crear la tarea para procesar los datos del IMU
osThreadDef(Task_ProcessIMUData, Task_ProcessIMUData, osPriorityNormal, 0, 128);
osThreadCreate(osThread(Task_ProcessIMUData), NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sí llegué a ver esto en la doc, pero no me jalaba...
Por eso la sintaxis de tid_task1 = osThreadCreate(osThread(TASK1_ID), NULL);

osSemaphoreId semaphore; // Semaphore ID
osSemaphoreDef(semaphore); // Semaphore definition

void thread1(void const* argument) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esto qué hace? xd

// proceso de empaquetados de datos con los datos del acelerometro y giroscopio que recibimos
// creacion strucct
typedef struct {
float vel_x, vel_y, vel_z; // velocidad variables
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Al final, checaste si estaba bien esta sintaxis? nunca la había visto, jeje

}

// funcion para inicializar el SPI
void ProcesarDatos(void) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excelente, así va

}
void Task_ProcessIMUData(void const* argument) {
while (1) {
// Esperar a recibir un mensaje de la cola
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A tí no te toca leer de ninguna cola, jeje

}

// Convertir los datos en valores float
float* x1 = (float*)&buffer[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sé si esto haga la conversión bien... (entre float e uint)

void SPI_WriteSensor(SPI_HandleTypeDef* hspi, uint8_t* data, uint16_t len); // Escribir datos SPI

// Declaracion de funciones de SPI
int16_t INU_ReadResgister16(uint8_t reg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Está nunca está definida!
Se me hace que debería de hacer lo que hace readData, pero con un registro a la vez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants