67 lines
2.1 KiB
C
67 lines
2.1 KiB
C
// intellectual property is bullshit bgdc
|
|
|
|
#ifndef TIMDAC_CONFIG_H
|
|
#define TIMDAC_CONFIG_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <inttypes.h>
|
|
|
|
#define TIMDAC_N_CHANNELS 4
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// HARDWARE DRIVER CONFIGURATION - These may differ between hardware drivers,
|
|
// check the documentation in yours.
|
|
|
|
// CH32V103 timer, must be a general-purpose timer
|
|
#define TIMDAC_HW_TIMER TIM3
|
|
|
|
// CH32V103 output compare channel
|
|
#define TIMDAC_HW_TIMER_CHANNEL 1
|
|
|
|
// CH32V103 timer interrupt. Optional, if you don't define this you must poll.
|
|
#define TIMDAC_HW_TIMER_IRQn TIM3_IRQn
|
|
// CH32V103 timer interrupt preemption priority
|
|
#define TIMDAC_HW_TIMER_IRQPRIO 3
|
|
// CH32V103 timer interrupt subpriority
|
|
#define TIMDAC_HW_TIMER_IRQSUBPRIO 3
|
|
|
|
// CH32V103 GPIO and pin: timer output compare
|
|
// You are responsible for making sure this and TIMDAC_HW_TIMER_CHANNEL match
|
|
// up, and also for applying any GPIO_PinRemapConfig() and clock startup as
|
|
// necessary prior to initializing timdac.
|
|
#define TIMDAC_HW_GPIO_TIMER GPIOC, GPIO_Pin_6
|
|
|
|
// CH32V103 GPIO and pin: mux inhibit
|
|
#define TIMDAC_HW_GPIO_MUXINHIBIT GPIOC, GPIO_Pin_3
|
|
|
|
// CH32V103 GPIO and pin: integrator discharge
|
|
#define TIMDAC_HW_GPIO_DISCHARGE GPIOC, GPIO_Pin_5
|
|
|
|
// CH32V103 GPIO and pin: polarity
|
|
// OPTIONAL, do not define if polarity switch is not implemented
|
|
#define TIMDAC_HW_GPIO_POLARITY GPIOC, GPIO_Pin_4
|
|
|
|
// CH32V103 GPIO and pin: tuning comparator
|
|
#define TIMDAC_HW_GPIO_TUNE GPIOC, GPIO_Pin_7
|
|
|
|
// CH32V103 tuning comparator polarity, true = noninverting
|
|
#define TIMDAC_HW_GPIO_TUNE_POL false
|
|
|
|
// CH32V103 GPIO: channel select. All channel select pins must be on the same
|
|
// port
|
|
#define TIMDAC_HW_GPIO_CHAN_PORT GPIOC
|
|
|
|
// CH32V103 pins: channel select. Start from the LSB, omit or zero unused
|
|
// bits. Up to 8 bits.
|
|
#define TIMDAC_HW_GPIO_CHAN_PINS GPIO_Pin_0, GPIO_Pin_1, GPIO_Pin_2
|
|
|
|
#define TIMDAC_TIMERFREQ_HZ 72000000
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// TIMDAC CONFIGURATION
|
|
|
|
#include "timdac_config_ref1p0.h"
|
|
|
|
#endif // !defined(TIMDAC_CONFIG_H)
|