добавил второй проект для C8T6
This commit is contained in:
67
john103C6T6/Core/Src/dma.c
Normal file
67
john103C6T6/Core/Src/dma.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file dma.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of all the requested memory to memory DMA transfers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "dma.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Configure DMA */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
DMA_HandleTypeDef hdma_memtomem_dma1_channel1;
|
||||
|
||||
/**
|
||||
* Enable DMA controller clock
|
||||
* Configure DMA for memory to memory transfers
|
||||
* hdma_memtomem_dma1_channel1
|
||||
*/
|
||||
void MX_DMA_Init(void)
|
||||
{
|
||||
|
||||
/* DMA controller clock enable */
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
|
||||
/* Configure DMA request hdma_memtomem_dma1_channel1 on DMA1_Channel1 */
|
||||
hdma_memtomem_dma1_channel1.Instance = DMA1_Channel1;
|
||||
hdma_memtomem_dma1_channel1.Init.Direction = DMA_MEMORY_TO_MEMORY;
|
||||
hdma_memtomem_dma1_channel1.Init.PeriphInc = DMA_PINC_ENABLE;
|
||||
hdma_memtomem_dma1_channel1.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_memtomem_dma1_channel1.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_memtomem_dma1_channel1.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_memtomem_dma1_channel1.Init.Mode = DMA_NORMAL;
|
||||
hdma_memtomem_dma1_channel1.Init.Priority = DMA_PRIORITY_LOW;
|
||||
if (HAL_DMA_Init(&hdma_memtomem_dma1_channel1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
@@ -159,11 +159,11 @@ int main(void)
|
||||
|
||||
MB_DATA.InRegs.num_Tsens = hdallas.onewire->RomCnt;
|
||||
// BufferState_t buffer_state = buffer_init();
|
||||
for(int i=0;i<RECORD_SIZE;i++)
|
||||
{
|
||||
flash_buff[i]=i;
|
||||
|
||||
}
|
||||
for(int i=0;i<RECORD_SIZE;i++)
|
||||
{
|
||||
flash_buff[i]=i;
|
||||
|
||||
}
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
@@ -433,8 +433,8 @@ FuncStat value_control(void )
|
||||
|
||||
{
|
||||
|
||||
MB_DATA.Coils.coils[0].all |= 1 << i;
|
||||
MB_DATA.Coils.coils[1].all &= ~(1 << i);
|
||||
MB_DATA.Coils.relay_struct_off.all |= 1 << i;
|
||||
MB_DATA.Coils.relay_struct_on.all &= ~(1 << i);
|
||||
|
||||
|
||||
}
|
||||
@@ -444,11 +444,19 @@ FuncStat value_control(void )
|
||||
if (sens[i].temperature > sens[i].set_temp + sens[i].hyst)
|
||||
{
|
||||
|
||||
MB_DATA.Coils.coils[0].all &= ~(1 << i);
|
||||
MB_DATA.Coils.coils[1].all |= 1 << i;
|
||||
MB_DATA.Coils.relay_struct_off.all &= ~(1 << i);
|
||||
MB_DATA.Coils.relay_struct_on.all |= 1 << i;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
if (sens[i].temperature == sens[i].set_temp )
|
||||
{
|
||||
MB_DATA.Coils.relay_struct_on.all &= ~(1 << i);
|
||||
MB_DATA.Coils.relay_struct_off.all &= ~(1 << i);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user