Private
Public Access
2
0

examples: add Interesting snippet tags to examples and link in Readme.md

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-05-28 11:00:36 +01:00
parent 024324f76e
commit dd3ffe8b78
6 changed files with 26 additions and 1 deletions

View File

@@ -26,8 +26,24 @@ C API Modules | C++ API Classes
@ref maa.h "maa" | @ref maa.h "maa" @ref maa.h "maa" | @ref maa.h "maa"
</center> </center>
### Hello Maa
@snippet hellomaa.c Interesting
### Basic GPIO
@snippet gpio_read6.c Interesting @snippet gpio_read6.c Interesting
### Basic PWM
@snippet cycle-pwm3.c Interesting
### Basic I2C
@snippet analogin_a0.c Interesting
### Basic AIO
@snippet analogin_a0.c Interesting
### Basic SPI
@snippet spi_mcp4261.c Interesting
## Supported platforms ## Supported platforms
- Galileo (Fab D) - Galileo (Fab D)

View File

@@ -31,6 +31,7 @@ int main ()
maa_aio_context adc_a0; maa_aio_context adc_a0;
uint16_t adc_value = 0; uint16_t adc_value = 0;
//! [Interesting]
adc_a0 = maa_aio_init(0); adc_a0 = maa_aio_init(0);
if (adc_a0 == NULL) { if (adc_a0 == NULL) {
return 1; return 1;
@@ -42,6 +43,7 @@ int main ()
} }
maa_aio_close(adc_a0); maa_aio_close(adc_a0);
//! [Interesting]
return MAA_SUCCESS; return MAA_SUCCESS;
} }

View File

@@ -30,6 +30,7 @@ int
main () main ()
{ {
maa_init(); maa_init();
//! [Interesting]
maa_pwm_context pwm; maa_pwm_context pwm;
pwm = maa_pwm_init(3); pwm = maa_pwm_init(3);
if (pwm == NULL) { if (pwm == NULL) {
@@ -49,5 +50,6 @@ main ()
} }
float output = maa_pwm_read(pwm); float output = maa_pwm_read(pwm);
} }
//! [Interesting]
return 0; return 0;
} }

View File

@@ -29,6 +29,8 @@
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
//! [Interesting]
fprintf(stdout, "hello maa\n Version: %s\n", maa_get_version()); fprintf(stdout, "hello maa\n Version: %s\n", maa_get_version());
return 0; return 0;
//! [Interesting]
} }

View File

@@ -83,6 +83,7 @@ main(int argc, char **argv)
int16_t x = 0, y = 0, z = 0; int16_t x = 0, y = 0, z = 0;
char rx_tx_buf[MAX_BUFFER_LENGTH]; char rx_tx_buf[MAX_BUFFER_LENGTH];
//! [Interesting]
maa_i2c_context i2c; maa_i2c_context i2c;
i2c = maa_i2c_init(0); i2c = maa_i2c_init(0);
@@ -90,6 +91,7 @@ main(int argc, char **argv)
rx_tx_buf[0] = HMC5883L_CONF_REG_B; rx_tx_buf[0] = HMC5883L_CONF_REG_B;
rx_tx_buf[1] = GA_1_3_REG; rx_tx_buf[1] = GA_1_3_REG;
maa_i2c_write(i2c, rx_tx_buf, 2); maa_i2c_write(i2c, rx_tx_buf, 2);
//! [Interesting]
maa_i2c_address(i2c, HMC5883L_I2C_ADDR); maa_i2c_address(i2c, HMC5883L_I2C_ADDR);
rx_tx_buf[0] = HMC5883L_MODE_REG; rx_tx_buf[0] = HMC5883L_MODE_REG;

View File

@@ -30,6 +30,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
maa_init(); maa_init();
//! [Interesting]
maa_spi_context spi; maa_spi_context spi;
spi = maa_spi_init(0); spi = maa_spi_init(0);
unsigned int response = 0; unsigned int response = 0;
@@ -53,5 +54,5 @@ main(int argc, char **argv)
usleep(100000); usleep(100000);
} }
} }
//! [Interesting]
} }