NetBurner 3.5.6
PDF Version
SOMRT1061/include/pins.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
5#ifndef _NB_PINS_H_
6#define _NB_PINS_H_
7
8#include <pinconstant.h>
9#include <cpu_pins.h>
10
26#define PLAT_PIN_COUNT 92 // 4 pins are tied to *two* cpu pads
27
28class PinIOArray;
29class FastIOArray
30{
31 static const FastIO::def_t cpuPinMap[PLAT_PIN_COUNT];
32public:
33 FastIO operator[] ( int n )
34 {
35 if ((n <= 0) || (n > PLAT_PIN_COUNT))
36 {
37 return FastIO(FastIO::def_t(PinDef_INVALID).port,
38 FastIO::def_t(PinDef_INVALID).idx);
39 }
40
41 return FastIO( cpuPinMap[n-1].port, cpuPinMap[n-1].idx );
42 };
43 FastIO::def_t getDef( int n )
44 {
45 if ((n <= 0) || (n > PLAT_PIN_COUNT))
46 {
47 return FastIO::def_t(PinDef_INVALID);
48 }
49 return cpuPinMap[n-1];
50 };
51 friend class PinIOArray;
52};
53
54class PinIOArray
55{
56public:
57 PinIO operator[] ( int n ) const
58 {
59 if ((n <= 0) || (n > PLAT_PIN_COUNT))
60 {
61 return PinIO(PinIO::def_t(PinDef_INVALID).port,
62 PinIO::def_t(PinDef_INVALID).idx);
63 }
64
65 return PinIO( FastIOArray::cpuPinMap[n-1].port, FastIOArray::cpuPinMap[n-1].idx );
66 };
67 const PinIO::def_t getDef( int n ) const
68 {
69 if ((n <= 0) || (n > PLAT_PIN_COUNT))
70 {
71 return PinIO::def_t(PinDef_INVALID);
72 }
73 return {FastIOArray::cpuPinMap[n-1].port,
74 FastIOArray::cpuPinMap[n-1].idx};
75 };
76};
77
78
79extern const FastIOArray FastPins;
80extern const PinIOArray Pins;
81
82#endif /* _NB_PINS_H_ */
GPIO Pin Class.
Definition coldfire/cpu/MCF5441X/include/cpu_pins.h:15