andysworkshop / stm32plus

The C++ library for the STM32 F0, F100, F103, F107 and F4 microcontrollers
http://www.andybrown.me.uk
Other
745 stars 224 forks source link

C++ syntax question #159

Closed dholth closed 8 years ago

dholth commented 8 years ago

At https://github.com/andysworkshop/stm32plus/blob/master/lib/include/dma/features/f0/DacDmaWriterFeature.h#L20 it says "If the setup of the initialisation structure is not to your needs then it can be customised before the transfers are started by casting this class to |DMA_InitTypeDef|". What's the syntax for doing this? C-style cast or static_cast of the templated class didn't seem to work.

Second question, Is Eclipse fairly useless at autocomplete for template classes or is mine just configured incorrectly?

Thanks.

andysworkshop commented 8 years ago

Is this what you're looking for (F0 example)?

  Dac1<DacChannel112BitRightAlignmentFeature> dac;
  Dac1UpdateDmaChannel<DacDmaWriterFeature<DacChannel112BitRightAlignmentFeature>> dma;

  static_cast<DMA_InitTypeDef&>(dma).DMA_Mode=DMA_Mode_Circular;

Is Eclipse fairly useless at autocomplete for template classes or is mine just configured incorrectly

It's not great. It'll find the template names for me but it won't list the parameters.

dholth commented 8 years ago

I did get dma circular to dac to play an .au file or a sine wave. I'll probably submit an example. On Feb 6, 2016 06:13, Andy Brown notifications@github.com wrote:Is this what you're looking for (F0 example)?

Dac1 dac; Dac1UpdateDmaChannel<DacDmaWriterFeature> dma;

static_cast<DMA_InitTypeDef&>(dma).DMA_Mode=DMA_Mode_Circular;

Is Eclipse fairly useless at autocomplete for template classes or is mine just configured incorrectly

It's not great. It'll find the template names for me but it won't list the parameters.

—Reply to this email directly or view it on GitHub.

dholth commented 8 years ago

Thank you