Added new features to tinyTILE-Extended-Support-Library.#5
Added new features to tinyTILE-Extended-Support-Library.#5SidLeung wants to merge 1 commit intointel:masterfrom
Conversation
Support I2C controller ACI_I2C0 and ARC_I2C1 of the ARC Core.
|
@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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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_ |
|
|
||
| #define LSBFIRST 0 | ||
| #define MSBFIRST 1 | ||
| #define SPI_MODE0 0x00 |
There was a problem hiding this comment.
These things are already defined in common_spi.h. Can we avoid re-defining, and include common_spi.h instead?
Two new features (two libraries) added,