-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSensorBase.h
More file actions
66 lines (58 loc) · 2.39 KB
/
SensorBase.h
File metadata and controls
66 lines (58 loc) · 2.39 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#ifndef SENSORBASE_H_
#define SENSORBASE_H_
#include "ChipObject/NiRio.h"
#include "ErrorBase.h"
#include <stdio.h>
#include "Base.h"
/**
* Base class for all sensors.
* Stores most recent status information as well as containing utility functions for checking
* channels and error processing.
*/
class SensorBase: public ErrorBase {
public:
static const UINT32 kSystemClockTicksPerMicrosecond = 40;
SensorBase();
virtual ~SensorBase();
static void SetDefaultAnalogModule(UINT32 slot);
static void SetDefaultDigitalModule(UINT32 slot);
static void SetDefaultSolenoidModule(UINT32 slot);
static void DeleteSingletons();
static UINT32 GetDefaultAnalogModule() { return m_defaultAnalogModule; }
static UINT32 GetDefaultDigitalModule() { return m_defaultDigitalModule; }
static UINT32 GetDefaultSolenoidModule() { return m_defaultSolenoidModule; }
static bool CheckDigitalModule(UINT32 slot);
static bool CheckRelayModule(UINT32 slot);
static bool CheckPWMModule(UINT32 slot);
static bool CheckSolenoidModule(UINT32 slot);
static bool CheckAnalogModule(UINT32 slot);
static bool CheckDigitalChannel(UINT32 channel);
static bool CheckRelayChannel(UINT32 channel);
static bool CheckPWMChannel(UINT32 channel);
static bool CheckAnalogChannel(UINT32 channel);
static bool CheckSolenoidChannel(UINT32 channel);
static const UINT32 kDigitalChannels = 14;
static const UINT32 kAnalogChannels = 8;
static const UINT32 kAnalogModules = 2;
static const UINT32 kDigitalModules = 2;
static const UINT32 kSolenoidChannels = 8;
static const UINT32 kSolenoidModules = 2;
static const UINT32 kPwmChannels = 10;
static const UINT32 kRelayChannels = 8;
static const UINT32 kChassisSlots = 8;
protected:
void AddToSingletonList();
private:
DISALLOW_COPY_AND_ASSIGN(SensorBase);
static UINT32 m_defaultAnalogModule;
static UINT32 m_defaultDigitalModule;
static UINT32 m_defaultSolenoidModule;
static SensorBase *m_singletonList;
SensorBase *m_nextSingleton;
};
#endif