Initiales Beispiel: LED Task -> LED blink
This commit is contained in:
22
Core/Src/LED.c
Normal file
22
Core/Src/LED.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* LED.c
|
||||
*
|
||||
* Created on: Apr 19, 2024
|
||||
* Author: Carst
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "stm32g0xx_ll_gpio.h"
|
||||
#include "tx_api.h"
|
||||
|
||||
void LED(ULONG thread_input)
|
||||
{
|
||||
(void)thread_input;
|
||||
|
||||
while(true)
|
||||
{
|
||||
tx_thread_sleep(500U);
|
||||
|
||||
LL_GPIO_TogglePin(GPIOA, LL_GPIO_PIN_10);
|
||||
}
|
||||
}
|
@@ -21,7 +21,7 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include "tx_api.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -100,6 +100,7 @@ void SystemClock_Config(void)
|
||||
/* Set APB1 prescaler*/
|
||||
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
|
||||
LL_Init1msTick(64000000);
|
||||
LL_SYSTICK_EnableIT();
|
||||
/* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
|
||||
LL_SetSystemCoreClock(64000000);
|
||||
}
|
||||
@@ -141,7 +142,19 @@ __NO_RETURN int main(void)
|
||||
SystemClock_Config();
|
||||
MX_GPIO_Init();
|
||||
|
||||
tx_kernel_enter();
|
||||
|
||||
__BKPT(0);
|
||||
}
|
||||
|
||||
extern void LED(ULONG thread_input);
|
||||
TX_THREAD tx_LED;
|
||||
ULONG stack_LED[64];
|
||||
|
||||
void tx_application_define(void *first_unused_memory)
|
||||
{
|
||||
(void)first_unused_memory;
|
||||
tx_thread_create(&tx_LED, "LED", LED, 0UL, stack_LED, sizeof(stack_LED), 1U, 1U, TX_NO_TIME_SLICE, TX_AUTO_START);
|
||||
}
|
||||
|
||||
/* USER CODE END 4 */
|
||||
|
@@ -106,33 +106,6 @@ void SVC_Handler(void)
|
||||
/* USER CODE END SVC_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Pendable request for system service.
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN PendSV_IRQn 0 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 0 */
|
||||
/* USER CODE BEGIN PendSV_IRQn 1 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System tick timer.
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SysTick_IRQn 0 */
|
||||
|
||||
/* USER CODE END SysTick_IRQn 0 */
|
||||
|
||||
/* USER CODE BEGIN SysTick_IRQn 1 */
|
||||
|
||||
/* USER CODE END SysTick_IRQn 1 */
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* STM32G0xx Peripheral Interrupt Handlers */
|
||||
/* Add here the Interrupt Handlers for the used peripherals. */
|
||||
|
Reference in New Issue
Block a user