-#define F_CPU 8000000UL
-#include <avr/io.h>
-#include <avr/interrupt.h>
-#include <util/delay.h>
-#include <avr/wdt.h>
-#include <avr/sleep.h>
-#include "USI_TWI_Master.h"
-#include "MAX1164x.h"
-
-void MAX1164x_init(){
-
-
-}
-void MAX1164x_config(uint8_t setup,uint8_t config){
- I2c_StartCondition();
- I2c_WriteByte (0b01101100);
- I2c_WriteByte (setup|0x80);
- I2c_WriteByte (config);
- I2c_StopCondition();
-
-}
-int16_t MAX1164x_read() {
- uint16_t res;
- I2c_StartCondition();
- I2c_WriteByte (0b01101101);
- //DDR_USI&=~(1<<PIN_USI_SCL);
- //while ((PIN_USI&(1<<PIN_USI_SCL))==0);
- //DDR_USI|=(1<<PIN_USI_SCL);
- _delay_us(80);
- res=((int16_t)(I2c_ReadByte(ACK)&0x0F))<<8;
- res|=I2c_ReadByte(NO_ACK);
-
-
- I2c_StopCondition();
- return res;
-
-}
-
-
-int16_t MAX1164x_read8() {
- uint16_t res;
- I2c_StartCondition();
- I2c_WriteByte (0b01101101);
- //DDR_USI&=~(1<<PIN_USI_SCL);
- //while ((PIN_USI&(1<<PIN_USI_SCL))==0);
- //DDR_USI|=(1<<PIN_USI_SCL);
- _delay_us(80);
- res=((int16_t)(I2c_ReadByte(ACK)&0x0F))<<8;
- res|=I2c_ReadByte(NO_ACK);
-
-
- I2c_StopCondition();
- return res;
-
-}
+#define F_CPU 8000000UL\r
+#include <avr/io.h>\r
+#include <avr/interrupt.h>\r
+#include <util/delay.h>\r
+#include <avr/wdt.h>\r
+#include <avr/sleep.h>\r
+#include "USI_TWI_Master.h"\r
+#include "MAX1164x.h"\r
+\r
+void MAX1164x_init(){\r
+ \r
+ \r
+}\r
+void MAX1164x_config(uint8_t setup,uint8_t config){\r
+ I2c_StartCondition();\r
+ I2c_WriteByte (0b01101100);\r
+ I2c_WriteByte (setup|0x80);\r
+ I2c_WriteByte (config);\r
+ I2c_StopCondition();\r
+ \r
+}\r
+int16_t MAX1164x_read(void) {\r
+ uint16_t res;\r
+ I2c_StartCondition();\r
+ I2c_WriteByte (0b01101101);\r
+ //DDR_USI&=~(1<<PIN_USI_SCL);\r
+ //while ((PIN_USI&(1<<PIN_USI_SCL))==0);\r
+ //DDR_USI|=(1<<PIN_USI_SCL);\r
+ _delay_us(80);\r
+ res=((int16_t)(I2c_ReadByte(ACK)&0x0F))<<8;\r
+ res|=I2c_ReadByte(NO_ACK);\r
+ \r
+ \r
+ I2c_StopCondition();\r
+ return res;\r
+ \r
+}\r
+\r
+\r
+int16_t MAX1164x_read8(void) {\r
+ uint16_t res;\r
+ I2c_StartCondition();\r
+ I2c_WriteByte (0b01101101);\r
+ //DDR_USI&=~(1<<PIN_USI_SCL);\r
+ //while ((PIN_USI&(1<<PIN_USI_SCL))==0);\r
+ //DDR_USI|=(1<<PIN_USI_SCL);\r
+ _delay_us(80);\r
+ res=((int16_t)(I2c_ReadByte(ACK)&0x0F))<<8;\r
+ res|=I2c_ReadByte(NO_ACK);\r
+ \r
+ \r
+ I2c_StopCondition();\r
+ return res;\r
+ \r
+}\r