Skip to content

Added support for Quark I2C interfaces: I2C0 and I2C1. #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed

Added support for Quark I2C interfaces: I2C0 and I2C1. #278

wants to merge 12 commits into from

Conversation

SidLeung
Copy link
Contributor

@SidLeung SidLeung commented Sep 1, 2016

Additions:

  1. Ported Quark I2C driver to ARC/CoreLibs, located at system/libarc32_arduino101/drivers.
  2. Created the I2C Adapters, located at cores/arduino.

Modifications:

  1. Platform.h - added number of I2C interface definition.

-Add debug interface on Serial1
-Update BLE stack and need update BLE's FW
-Reconstruct the BLE peripheral base on V3
-Implement the BLE Central Role base on V3
-Implement some sketches for new BLE library
-Add central read/write example
-Add set advertising parameter interface
-Add API to allow set up advertising after setup
-Add interface to set the device name

File description
Porting from V3
 system/libarc32_arduino101/common/atomic.h
 system/libarc32_arduino101/common/misc/byteorder.h
 system/libarc32_arduino101/drivers/atomic_native.c
 system/libarc32_arduino101/drivers/bluetooth/att.h
 system/libarc32_arduino101/drivers/bluetooth/bluetooth.h
 system/libarc32_arduino101/drivers/bluetooth/conn.h
 system/libarc32_arduino101/drivers/bluetooth/conn_internal.h
 system/libarc32_arduino101/drivers/bluetooth/gatt.h
 system/libarc32_arduino101/drivers/bluetooth/hci.h
 system/libarc32_arduino101/drivers/bluetooth/uuid.h
 system/libarc32_arduino101/drivers/rpc/rpc.h
 system/libarc32_arduino101/drivers/rpc/rpc_deserialize.c
 system/libarc32_arduino101/drivers/rpc/rpc_functions_to_ble_core.h
 system/libarc32_arduino101/drivers/rpc/rpc_functions_to_quark.h
 system/libarc32_arduino101/drivers/rpc/rpc_serialize.c
 system/libarc32_arduino101/framework/include/util/misc.h
 system/libarc32_arduino101/framework/src/os/panic.c
 system/libarc32_arduino101/framework/src/services/ble/conn.c
 system/libarc32_arduino101/framework/src/services/ble/conn_internal.h
 system/libarc32_arduino101/framework/src/services/ble/dtm_tcmd.c
 system/libarc32_arduino101/framework/src/services/ble/gap.c
 system/libarc32_arduino101/framework/src/services/ble/gatt.c
 system/libarc32_arduino101/framework/src/services/ble/hci_core.h
 system/libarc32_arduino101/framework/src/services/ble/l2cap.c
 system/libarc32_arduino101/framework/src/services/ble/l2cap_internal.h
 system/libarc32_arduino101/framework/src/services/ble/smp.h
 system/libarc32_arduino101/framework/src/services/ble/smp_null.c
 system/libarc32_arduino101/framework/src/services/ble/uuid.c
 system/libarc32_arduino101/framework/src/services/ble_service/ble_service.c
 system/libarc32_arduino101/framework/src/services/ble_service/ble_service_api.c
 system/libarc32_arduino101/framework/src/services/ble_service/ble_service_int.h
 system/libarc32_arduino101/framework/src/services/ble_service/ble_service_internal.h
 system/libarc32_arduino101/framework/src/services/ble_service/ble_service_utils.c
 system/libarc32_arduino101/framework/src/services/ble_service/gap_internal.h
 system/libarc32_arduino101/framework/src/services/ble_service/gatt_internal.h
 system/libarc32_arduino101/framework/src/services/ble_service/nble_driver.c
@eriknyquist
Copy link
Contributor

@SidLeung is it correct to say that all the files in cores/arduino are brand new files?

@SidLeung
Copy link
Contributor Author

SidLeung commented Sep 3, 2016

The additional files are ported from TD, I believe.

@eriknyquist
Copy link
Contributor

Is this related to PR #218?

@SidLeung
Copy link
Contributor Author

SidLeung commented Sep 7, 2016

Yes. PR #218 is going to be closed without merging back to the main trunk. Actually, thank you for reminding me to do that...

@SidLeung
Copy link
Contributor Author

SidLeung commented Sep 7, 2016

@bbaltz505 Would you please close out PR-218 without merging it. We are going on this branch.

@SidLeung
Copy link
Contributor Author

SidLeung commented Sep 7, 2016

@bigdinotech @eriknyquist Russ has been testing this branch of Quark I2C driver together with library and sketch in the Extended Support Library. Please review the code. Thank you. @russmcinnis Please give a brief update on the testing of this code so far. Thanks.

@bigdinotech
Copy link
Contributor

@SidLeung I don't think the example test sketch belongs here since it is just for testing and may just confuse users. Otherwise. +1

soc_i2c_deconfig(controller_id);
soc_i2c_clock_disable(controller_id);

SET_PIN_MODE(20, GPIO_MUX_MODE);
Copy link
Contributor

Choose a reason for hiding this comment

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

it should according to the I2C controller id to set different pins, for I2C0, the pins are 20 and 21, for I2C1 the pins are 22 and 23

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a bug. Will fix it. BTW should the pin be set to high, Qi? @xieqi

1. Jira 541 Peripheral Start fails on X Number of Attributes
    -Change the interface and add return value

2. Fix BLE Peripheral is not advertising
    -Add a delay after register the profile.

3. Modify some comments based on code review

4. Jira 544 BLE peripheral disconnect and end functions
    -The state not aligned and make disconnect failed. Update when connect and disconnect event received

5. Delete the duplicated code that base class has implemented

6. Fix Jira 665 BLECentral Preview -- compile issue when instantiating BLE descriptor
    -Fix the build error.
    Note:
      i  . The current code only support one descriptor on characteristic.
      ii . The central discover logic need more twist.
      iii. Now is so long and can't process CCCD and another characteristic.
      iv . The library will support one other descriptor except CCCD.

7. Improve the discover logic and support another descriptor
    i.  Improve the discover logic
    ii. Support another the descriptor and CCCD at same time.

8. Modify the comments and delete the unused API

9. Fix Jira 670 A compile error occurs with two BLE methods with the same name
    i.  Add method uuid_cstr in BLEAttribute class.
    ii. Remove the duplicate file.

10. Fix Jira 672 BLE documentation in code needs to specify units
    i.   Change the scan and connection interval's unit to ms.
    ii.  Unify the advertising interval unit as millisecond
    iii. Delete some unused code.

11. Fix Jria 671 Support update connection interval in central/peripheral
     i. Central can update the connection interval.
     ii. Unify the interval unit to ms at user API.

12. Adjust the example comments and functions
     i.  Fix Jira 675 - BLE callbacks should use passed arguments instead of global variables
     ii. Adjust the code struture to align with Arduino's requirement

13. Fix Jira 680 LED and LED Central sketches need some work
     -Add a delay to make sure profile register process success.
     -The UART send too fast may makes the profile registration failed.

14. Fix Jira 673 BLE Api should pass arguments that are typedef

15. Fix Jira 671 Support update connection interval in central/peripheral
     i. Add peripheral update the connection interval feature.
     ii. Update the library.

16. Fix Jira  687 Edit the keyword.txt of CurieBLE to reflect Library changes

17. Make example function ready. But need to resolve Jira 675

18. Fix Jira 676 Review Edit Update BLE User Manual with China Flex

19. Fix Jira 685 BLE Peripheral sketches shall state which associated Central sketch to use

20. Fix Jira 588 - BLE Corrupted Long Write
     i. Modify the BLECharacteristic to implement the Long write feature.

21. Fix Jira 683 Typecasting and Pointers should be avoided in sketch
     i.   Add write in Characteristic template
     ii.  Add method in BLE Role class to avoid typecaste
     iii. Modify the advertise address parameter and related example sketches

22. Fix Jira 704 Type Characteristic should be documented
23. Fix Jira 684 Documentation about the central/peripheral
1. Fix Jira 664 demonstrates changing the ADV data
2. Fix Jira 671 Support update connection interval in central/peripheral
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(115200); // start serial for output
while (Serial)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean while (!Serial); ?

@eriknyquist
Copy link
Contributor

My only issues are with the master_check.ino example, so if this will be removed like @bigdinotech says, then it's a +1 from me for everything else.

@SidLeung
Copy link
Contributor Author

SidLeung commented Sep 9, 2016

Example, master_check, is removed since it is more for testing not use application. Bug fixed for closing the adapter. Will squash the PR's.

SidLeung and others added 6 commits September 9, 2016 16:34
Additions:
1.  Ported Quark I2C driver to ARC/CoreLibs, located at system/libarc32_arduino101/drivers.
2.  Created the I2C Adapters, located at cores/arduino.

Modifications:
1.  Platform.h - added number of I2C interface definition.
* Added support for both two ARC SPI controllers: SS_SPI0 and SS_SPI1

1. move the origin ss_spi.c and ss_spi.h form libraries/CurieIMU/src/internal to system/libarc32_arduino101/drivers
2. modify the ss_spi.c and ss_spi.h to support both SPI controllers in ARC cores.

* Modified the ARC SPI driver to support Arduino SPI API

1.Added the function to support set SPI mode.
2.Added the function to support set SPI speed.
Mods:
1.  Added ARC core SPI driver, ss_spi.xxx.
@kitsunami kitsunami added this to the Castor milestone Sep 19, 2016
@SidLeung
Copy link
Contributor Author

Code been reviewed by @bigdinotech @eriknyquist @xieqi, corrections made accordingly. Please merge @calvinatintel

@calvinatintel calvinatintel force-pushed the master branch 2 times, most recently from 5340b0c to 83c76a6 Compare September 19, 2016 22:23
@calvinatintel
Copy link
Contributor

Cherry-picked into the 1.0.7 branch. Will be closed once 1.0.7 is final.

@calvinatintel
Copy link
Contributor

cherry-picked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants