My favorites | Sign in
Project Home Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
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

#ifndef _softtwi_h_
#define _softtwi_h_

#include <WProgram.h>

#define BUFFER_LENGTH 32

class SoftTWI {
public:
void attach(int sdaPin, int sclPin);
void begin();
void beginTransmission(uint8_t address);
void beginTransmission(int address);
void endTransmission();
uint8_t send(uint8_t val);
uint8_t requestFrom(uint8_t address, uint8_t quantity);
uint8_t receive();
int16_t receiveInt16();

private:
uint8_t _sdaBit;
uint8_t _sdaPort;
volatile uint8_t* _sdaMode;
volatile uint8_t* _sdaOut;
volatile uint8_t* _sdaIn;

uint8_t _sclBit;
uint8_t _sclPort;
volatile uint8_t* _sclMode;
volatile uint8_t* _sclOut;
volatile uint8_t* _sclIn;

uint8_t* _rxBuffer;
uint8_t _rxBufferIndex;
uint8_t _rxBufferLength;

uint8_t readFrom(uint8_t address, uint8_t* buffer, uint8_t quantity);
uint8_t read(uint8_t more);
};

#endif











Change log

9493522eee63 by j...@fernsroth.com on Aug 25, 2010   Diff
initial commit
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 877 bytes, 53 lines
Powered by Google Project Hosting