Im Interrupt Systick Handler habe ich eine Variable debounceCounterLOCK
1 | void SysTick_Handler(void)
|
2 | {
|
3 |
|
4 | if(DiffAcValue.KEY1 > SWITCHING_THRESHOLD_LOCK_PRESSED)
|
5 | {
|
6 | debounceCounterLOCK++;
|
7 | }
|
8 | }
|
Die Variable habe ich in einem c-file definiert:
volatile uint16_t debounceCounterLOCK = 0;
In einer Funktion im main mache ich Folgendes:
1 | void handleTouchkeys(void)
|
2 | {
|
3 |
|
4 | if((DiffAcValue.KEY1 <= SWITCHING_THRESHOLD_LOCK_UNPRESSED) & LockButtonPressed)
|
5 | {
|
6 | lockButtonPressed = false;
|
7 | }
|
8 |
|
9 | if(debounce(DiffAcValue.KEY1, MAXVALUE_DEBOUNCECOUNTER, SWITCHING_THRESHOLD_LOCK_PRESSED, &debounceCounterLOCK) & !lockButtonPressed)
|
10 | {
|
11 | lockButtonPressed = true;
|
12 | }
|
Der Funktionsprototyp sieht folgendermassen aus:
bool debounce(uint16_t sensorValue, uint16_t maxDebounceCounter,
uint16_t switchingThreshold, uint16_t *debounceCounter);
Ich bekomme nun den Fehler:
../Src/main.c(165): warning: #167-D: argument of type "volatile
uint16_t *" is incompatible with parameter of type "uint16_t *"
Was ist das Problem? Ich verstehe nicht was hier gemeint ist.
Warum kann ich eine volatile Variable nicht per Pointer übergeben?