diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0a85cd68 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +Resources/Source_code/Workspace/stm32f4xx_drivers/Debug/ \ No newline at end of file diff --git a/Resources/Arduino/i2c/002I2CSlaveTxString.ino/002I2CSlaveTxString.ino.ino b/Resources/Arduino/i2c/002I2CSlaveTxString.ino/002I2CSlaveTxString/002I2CSlaveTxString.ino similarity index 100% rename from Resources/Arduino/i2c/002I2CSlaveTxString.ino/002I2CSlaveTxString.ino.ino rename to Resources/Arduino/i2c/002I2CSlaveTxString.ino/002I2CSlaveTxString/002I2CSlaveTxString.ino diff --git a/Resources/Arduino/spi/001SPISlaveRxString/001SPISlaveRxString.ino b/Resources/Arduino/spi/001SPISlaveRxString/001SPISlaveRxString.ino index fc8c4ac0..cc6064e8 100644 --- a/Resources/Arduino/spi/001SPISlaveRxString/001SPISlaveRxString.ino +++ b/Resources/Arduino/spi/001SPISlaveRxString/001SPISlaveRxString.ino @@ -16,27 +16,18 @@ #define SPI_MOSI 11 #define SPI_SS 10 -char dataBuff[500]; +#define MAX_I2C_PAYLOAD_LENGTH 500 + +char dataBuff[MAX_I2C_PAYLOAD_LENGTH]; //Initialize SPI slave. void SPI_SlaveInit(void) { - #if 0 // Initialize SPI pins. - pinMode(SPI_SCK, INPUT); - pinMode(SPI_MOSI, INPUT); - pinMode(SPI_MISO, OUTPUT); - pinMode(SPI_SS, INPUT); - - // Enable SPI as slave. - SPCR = (1 << SPE); - #endif - // Initialize SPI pins. pinMode(SCK, INPUT); pinMode(MOSI, INPUT); pinMode(MISO, OUTPUT); pinMode(SS, INPUT); - //make SPI as slave - + // Enable SPI as slave. SPCR = (1 << SPE); } @@ -45,71 +36,67 @@ void SPI_SlaveInit(void) uint8_t SPI_SlaveReceive(void) { /* Wait for reception complete */ + //Serial.println("in SPI_SlaveReceive - waiting for reception complete"); while(!(SPSR & (1< @@ -17,18 +14,17 @@ boolean ledState = HIGH; // LED state flag. uint8_t dataBuff[255]; -uint8_t board_id[10] = "ARDUINOUNO"; - -#define NACK 0xA5 -#define ACK 0xF5 +char board_id[10] = "ARDUINOUNO"; +#define NACK 0xA5 +#define ACK 0xF5 //command codes #define COMMAND_LED_CTRL 0x50 #define COMMAND_SENSOR_READ 0x51 #define COMMAND_LED_READ 0x52 -#define COMMAND_PRINT 0x53 -#define COMMAND_ID_READ 0x54 +#define COMMAND_PRINT 0x53 +#define COMMAND_ID_READ 0x54 #define LED_ON 1 #define LED_OFF 0 @@ -44,12 +40,12 @@ uint8_t board_id[10] = "ARDUINOUNO"; void SPI_SlaveInit(void) { // Initialize SPI pins. - pinMode(SCK, INPUT); + pinMode(SCK, INPUT); pinMode(MOSI, INPUT); pinMode(MISO, OUTPUT); - pinMode(SS, INPUT); + pinMode(SS, INPUT); + //make SPI as slave - // Enable SPI as slave. SPCR = (1 << SPE); } @@ -72,6 +68,8 @@ void SPI_SlaveTransmit(uint8_t data) /* Wait for transmission complete */ while(!(SPSR & (1<