-
Notifications
You must be signed in to change notification settings - Fork 3k
Nanostack release for Mbed OS 5.13 #10624
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9687f59
Update mesh related configuration help texts
f03e51a
Sync 802.15.4 RF drivers from master repos
a24db79
Squashed 'features/nanostack/coap-service/' changes from 086e7ba..3c7…
8ff97b0
Merge commit 'a24db795a57f8969d037ce949da1bd518956a1db' into prepare_…
1c29564
Squashed 'features/nanostack/sal-stack-nanostack/' changes from 84a07…
07aac7b
Merge commit '1c29564f653e93a2bda270b257c9bb239de9b61e' into prepare_…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
components/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (c) 2019-2019 ARM Limited. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Licensed under the Apache License, Version 2.0 (the License); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "NanostackRfPhys2lp.h" | ||
#include "at24mac_s2lp.h" | ||
|
||
|
||
#if DEVICE_I2C | ||
#ifdef AT24MAC | ||
|
||
/* Device addressing */ | ||
#define AT24MAC_EEPROM_ADDRESS (0x0A<<4) | ||
#define AT24MAC_RW_PROTECT_ADDRESS (0x06<<4) | ||
#define AT24MAC_SERIAL_ADDRESS (0x0B<<4) | ||
|
||
/* Known memory blocks */ | ||
#define AT24MAC_SERIAL_OFFSET (0x80) | ||
#define AT24MAC_EUI64_OFFSET (0x98) | ||
#define AT24MAC_EUI48_OFFSET (0x9A) | ||
|
||
#define SERIAL_LEN 16 | ||
#define EUI64_LEN 8 | ||
#define EUI48_LEN 6 | ||
|
||
using namespace mbed; | ||
|
||
AT24Mac_s2lp::AT24Mac_s2lp(PinName sda, PinName scl) : _i2c(sda, scl) | ||
{ | ||
// Do nothing | ||
} | ||
|
||
int AT24Mac_s2lp::read_serial(void *buf) | ||
{ | ||
char offset = AT24MAC_SERIAL_OFFSET; | ||
if (_i2c.write(AT24MAC_SERIAL_ADDRESS, &offset, 1, true)) { | ||
return -1; //No ACK | ||
} | ||
return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char *)buf, SERIAL_LEN); | ||
} | ||
|
||
int AT24Mac_s2lp::read_eui64(void *buf) | ||
{ | ||
char offset = AT24MAC_EUI64_OFFSET; | ||
if (_i2c.write(AT24MAC_SERIAL_ADDRESS, &offset, 1, true)) { | ||
return -1; //No ACK | ||
} | ||
return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char *)buf, EUI64_LEN); | ||
} | ||
|
||
int AT24Mac_s2lp::read_eui48(void *buf) | ||
{ | ||
char offset = AT24MAC_EUI48_OFFSET; | ||
if (_i2c.write(AT24MAC_SERIAL_ADDRESS, &offset, 1, true)) { | ||
return -1; //No ACK | ||
} | ||
return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char *)buf, EUI48_LEN); | ||
} | ||
|
||
#endif /* AT24MAC */ | ||
#endif /* DEVICE_I2C */ |
71 changes: 71 additions & 0 deletions
71
components/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright (c) 2019-2019 ARM Limited. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Licensed under the Apache License, Version 2.0 (the License); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#ifndef AT24MAC_S2LP_H | ||
#define AT24MAC_S2LP_H | ||
|
||
#include "PinNames.h" | ||
|
||
#if DEVICE_I2C | ||
#ifdef AT24MAC | ||
|
||
#include "I2C.h" | ||
#include "drivers/DigitalInOut.h" | ||
#include "platform/mbed_wait_api.h" | ||
|
||
/* | ||
* AT24MAC drivers. | ||
* | ||
* This is a EEPROM chip designed to contain factory programmed read-only EUI-64 or EUI-48, | ||
* a 128bit serial number and some user programmable EEPROM. | ||
* | ||
* AT24MAC602 contains EUI-64, use read_eui64() | ||
* AT24MAC402 contains EUI-64, use read_eui48() | ||
* | ||
* NOTE: You cannot use both EUI-64 and EUI-48. Chip contains only one of those. | ||
*/ | ||
|
||
class AT24Mac_s2lp { | ||
public: | ||
AT24Mac_s2lp(PinName sda, PinName scl); | ||
|
||
/** | ||
* Read unique serial number from chip. | ||
* \param buf pointer to write serial number to. Must have space for 16 bytes. | ||
* \return zero on success, negative number on failure | ||
*/ | ||
int read_serial(void *buf); | ||
|
||
/** | ||
* Read EUI-64 from chip. | ||
* \param buf pointer to write EUI-64 to. Must have space for 8 bytes. | ||
* \return zero on success, negative number on failure | ||
*/ | ||
int read_eui64(void *buf); | ||
|
||
/** | ||
* Read EUI-48 from chip. | ||
* \param buf pointer to write EUI-48 to. Must have space for 6 bytes. | ||
* \return zero on success, negative number on failure | ||
*/ | ||
int read_eui48(void *buf); | ||
|
||
private: | ||
mbed::I2C _i2c; | ||
}; | ||
|
||
#endif /* AT24MAC */ | ||
#endif /* DEVICE_I2C */ | ||
#endif /* AT24MAC_S2LP_H */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this copy&paste from Atmel driver, and why was it not working for this device?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a copy and it would work with this device. But I guess we cannot rely we always have atmel drivers compiled when running s2-lp? We should probably have some common driver folder for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then move to common folder.
AT24MAC is not Atmel RF driver specific. So now would be correct time to separate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggesting to make it as a separate PR once the change has been properly analysed and correct location/API has been decided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A PR for moving AT24MAC: https://jira.arm.com/browse/IOTTHD-3532