User's Guide

4.3 I2C program
DDK2 leads to the i2c0 bus share reserved for developers. You can read and write from the
device node /dev/i2c0.
1. Open i2c device.
2. Set slave station address (7-bit address)
3. read/write
The sample code is as follows
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define I2C_DEV_ADDR 0x3e
int main(int argc, char const *argv[])
{
int fd = -1;
char data[32] = {0};
fd = open("/dev/i2c-0", O_WRONLY);
ioctl(fd, I2C_SLAVE, I2C_DEV_ADDR);
write(fd, (char*)data, sizeof(data));
close(fd);
return 0;
}
4.4 GPIO program
Operate GPIO in user space, you can refer to MTK SampleCode.
4.5 Audio operating programming
Audio operations can be performed directly using the standard ALSA framework. DDK2
operates on ALSA in the following ways:
1, Use the arecord that come with ALSA
arecord -D hw:0,1 -r 16000 -c 8 -f S32_LE -d 3 /tmp/16k_8ch_32bit.wav