Commit d27d97ee authored by Erik Strand's avatar Erik Strand

Always keep clock high when idle

parent 005a66ac
......@@ -21,6 +21,8 @@
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "tinySPI.h" // https://github.com/JChristensen/tinySPI
#define output(directions,pin) (directions |= pin) // set port direction for output
#define input(directions,pin) (directions &= (~pin)) // set port direction for input
#define set(port,pin) (port |= pin) // set port pin
......@@ -193,6 +195,10 @@ void put_hex_string(uint8_t *string, uint16_t length) {
// SPI_write
// write an SPI character and return the response
//
unsigned char SPI_write_hardware(uint8_t chr) {
return SPI.transfer(chr);
}
unsigned char SPI_write(uint8_t chr) {
static unsigned char bit,ret;
ret = 0;
......@@ -352,11 +358,15 @@ void loop() {
set(MOSI_port, MOSI_pin);
set(CS_port, CS_pin);
for (count = 0; count < 80; ++count) {
set(SCK_port,SCK_pin);
set(SCK_port, SCK_pin);
SPI_delay();
clear(SCK_port,SCK_pin);
clear(SCK_port, SCK_pin);
SPI_delay();
}
}
set(SCK_port, SCK_pin);
//SPI.begin();
//SPI.setDataMode(SPI_MODE1);
//
// CMD0: reset and enter idle state
......@@ -575,5 +585,6 @@ void loop() {
//
}
put_flash_string(PSTR("\r\n\r\nend of file\r\n"));
//SPI.end();
led_port &= ~led_pin;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment