Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Added new features to tinyTILE-Extended-Support-Library.#5

Open
SidLeung wants to merge 1 commit intointel:masterfrom
SidLeung:master
Open

Added new features to tinyTILE-Extended-Support-Library.#5
SidLeung wants to merge 1 commit intointel:masterfrom
SidLeung:master

Conversation

@SidLeung
Copy link
Contributor

Two new features (two libraries) added,

  1. I2C-1 from the ARC core. Connection is on the backside of tinyTILE.
  2. SPI-0 from the ARC core. Connection is on the backside of tinyTILE.

Support I2C controller ACI_I2C0 and ARC_I2C1 of the ARC Core.
@SidLeung
Copy link
Contributor Author

@bigdinotech @eriknyquist Please review the new library additions to the tinyTILE library, namely the ARC_SPI and the ARC_I2C. Thanks.

{
uint8_t buffer[1];
buffer[0] = data;
ss_spi_xfer(controller_id, buffer, 1, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit of a roundabout way to get a pointer to data. This could be simplified to 2 lines;

ss_spi_xfer(controller_id, &data, 1, 1)
return data;

Serial.println(chip_id, HEX); // print the character
delay(1000);

//ARC_SPI0.transfer(dummy_reg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 64 is commented out. Is it needed? if so, explain with another comment. If not, remove.

ARC_I2C1.begin(); // join i2c bus
}

byte x = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one-letter variable names in sketches, not great for the user. How about something more descriptive, like sendData and receiveData

void loop()
{
Serial.print("Transfer OpCode RDID. Return Value = 0x"); // print the character
uint8_t chip_id = ARC_SPI0.transfer(0x9F);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be a bit more consistent with the data type being used for I2C data? one example uses char, the next one uses byte and this one uses uint8_t. Couldn't they all just use char? or maybe uint8_t?

* Copyright (C) 2016 Intel Corporation
*/

#ifndef _ARC_SPI_H_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "ARC_SPI0"


#define LSBFIRST 0
#define MSBFIRST 1
#define SPI_MODE0 0x00
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These things are already defined in common_spi.h. Can we avoid re-defining, and include common_spi.h instead?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants