hdrs+= spi.h
endif
+# include twe app
+ifeq ($(filter twe, $(config)), twe)
+ apps+= apps/twe/twe.o
+ hdrs+= twe.h
+endif
+
# include base jtag if they specified it explicitly
ifeq ($(filter jtag, $(config)), jtag)
ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
-/*! \file spi.c
+/*! \file twe.c
\author EiNSTeiN_ <einstein@g3nius.org>
\brief Atmel 2-wire EEPROM
*/
CLRSCL;
delay_us(15);
}
- //~ else {
- //~ SETSDA;
- //~ }
-
return rd;
}
twe_tx(0xa0); // preamble=1010, device adr=000, write=0
// output address bytes
- //~ debughex((adr >> 8) & 0xff);
twe_tx((adr >> 8) & 0xff);
- //~ debughex(adr & 0xff);
twe_tx(adr & 0xff);
// start command / read
twe_start();
twe_stop();
-
-
}
//! Handles a monitor command.
#define TWE 0x05
//Pins and I/O
-//~ #define MOSI BIT1
-//~ #define MISO BIT2
-//~ #define SCK BIT3
#define SDA BIT1
#define SCL BIT3
//! Read and write an SPI byte.
unsigned char twe_trans8(unsigned char byte);
-//! Read a block to a buffer.
-//~ void twe_peekblock(uint8_t const app,
- //~ uint8_t const verb,
- //~ uint16_t adr,
- //~ uint32_t len);
-
-
void twe_handle_fn( uint8_t const app,
uint8_t const verb,
uint32_t const len);