Added missing DAC startup and removed superfluous SysTick_Handler. PSDR.hex compiles
This commit is contained in:
parent
0de5e32b0e
commit
75f5ef8e07
|
@ -299,16 +299,6 @@ void doNothing()
|
|||
cap++;
|
||||
}
|
||||
|
||||
void
|
||||
SysTick_Handler (void)
|
||||
{
|
||||
millis++;
|
||||
timer_tick ();
|
||||
Tick();
|
||||
HAL_IncTick();
|
||||
if(timingDelay > 0) timingDelay--;
|
||||
}
|
||||
|
||||
int clickMultiply;
|
||||
int Max;
|
||||
int Min;
|
||||
|
@ -1741,6 +1731,102 @@ void drawNumberSmall(char c, uint16_t x, uint16_t y, uint16_t tintMask)
|
|||
Adafruit_GFX_fillRect(x, y, 8, 9, ILI9340_BLACK);
|
||||
}
|
||||
}
|
||||
/* Definition for DACx clock resources */
|
||||
#define DACx DAC
|
||||
#define DACx_CLK_ENABLE() __DAC_CLK_ENABLE()
|
||||
#define DACx_CHANNEL_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
|
||||
|
||||
#define DACx_FORCE_RESET() __DAC_FORCE_RESET()
|
||||
#define DACx_RELEASE_RESET() __DAC_RELEASE_RESET()
|
||||
|
||||
/* Definition for ADCx Channel Pin */
|
||||
#define DACx_CHANNEL_PIN GPIO_PIN_4
|
||||
#define DACx_CHANNEL_GPIO_PORT GPIOA
|
||||
|
||||
/* Definition for ADCx's Channel */
|
||||
#define DACx_CHANNEL DAC_CHANNEL_1
|
||||
|
||||
DAC_HandleTypeDef DacHandle;
|
||||
static DAC_ChannelConfTypeDef dacSConfig;
|
||||
|
||||
void initDac1()
|
||||
{
|
||||
DACx_CLK_ENABLE();
|
||||
|
||||
|
||||
/*##-1- Configure the DAC peripheral #######################################*/
|
||||
DacHandle.Instance = DACx;
|
||||
|
||||
if(HAL_DAC_Init(&DacHandle) != HAL_OK)
|
||||
{
|
||||
/* Initiliazation Error */
|
||||
// Error_Handler();
|
||||
doNothing();
|
||||
}
|
||||
|
||||
/*##-2- Configure DAC channel1 #############################################*/
|
||||
dacSConfig.DAC_Trigger = DAC_TRIGGER_NONE;
|
||||
dacSConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
|
||||
|
||||
if(HAL_DAC_ConfigChannel(&DacHandle, &dacSConfig, DAC_CHANNEL_1) != HAL_OK)
|
||||
{
|
||||
/* Channel configuration Error */
|
||||
// Error_Handler();
|
||||
doNothing();
|
||||
}
|
||||
|
||||
|
||||
if(HAL_DAC_ConfigChannel(&DacHandle, &dacSConfig, DAC_CHANNEL_2) != HAL_OK)
|
||||
{
|
||||
/* Channel configuration Error */
|
||||
// Error_Handler();
|
||||
doNothing();
|
||||
}
|
||||
|
||||
/*##-3- Set DAC Channel1 DHR register ######################################*/
|
||||
if(HAL_DAC_SetValue(&DacHandle, DAC_CHANNEL_1, DAC_ALIGN_12B_R/*DAC_ALIGN_8B_R*/, 0x88) != HAL_OK)
|
||||
{
|
||||
/* Setting value Error */
|
||||
// Error_Handler();
|
||||
doNothing();
|
||||
}
|
||||
|
||||
/*##-3- Set DAC Channel1 DHR register ######################################*/
|
||||
if(HAL_DAC_SetValue(&DacHandle, DAC_CHANNEL_2, DAC_ALIGN_12B_R/*DAC_ALIGN_8B_R*/, 0x88) != HAL_OK)
|
||||
{
|
||||
/* Setting value Error */
|
||||
// Error_Handler();
|
||||
doNothing();
|
||||
}
|
||||
|
||||
/*##-4- Enable DAC Channel1 ################################################*/
|
||||
if(HAL_DAC_Start(&DacHandle, DAC_CHANNEL_1) != HAL_OK)
|
||||
{
|
||||
/* Start Error */
|
||||
// Error_Handler();
|
||||
doNothing();
|
||||
}
|
||||
|
||||
/*##-4- Enable DAC Channel1 ################################################*/
|
||||
if(HAL_DAC_Start(&DacHandle, DAC_CHANNEL_2) != HAL_OK)
|
||||
{
|
||||
/* Start Error */
|
||||
// Error_Handler();
|
||||
doNothing();
|
||||
}
|
||||
}
|
||||
|
||||
void dac1SetValue(uint16_t value)
|
||||
{
|
||||
value = value & 0b0000111111111111;
|
||||
HAL_DAC_SetValue(&DacHandle, DAC_CHANNEL_1, DAC_ALIGN_12B_R, value);
|
||||
}
|
||||
|
||||
void dac2SetValue(uint16_t value)
|
||||
{
|
||||
value = value & 0b0000111111111111;
|
||||
HAL_DAC_SetValue(&DacHandle, DAC_CHANNEL_2, DAC_ALIGN_12B_R, value);
|
||||
}
|
||||
|
||||
static void CPU_CACHE_Enable(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue