- New code to dump the contents of Atmel's 2-wire EEPROM chips
[goodfet] / firmware / include / twe.h
1 /*! \file spi.h
2   \author EiNSTeiN_ <einstein@g3nius.org>
3   \brief Definitions for the Atmel 2-wire EEPROM application.
4 */
5
6 #ifndef TWE_H
7 #define TWE_H
8
9 #include "app.h"
10
11 #define TWE 0x05
12
13 //Pins and I/O
14 //~ #define MOSI BIT1
15 //~ #define MISO BIT2
16 //~ #define SCK  BIT3
17 #define SDA BIT1
18 #define SCL BIT3
19
20 #define SETSDA SPIOUT |= SDA
21 #define CLRSDA SPIOUT &= ~SDA
22 #define SETSCL SPIOUT |= SCL
23 #define CLRSCL SPIOUT &= ~SCL
24
25 //! Set up the pins for SPI mode.
26 void twe_setup();
27
28 //! Read and write an SPI byte.
29 unsigned char twe_trans8(unsigned char byte);
30
31 //! Read a block to a buffer.
32 //~ void twe_peekblock(uint8_t const app,
33               //~ uint8_t const verb,
34               //~ uint16_t adr,
35               //~ uint32_t len);
36
37
38 void twe_handle_fn( uint8_t const app,
39                                         uint8_t const verb,
40                                         uint32_t const len);
41
42 extern app_t const twe_app;
43
44 #endif /* TWE_H */