]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - drivers/avr/i2c_master.c
Usbasploader bootloader option addition (#6304)
[qmk_firmware.git] / drivers / avr / i2c_master.c
index ba6d0d1586e7660dce138cee95b066768f3c5428..0acc246426460815776263780d0d2f960f36a6c8 100755 (executable)
@@ -1,3 +1,18 @@
+/*  Copyright (C) 2019 Elia Ritterbusch
+ +
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
 /* Library made by: g4lvanix
  * Github repository: https://github.com/g4lvanix/I2C-master-lib
  */
@@ -121,7 +136,7 @@ int16_t i2c_read_nack(uint16_t timeout) {
   return TWDR;
 }
 
-i2c_status_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) {
+i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) {
   i2c_status_t status = i2c_start(address | I2C_WRITE, timeout);
 
   for (uint16_t i = 0; i < length && status >= 0; i++) {
@@ -155,7 +170,7 @@ i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16
   return (status < 0) ? status : I2C_STATUS_SUCCESS;
 }
 
-i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) {
+i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) {
   i2c_status_t status = i2c_start(devaddr | 0x00, timeout);
   if (status >= 0) {
     status = i2c_write(regaddr, timeout);