mirror of
https://github.com/micropython/micropython.git
synced 2026-01-26 22:00:23 +01:00
stm32/dac: Add support for DAC feature on STM32G0.
DAC.write() and DAC.write_timed() are now available on STM32G0. Tested on NUCLEO_G0B1RE. Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
This commit is contained in:
committed by
Damien George
parent
1b35116c92
commit
152a0782e6
@@ -5,7 +5,7 @@
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (0)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (0)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (0) // can be enabled if USB cable connected to PA11/PA12
|
||||
#define MICROPY_PY_PYB_LEGACY (0)
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ static uint32_t TIMx_Config(mp_obj_t timer) {
|
||||
// work out the trigger channel (only certain ones are supported)
|
||||
if (tim->Instance == TIM2) {
|
||||
return DAC_TRIGGER_T2_TRGO;
|
||||
#if defined(TIM4)
|
||||
#if defined(TIM4) && defined(DAC_TRIGGER_T4_TRGO) // G0B1 doesn't have this
|
||||
} else if (tim->Instance == TIM4) {
|
||||
return DAC_TRIGGER_T4_TRGO;
|
||||
#endif
|
||||
|
||||
@@ -1657,7 +1657,7 @@ static void dma_idle_handler(uint32_t tick) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(STM32F0) || defined(STM32G4) || defined(STM32L0) || defined(STM32L1) || defined(STM32L4)
|
||||
#if defined(STM32F0) || defined(STM32G0) || defined(STM32G4) || defined(STM32L0) || defined(STM32L1) || defined(STM32L4)
|
||||
|
||||
void dma_nohal_init(const dma_descr_t *descr, uint32_t config) {
|
||||
DMA_Channel_TypeDef *dma = descr->instance;
|
||||
@@ -1680,7 +1680,7 @@ void dma_nohal_init(const dma_descr_t *descr, uint32_t config) {
|
||||
} else {
|
||||
__HAL_DMA2_REMAP(descr->sub_instance);
|
||||
}
|
||||
#elif defined(STM32G4)
|
||||
#elif defined(STM32G0) || defined(STM32G4)
|
||||
uint32_t *dmamux_ctrl = (void *)(DMAMUX1_Channel0_BASE + 0x04 * descr->id);
|
||||
*dmamux_ctrl = (*dmamux_ctrl & ~(0x7f)) | descr->sub_instance;
|
||||
#elif defined(STM32L1)
|
||||
@@ -1807,7 +1807,7 @@ void dma_nohal_start(const dma_descr_t *descr, uint32_t src_addr, uint32_t dst_a
|
||||
dma->CCR |= DMA_CCR_EN;
|
||||
}
|
||||
|
||||
#elif defined(STM32G0) || defined(STM32N6) || defined(STM32WB) || defined(STM32WL)
|
||||
#elif defined(STM32N6) || defined(STM32WB) || defined(STM32WL)
|
||||
|
||||
// These functions are currently not implemented or needed for this MCU.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user