no instance of constructor matches the argument list ARM STM32

OP #2569917
Lesenswert?

Hallo,

Ich habe die Aufgabe, mit der Standard Periphery Bibkiothek eine Classe 
für den ADC des STM32 zu schreiben. Habe bisher noch keine große Kunst 
betrieben, um überhaupt mal mit dem Handwerklichen klar zu kommen.
Dabei wird kein Objekt angelegt.

Die Headerdatei:
1
#ifndef _ADC_CL_
2
#define _ADC_CL_ 1
3

4

5
#include "stm32f10x_adc.h"
6

7

8
 /**
9
 * I2S class
10
 */
11
class ADCClass
12
{
13
public:
14
    ADCClass();
15
    void Init(  uint32_t ADC_Mode,
16
        FunctionalState ADC_ScanConvMode,
17
          FunctionalState ADC_ContinuousConvMode,
18
          uint32_t ADC_ExternalTrigConv,
19
          uint32_t ADC_DataAlign,
20
          uint8_t ADC_NbrOfChannel);
21

22
  void ADC_Reg_Chnl(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
23

24
  void ADC_dis_enable(ADC_TypeDef* ADCx, FunctionalState NewState);
25

26
  unsigned short GetValue(ADC_TypeDef* ADCx);
27

28
  void ADC_SoftwareStart(ADC_TypeDef* ADCx, FunctionalState NewState);
29

30

31
protected:
32

33
  void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct);
34
};
35
#endif //_I2S_CL_


Die Source Datei:
1
#include "ADC.h"
2
#include "GpioPin.h"
3
       
4
  ADCClass::ADCClass()
5
  {
6
  }   
7

8
  void ADCClass::Init(  uint32_t ADC_Mode,
9
              FunctionalState ADC_ScanConvMode,
10
                FunctionalState ADC_ContinuousConvMode,
11
                uint32_t ADC_ExternalTrigConv,
12
                uint32_t ADC_DataAlign,
13
                uint8_t ADC_NbrOfChannel)
14
    {
15
    void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct);
16
  }
17

18
  void ADCClass::ADC_Reg_Chnl(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
19
  {
20
    void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
21
  }
22

23
  void ADCClass::ADC_dis_enable(ADC_TypeDef* ADCx, FunctionalState NewState)
24
  {
25
    void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState);
26
  }
27

28
  unsigned short GetValue(ADC_TypeDef* ADCx)
29
  {      
30
    unsigned short ADC_Value;
31
    ADC_Value = ADC1->DR & 0x0FFF;
32
    return ADC_Value;
33
  }
34

35
  void ADC_SoftwareStart(ADC_TypeDef* ADCx, FunctionalState NewState)
36
  {
37
    ADC_SoftwareStartConvCmd(ADC1, ENABLE);
38
  }


Instanziierung :
1
ADCClass ADC1;

vielen Dank, Jasson
Gast #2569986
Lesenswert?

Als erstes weniger auf copy and paste im Quellcode verlassen!
oder C++ Lehrbuch zur Hand nehmen.

Bei Dir müsste es sinngemäß den erstmal den Fehler geben:
"Lokale Funktionsdeklarationen sind nicht erlaubt"

> "no instance of constructor matches the argument list"?
Du bekommst Du bestimmt eine
Zeilennummer und Bezeichner mitgeliefert.

Ist FunctionalState eine Klasse ohne Standard-ctor?

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren