aliexpress sucks

This commit is contained in:
2023-03-12 02:59:17 +01:00
parent 2521cd75c7
commit ddde12e4c3
8 changed files with 51 additions and 11 deletions
+28 -1
View File
@@ -106,6 +106,30 @@ to exclude the API function. */
*/
#define USE_FreeRTOS_HEAP_4
#define FAKE_STM32 1
#if FAKE_STM32
/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 3
#endif
/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 7
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
#else
/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
@@ -124,6 +148,8 @@ INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
#endif
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
@@ -134,7 +160,8 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
/* USER CODE BEGIN 1 */
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
#include <stdio.h>
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); printf("configASSERT "__FILE__":%d\r\n",__LINE__); for( ;; );}
/* USER CODE END 1 */
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
+7 -1
View File
@@ -97,6 +97,7 @@ void app_task_main(void *argument)
bool any_change = true;
uint32_t last_redraw = osKernelGetTickCount();
uint32_t last_blink = xTaskGetTickCount();
for (;;) {
// sampling is done in the heater loop
@@ -144,11 +145,16 @@ void app_task_main(void *argument)
any_change = false;
// Blink
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
}
vTaskDelay(pdMS_TO_TICKS(10));
now = osKernelGetTickCount();
if (now - last_blink > 250) {
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
last_blink = now;
}
// feed dogs
HAL_IWDG_Refresh(&hiwdg);
}
+2
View File
@@ -106,6 +106,7 @@ int main(void)
MX_TIM3_Init();
MX_SPI2_Init();
/* USER CODE BEGIN 2 */
printf("Kernel start\r\n");
/* USER CODE END 2 */
/* Init scheduler */
@@ -224,6 +225,7 @@ void Error_Handler(void)
void assert_failed(uint8_t *file, uint32_t line)
{
/* USER CODE BEGIN 6 */
printf("assert_failed %s:%d\r\n", file, line);
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
+1 -1
View File
@@ -44,7 +44,7 @@ void MX_SPI2_Init(void)
hspi2.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi2.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi2.Init.NSS = SPI_NSS_SOFT;
hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64;
hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi2.Init.TIMode = SPI_TIMODE_DISABLE;
hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;