MediaTek LinkIt™ Connect 7681 Developer's Guide
© 2015, 2016 MediaTek Inc.
Page 16 of 65
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
2.4.1.
Code your firmware
Custom firmware code for a MT7681 is stored in the
*:\LinkIt_Connect_7681_SDK\Src\
folder.
For this example the following code needs to be added to the
IoT_Cust_SubTask_1
method of
iot_custom.c
:
void iot_cust_subtask1(void)
{
/* example: make GPIO 2 blinking every 1 second */
static uint32 subPreTimer = 0;
static uint32 subCurTimer = 0;
uint8 input, polarity;
/* get current counter value (unit:1ms) */
subCurTimer = iot_get_ms_time();
/* if the time difference is 1000ms, change gpio output value*/
if (subCurTimer - subPreTimer >= 1000)
{
subPreTimer = subCurTimer;
iot_gpio_read(2, &input, &polarity); /*get gpio mode and value*/
iot_gpio_output(2, (input+1)%2); /*change gpio to output mode with
the reversed value*/
}
}
Simply locate the
iot_custom.c
file, open it in a suitable editor, add the code above, and save the
file.
See section 4.1, “Creating software projects” for details on how to use the content of
*:\LinkIt_Connect_7681_SDK\Src\
to create your own firmware projects.
2.4.2.
Compiling the application
This section describes how to compile the
iot_customer.c
file into Wi-Fi station mode firmware
for the LinkIt Connect 7681 development board.
2.4.2.1.
Source Code Compilation on Windows
In File Explorer open
C:\Cygwin
and double-click
cygwin-andes.bat
to start the Cygwin shell.
Enter the root directory of MT7681 source project, that is, the
Src
folder of the extracted SDK. In
this case
*:\LinkIt_Connect_7681_SDK\Src\
, noting that Cygwin uses the Linux
/
to delineate
the folder tree.