diff --git a/api/gpio.h b/api/gpio.h index f4e321b..1be270a 100644 --- a/api/gpio.h +++ b/api/gpio.h @@ -1,19 +1,25 @@ /* - * Originally from mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * Copyright (c) 2014 Intel Corporation + * Author: Thomas Ingleby + * Copyright (c) 2014 Intel Corporation. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once @@ -63,8 +69,7 @@ typedef enum { * * @param pin pin number read from the board, i.e IO3 is 3. * - * @returns - * maa_gpio_context based on the IO pin + * @returns maa_gpio_context based on the IO pin */ maa_gpio_context* maa_gpio_init(int pin); diff --git a/api/i2c.h b/api/i2c.h index 1dc00ad..89c86c1 100644 --- a/api/i2c.h +++ b/api/i2c.h @@ -1,19 +1,25 @@ /* - * Originally from mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * Copyright (c) 2014 Intel Corporation + * Author: Brendan Le Foll + * Copyright (c) 2014 Intel Corporation. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once @@ -49,7 +55,7 @@ typedef struct { maa_i2c_context* maa_i2c_init(); -/** Set the frequency of the I2C interface +/** Sets the frequency of the i2c context * * @param dev the i2c context * @param hz The bus frequency in hertz @@ -58,25 +64,17 @@ maa_i2c_context* maa_i2c_init(); */ maa_result_t maa_i2c_frequency(maa_i2c_context* dev, int hz); -/** Checks to see if this I2C Slave has been addressed. - * - * @param dev the i2c context - * - * @return maa_result_t the maa result. - */ -maa_result_t maa_i2c_receive(maa_i2c_context* dev); - -/** Read from an I2C master. +/** Read from an i2c context * * @param dev the i2c context * @param data pointer to the byte array to read data in to - * @param length maximum number of bytes to read + * @param length max number of bytes to read * * @return maa_result_t the maa result. */ maa_result_t maa_i2c_read(maa_i2c_context* dev, char *data, int length); -/** Read a single byte from an I2C master. +/** Read a single byte from the i2c context * * @param dev the i2c context * @@ -84,17 +82,17 @@ maa_result_t maa_i2c_read(maa_i2c_context* dev, char *data, int length); */ int maa_i2c_read_byte(maa_i2c_context* dev); -/** Write to an I2C master +/** Write to an i2c context * * @param dev the i2c context - * @param data pointer to the byte array to be transmitted - * @param length the number of bytes to transmite + * @param data pointer to the byte array to be written + * @param length the number of bytes to transmit * * @return maa_result_t the maa result. */ maa_result_t maa_i2c_write(maa_i2c_context* dev, const char *data, int length); -/** Write a single byte to an I2C master. +/** Write a single byte to an i2c context * * @param dev the i2c context * @data the byte to write @@ -103,7 +101,7 @@ maa_result_t maa_i2c_write(maa_i2c_context* dev, const char *data, int length); */ maa_result_t maa_i2c_write_byte(maa_i2c_context* dev, int data); -/** Sets the I2C slave address. +/** Sets the i2c context address. * * @param dev the i2c context * @param address The address to set for the slave (ignoring the least diff --git a/api/pwm.h b/api/pwm.h index 9e94304..a0077e3 100644 --- a/api/pwm.h +++ b/api/pwm.h @@ -1,19 +1,25 @@ /* - * Originally from mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * Copyright (c) 2014 Intel Corporation + * Author: Thomas Ingleby + * Copyright (c) 2014 Intel Corporation. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once @@ -90,7 +96,7 @@ float maa_pwm_read(maa_pwm_context* pwm); */ maa_result_t maa_pwm_period(maa_pwm_context* pwm, float seconds); -/** Set period. milli-oseconds. +/** Set period, milli-oseconds. * * @param pwm The PWM context to use. * @param ms milli-seconds for period. @@ -99,7 +105,7 @@ maa_result_t maa_pwm_period(maa_pwm_context* pwm, float seconds); */ maa_result_t maa_pwm_period_ms(maa_pwm_context* pwm, int ms); -/** Set period. microseconds +/** Set period, microseconds * * @param pwm The PWM context to use. * @param ns microseconds as period. @@ -117,7 +123,7 @@ maa_result_t maa_pwm_period_us(maa_pwm_context* pwm, int us); */ maa_result_t maa_pwm_pulsewidth(maa_pwm_context* pwm, float seconds); -/** Set pulsewidth. Milliseconds +/** Set pulsewidth, milliseconds * * @param pwm The PWM context to use. * @param ms milliseconds for pulsewidth. diff --git a/src/i2c/i2c.c b/src/i2c/i2c.c index b4c3d29..01726d2 100644 --- a/src/i2c/i2c.c +++ b/src/i2c/i2c.c @@ -48,12 +48,6 @@ maa_i2c_frequency(maa_i2c_context* dev, int hz) return MAA_SUCCESS; } -maa_result_t -maa_i2c_receive(maa_i2c_context* dev) -{ - return MAA_ERROR_FEATURE_NOT_IMPLEMENTED; -} - maa_result_t maa_i2c_read(maa_i2c_context* dev, char *data, int length) {