Skip to content

Conversation

@CarlosHeredia597
Copy link

No description provided.

@CarlosHeredia597
Copy link
Author

pene

@JorgePerC
Copy link
Contributor

Intenta compilar, eso te va generar un par de errores

#define HEADLIGHT_PIN GPIO_PIN_0
#define MOTOR_PWM_PIN GPIO_PIN_1

void pwm_init() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Está padre que se haga con registros directo... Pero recuerda que por cuestiones de modularidad, usamos los tim handlers del STM32

Ocupa esos, jeje

TIM2->CR1 |= TIM_CR1_CEN;
}

void set_motor_speed(uint8_t duty_cycle) { TIM2->CCR2 = duty_cycle; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Esto también debería de ser a través del handler

gpio_init();
pwm_init();

osThreadDef(THREAD_1, motor_control_task, osPriorityNormal, 0, configMINIMAL_STACK_SIZE);
Copy link
Contributor

Choose a reason for hiding this comment

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

Esto está bien, sólo faltaría condicionar para que con el semaphore, se prenda y se apaque 👀

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