* Added ADC peripheral snippets showing simplified and advanced APIs
* Added samples categorisation to top-level readme
* Add notes to DeviceToCloud and Powerdown READMEs regarding reset in power-down state
* Small doc fixes
This commit is contained in:
Chris Whitworth 2021-01-28 22:48:15 +00:00 коммит произвёл GitHub
Родитель 54070d4102
Коммит b0ef37ce58
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
67 изменённых файлов: 767 добавлений и 121 удалений

7
.devcontainer/Dockerfile Normal file
Просмотреть файл

@ -0,0 +1,7 @@
FROM mcr.microsoft.com/azurespheresdk:latest
# Install GNU Arm Embedded Toolchain
RUN curl -L -O https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 && \
tar -xf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 && \
rm gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2;
ENV PATH "$PATH:/:/gcc-arm-none-eabi-9-2019-q4-major/bin"

Просмотреть файл

@ -0,0 +1,16 @@
{
"name": "Azure Sphere Sample",
"dockerFile": "Dockerfile",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"ms-vscode.azure-sphere-tools",
"ms-vscode.azure-sphere-tools-ui"
]
}

Просмотреть файл

@ -0,0 +1,369 @@
// Code Snippet: Read ADC channel using Advanced Functions (Linux ioctls)
// This code snippet demonstrates how to read a value from the ADC
// Potentiometer controller using ioctl system calls, and displays the
// value in volts.
// To read a value from an ADC channel, the application manifest
// (https://docs.microsoft.com/azure-sphere/app-development/app-manifest)
// must enable the peripheral. To enable this capability, copy the
// lines in the Capabilities section of AdvancedFunctions/app_manifest.json
// into your application manifest file.
#include <string.h>
#include <applibs/adc.h>
#include <applibs/log.h>
static int OpenAdc(ADC_ControllerId adcControllerId);
static int GetSampleBitCount(int adcControllerFd, ADC_ChannelId channelId,
struct iio_ioctl_chan_spec_buffer *channelSpecBuffer);
static int GetPropertyIndex(const struct iio_ioctl_chan_spec *channelSpec,
const char *propertyName);
static int GetExtInfo(int adcControllerFd, ADC_ChannelId channelId,
unsigned int extendedPropertyIndex, char *data, size_t length);
static int SetReferenceVoltage(int adcControllerFd, ADC_ChannelId channelId,
struct iio_ioctl_chan_spec_buffer *channelSpecBuffer,
float referenceVoltage);
static int PollAdc(int adcControllerFd, ADC_ChannelId channelId, uint32_t *outSampleValue);
static int SetExtInfo(int adcControllerFd, ADC_ChannelId channelId,
unsigned int extendedPropertyIndex, const char *data, size_t length);
static int GetChannelSpecification(int adcControllerFd, ADC_ChannelId channelId,
struct iio_ioctl_chan_spec_buffer *channelSpecBuffer);
static int ReadAdcChannel(void);
// The maximum voltage.
static const float sampleMaxVoltage = 2.5f;
// ADC device path.
static const char adcPath[] = "/dev/adc";
// Channel specification.
static struct iio_ioctl_chan_spec_buffer channelSpecBuffer;
/// <summary>
/// Reads the value from the ADC channel and displays the value in volts.
/// </summary>
/// <returns>0 on success, else -1.</returns>
static int ReadAdcChannel(void)
{
int adcControllerFd = -1;
int sampleBitCount = -1;
int retVal = -1;
// Open the ADC.
adcControllerFd = OpenAdc(SAMPLE_POTENTIOMETER_ADC_CONTROLLER);
if (adcControllerFd == -1) {
Log_Debug("ERROR: OpenAdc failed.\n");
goto cleanup;
}
// Get the specification for the channel.
int result = GetChannelSpecification(adcControllerFd, SAMPLE_POTENTIOMETER_ADC_CHANNEL,
&channelSpecBuffer);
if (result == -1) {
Log_Debug("ERROR: GetChannelSpecification failed.\n");
goto cleanup;
}
// Get the number of bits in the sample.
sampleBitCount =
GetSampleBitCount(adcControllerFd, SAMPLE_POTENTIOMETER_ADC_CHANNEL, &channelSpecBuffer);
if (sampleBitCount == -1) {
Log_Debug("ERROR: GetSampleBitCount failed.\n");
goto cleanup;
}
// Set the reference voltage.
result = SetReferenceVoltage(adcControllerFd, SAMPLE_POTENTIOMETER_ADC_CHANNEL,
&channelSpecBuffer, sampleMaxVoltage);
if (result == -1) {
Log_Debug("ERROR: SetReferenceVoltage failed.\n");
goto cleanup;
}
// Poll the ADC to read the voltage.
uint32_t value;
result = PollAdc(adcControllerFd, SAMPLE_POTENTIOMETER_ADC_CHANNEL, &value);
if (result == -1) {
Log_Debug("ERROR: PollAdc failed.\n");
goto cleanup;
}
// Calculate voltage.
float maxSample = (float)((1 << sampleBitCount) - 1);
float voltage = ((float)value * sampleMaxVoltage) / maxSample;
Log_Debug("The out sample value is %.3f V.\n", voltage);
retVal = 0;
cleanup:
// Close the file descriptor.
if (adcControllerFd != -1) {
int result = close(adcControllerFd);
if (result != 0) {
Log_Debug("ERROR: Could not close ADC fd: %s (%d).\n", strerror(errno), errno);
}
}
return retVal;
}
/// <summary>
/// Helper function to open the ADC.
/// </summary>
/// <param name="adcControllerId">Id of the ADC controller.</param>
/// <returns>Value of fd if succesful, -1 on error</returns>
static int OpenAdc(ADC_ControllerId adcControllerId)
{
// Format the ADC path.
char path[32];
int len = snprintf(path, sizeof(path), "%s%u", adcPath, adcControllerId);
if (len < 0 || len >= sizeof(path)) {
Log_Debug("ERROR: Cannot format ADC path to buffer.\n");
return -1;
}
int fd = open(path, O_RDWR | O_CLOEXEC, 0);
if (fd == -1) {
if (errno == ENOENT) {
Log_Debug("ERROR: open failed with error: %s (%d)\n", strerror(errno), errno);
}
return -1;
}
return fd;
}
/// <summary>
/// Helper function to gets the specification of the channel and stores the specification
/// in channelSpecBuffer parameter.
/// </summary>
/// <param name="adcControllerFd">The ADC file descriptor.</param>
/// <param name="channelId">The channel id of the ADC.</param>
/// <param name="channelSpecBuffer">The channel spec buffer.</param>
/// <returns>0 if succesful, -1 on error</returns>
static int GetChannelSpecification(int adcControllerFd, ADC_ChannelId channelId,
struct iio_ioctl_chan_spec_buffer *channelSpecBuffer)
{
struct iio_ioctl_chan_spec_buffer_size channelSpecBufferSize = {
.size = sizeof(channelSpecBufferSize), .index = (int)channelId, .total_size = 0};
int ret = ioctl(adcControllerFd, (int)IIO_GET_CHANNEL_SPEC_BUFFER_TOTAL_SIZE_IOCTL,
&channelSpecBufferSize);
if (ret < 0) {
Log_Debug(
"ERROR: ioctl call failed with error \"%s (%d)\" for request "
"IIO_GET_CHANNEL_SPEC_BUFFER_TOTAL_SIZE_IOCTL.\n",
strerror(errno), errno);
return -1;
}
channelSpecBuffer->size = sizeof(*channelSpecBuffer);
channelSpecBuffer->total_size = channelSpecBufferSize.total_size;
channelSpecBuffer->index = (int)channelId;
channelSpecBuffer->channel = NULL;
ret = ioctl(adcControllerFd, (int)IIO_GET_CHANNEL_SPEC_BUFFER_IOCTL, channelSpecBuffer);
if (ret < 0) {
Log_Debug(
"ERROR: ioctl call failed with error \"%s (%d)\" for request "
"IIO_GET_CHANNEL_SPEC_BUFFER_IOCTL.\n",
strerror(errno), errno);
return -1;
}
return 0;
}
/// <summary>
/// Helper function to get the index of the specified property name.
/// </summary>
/// <param name="channelSpec">Pointer to channel specification struct</param>
/// <param name="propertyName">Name of the property</param>
/// <returns>Index of the property if succesful, -1 on error</returns>
static int GetPropertyIndex(const struct iio_ioctl_chan_spec *channelSpec, const char *propertyName)
{
if (!channelSpec) {
Log_Debug("ERROR: Channel specification input parameter is NULL.\n");
return -1;
}
int propertyIndex = 0;
const struct iio_ioctl_chan_spec_ext_info *extendedChannelSpecInfo = channelSpec->ext_info;
while (extendedChannelSpecInfo) {
if (extendedChannelSpecInfo->name &&
strcmp(propertyName, extendedChannelSpecInfo->name) == 0) {
return propertyIndex;
}
++propertyIndex;
extendedChannelSpecInfo = extendedChannelSpecInfo->next;
}
Log_Debug("ERROR: Failed to retrieve property index for property name %s.\n", propertyName);
return -1;
}
/// <summary>
/// Helper function to get the extended channel information.
/// </summary>
/// <param name="adcControllerFd">The ADC file descriptor.</param>
/// <param name="propertyName">The channel id of the ADC.</param>
/// <param name="extendedPropertyIndex">The index of the property.</param>
/// <param name="data">Buffer to hold the extended information.</param>
/// <param name="length">Length of the buffer.</param>
/// <returns>0 if succesful, -1 on error</returns>
static int GetExtInfo(int adcControllerFd, ADC_ChannelId channelId,
unsigned int extendedPropertyIndex, char *data, size_t length)
{
struct iio_ioctl_read_chan_ext_info readExtendedChannelInfo = {
.size = sizeof(readExtendedChannelInfo),
.channel_index = channelId,
.info_index = extendedPropertyIndex,
.buffer = data,
.length = length};
int ret =
ioctl(adcControllerFd, (int)IIO_READ_CHANNEL_EXT_INFO_IOCTL, &readExtendedChannelInfo);
if (ret < 0) {
Log_Debug(
"ERROR: ioctl call failed with error \"%s (%d)\" for request "
"IIO_READ_CHANNEL_EXT_INFO_IOCTL.\n",
strerror(errno), errno);
return -1;
}
return 0;
}
/// <summary>
/// Helper function to set the extended channel information.
/// </summary>
/// <param name="adcControllerFd">The ADC file descriptor.</param>
/// <param name="propertyName">The channel id of the ADC.</param>
/// <param name="extendedPropertyIndex">The index of the property.</param>
/// <param name="data">Buffer holding the extended information to be set.</param>
/// <param name="length">Length of the buffer.</param>
/// <returns>0 if succesful, -1 on error</returns>
static int SetExtInfo(int adcControllerFd, ADC_ChannelId channelId,
unsigned int extendedPropertyIndex, const char *data, size_t length)
{
if (extendedPropertyIndex < 0) {
Log_Debug("ERROR: SetExtInfo: Invalid extended property index.\n");
return -1;
}
struct iio_ioctl_write_chan_ext_info writeExtendedChannelInfo = {
.size = sizeof(writeExtendedChannelInfo),
.channel_index = channelId,
.info_index = extendedPropertyIndex,
.buffer = data,
.length = length};
int ret =
ioctl(adcControllerFd, (int)IIO_WRITE_CHANNEL_EXT_INFO_IOCTL, &writeExtendedChannelInfo);
if (ret < 0) {
Log_Debug(
"ERROR: ioctl call failed with error \"%s (%d)\" for request "
"IIO_WRITE_CHANNEL_EXT_INFO_IOCTL.\n",
strerror(errno), errno);
return -1;
}
return 0;
}
/// <summary>
/// Helper function to get the number of bits in the sample.
/// </summary>
/// <param name="adcControllerFd">The ADC file descriptor.</param>
/// <param name="propertyName">The channel id of the ADC.</param>
/// <param name="iio_ioctl_chan_spec_buffer">The channel spec buffer.</param>
/// <returns>Number of bits if succesful, -1 on error</returns>
static int GetSampleBitCount(int adcControllerFd, ADC_ChannelId channelId,
struct iio_ioctl_chan_spec_buffer *channelSpecBuffer)
{
// Buffer to hold decimal representation of 4-byte integer value and null terminator.
char dataBuffer[12];
int res = GetExtInfo(adcControllerFd, channelId,
(unsigned int)GetPropertyIndex(channelSpecBuffer->channel, "current_bits"),
dataBuffer, sizeof(dataBuffer));
if (res < 0) {
Log_Debug("ERROR: Failed to retrieve extended channel information for channelId = %u.\n",
channelId);
return -1;
}
if (sizeof(dataBuffer) <= strnlen(dataBuffer, sizeof(dataBuffer))) {
Log_Debug("ERROR: Extended channel information received is invalid for channelId = %d.\n",
channelId);
return -1;
}
int numberOfBits = atoi(dataBuffer);
return numberOfBits;
}
/// <summary>
/// Helper function to set the reference voltage.
/// </summary>
/// <param name="adcControllerFd">The ADC file descriptor.</param>
/// <param name="propertyName">The channel id of the ADC.</param>
/// <param name="channelSpecBuffer">The channel spec buffer.</param>
/// <param name="referenceVoltage">The reference voltage to set.</param>
/// <returns>0 if succesful, -1 on error</returns>
static int SetReferenceVoltage(int adcControllerFd, ADC_ChannelId channelId,
struct iio_ioctl_chan_spec_buffer *channelSpecBuffer,
float referenceVoltage)
{
// Buffer to hold single precision floating point and null terminator.
char dataBuffer[12];
int length = snprintf(dataBuffer, sizeof(dataBuffer), "%.3f", referenceVoltage);
if (length < 0 || length >= sizeof(dataBuffer)) {
Log_Debug("ERROR: Cannot write reference voltage to buffer.\n");
return -1;
}
int res =
SetExtInfo(adcControllerFd, channelId,
(unsigned int)GetPropertyIndex(channelSpecBuffer->channel, "reference_voltage"),
dataBuffer, (size_t)(length + 1));
if (res < 0) {
Log_Debug("ERROR: Failed to set extended channel information for channelId = %u.\n",
channelId);
return -1;
}
return 0;
}
/// <summary>
/// Helper function to poll the ADC.
/// </summary>
/// <param name="adcControllerFd">The ADC file descriptor.</param>
/// <param name="propertyName">The channel id of the ADC.</param>
/// <param name="outSampleValue">Holds the sampled value.</param>
/// <returns>0 if succesful, -1 on error</returns>
static int PollAdc(int adcControllerFd, ADC_ChannelId channelId, uint32_t *outSampleValue)
{
if (adcControllerFd < 0) {
Log_Debug("ERROR: Invalid file descriptor.\n");
return -1;
}
struct iio_ioctl_raw_channel_info rawChannelInfo = {
.size = sizeof(rawChannelInfo), .index = (int)(channelId), .mask = IIO_IOCTL_CHAN_INFO_RAW};
int result = ioctl(adcControllerFd, (int)IIO_READ_RAW_CHANNEL_INFO_IOCTL, &rawChannelInfo);
if (result < 0) {
Log_Debug(
"ERROR: ioctl call failed with error \"%s (%d)\" for request "
"IIO_READ_RAW_CHANNEL_INFO_IOCTL.\n",
strerror(errno), errno);
return -1;
}
*outSampleValue = (uint32_t)(rawChannelInfo.val);
return 0;
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"Capabilities": {
"Adc": [
"$SAMPLE_POTENTIOMETER_ADC_CONTROLLER"
]
}
}

Просмотреть файл

@ -0,0 +1,30 @@
# Snippet: Linux sysfs nodes
This is a Linux code snippet which demonstrates how to read a value from an MCP3008 ADC chip which is connected to a Raspberry Pi 4 Model B using Linux sysfs nodes and displays the value in volts.
Refer to this snippet to understand the semantic differences in interacting with an analog to digital converter (ADC) peripheral when coding for Azure Sphere versus coding for a generic Linux system. It may be particularly helpful if you have a Linux background but are new to Azure Sphere.
## Prerequisites
The snippet requires the following hardware:
1. Raspberry Pi 4 Model B
- The Raspberry Pi has no built-in ADC. Hence the MCP3008 ADC chip is connected externally to the Raspberry Pi.
- The SPI interface must be enabled on the Raspberry Pi. It is usually disabled by default.
- Append the following line to `/boot/config.txt` to set up the device driver for the MCP3008 ADC chip.
`dtoverlay=mcp3008:spi0-0-present`
1. MCP3008 ADC chip
- The MCP3008 has a 10-bit resolution, and so it can report a range of numbers from 0 to 1023 (2 to the power of 10). A reading of 0 means the input is 0V and a reading of 1023 means the input is 3.3V.
## Circuit
The following list shows how to connect the MCP3008 to the Raspberry Pi. It requires 6 GPIO pins on the Raspberry Pi P1 Header.
VDD 3.3V (P1-01)
VREF 3.3V (P1-01)
AGND GROUND (P1-06)
CLK GPIO11 (P1-23)
DOUT GPIO9 (P1-21)
DIN GPIO10 (P1-19)
CS GPIO8 (P1-24)
DGND GROUND

Просмотреть файл

@ -0,0 +1,112 @@
// Code Snippet: Read ADC channel via sysfs nodes on Raspberry Pi
// This code snippet demonstrates how to read a value from the MCP3008 ADC chip (which is connected
// to a Raspberry Pi 4 Model B) using Linux sysfs nodes and displays the value in volts.
// Refer to LinuxSysfsNodes/README.md for prerequisites and circuit information.
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static int OpenAdc(int adcChannel);
static int ReadAdc(int adcFd, int *outSampleValue);
static int ReadAdcChannel(void);
static const char iioSysPath[] = "/sys/bus/iio/devices/iio:device0/";
static const int channelNumber = 0; // Channel 0.
static const int sampleBitCount = 10;
static const float referenceVoltage = 3.3f; // Vref is 3.3V.
/// <summary>
/// Reads the value from the ADC channel and displays the value in volts.
/// </summary>
/// <returns>0 on success, else -1.</returns>
static int ReadAdcChannel(void)
{
int adcFd = -1;
int sampleValue = 0;
int retVal = -1;
adcFd = OpenAdc(channelNumber);
if (adcFd == -1) {
goto cleanup;
}
if (ReadAdc(adcFd, &sampleValue) == -1) {
goto cleanup;
}
// Calculate voltage.
float maxSample = (float)((1 << sampleBitCount) - 1);
float voltage = ((float)sampleValue * referenceVoltage) / maxSample;
printf("The out sample value is %.3f V.\n", voltage);
retVal = 0;
cleanup:
// Close the file descriptor.
if (adcFd >= 0) {
int result = close(adcFd);
if (result != 0) {
fprintf(stderr, "ERROR: Could not close ADC fd: %s (%d).\n", strerror(errno), errno);
}
}
return retVal;
}
/// <summary>
/// Helper function to open the ADC file descriptor.
/// </summary>
/// <param name="adcChannel">Channel number to open.</param>
/// <returns>Value of fd if succesful, -1 on error</returns>
static int OpenAdc(int adcChannel)
{
// Format the path for the channel.
char path[128];
int len = snprintf(path, sizeof(path), "%sin_voltage%d_raw", iioSysPath, adcChannel);
if (len < 0 || len >= sizeof(path)) {
fprintf(stderr, "ERROR: Cannot format ADC path to buffer.\n");
return -1;
}
int fd = open(path, O_RDONLY);
if (fd == -1) {
fprintf(stderr, "ERROR: OpenAdc failed with error: %s (%d) for path %s.\n", strerror(errno),
errno,
path);
return -1;
}
return fd;
}
/// <summary>
/// Helper function which reads the specified ADC channel.
/// </summary>
/// <param name="adcFd">ADC file descriptor.</param>
/// <param name="outSampleValue">Holds the value read from the channel.</param>
/// <returns>0 on success, else -1</returns>
static int ReadAdc(int adcFd, int *outSampleValue)
{
if (adcFd < 0) {
fprintf(stderr, "ERROR: Invalid file descriptor.\n");
return -1;
}
// Buffer to hold decimal representation of 4-byte integer value and null terminator.
char dataBuffer[12];
memset(dataBuffer, 0, sizeof(dataBuffer));
if (read(adcFd, dataBuffer, sizeof(dataBuffer)) == -1) {
fprintf(stderr, "ERROR: ReadAdc failed with error: %s (%d).\n", strerror(errno), errno);
return -1;
}
*outSampleValue = atoi(dataBuffer);
return 0;
}

Просмотреть файл

@ -0,0 +1,23 @@
# Snippets: ADC Peripheral Snippets
This folder contains two snippets that demonstrate two different ways to interact with the ADC peripheral when coding for Azure Sphere. Additionally, this folder also includes a Linux snippet which is provided to help customers who come from a Linux background, to understand the semantic differences in interacting with the ADC peripheral when coding for Azure Sphere versus coding for a generic Linux system.
All the snippets provide examples of the same ADC functionality, that is, how to open an ADC, get the sample bit count and read a value.
For more information, refer to [ADC access](https://docs.microsoft.com/azure-sphere/app-development/adc#adc-access) documentation.
## Snippets
### Simplified Functions
This snippet demonstrates how to interact with the ADC using the simplified functions provided by Azure Sphere.
* [SimplifiedFunctions Snippet](SimplifiedFunctions)
### Advanced Functions
This snippet demonstrates how to interact with the ADC using the advanced functions provided by Azure Sphere. In this snippet, Linux ioctls are used to communicate with the peripheral directly.
This can be used by an intermediate Linux developer who is used to working with peripherals using the Linux libraries.
* [AdvancedFunctions Snippet](AdvancedFunctions)
### Linux sysfs nodes
This snippet is entirely Linux-based and will not run on Azure Sphere. We provide it as a reference to help you understand the differences in semantics between interacting with the peripheral when coding for Azure Sphere versus coding for a generic Linux system. It may be particularly helpful if you have a Linux background but are new to Azure Sphere.
* [LinuxSysfsNodes Snippet](LinuxSysfsNodes)

Просмотреть файл

@ -0,0 +1,7 @@
{
"Capabilities": {
"Adc": [
"$SAMPLE_POTENTIOMETER_ADC_CONTROLLER"
]
}
}

Просмотреть файл

@ -0,0 +1,76 @@
// Code Snippet: Read ADC channel using Azure Sphere simplified functions
// This code snippet demonstrates how to read a value from the ADC
// Potentiometer controller using Azure Sphere simplified functions and
// displays the value in volts.
// To read a value from an ADC channel, the application manifest
// (https://docs.microsoft.com/azure-sphere/app-development/app-manifest)
// must enable the peripheral. Copy the lines in the Capabilities section
// of SimplifiedFunctions/app_manifest.json into your application manifest file.
#include <applibs/adc.h>
#include <applibs/log.h>
// The maximum voltage.
static const float sampleMaxVoltage = 2.5f;
/// <summary>
/// Reads the value from the ADC channel and displays the value in volts.
/// </summary>
/// <returns>0 on success, else -1.</returns>
static int ReadAdcChannel(void)
{
int adcControllerFd = -1;
int sampleBitCount = -1;
int retVal = -1;
// Open the ADC.
adcControllerFd = ADC_Open(SAMPLE_POTENTIOMETER_ADC_CONTROLLER);
if (adcControllerFd == -1) {
Log_Debug("ERROR: ADC_Open failed with error: %s (%d)\n", strerror(errno), errno);
goto cleanup;
}
// Get the number of bits in the sample.
sampleBitCount = ADC_GetSampleBitCount(adcControllerFd, SAMPLE_POTENTIOMETER_ADC_CHANNEL);
if (sampleBitCount == -1) {
Log_Debug("ERROR: ADC_GetSampleBitCount failed with error : %s (%d)\n", strerror(errno),
errno);
goto cleanup;
}
// Set the reference voltage.
int result = ADC_SetReferenceVoltage(adcControllerFd, SAMPLE_POTENTIOMETER_ADC_CHANNEL,
sampleMaxVoltage);
if (result == -1) {
Log_Debug("ERROR: ADC_SetReferenceVoltage failed with error : %s (%d)\n", strerror(errno),
errno);
goto cleanup;
}
// Poll the ADC to read the voltage.
uint32_t value;
result = ADC_Poll(adcControllerFd, SAMPLE_POTENTIOMETER_ADC_CHANNEL, &value);
if (result == -1) {
Log_Debug("ERROR: ADC_Poll failed with error: %s (%d)\n", strerror(errno), errno);
goto cleanup;
}
// Calculate voltage
float maxSample = (float)((1 << sampleBitCount) - 1);
float voltage = ((float)value * sampleMaxVoltage) / maxSample;
Log_Debug("The out sample value is %.3f V.\n", voltage);
retVal = 0;
cleanup:
// Close the file descriptor.
if (adcControllerFd != -1) {
int result = close(adcControllerFd);
if (result != 0) {
Log_Debug("ERROR: Could not close ADC fd: %s (%d).\n", strerror(errno), errno);
}
}
return retVal;
}

Просмотреть файл

@ -28,5 +28,17 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio
## Licenses
For information about the licenses that apply to a particular sample, see the License and README.md files in each subdirectory.
For information about the licenses that apply to a particular sample, see the License and README.md files in each subdirectory.
## Samples by category
| Categories | Samples |
|-----------------------------------|-------------------------------|
| Application lifecycle | [Deferred update](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/DeferredUpdate/DeferredUpdate_HighLevelApp) <br/> [Device to Cloud](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/DeviceToCloud/ExternalMcuLowPower) <br/> [Power down](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/Powerdown/Powerdown_HighLevelApp) |
| External MCUs | [Device to Cloud](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/DeviceToCloud/ExternalMcuLowPower) <br/> [External MCU update](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/ExternalMcuUpdate) <br/> [Wi-Fi setup via BLE](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/WifiSetupAndDeviceControlViaBle) |
| Microsoft Azure | [Azure IoT](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/AzureIoT) |
| Multi-core samples | [Inter-core communication](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/IntercoreComms) <br/> [Hello World](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/HelloWorld) |
| Networking & time | [DNS service discovery](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/DNSServiceDiscovery) <br/> [Private network services](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/PrivateNetworkServices) <br/> [Custom NTP](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/CustomNTP/CustomNTP_HighLevelApp) <br/> [Wi-Fi](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/WiFi/WiFi_HighLevelApp) <br/> [Wi-Fi setup via BLE](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/WifiSetupAndDeviceControlViaBle) <br/> [HTTPS cURL Easy](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/HTTPS/HTTPS_Curl_Easy) <br/> [HTTPS cURL Multi](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/HTTPS/HTTPS_Curl_Multi) <br/> [WolfSSL API](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/WolfSSL/WolfSSL_HighLevelApp) <br/> [System time](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/SystemTime) <br/> [Certificates](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/Certificates/Cert_HighLevelApp) |
| Peripherals, sensors, & devices | [ADC](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/ADC/ADC_HighLevelApp) <br/> [GPIO](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/GPIO/GPIO_HighLevelApp) <br/> [I2C](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/I2C/I2C_LSM6DS3_HighLevelApp) <br/> [SPI](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/SPI/SPI_LSM6DS3_HighLevelApp) <br/> [UART](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/UART/UART_HighLevelApp) <br/> [PWM](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/PWM/PWM_HighLevelApp) <br/> [Hello World](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/HelloWorld) |
| Power & memory | [Power down](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/Powerdown/Powerdown_HighLevelApp) <br/> [External MCU low power](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/DeviceToCloud/ExternalMcuLowPower) |
| Storage | [Mutable storage](https://github.com/Azure/azure-sphere-samples/tree/master/Samples/MutableStorage) |

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(ADC_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -55,7 +55,7 @@ The sample requires the following hardware:
## Prepare the sample
1. Ensure that your Azure Sphere device is connected to your computer, and your computer is connected to the internet.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`
@ -85,4 +85,3 @@ The out sample value is 2.483 V
The out sample value is 2.337 V
The out sample value is 2.055 V
```

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(AzureIoT C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c parson.c)
target_include_directories(${PROJECT_NAME} PUBLIC ${AZURE_SPHERE_API_SET_DIR}/usr/include/azureiot

Просмотреть файл

@ -76,7 +76,7 @@ The sample uses the following Azure Sphere application libraries:
The sample requires the following software:
- Azure Sphere SDK version 20.10 or higher. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk), if necessary.
- Azure Sphere SDK version 21.01 or higher. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk), if necessary.
- An Azure subscription. If your organization does not already have one, you can set up a [free trial subscription](https://azure.microsoft.com/free/?v=17.15).
## Preparation
@ -96,4 +96,3 @@ The sample requires the following software:
- [Run the sample with Azure IoT Central](./IoTCentral.md)
- [Run the sample with an Azure IoT Hub](./IoTHub.md)
- [Run the sample with an IoT Edge device](./IoTEdge.md)

Просмотреть файл

@ -9,5 +9,5 @@
"Gpio": [ "$SAMPLE_BUTTON_1", "$SAMPLE_LED" ],
"DeviceAuthentication": "00000000-0000-0000-0000-000000000000"
},
"ApplicationType": "Default"
}
"ApplicationType": "Default"
}

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(Cert_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -81,7 +81,7 @@ The sample requires the following hardware:
## Prepare the sample
1. Ensure that your Azure Sphere device is connected to your computer and your computer is connected to the internet.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`
@ -126,4 +126,3 @@ To build and run this sample, follow the instructions in [Build a sample applica
The output will be displayed in the terminal window.
Use BUTTON_1 and BUTTON_2 as directed in the sample description, above.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(CustomNTP_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -85,7 +85,7 @@ By default, this sample runs over a Wi-Fi connection to the internet. To use Eth
## Prepare the sample
1. Ensure that your Azure Sphere device is connected to your computer, and your computer is connected to the internet.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Install the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Install the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`
@ -190,4 +190,4 @@ To build and run this sample, follow the instructions in [Build a sample applica
## Test the sample
The output will be displayed in the terminal window. When the sample runs, it will configure the NTP servers as per your configuration in the application manifest file.
Use SAMPLE_BUTTON_1 and Status LED as directed in the sample description, above.
Use SAMPLE_BUTTON_1 and Status LED as directed in the sample description, above.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(DNSServiceDiscovery C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c dns-sd.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -58,7 +58,7 @@ The sample requires the following hardware:
## Prepare the sample
1. Even if you've performed this set up previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Even if you've performed this set up previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Connect your Azure Sphere device to your computer by USB.
1. Connect your Azure Sphere device to the same local network as the DNS service.
1. Enable application development, if you have not already done so:
@ -137,4 +137,3 @@ By default, this sample queries the _sample-service._tcp.local DNS server addres
## Sending unicast queries
If you don't need to use multicast queries, you can use unicast queries by calling the res_send() POSIX API to query the DNS server and process the response in a single blocking call. This may simplify the application, especially if it doesn't need to perform other activities while waiting for the response.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(DeferredUpdate C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -47,7 +47,7 @@ The sample requires the following hardware:
**Note:** By default, this sample targets [MT3620 reference development board (RDB)](https://docs.microsoft.com/azure-sphere/hardware/mt3620-reference-board-design) hardware, such as the MT3620 development kit from Seeed Studio. To build the sample for different Azure Sphere hardware, change the Target Hardware Definition Directory in the CMakeLists.txt file. For detailed instructions, see the [README file in the HardwareDefinitions folder](../../../HardwareDefinitions/README.md).
- Azure Sphere SDK version 20.10 or above. To check, run **azsphere show-version** at the command prompt.
- Azure Sphere SDK version 21.01 or above. To check, run **azsphere show-version** at the command prompt.
## Create the Blink application .imagepackage file
@ -149,4 +149,3 @@ You can update the device with the Deferred Update application running inside or
See [Troubleshooting samples](../../troubleshooting.md) if you encounter errors.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(LowPowerMcuToCloud C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME}
main.c

Просмотреть файл

@ -2,7 +2,7 @@
**Note:** The [Azure Sphere Hardware Designs repository](https://github.com/Azure/azure-sphere-hardware-designs/tree/master/P-MT3620EXMSTLP-1-0) on GitHub includes a hardware reference design (folder P-MT3620EXMSTLP-1-0) that demonstrates how to integrate MT3620 into a low-power design where the MT3620 achieves its lowest-power mode but wakes to provide cloud-based operations. The design incorporates an external very-low-power microcontroller that can respond to external input such as button presses.
To build and run this application using off the shelf hardware you will need to do the following:
To build and run this application using off-the-shelf hardware you will need to do the following:
- Wire up the external MCU development board and connect it to an Azure Sphere development board.
- Create an IoT Central application and add views.
@ -109,6 +109,14 @@ To create an IoT Central app, see [IOT Central Setup](./IOTCentralSetup.md).
To build and run the high-level app, follow the instructions in [Build a sample application](../../BUILD_INSTRUCTIONS.md).
**Note:**
When the MT3620 is in Power Down state, it might be unresponsive to CLI commands or attempts to deploy a new or updated image from Visual Studio and Visual Studio Code. You may therefore need to manually restart the MT3620 during the interval when the device is not in Power Down state, using either the Reset button or the "azsphere device restart" CLI command.
When running this sample, the status LED indicates when the MT3620 device is not in Power Down state.
If this interval is too short, try the following:
1. Use the Azure Sphere `azsphere device restart` CLI command to restart the device.
2. After the device has restarted, use the `azsphere device sideload delete` command to delete the sideloaded application that is causing Power Down state.
## Run the solution
**MCU Interactions:**

Просмотреть файл

@ -60,4 +60,3 @@ For details on license, see LICENSE.txt in this directory.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(ExternalMcuUpdateNrf52 C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c file_view.c mem_buf.c eventloop_timer_utilities.c nordic/slip.c nordic/crc.c nordic/dfu_uart_protocol.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -31,7 +31,7 @@ This reference solution demonstrates how you might use an Azure Sphere device to
This reference solution requires the following:
- Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Download and install the latest SDK as needed. The [set-up procedures](https://docs.microsoft.com/azure-sphere/install/overview) describe how to choose and install an SDK.
- Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Download and install the latest SDK as needed. The [set-up procedures](https://docs.microsoft.com/azure-sphere/install/overview) describe how to choose and install an SDK.
- Azure Sphere MT3620 board
- Nordic nRF52 BLE development board
- Jumper wires to connect the boards
@ -177,4 +177,3 @@ For license details, see LICENSE.txt in each directory.
## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(GPIO_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -54,7 +54,7 @@ The sample requires the following hardware:
## Prepare the sample
1. Ensure that your Azure Sphere device is connected to your computer, and your computer is connected to the internet.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`
@ -81,4 +81,3 @@ C:\Build>azsphere device app show-status
To stop the application enter the command `azsphere device app stop -i <component ID>`.
To restart the application enter the command `azsphere device app start -i <component ID>`.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(HTTPS_Curl_Easy C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c curl)

Просмотреть файл

@ -89,7 +89,7 @@ By default, this sample runs over a Wi-Fi connection to the internet. To use Eth
## Prepare the sample
1. Ensure that your Azure Sphere device is connected to your computer, and your computer is connected to the internet.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`
@ -246,4 +246,4 @@ Until the updated OS is released, you can mitigate this problem. However, the mi
`curl_easy_setopt(curlHandle, CURLOPT_SSL_SESSIONID_CACHE, 0);`
For details about how to set this option, see [CURLOPT_SSL_SESSIONID_CACHE explained](https://curl.haxx.se/libcurl/c/CURLOPT_SSL_SESSIONID_CACHE.html) in the cURL documentation.
For details about how to set this option, see [CURLOPT_SSL_SESSIONID_CACHE explained](https://curl.haxx.se/libcurl/c/CURLOPT_SSL_SESSIONID_CACHE.html) in the cURL documentation.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(HTTPS_Curl_Multi C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c ui.c eventloop_timer_utilities.c web_client.c log_utils.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c curl)

Просмотреть файл

@ -88,7 +88,7 @@ The sample requires the following hardware:
## Prepare the sample
1. Ensure that your Azure Sphere device is connected to your computer, and your computer is connected to the internet.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`
@ -175,4 +175,4 @@ Until the updated OS is released, you can mitigate this problem. However, the mi
`curl_easy_setopt(curlHandle, CURLOPT_SSL_SESSIONID_CACHE, 0);`
For details about how to set this option, see [CURLOPT_SSL_SESSIONID_CACHE explained](https://curl.haxx.se/libcurl/c/CURLOPT_SSL_SESSIONID_CACHE.html) in the cURL documentation.
For details about how to set this option, see [CURLOPT_SSL_SESSIONID_CACHE explained](https://curl.haxx.se/libcurl/c/CURLOPT_SSL_SESSIONID_CACHE.html) in the cURL documentation.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(HelloWorld_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -31,7 +31,7 @@ The sample requires the following hardware:
## Prepare the sample
1. Ensure that your Azure Sphere device is connected to your computer and your computer is connected to the internet.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`

Просмотреть файл

@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.10)
project(HelloWorld_RTApp_MT3620_BareMetal C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_tools(TOOLS_REVISION "21.01")
add_executable(${PROJECT_NAME} main.c)
target_link_libraries(${PROJECT_NAME})

Просмотреть файл

@ -29,4 +29,3 @@ The samples in this folder demonstrate the basic features of Azure Sphere high-l
* [HelloWorld_HighLevelApp](HelloWorld_HighLevelApp/) - a basic high-level app.
* [HelloWorld_RTApp_MT3620_BareMetal](HelloWorld_RTApp_MT3620_BareMetal/) - a basic real-time capable app for the MT3620 running on bare-metal.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(I2C_LSM6DS3_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -23,9 +23,9 @@ description: "Demonstrates how to use the I2C (Inter-Integrated Circuit) interfa
# Sample: I2C high-level app
This sample demonstrates how to use [I2C with Azure Sphere](https://docs.microsoft.com/azure-sphere/app-development/i2c) in a high-level application. The sample displays data from an ST LSM6DS3 accelerometer connected to an MT3620 development board through I2C (Inter-Integrated Circuit). The accelerometer data is retrieved every second, by calling the [Applibs I2C APIs](https://docs.microsoft.com/azure-sphere/reference/applibs-reference/applibs-i2c/i2c-overview), and then displayed by calling [Log_Debug](https://docs.microsoft.com/azure-sphere/reference/applibs-reference/applibs-log/function-log-debug).
This sample demonstrates how to use [I2C with Azure Sphere](https://docs.microsoft.com/azure-sphere/app-development/i2c) in a high-level application. The sample displays data from an accelerometer connected to an MT3620 development board through I2C (Inter-Integrated Circuit). Once per second the application calls the [Applibs I2C APIs](https://docs.microsoft.com/azure-sphere/reference/applibs-reference/applibs-i2c/i2c-overview) to retrieve the accelerometer data. It then calls [Log_Debug](https://docs.microsoft.com/azure-sphere/reference/applibs-reference/applibs-log/function-log-debug) to display the data.
To run the sample using the Avnet MT3620 Starter Kit and the on-device LSM6DSO accelerometer, see [Changes required to use the Avnet MT3620 Starter Kit and its built-in LSM6SDO accelerometer](#changes-required-to-use-the-avnet-mt3620-starter-kit-and-its-built-in-lsm6sdo-accelerometer).
By default, this sample is configured to use an external accelerometer—the [ST LSM6DS3](https://www.st.com/en/mems-and-sensors/lsm6ds3.html). It is not configured to use the on-board sensors found on some development boards, such as the [ST LSM6DS0](https://www.st.com/resource/en/datasheet/LSM6DSO.pdf) on the Avnet Starter Kit. To run the sample using the Avnet MT3620 Starter Kit and the on-board LSM6DSO accelerometer, see [Changes required to use the Avnet MT3620 Starter Kit and its on-board LSM6SDO accelerometer](#changes-required-to-use-the-avnet-mt3620-starter-kit-and-its-on-board-lsm6sdo-accelerometer).
The sample uses the following Azure Sphere libraries:
@ -43,10 +43,7 @@ The sample uses the following Azure Sphere libraries:
**NOTE:** By default, this sample targets [MT3620 reference development board (RDB)](https://docs.microsoft.com/azure-sphere/hardware/mt3620-reference-board-design) hardware, such as the MT3620 development kit from Seeed Studios. To build the sample for different Azure Sphere hardware, change the Target Hardware Definition Directory in the CMakeLists.txt file. For detailed instructions, see the [README file in the HardwareDefinitions folder](../../../HardwareDefinitions/README.md). You might also need to wire the boards differently; check with your hardware manufacturer for details.
- [ST LSM6DS3](https://www.st.com/en/mems-and-sensors/lsm6ds3.html)
**Note:** By default, this sample is configured to use an external LSM6DS3, and isn't configured to use the onboard sensors found on some development boards, such as the LSM6DS0 on the Avnet Starter Kit. This sample uses ISU1 on the MT3620 board; however, you can use another ISU by adjusting the wiring, the code, and the application manifest.
- ST LSM6DS3 accelerometer
- 2 x 10K ohm resistors
- We recommend a breadboard because this sample requires wiring from multiple sources to the same pin and the use of pull-up resistors.
- Jumper wires to connect the boards.
@ -54,7 +51,7 @@ The sample uses the following Azure Sphere libraries:
## Prepare the sample
1. Set up your Azure Sphere device and development environment as described in the [Azure Sphere documentation](https://docs.microsoft.com/azure-sphere/install/overview).
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Connect your Azure Sphere device to your computer by USB.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
@ -79,21 +76,21 @@ To build and run this sample, follow the instructions in [Build a sample applica
## Test the sample
When you run the application, it reads the WHO_AM_I register from the accelerometer. This should return the known value 0x69, which confirms that the MT3620 can successfully communicate with the accelerometer. If this fails, verify that the devices are wired correctly, and that the application opened the correct I2C interface. For details on the registers, see the [ST LSM6DS3 data sheet](https://www.st.com/resource/en/datasheet/lsm6ds3.pdf).
When you run the application, it reads the accelerometer WHO_AM_I register. The returned value (0x69 for the LSM6DS3) is compared with the application's `expectedWhoAmI` constant to verify that the MT3620 can successfully communicate with the accelerometer. If this fails, verify that the devices are wired correctly, and that the application opened the correct I2C interface. For details on the LSM6DS3 registers, see the [ST LSM6DS3 data sheet](https://www.st.com/resource/en/datasheet/lsm6ds3.pdf).
After displaying the initial values, the application configures the accelerometer and then displays the vertical acceleration every second.
To test the accelerometer data:
1. Keep the device still and observe the accelerometer output in the **Output Window**. Once the data from the CTRL3_C register is displayed, the output should repeat every second.
1. Keep the device still and observe the accelerometer output in the **Output Window**. It should indicate a vertical acceleration of approximately +1g. Once the data from the accelerometer CTRL3_C register is displayed, the output should repeat every second.
1. Turn the accelerometer upside down and observe the updated data in the **Output Window**. The vertical acceleration should change from approximately +1g to approximately -1g.
## Changes required to use the Avnet MT3620 Starter Kit and its built-in LSM6SDO accelerometer
## Changes required to use the Avnet MT3620 Starter Kit and its on-board LSM6SDO accelerometer
1. Open main.c
1. Search for `static const uint8_t expectedWhoAmI = 0x69;` and replace `0x69` with `0x6C`
1. Search for `i2cFd = I2CMaster_Open(SAMPLE_LSM6DS3_I2C);` and replace `SAMPLE_LSM6DS3_I2C` with `SAMPLE_LSM6DSO_I2C`
1. Open app_manifest.json
1. Search for `"I2cMaster": [ "$SAMPLE_LSM6DS3_I2C" ]` and replace `$SAMPLE_LSM6DS3_I2C` with `$SAMPLE_LSM6DSO_I2C`
1. Search for `"I2cMaster": [ "$SAMPLE_LSM6DS3_I2C" ]` and replace `$SAMPLE_LSM6DS3_I2C` with `$SAMPLE_LSM6DSO_I2C`

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(IntercoreComms_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.10)
project(IntercoreComms_RTApp_MT3620_BareMetal C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_tools(TOOLS_REVISION "21.01")
add_executable(${PROJECT_NAME} main.c logical-intercore.c logical-dpc.c mt3620-intercore.c mt3620-uart-poll.c mt3620-timer.c)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_DEPENDS ${CMAKE_SOURCE_DIR}/linker.ld)

Просмотреть файл

@ -140,4 +140,3 @@ Text: hl-app-to-rt-app-01
```
Again, the numbers in the messages may start from different places.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(MutableStorage C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -52,7 +52,7 @@ The sample uses the following Azure Sphere libraries:
**Note:**: By default, this sample targets MT3620 reference development board (RDB) hardware, such as the MT3620 development kit from Seeed Studio. To build the sample for different Azure Sphere hardware, change the Target Hardware Definition Directory in the CMakeLists.txt file. For detailed instructions, see the README file in the HardwareDefinitions folder.
1. Set up your Azure Sphere device and development environment as described in the [Azure Sphere documentation](https://docs.microsoft.com/azure-sphere/install/overview).
1. Even if you've performed this set up previously, ensure you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Even if you've performed this set up previously, ensure you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Clone the [Azure Sphere samples](https://github.com/Azure/azure-sphere-samples) repo and find the MutableStorage sample.
1. Connect your Azure Sphere device to your computer by USB.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
@ -69,4 +69,3 @@ When the application starts:
1. Press button A to open and write to a file.
1. Press the button repeatedly to increment the value in the file.
1. Press button B to delete the file.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(PWM_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -57,7 +57,7 @@ It varies the brightness of an LED by incrementally varying the duty cycle of th
**Note:** By default, this sample targets [MT3620 reference development board (RDB)](https://docs.microsoft.com/azure-sphere/hardware/mt3620-reference-board-design) hardware, such as the MT3620 development kit from Seeed Studios. To build the sample for different Azure Sphere hardware, change the Target Hardware Definition Directory in the CMakeLists.txt file. For detailed instructions, see the [README file in the HardwareDefinitions folder](../../../HardwareDefinitions/README.md).
1. Ensure that your Azure Sphere device is connected to your computer, and your computer is connected to the internet.
1. Even if you've performed this set up previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the Azure Sphere Developer Command Prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this set up previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the Azure Sphere Developer Command Prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`
@ -84,4 +84,3 @@ To stop the application enter the command:
To restart the application enter the command:
`azsphere device app start -i <component ID>`.

Просмотреть файл

@ -4,8 +4,8 @@
cmake_minimum_required(VERSION 3.10)
project(PowerDown_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -46,7 +46,7 @@ The sample uses the following Azure Sphere libraries.
|[sysevent](https://docs.microsoft.com/azure-sphere/reference/applibs-reference/applibs-sysevent/sysevent-overview) | Used to register for system event notifications about updates so that the app can make sure update checks have completed before the Power Down state is requested |
|[powermanagement](https://docs.microsoft.com/azure-sphere/reference/applibs-reference/applibs-power/power-overview) | Used to manage the power state of the device |
|[storage](https://docs.microsoft.com/azure-sphere/reference/applibs-reference/applibs-storage/storage-overview) | Used to keep track of when an update check happened |
|[networking](https://docs.microsoft.com/azure-sphere/reference/applibs-reference/applibs-storage/storage-overview) | Used to check if the device is connected to a network and if the time is synchronized|
|[networking](https://docs.microsoft.com/azure-sphere/reference/applibs-reference/applibs-networking/networking-overview) | Used to check if the device is connected to a network and if the time is synchronized|
By default, this sample runs over a Wi-Fi connection to the internet. To use Ethernet instead, make the following changes:
@ -72,7 +72,6 @@ By default, this sample runs over a Wi-Fi connection to the internet. To use Eth
}
```
## Contents
| File/folder | Description |
@ -90,7 +89,7 @@ By default, this sample runs over a Wi-Fi connection to the internet. To use Eth
![Connection diagram for pulling PMU_EN low on RDB v1.0](./media/RTC_battery_RDB.png)
- Jumper block to set the power source for the RTC:
- Jumper block to set the power source for the RTC:
- To power the RTC from the main 3.3V power supply, use the jumper block to connect pins 2 and 3 of jumper J3 (J3.2, J3.3).
- To power the RTC from a coin cell battery, use the jumper block to connect pins 1 and 2 of Jumper J3 (J3.1, J3.2) as shown in the bottom left corner of the RDB in the following image.
@ -107,24 +106,26 @@ By default, this sample runs over a Wi-Fi connection to the internet. To use Eth
![Image showing USB current meter setup](./media/Current_Meter_Setup.jpg)
**Note:** Additional on-board circuitry (the FTDI interface and so forth) is also powered from the main power supply. When the chip is placed in Power Down mode, the overall current consumption of the board will not drop to the expected MT3620 Power Down levels because the FTDI consumes between 10-80mA, depending on its connection activity with the USB Host device. As such, the RDB is helpful for validating that software is correctly placing the chip in Power Down mode, but is less useful for validating overall power consumption of the hardware design.
**Note:** Additional on-board circuitry (the FTDI interface and so forth) is also powered from the main power supply. When the chip is placed in Power Down state, the overall current consumption of the board will not drop to the expected MT3620 Power Down levels because the FTDI consumes between 10-80mA, depending on its connection activity with the USB Host device. As such, the RDB is helpful for validating that software is correctly placing the chip in Power Down state, but is less useful for validating overall power consumption of the hardware design.
## Prepare the sample
1. Set up your Azure Sphere device and development environment as described in the [Azure Sphere documentation](https://docs.microsoft.com/azure-sphere/install/overview).
1. Even if you've performed this set up previously, ensure you have Azure Sphere SDK version 20.10 or above. In an Azure Sphere Developer Command Prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK for Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [the Azure Sphere SDK for Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux).
1. Even if you've performed this setup previously, ensure you have Azure Sphere SDK version 21.01 or above. In an Azure Sphere Developer Command Prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK for Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [the Azure Sphere SDK for Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux).
1. Connect your Azure Sphere device to your PC by USB.
1. Enable application development, if you have not already done so, using this command:
`azsphere device enable-development`
1. Clone the [Azure Sphere samples](https://github.com/Azure/azure-sphere-samples) repo and find the PowerDown_HighLevelApp sample in the Powerdown folder.
1. Clone the [Azure Sphere samples](https://github.com/Azure/azure-sphere-samples) repo and find the PowerDown_HighLevelApp sample in the "Powerdown" folder.
## Build and run the sample
To build and run this sample, follow the instructions in [Build a sample application](../../../BUILD_INSTRUCTIONS.md).
**Note:** After a Power Down/wake cycle, the debugger will no longer be attached to the Azure Sphere device. This means you will also no longer see debug console output after the device wakes up. As a workaround, redeploy the sample app after the device wakes up to restore debugging functionality and debug console output.
**Note:**
- When the MT3620 is in Power Down state, it will be unresponsive to CLI commands or attempts to deploy a new or updated image from Visual Studio and Visual Studio Code. The reset button on the development board will not work, and recovery will also not work while the board is in this state. Please see the [MT3620 Hardware Notes](https://docs.microsoft.com/azure-sphere/hardware/mt3620-hardware-notes#power-down-considerations) for more information.
- After a Power Down/wake cycle, the debugger will no longer be attached to the Azure Sphere device. This means you will also no longer see debug console output after the device wakes up. As a workaround, redeploy the sample app after the device wakes up to restore debugging functionality and debug console output.
## Test Power Down
@ -182,4 +183,4 @@ The device repeatedly cycles through 3 states: Start-up, Update, and Power Down.
For details on license, see LICENSE.txt in this directory.
## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(PrivateNetworkServices C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c echo_tcp_server.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -65,7 +65,7 @@ to
## Prepare the sample
1. Set up your Azure Sphere device and development environment as described in the [Azure Sphere documentation](https://docs.microsoft.com/azure-sphere/install/overview).
1. Even if you've performed this set up previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Even if you've performed this set up previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Connect your Azure Sphere device to your computer by USB.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
@ -148,4 +148,3 @@ The sample server can hold 15 characters. If another character arrives before a
#### Socket buffer size
To retrieve and configure the socket send and receive buffer sizes, use the standard `getsockopt` and `setsockopt` functions.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(SPI_LSM6DS3_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -45,7 +45,7 @@ The sample uses the following Azure Sphere libraries:
## Prepare the sample
1. Set up your Azure Sphere device and development environment as described in the [Azure Sphere documentation](https://docs.microsoft.com/azure-sphere/install/overview).
1. Even if you've performed this set up previously, ensure you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this set up previously, ensure you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Connect your Azure Sphere device to your computer by USB.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
@ -75,4 +75,3 @@ To test the accelerometer data:
1. Keep the device still, and observe the accelerometer output in the **Output Window**. Once the data from the CTRL3_C register is displayed, the output should repeat every second.
1. Turn the accelerometer upside down and observe the updated data in the **Output Window**. The vertical acceleration should change from approximately +1g to approximately -1g.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(SystemTime C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -66,7 +66,7 @@ You must perform these steps before you continue:
## To prepare the sample
1. Even if you've performed this set up previously, ensure you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Even if you've performed this set up previously, ensure you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Clone the [Azure Sphere samples](https://github.com/Azure/azure-sphere-samples/) repo and find the SystemTime sample.
## Build and run the sample
@ -119,4 +119,3 @@ To build and run this sample, follow the instructions in [Build a sample applica
1. Wait at least ten seconds and then plug the cable back into the device.
1. Wait at least five more seconds and then restart the application.
1. Verify that the system time was maintained after power loss.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(UART_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -68,7 +68,7 @@ On header 2 (marked H2) on the lower left side of the board:
## Prepare the sample
1. Even if you've performed this setup previously, ensure you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Even if you've performed this setup previously, ensure you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) as needed.
1. Connect your Azure Sphere device to your computer by USB.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
@ -130,4 +130,3 @@ Putty settings:
- Local echo = force on
- Local line editing = force on

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(Wifi_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -85,7 +85,7 @@ The sample requires the following hardware:
## Prepare the sample
1. Even if you've performed this set up previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) if needed.
1. Even if you've performed this set up previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) if needed.
1. Connect your Azure Sphere device to your computer by USB.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
@ -128,4 +128,3 @@ To build and run this sample, follow the instructions in [Build a sample applica
The output will be displayed in the terminal window.
Use BUTTON_1 and BUTTON_2 as directed in the sample description, above.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(WifiSetupAndDeviceControlViaBle C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c wificonfig_message_protocol.c blecontrol_message_protocol.c devicecontrol_message_protocol.c message_protocol.c epoll_timerfd_utilities.c ../common/message_protocol_utilities.c)
target_include_directories(${PROJECT_NAME} PUBLIC ../common)

Просмотреть файл

@ -44,7 +44,7 @@ For more information on the design of this sample solution see the [Design overv
This reference solution requires the following:
- Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) if needed.
- Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Install [the Azure Sphere SDK](https://docs.microsoft.com/azure-sphere/install/install-sdk) if needed.
- Azure Sphere MT3620 board
- Nordic nRF52 BLE development board
- Jumper wires to connect the boards to each other
@ -198,4 +198,3 @@ If the JLINK drive does not appear in Windows Explorer, try the following:
1. Turn off the power on the nRF52 board and then turn the power on. Check that the JLINK drive appears in Windows Explorer. LED 5 should be lit (no longer blinking).
If these steps don't resolve the problem, contact Nordic for more help.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(WolfSSL_HighLevelApp C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c wolfssl)

Просмотреть файл

@ -92,7 +92,7 @@ By default, this sample runs over a Wi-Fi connection to the internet. To use Eth
## Prepare the sample
1. Ensure that your Azure Sphere device is connected to your computer, and your computer is connected to the internet.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`
@ -156,4 +156,3 @@ If the website uses SSL, you may need to use a different root CA certificate. To
To use a protocol other than HTTP, replace the `WriteData` and `ReadData` functions, which send
the HTTP request and read the response, with the appropriate logic for another protocol.

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(ErrorReporting C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -53,7 +53,7 @@ The tutorial requires the following:
## Prepare the tutorial
1. Ensure that your Azure Sphere device is connected to your computer, and your computer and Azure Sphere device are connected to the internet using Wi-Fi or Ethernet for communicating with the Azure Sphere Security Service.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`

Просмотреть файл

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(ErrorReporting C)
azsphere_configure_tools(TOOLS_REVISION "20.10")
azsphere_configure_api(TARGET_API_SET "7")
azsphere_configure_tools(TOOLS_REVISION "21.01")
azsphere_configure_api(TARGET_API_SET "8")
add_executable(${PROJECT_NAME} main.c eventloop_timer_utilities.c)
target_link_libraries(${PROJECT_NAME} applibs gcc_s c)

Просмотреть файл

@ -54,7 +54,7 @@ The tutorial requires the following:
## Prepare the tutorial
1. Ensure that your Azure Sphere device is connected to your computer, and your computer and Azure Sphere device are connected to the internet using Wi-Fi or Ethernet for communicating with the Azure Sphere Security Service.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 20.10 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Even if you've performed this setup previously, ensure that you have Azure Sphere SDK version 21.01 or above. At the command prompt, run **azsphere show-version** to check. Upgrade the Azure Sphere SDK for [Windows](https://docs.microsoft.com/azure-sphere/install/install-sdk) or [Linux](https://docs.microsoft.com/azure-sphere/install/install-sdk-linux) as needed.
1. Enable application development, if you have not already done so, by entering the following line at the command prompt:
`azsphere device enable-development`