-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_io.h
More file actions
executable file
·55 lines (48 loc) · 1.36 KB
/
python_io.h
File metadata and controls
executable file
·55 lines (48 loc) · 1.36 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
#include "definitions.h"
#include <sys/io.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef PYTHON_IO_H
#define PYTHON_IO_H
class PythonIO
{
public:
PythonIO();
void setPWMDuty(char _duty);
int getTach(int _chip);
float getFreq(int _chip);
/**
* Function to set one byte of digital output
* @param io_byte value from 0-3, corresponding to the byte we are interested in
* @param _data Value to write to the byte
*/
void setDigital(char io_byte, unsigned char _data);
/**
* Function to initialize the direction of the digital IO ports
* @param direction unsigned int where a bit that is set indicates and input
*/
void initDigitalIO(unsigned int direction);
void initPWM();
/**
* Function to get one byte of digital input
* @param io_byte value from 0-3, corresponding to the byte we are interested in
*/
unsigned char getDigital(char io_byte);
/**
* Function to get analog input
* @param io_byte value from 0-3, corresponding to the byte we are interested in
*/
unsigned short getAnalog(char io_pin);
private:
void waitOnTransaction();
unsigned short rSPIControl;//R/W
unsigned short rSPIStatus;//R/W
unsigned short rSPIData0;
unsigned short rSPIData1;
unsigned short rSPIData2;
unsigned short rSPIData3;
unsigned short rHWMoniterIndex;
unsigned short rHWMoniterData;
};
#endif