Skip to content

Latest commit

 

History

History
84 lines (59 loc) · 2.82 KB

README.md

File metadata and controls

84 lines (59 loc) · 2.82 KB

About Azure Sphere MT3620 Grove Shield Library

This is library for Azure Sphere MT3620 Grove Shield, the shield enhences Azure Sphere by adding I2C interface and Analog input.

Requirements

Create a MT3620 application

Review the [Azure Sphere documentation]https://docs.microsoft.com/en-au/azure-sphere/ for the guide to setting up the developer tools and Azure Sphere SDK on Windows 10 or Ubuntu 18.04.

MT3620 Grove Shield App Manifest

Select app_manifest.json in the application project, add the below attributions, so that we can use the peripherals that MT3620 Grove Shield would use.

"Capabilities": {
	"Gpio": [ 8, 9, 10, 15, 16, 17, 18, 19, 20, 12, 13, 0, 1, 4, 5, 57, 58, 11, 14, 48 ],
	"Uart": [ "ISU0", "ISU3" ],
	"AllowedApplicationConnections": []
}

When using a hardware definition file, you must use an identifier for app_manifest.json.

"Capabilities": {
	"Gpio": [ "$MT3620_GPIO8", "$MT3620_GPIO9", "$MT3620_GPIO10", "$MT3620_GPIO15", "$MT3620_GPIO16", "$MT3620_GPIO17", "$MT3620_GPIO18", "$MT3620_GPIO19", "$MT3620_GPIO20", "$MT3620_GPIO12", "$MT3620_GPIO13", "$MT3620_GPIO0", "$MT3620_GPIO1", "$MT3620_GPIO4", "$MT3620_GPIO5", "$MT3620_GPIO57", "$MT3620_GPIO58", "$MT3620_GPIO11", "$MT3620_GPIO14", "$MT3620_GPIO48" ],
	"Uart": [ "$MT3620_ISU0_UART", "$MT3620_ISU3_UART" ],
	"AllowedApplicationConnections": []
}

Here for details of the hardware definition file.

Some available header files

  • Grove.h
  • Sensors/Grove4DigitDisplay.h
  • Sensors/GroveRelay.h
  • Sensors/GroveTempHumiBaroBME280.h
  • Sensors/GroveTempHumiSHT31.h
  • Sensors/GroveAD7992.h
  • Sensors/GroveOledDisplay96x96.h
  • Sensors/GroveRelay.h
  • Sensors/GroveRotaryAngleSensor.h
  • Sensors/GroveLEDButton.h
  • Sensors/GroveLightSensor.h

Usage of the library, see Example - Temp and Huminidy SHT31

  1. Add headers
#include "Grove.h"
#include "Sensors/GroveTempHumiSHT31.h"
  1. Initialize the shield in main() function
int i2cFd;
GroveShield_Initialize(&i2cFd, 115200); // baudrate - 9600,14400,19200,115200,230400 
  1. Initialize and instantiation
void* sht31 = GroveTempHumiSHT31_Open(i2cFd);
  1. Read temp and humidiy from the sensor
GroveTempHumiSHT31_Read(sht31);
float temp = GroveTempHumiSHT31_GetTemperature(sht31);
float humi = GroveTempHumiSHT31_GetHumidity(sht31);