NetBurner 3.5.6
PDF Version
NANO54415/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
11/*
12 * The following class is created to assist in processor pin configuration and
13 * operation for GPIO and special functions. Each pin is defined by the system
14 * in the `\nburn<Platform>\system` and `\nburn<Platform>\include` directories for
15 * the specific platform you are using.
16 *
17 * Examples:
18 * Pins[32] = 1; Set pin 32 high
19 * Pins[32] = 0; Set pin 32 low
20 * Pins[32].hiz(); Set pin 32 to be a high impedance input
21 * BOOL bpinstate = Pins[32]; Set the pin to be an input and read
22 * if( !Pins[32] )
23 * iprintf( "The pin is low" );
24 */
25//class PinIO
26//{
27// uint8_t pinnum;
28// PinIO(int n) { pinnum = n; };
29//
30// public:
31// void set(BOOL = TRUE); // Set output high
32// void clr() { set(FALSE); }; // Set output low
33// BOOL toggle(); // Set output state to the opposite of current state
34// BOOL read(); // Read hi/low state of input pin
35// BOOL readBack(); // Read pin state without affecting direction
36// void hiz() { read(); }; // Set output to tristate
37// void drive(); // Turn output on (opposite of tristate)
38// void function(int ft); // Set pin to special function
39// int getFunction(); // Get the special function the pin is set to
40// PinIO &operator=(BOOL b)
41// {
42// set(b);
43// return *this;
44// };
45// PinIO &operator=(int i)
46// {
47// set(i);
48// return *this;
49// };
50// operator int() { return (int)read(); }; // Read and return int value
51// operator BOOL() { return (BOOL)read(); }; // Read and return BOOL value
52// operator bool() { return (bool)read(); }; // Read and return boolean value
53// friend class PinIOArray;
54//};
55
56class PinIOArray
57{
58 public:
59 PinIO operator[](int n); // { return PinIO(n); };
60};
61
62class FastIOArray
63{
64 public:
65 FastIO operator[](int n); // { return PinIO(n); };
66};
67
68extern PinIOArray Pins;
69extern FastIOArray Fast_Pins;
70
71#endif /* _NB_PINS_H_ */
GPIO Pin Class.
Definition coldfire/cpu/MCF5441X/include/cpu_pins.h:15