You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CCS-COMM_BOARD/Protocol/DigitalIO.h

64 lines
952 B
C++

#pragma once
#include "DSP28x_Project.h"
namespace interface
{
struct DigitalIODataBitField
{
Uint16 b00: 1;
Uint16 b01: 1;
Uint16 b02: 1;
Uint16 b03: 1;
Uint16 b04: 1;
Uint16 b05: 1;
Uint16 b06: 1;
Uint16 b07: 1;
Uint16 b08: 1;
Uint16 b09: 1;
Uint16 b10: 1;
Uint16 b11: 1;
Uint16 b12: 1;
Uint16 b13: 1;
Uint16 b14: 1;
Uint16 b15: 1;
};
union DigitalIODataRegister
{
Uint16 all;
DigitalIODataBitField bit;
DigitalIODataRegister():
all(0)
{}
};
struct DigitalIOData
{
DigitalIODataRegister input;
DigitalIODataRegister output;
DigitalIOData():
input(),
output()
{}
};
class DigitalIO {
public:
DigitalIO();
void setup(Uint16 *memzone);
void setMemoryOffset(Uint16 offset);
void readDigitalIO(Uint16& data);
void writeDigitalIO(Uint16& data) const;
private:
Uint16 *m_pointer;
};
} // interface