forked from Kreyl/Locket_fw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PinSnsSettings.h
48 lines (38 loc) · 1.13 KB
/
PinSnsSettings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* SnsPins.h
*
* Created on: 17 ÿíâ. 2015 ã.
* Author: Kreyl
*/
/* ================ Documentation =================
* There are several (may be 1) groups of sensors (say, buttons and USB connection).
* There is GPIO and Pin data for every sensor.
*
*/
#pragma once
#include "ch.h"
#include "hal.h"
#include <kl_lib.h>
#include "board.h"
#include "main.h" // App.thd here
#include "evt_mask.h"
#define SIMPLESENSORS_ENABLED FALSE
#define SNS_POLL_PERIOD_MS 72
#if SIMPLESENSORS_ENABLED
enum PinSnsState_t {pssLo, pssHi, pssRising, pssFalling};
typedef void (*ftVoidPSnsStLen)(PinSnsState_t *PState, uint32_t Len);
// Single pin setup data
class PinSns_t : public PinInput_t {
public:
ftVoidPSnsStLen Postprocessor;
PinSns_t(PortPinInput_t APin, ftVoidPSnsStLen pp) : PinInput_t(APin), Postprocessor(pp) {}
};
// ================================= Settings ==================================
// Button handler
extern void ProcessButtons(PinSnsState_t *PState, uint32_t Len);
const PinSns_t PinSns[] = {
// Buttons
{BTN_PIN, ProcessButtons},
};
#define PIN_SNS_CNT countof(PinSns)
#endif // if enabled