Browse Source

Add spark fun fuel gauge back ; use qwiic as interface instread of other pins

master
KemoNine 3 years ago
parent
commit
3a83bc5b43
  1. 86
      hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/defs.h
  2. 175
      hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/i2c.h
  3. 359
      hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/main.c
  4. 379
      hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/main.hex
  5. 555
      hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/makefile
  6. 65
      hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/types.h
  7. 32
      hardware/arduino/Plant_Monitor/extern/max1704x/.gitignore
  8. 674
      hardware/arduino/Plant_Monitor/extern/max1704x/LICENSE
  9. 123
      hardware/arduino/Plant_Monitor/extern/max1704x/README.md
  10. 88
      hardware/arduino/Plant_Monitor/extern/max1704x/examples/Both/Both.ino
  11. 202
      hardware/arduino/Plant_Monitor/extern/max1704x/examples/MAX17043/MAX17043.ino
  12. 202
      hardware/arduino/Plant_Monitor/extern/max1704x/examples/MAX17044/MAX17044.ino
  13. BIN
      hardware/arduino/Plant_Monitor/extern/max1704x/extras/MAX17043-MAX17044.pdf
  14. BIN
      hardware/arduino/Plant_Monitor/extern/max1704x/extras/SparkFunLiPoFuelGauge-small.png
  15. BIN
      hardware/arduino/Plant_Monitor/extern/max1704x/extras/SparkFunLiPoFuelGauge.jpg
  16. 40
      hardware/arduino/Plant_Monitor/extern/max1704x/keywords.txt
  17. 9
      hardware/arduino/Plant_Monitor/extern/max1704x/library.properties
  18. 37
      hardware/arduino/Plant_Monitor/extern/max1704x/src/MAX17043.h
  19. 37
      hardware/arduino/Plant_Monitor/extern/max1704x/src/MAX17044.h
  20. 229
      hardware/arduino/Plant_Monitor/extern/max1704x/src/MAX1704X.cpp
  21. 75
      hardware/arduino/Plant_Monitor/extern/max1704x/src/MAX1704X.h
  22. 37
      hardware/arduino/Plant_Monitor/ino/MAX17043.h
  23. 229
      hardware/arduino/Plant_Monitor/ino/MAX1704X.cpp
  24. 75
      hardware/arduino/Plant_Monitor/ino/MAX1704X.h
  25. 11
      hardware/arduino/Plant_Monitor/ino/battery_0.h
  26. 11
      hardware/arduino/Plant_Monitor/ino/battery_100.h
  27. 11
      hardware/arduino/Plant_Monitor/ino/battery_25.h
  28. 11
      hardware/arduino/Plant_Monitor/ino/battery_50.h
  29. 11
      hardware/arduino/Plant_Monitor/ino/battery_75.h
  30. 77
      hardware/arduino/Plant_Monitor/ino/ino.ino
  31. 11
      hardware/arduino/Plant_Monitor/ino/warning.h

86
hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/defs.h vendored

@ -0,0 +1,86 @@
/*! \file avrlibdefs.h \brief AVRlib global defines and macros. */
//*****************************************************************************
//
// File Name : 'avrlibdefs.h'
// Title : AVRlib global defines and macros include file
// Author : Pascal Stang
// Created : 7/12/2001
// Revised : 9/30/2002
// Version : 1.1
// Target MCU : Atmel AVR series
// Editor Tabs : 4
//
// Description : This include file is designed to contain items useful to all
// code files and projects, regardless of specific implementation.
//
// This code is distributed under the GNU Public License
// which can be found at http://www.gnu.org/licenses/gpl.txt
//
//*****************************************************************************
#ifndef AVRLIBDEFS_H
#define AVRLIBDEFS_H
//#define F_CPU 4000000
#define MEM_TYPE 1
// Code compatibility to new AVR-libc
// outb(), inb(), inw(), outw(), BV(), sbi(), cbi(), sei(), cli()
#ifndef outb
#define outb(addr, data) addr = (data)
#endif
#ifndef inb
#define inb(addr) (addr)
#endif
#ifndef outw
#define outw(addr, data) addr = (data)
#endif
#ifndef inw
#define inw(addr) (addr)
#endif
#ifndef BV
#define BV(bit) (1<<(bit))
#endif
//#ifndef cbi
// #define cbi(reg,bit) reg &= ~(BV(bit))
//#endif
//#ifndef sbi
// #define sbi(reg,bit) reg |= (BV(bit))
//#endif
#ifndef cli
#define cli() __asm__ __volatile__ ("cli" ::)
#endif
#ifndef sei
#define sei() __asm__ __volatile__ ("sei" ::)
#endif
// support for individual port pin naming in the mega128
// see port128.h for details
#ifdef __AVR_ATmega128__
// not currently necessary due to inclusion
// of these defines in newest AVR-GCC
// do a quick test to see if include is needed
#ifndef PD0
//#include "port128.h"
#endif
#endif
// use this for packed structures
// (this is seldom necessary on an 8-bit architecture like AVR,
// but can assist in code portability to AVR)
#define GNUC_PACKED __attribute__((packed))
// port address helpers
#define DDR(x) ((x)-1) // address of data direction register of port x
#define PIN(x) ((x)-2) // address of input register of port x
// MIN/MAX/ABS macros
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a>b)?(a):(b))
#define ABS(x) ((x>0)?(x):(-x))
// constants
#define PI 3.14159265359
#endif

175
hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/i2c.h vendored

@ -0,0 +1,175 @@
// This library provides the high-level functions needed to use the I2C
// serial interface supported by the hardware of several AVR processors.
#include <avr/io.h>
#include <avr/interrupt.h>
#include "types.h"
#include "defs.h"
// TWSR values (not bits)
// (taken from avr-libc twi.h - thank you Marek Michalkiewicz)
// Master
#define TW_START 0x08
#define TW_REP_START 0x10
// Master Transmitter
#define TW_MT_SLA_ACK 0x18
#define TW_MT_SLA_NACK 0x20
#define TW_MT_DATA_ACK 0x28
#define TW_MT_DATA_NACK 0x30
#define TW_MT_ARB_LOST 0x38
// Master Receiver
#define TW_MR_ARB_LOST 0x38
#define TW_MR_SLA_ACK 0x40
#define TW_MR_SLA_NACK 0x48
#define TW_MR_DATA_ACK 0x50
#define TW_MR_DATA_NACK 0x58
// Slave Transmitter
#define TW_ST_SLA_ACK 0xA8
#define TW_ST_ARB_LOST_SLA_ACK 0xB0
#define TW_ST_DATA_ACK 0xB8
#define TW_ST_DATA_NACK 0xC0
#define TW_ST_LAST_DATA 0xC8
// Slave Receiver
#define TW_SR_SLA_ACK 0x60
#define TW_SR_ARB_LOST_SLA_ACK 0x68
#define TW_SR_GCALL_ACK 0x70
#define TW_SR_ARB_LOST_GCALL_ACK 0x78
#define TW_SR_DATA_ACK 0x80
#define TW_SR_DATA_NACK 0x88
#define TW_SR_GCALL_DATA_ACK 0x90
#define TW_SR_GCALL_DATA_NACK 0x98
#define TW_SR_STOP 0xA0
// Misc
#define TW_NO_INFO 0xF8
#define TW_BUS_ERROR 0x00
// defines and constants
#define TWCR_CMD_MASK 0x0F
#define TWSR_STATUS_MASK 0xF8
// return values
#define I2C_OK 0x00
#define I2C_ERROR_NODEV 0x01
#define WRITE_sda() DDRC = DDRC | 0b00010000 //SDA must be output when writing
#define READ_sda() DDRC = DDRC & 0b11101111 //SDA must be input when reading - don't forget the resistor on SDA!!
#define sbi(var, mask) ((var) |= (uint8_t)(1 << mask))
#define cbi(var, mask) ((var) &= (uint8_t)~(1 << mask))
// functions
//! Initialize I2C (TWI) interface
void i2cInit(void);
//! Set the I2C transaction bitrate (in KHz)
void i2cSetBitrate(unsigned short bitrateKHz);
// Low-level I2C transaction commands
//! Send an I2C start condition in Master mode
void i2cSendStart(void);
//! Send an I2C stop condition in Master mode
void i2cSendStop(void);
//! Wait for current I2C operation to complete
void i2cWaitForComplete(void);
//! Send an (address|R/W) combination or a data byte over I2C
void i2cSendByte(unsigned char data);
//! Receive a data byte over I2C
// ackFlag = TRUE if recevied data should be ACK'ed
// ackFlag = FALSE if recevied data should be NACK'ed
void i2cReceiveByte(unsigned char ackFlag);
//! Pick up the data that was received with i2cReceiveByte()
unsigned char i2cGetReceivedByte(void);
//! Get current I2c bus status from TWSR
unsigned char i2cGetStatus(void);
// high-level I2C transaction commands
//! send I2C data to a device on the bus (non-interrupt based)
unsigned char i2cMasterSendNI(unsigned char deviceAddr, unsigned char length, unsigned char* data);
//! receive I2C data from a device on the bus (non-interrupt based)
unsigned char i2cMasterReceiveNI(unsigned char deviceAddr, unsigned char length, unsigned char *data);
/*********************
****I2C Functions****
*********************/
void i2cInit(void)
{
// set i2c bit rate to 40KHz
i2cSetBitrate(100);
// enable TWI (two-wire interface)
sbi(TWCR, TWEN);
}
void i2cSetBitrate(unsigned short bitrateKHz)
{
unsigned char bitrate_div;
cbi(TWSR, TWPS0);
cbi(TWSR, TWPS1);
// calculate bitrate division
bitrate_div = ((F_CPU/4000l)/bitrateKHz);
if(bitrate_div >= 16)
bitrate_div = (bitrate_div-16)/2;
outb(TWBR, bitrate_div);
}
void i2cSendStart(void)
{
WRITE_sda();
// send start condition
TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN);
}
void i2cSendStop(void)
{
// transmit stop condition
TWCR = (1<<TWINT)|(1<<TWEN)|(1<<TWSTO);
}
void i2cWaitForComplete(void)
{
int i = 0; //time out variable
// wait for i2c interface to complete operation
while ((!(TWCR & (1<<TWINT))) && (i < 90))
i++;
}
void i2cSendByte(unsigned char data)
{
WRITE_sda();
// save data to the TWDR
TWDR = data;
// begin send
TWCR = (1<<TWINT)|(1<<TWEN);
}
void i2cReceiveByte(unsigned char ackFlag)
{
// begin receive over i2c
if( ackFlag )
{
// ackFlag = TRUE: ACK the recevied data
outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA));
}
else
{
// ackFlag = FALSE: NACK the recevied data
outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT));
}
}
unsigned char i2cGetReceivedByte(void)
{
// retieve received data byte from i2c TWDR
return( inb(TWDR) );
}
unsigned char i2cGetStatus(void)
{
// retieve current i2c status from i2c TWSR
return( inb(TWSR) );
}

359
hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/main.c vendored

@ -0,0 +1,359 @@
/*
6-22-11
Aaron Weiss
aaron at sparkfun dot com
OSHW 1.0 License, http://freedomdefined.org/OSHW
LiPo Fuel Gauge Example Code
Uses the MAX17043
ATmega328@3.3V w/ external 8MHz resonator
HF: 0xDA, LF: 0xFF, EF: 0xF8
PIN CONNECTIONS:
VCC - No connect or connect to system power
GND - GND
SDA - PC4
SCL - PC5
ALT - PD2
QST - GND or a hardware reset pin
Default Baud Rate: 9600bps 8N1
Firmware: v10
Hardware: v10
Usage: Displays the raw A/D value in mV and percentage of
charge every second
*/
#include <stdlib.h>
#include <stdio.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "types.h"
#include "defs.h"
#include "i2c.h"
#define FOSC 8000000
#define BAUD 9600
#define sbi(var, mask) ((var) |= (uint8_t)(1 << mask))
#define cbi(var, mask) ((var) &= (uint8_t)~(1 << mask))
#define STATUS_LED 5
///===========Main Prototypes=============================///////////////////////
void config(void);
void power_on_reset(void);
long read_ad(void);
long read_config(void);
void read_percent(void);
void quick_start_reset(void);
/////=====================================================///////////////////////
///============Initialize Prototypes=====================///////////////////////
void ioinit(void); // initializes IO
void UART_Init(unsigned int ubrr);
static int uart_putchar(char c, FILE *stream);
uint8_t uart_getchar(void);
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
void delay(uint16_t x); // general purpose delay
/////===================================================////////////////////////
///============I2C Prototypes=============//////////////////
void i2cSendStart(void);
void i2cSendStop(void);
void i2cWaitForComplete(void);
void i2cSendByte(unsigned char data);
void i2cInit(void);
void i2cHz(long uP_F, long scl_F);
///===========Global Vars=============================//////////////////////////
volatile long i=0; //counts per second
volatile double percent_decimal;
/////===================================================////////////////////////
//=========MAIN================/////////////////////////////////////////////////
ISR (INT0_vect)
{
//when charge drops below 32% turn on status LED
sbi(PORTB, STATUS_LED);
}
ISR(TIMER1_OVF_vect)
{
//one second timer, prints values every second
TCNT1 = 34286;
//printf("config=%5ld, ", read_config());
printf("a/d=%5ld, ", read_ad());
read_percent();
}
int main(void)
{
ioinit(); //Setup IO pins and defaults
power_on_reset(); // reset MAX module upon MCU reset
config();
while(1)
{
//put your additional code here
}
return (0);
}
void config(void)
{
/////////write config register///////////////
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x6C); //write MAX
i2cWaitForComplete();
i2cSendByte(0x0C); //mode register
i2cWaitForComplete();
i2cSendByte(0x97);
i2cWaitForComplete();
i2cSendByte(0x00); //set alert to 32%
i2cWaitForComplete();
i2cSendStop();
i2cSendStart();
}
void power_on_reset(void)
{
/////////write command register to reset///////////////
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x6C); //write MAX
i2cWaitForComplete();
i2cSendByte(0xFE); //mode register
i2cWaitForComplete();
i2cSendByte(0x54);
i2cWaitForComplete();
i2cSendByte(0x00);
i2cWaitForComplete();
i2cSendStop();
i2cSendStart();
}
long read_ad(void)
{
//0x6C write, 0x6D read
uint16_t xm, xl;
long temp, xo;
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x6C); //write MAX
i2cWaitForComplete();
i2cSendByte(0x02); //mode register
i2cWaitForComplete();
i2cSendStop();
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x6D); //read from MAX
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cWaitForComplete();
xm = i2cGetReceivedByte(); //high byte
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cWaitForComplete();
xl = i2cGetReceivedByte(); //high byte
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cSendStop();
i2cSendStart();
temp = ((xl|(xm << 8)) >> 4);
xo = 1.25* temp;
//returns A/D value in mV
return xo;
}
long read_config(void)
{
///should read 38656 or 0x9700 before alert
///should read 38752 or 0x9760 after alert
//0x6C write, 0x6D read
uint16_t xm, xl;
long xo;
//////////read command register/////////////
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x6C); //write MAX
i2cWaitForComplete();
i2cSendByte(0x0C); //mode register
i2cWaitForComplete();
i2cSendStop();
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x6D); //read from MAX
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cWaitForComplete();
xm = i2cGetReceivedByte(); //high byte
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cWaitForComplete();
xl = i2cGetReceivedByte(); //high byte
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cSendStop();
i2cSendStart();
xo = xl|(xm << 8);
return xo;
}
void read_percent(void)
{
//0x6C write, 0x6D read
uint8_t xm, xl;
//uint8_t xmh, xml, xlh, xll;
//long xo;
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x6C); //write MAX
i2cWaitForComplete();
i2cSendByte(0x04); //SOC register
i2cWaitForComplete();
i2cSendStop();
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x6D); //read from MAX
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cWaitForComplete();
xm = i2cGetReceivedByte(); //high byte
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cWaitForComplete();
xl = i2cGetReceivedByte(); //high byte
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cSendStop();
i2cSendStart();
//percent_decimal = (0.003906)*xl + xm;
//xo = xl|(xm << 8);
printf("percent=%d\n\r", xm);
//printf("percent=%4.2f\n\r", percent_decimal);
}
void quick_start_reset(void)
{
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x6C); //write MAX
i2cWaitForComplete();
i2cSendByte(0x06); //mode register
i2cWaitForComplete();
i2cSendByte(0x40);
i2cWaitForComplete();
i2cSendByte(0x00);
i2cWaitForComplete();
i2cSendStop();
i2cSendStart();
}
////////////////////////////////////////////////////////////////////////////////
///==============Initializations=======================================/////////
////////////////////////////////////////////////////////////////////////////////
void ioinit (void)
{
//1 = output, 0 = input
DDRB = 0b11101111; //PB4 = MISO
DDRC = 0b11111111; //Output on PORTC0, PORTC4 (SDA), PORTC5 (SCL), all others are inputs
DDRD = 0b11110010; //PORTD (RX on PD0), input on PD2 ,out on PD5 for ATtiny motor enable
PORTD |= (1<<PORTD2); //pullup on PD2
PORTC = (1<<PORTC4)|(1<<PORTC5); //i2c pullups
cbi(PORTB, STATUS_LED);
UART_Init((unsigned int)((1000000)/(BAUD*2)-1));
i2cInit();
//pin change interrupt on INT0
EICRA = (1<<ISC01);//falling edge generates interrupt
EIMSK = (1<<INT0);
// Setting Timer 1:
// normal mode
TCCR1A = 0x00;
// Set to clk/256
TCCR1B |= (1<<CS12);
//enable overflow interrupt
TIMSK1 |= (1<<TOIE1);
//load timer with a value to optimize for 1 second,
//(256/8MHz)*(65536bits-34286) = 1s
TCNT1 = 34286;
sei(); //turn on global interrupts
}
void UART_Init(unsigned int ubrr)
{
// Set baud rate
UBRR0H = ubrr>>8;
UBRR0L = ubrr;
// Enable receiver and transmitter
UCSR0A = (0<<U2X0);
UCSR0B = (1<<RXEN0)|(1<<TXEN0);
// Set frame format: 8 bit, no parity, 1 stop bit,
UCSR0C = (1<<UCSZ00)|(1<<UCSZ01);
stdout = &mystdout; //Required for printf init
delay(2000);
}
static int uart_putchar(char c, FILE *stream)
{
if (c == '\n') uart_putchar('\r', stream);
loop_until_bit_is_set(UCSR0A, UDRE0);
UDR0 = c;
return 0;
}
uint8_t uart_getchar(void)
{
while( !(UCSR0A & (1<<RXC0)) );
return(UDR0);
}
//General short delays
void delay(uint16_t x)
{
uint8_t y;
for ( ; x > 50 ; x--){
for ( y = 0 ; y < 200 ; y++){
asm volatile ("nop");
}
}
}

379
hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/main.hex vendored

@ -0,0 +1,379 @@
:100000000C94B5000C9429010C94D2000C94D200ED
:100010000C94D2000C94D2000C94D2000C94D20018
:100020000C94D2000C94D2000C94D2000C94D20008
:100030000C94D2000C94EC040C94D2000C94D200DA
:100040000C94D2000C94D2000C94D2000C94D200E8
:100050000C94D2000C94D2000C94D2000C94D200D8
:100060000C94D2000C94D2006E616E00696E660032
:1000700000407A10F35A00A0724E18090010A5D45F
:10008000E80000E87648170000E40B54020000CABC
:100090009A3B000000E1F505000080969800000002
:1000A00040420F000000A086010000001027000061
:1000B0000000E803000000006400000000000A00E7
:1000C000000000000100000000002C76D888DC67EA
:1000D0004F0823DFC1DFAE59E1B1B796E5E3E45342
:1000E000C63AE651997696E8E6C28426EB898C9B5F
:1000F00062ED407C6FFCEFBC9C9F40F2BAA56FA5FF
:10010000F490055A2AF75C936B6CF9676DC11BFC80
:10011000E0E40D47FEF520E6B500D0ED902E03009B
:10012000943577050080841E080000204E0A0000E8
:1001300000C80C333333330F986E12831141EF8DA7
:100140002114893BE65516CFFEE6DB18D1844B38E7
:100150001BF77C1D901DA4BBE424203284725E2218
:100160008100C9F124ECA1E53D2711241FBECFEF8A
:10017000D8E0DEBFCDBF11E0A0E0B1E0E4E6F7E1FA
:1001800002C005900D92A632B107D9F711E0A6E2A0
:10019000B1E001C01D92A433B107E1F70E942D0424
:1001A0000C94B00B0C940000BC018091B9008E7FC0
:1001B0008093B9008091B9008D7F8093B90080ED64
:1001C00097E00E94D809603130F0862F90E0409788
:1001D00095958795682F6093B800089584E690E020
:1001E0000E94D400ECEBF0E080818460808308956D
:1001F0003C9A84EA8093BC00089584E98093BC0013
:10020000089520E030E002C02F5F3F4F8091BC0096
:1002100087FD03C02A353105B9F708953C9A8093CC
:10022000BB0084E88093BC000895882329F0809166
:10023000BC008F70806C04C08091BC008F7080689F
:100240008093BC0008958091BB0008958091B9000F
:1002500008951F920F920FB60F9211242D9A0F90AE
:100260000FBE0F901F9018953C9A84EA8093BC00B3
:1002700020E030E002C02F5F3F4F8091BC0087FD3F
:1002800003C02A353105B9F73C9A8CE68093BB0050
:1002900084E88093BC0020E030E002C02F5F3F4F35
:1002A0008091BC0087FD03C02A353105B9F73C9A1F
:1002B0008CE08093BB0084E88093BC0020E030E0B9
:1002C00002C02F5F3F4F8091BC0087FD03C02A35DD
:1002D0003105B9F73C9A87E98093BB0084E88093A5
:1002E000BC0020E030E002C02F5F3F4F8091BC0097
:1002F00087FD03C02A353105B9F73C9A1092BB003F
:1003000084E88093BC0020E030E002C02F5F3F4FC4
:100310008091BC0087FD03C02A353105B9F784E917
:100320008093BC003C9A84EA8093BC0008953C9A78
:1003300084EA8093BC0020E030E002C02F5F3F4F92
:100340008091BC0087FD03C02A353105B9F73C9A7E
:100350008CE68093BB0084E88093BC0020E030E012
:1003600002C02F5F3F4F8091BC0087FD03C02A353C
:100370003105B9F73C9A8EEF8093BB0084E88093F7
:10038000BC0020E030E002C02F5F3F4F8091BC00F6
:1003900087FD03C02A353105B9F73C9A84E580937F
:1003A000BB0084E88093BC0020E030E002C02F5FF7
:1003B0003F4F8091BC0087FD03C02A353105B9F756
:1003C0003C9A1092BB0084E88093BC0020E030E0AF
:1003D00002C02F5F3F4F8091BC0087FD03C02A35CC
:1003E0003105B9F784E98093BC003C9A84EA809394
:1003F000BC0008950F931F933C9A84EA8093BC003D
:1004000020E030E002C02F5F3F4F8091BC0087FDAD
:1004100003C02A353105B9F73C9A8CE68093BB00BE
:1004200084E88093BC0020E030E002C02F5F3F4FA3
:100430008091BC0087FD03C02A353105B9F73C9A8D
:1004400082E08093BB0084E88093BC0020E030E031
:1004500002C02F5F3F4F8091BC0087FD03C02A354B
:100460003105B9F784E98093BC003C9A84EA809313
:10047000BC0020E030E002C02F5F3F4F8091BC0005
:1004800087FD03C02A353105B9F73C9A8DE6809384
:10049000BB0084E88093BC0020E030E002C02F5F06
:1004A0003F4F8091BC0087FD03C02A353105B9F765
:1004B0008FEF0E94150120E030E002C02F5F3F4F18
:1004C0008091BC0087FD03C02A353105B9F7009142
:1004D000BB0020E030E002C02F5F3F4F8091BC00A6
:1004E00087FD03C02A353105B9F78FEF0E9415014A
:1004F00020E030E002C02F5F3F4F8091BC0087FDBD
:1005000003C02A353105B9F71091BB0020E030E077
:1005100002C02F5F3F4F8091BC0087FD03C02A358A
:100520003105B9F78FEF0E94150184E98093BC0073
:100530003C9A84EA8093BC00702F60E0212F30E069
:10054000622B732B34E0769567953A95E1F780E05E
:1005500090E00E94E90820E030E040EA5FE30E947A
:100560004D090E94B6089B01AC01CA011F910F9171
:1005700008950F931F933C9A84EA8093BC0020E077
:1005800030E002C02F5F3F4F8091BC0087FD03C069
:100590002A353105B9F73C9A8CE68093BB0084E894
:1005A0008093BC0020E030E002C02F5F3F4F80917D
:1005B000BC0087FD03C02A353105B9F73C9A8CE0B1
:1005C0008093BB0084E88093BC0020E030E002C050
:1005D0002F5F3F4F8091BC0087FD03C02A35310556
:1005E000B9F784E98093BC003C9A84EA8093BC000C
:1005F00020E030E002C02F5F3F4F8091BC0087FDBC
:1006000003C02A353105B9F73C9A8DE68093BB00CB
:1006100084E88093BC0020E030E002C02F5F3F4FB1
:100620008091BC0087FD03C02A353105B9F78FEFF3
:100630000E94150120E030E002C02F5F3F4F809103
:10064000BC0087FD03C02A353105B9F70091BB0016
:1006500020E030E002C02F5F3F4F8091BC0087FD5B
:1006600003C02A353105B9F78FEF0E94150120E04C
:1006700030E002C02F5F3F4F8091BC0087FD03C078
:100680002A353105B9F71091BB0020E030E002C0F7
:100690002F5F3F4F8091BC0087FD03C02A35310595
:1006A000B9F78FEF0E94150184E98093BC003C9A52
:1006B00084EA8093BC00902F80E0212F30E0822BD1
:1006C000932BBC0180E090E01F910F9108953C9A1C
:1006D00084EA8093BC0020E030E002C02F5F3F4FEF
:1006E0008091BC0087FD03C02A353105B9F73C9ADB
:1006F0008CE68093BB0084E88093BC0020E030E06F
:1007000002C02F5F3F4F8091BC0087FD03C02A3598
:100710003105B9F73C9A86E08093BB0084E880936A
:10072000BC0020E030E002C02F5F3F4F8091BC0052
:1007300087FD03C02A353105B9F73C9A80E48093E0
:10074000BB0084E88093BC0020E030E002C02F5F53
:100750003F4F8091BC0087FD03C02A353105B9F7B2
:100760003C9A1092BB0084E88093BC0020E030E00B
:1007700002C02F5F3F4F8091BC0087FD03C02A3528
:100780003105B9F784E98093BC003C9A84EA8093F0
:10079000BC0008951F93182F8A3019F48DE00E9431
:1007A000CA038091C00085FFFCCF1093C60080E093
:1007B00090E01F9108958091C00087FFFCCF809149
:1007C000C600089506C020E000002F5F283CE1F736
:1007D000019783339105B8F708959093C5008093EE
:1007E000C4001092C00088E18093C10086E080932D
:1007F000C20088E191E0909331018093300180ED57
:1008000097E00E94E20308958FEE84B98FEF87B9D5
:1008100082EF8AB95A9A80E388B92D9883E390E0F1
:100820000E94ED030E94EE0082E08093690081E067
:100830008DBB10928000E1E8F0E0808184608083CD
:10084000EFE6F0E08081816080838EEE95E8909302
:10085000850080938400789408950E9404040E9487
:1008600097010E943401FFCF1F933C9A84EA809342
:10087000BC0020E030E002C02F5F3F4F8091BC0001
:1008800087FD03C02A353105B9F73C9A8CE6809381
:10089000BB0084E88093BC0020E030E002C02F5F02
:1008A0003F4F8091BC0087FD03C02A353105B9F761
:1008B0003C9A84E08093BB0084E88093BC0020E0F5
:1008C00030E002C02F5F3F4F8091BC0087FD03C026
:1008D0002A353105B9F784E98093BC003C9A84EA53
:1008E0008093BC0020E030E002C02F5F3F4F80913A
:1008F000BC0087FD03C02A353105B9F73C9A8DE667
:100900008093BB0084E88093BC0020E030E002C00C
:100910002F5F3F4F8091BC0087FD03C02A35310512
:10092000B9F78FEF0E94150120E030E002C02F5F81
:100930003F4F8091BC0087FD03C02A353105B9F7D0
:100940001091BB0020E030E002C02F5F3F4F80914C
:10095000BC0087FD03C02A353105B9F78FEF0E942F
:10096000150120E030E002C02F5F3F4F8091BC00B6
:1009700087FD03C02A353105B9F78091BB0020E01F
:1009800030E002C02F5F3F4F8091BC0087FD03C065
:100990002A353105B9F78FEF0E94150184E980935C
:1009A000BC003C9A84EA8093BC0000D000D0EDB734
:1009B000FEB7319680E091E0ADB7BEB712969C933A
:1009C0008E931197128313820E943D0B0F900F900C
:1009D0000F900F901F9108951F920F920FB60F92D4
:1009E00011242F933F934F935F936F937F938F9334
:1009F0009F93AF93BF93EF93FF938EEE95E8909301
:100A00008500809384000E94FA0100D000D000D0BD
:100A10002DE031E0EDB7FEB7328321836383748329
:100A2000858396830E943D0B8DB79EB706960FB6C1
:100A3000F8949EBF0FBE8DBF0E943404FF91EF91CA
:100A4000BF91AF919F918F917F916F915F914F91E6
:100A50003F912F910F900FBE0F901F901895A1E11D
:100A6000B0E0E5E3F5E00C94EC093C017F876E878C
:100A70006A01FC0117821682838181FD03C06FEF3A
:100A80007FEF6FC39E012F5F3F4F398B288BF301A0
:100A90002381EE85FF8523FD859123FF8191FF87CB
:100AA000EE87882309F45AC3853251F4EE85FF8519
:100AB00023FD859123FF8191FF87EE87853229F4FD
:100AC00090E0B3010E94110BE2CF982F10E0882430
:100AD00099241032B0F49B3269F09C3228F49032A1
:100AE00051F0933271F40BC09D3239F0903349F4D8
:100AF000116028C01260146025C0186023C0106106
:100B000021C017FD2AC0892F80538A3078F416FF40
:100B100006C0FAE09F9E902C1124980E13C03AE074
:100B2000839E802C1124880E10620CC09E3221F40A
:100B300016FD14C3106406C09C3611F4106802C080
:100B4000983659F4EE85FF8523FD959123FF919109
:100B5000FF87EE87992309F0BCCF892F8554833016
:100B600020F4812F8061905E07C0892F85568330E5
:100B700008F09FC1812F8F7E86FD02C076E0972E00
:100B80006FE3F62EF822953619F4F0E4FF2A07C039
:100B9000963619F420E8F22A02C091109A94F7FED2
:100BA0000AC03BE3391518F45CE3B52E02C0B92C3A
:100BB000B39427E009C047E0491520F4BB2447E07F
:100BC000942EF7CF292DBB24C60104969D878C87D0
:100BD000F6016081718182819381AE014F5F5F4F29
:100BE0000B2D0E94230A6C010981202E332400FF63
:100BF00004C003FD02C01DE209C0F1FE02C01BE2F9
:100C000005C0F2FC02C010E001C010E2C1018C700E
:100C10009070892BB9F1112311F483E001C084E0B5
:100C2000881510F088240AC0881AF3FC07C080E2F7
:100C300090E0B3010E94110B8A94C9F7112329F0A7
:100C4000812F90E0B3010E94110B23FE03C008E640
:100C500010E00EC00CE610E00BC0E114F10409F046
:100C6000805290E0B3010E94110B0F5F1F4F05C02F
:100C7000EF2CFF24F0E1EF22FF24F8018491882378
:100C800061F714C1F7FE12C0BC0C24FE04C08A81B7
:100C9000813309F4BA941B141CF0BB24B3942DC007
:100CA000F8E0FB1550F538E0B32E27C0F6FC25C060
:100CB000892D90E08C159D054CF02CEFC2162FEF7E
:100CC000D20624F030E8F32A01C09A94992049F022
:100CD000E2E0F0E0EC0FFD1FE90DF11D80818033B3
:100CE000A1F3F7FE0AC0B92CB394892D90E0C81681
:100CF000D90614F0992401C09C18F7FC03C025E024
:100D000030E009C01C141D041CF021E030E003C0D9
:100D100096012F5F3F4F112311F02F5F3F4F992016
:100D200029F0892D90E00196280F391F882D90E039
:100D30002817390714F0882401C0821A4F2C552433
:100D4000C20189709070892B39F008C080E290E070
:100D5000B3010E94110B8A948820C1F7112329F056
:100D6000812F90E0B3010E94110B43FE07C008C021
:100D700080E390E0B3010E94110B8A948820C1F7B0
:100D8000F7FE46C08601D7FE02C000E010E0760103
:100D90000894E11CF11CE01AF10A41E050E04C0F0C
:100DA0005D1FE40EF51E26014B185108892D90E0B9
:100DB000AA24BB24A81AB90A5FEF0F3F150729F42C
:100DC0008EE290E0B3010E94110BC016D10634F000
:100DD000401651061CF4F701808101C080E30150E8
:100DE00010400894E11CF11C0A151B052CF090E042
:100DF000B3010E94110BE0CF0C151D0539F49A8147
:100E0000963318F4953311F424FE81E390E04BC03F
:100E10008A81813309F00F7E90E0B3010E94110BAB
:100E20009920A1F08EE290E0B3010E94110B12E034
:100E3000E1E0F0E0EC0FFD1FE10FF11D1F5F80818D
:100E400090E0B3010E94110B9A9491F744FC03C007
:100E500085E690E002C085E490E0B3010E94110BAA
:100E6000D7FC05C0C114D10441F404FF06C0D094DE
:100E7000C194D108D3948DE201C08BE290E0B3011C
:100E80000E94110B80E305C08F5F26EF3FEFC20E7B
:100E9000D31E3AE0C316D104BCF790E0B3010E9420
:100EA000110BC601C096B3010E94110BCC84DD84E6
:100EB00052C1933631F0933799F0933509F059C008
:100EC00023C0F601808189835E010894A11CB11CB6
:100ED00022E030E0C20ED31E21E0E22EF12C12C03F
:100EE000F601A080B18016FD03C06FEF7FEF02C056
:100EF000692D70E022E030E0C20ED31EC5010E94D1
:100F0000060B7C011F7713C0F601A080B18016FD8F
:100F100003C06FEF7FEF02C0692D70E022E030E088
:100F2000C20ED31EC5010E94FB0A7C01106813FF8C
:100F300007C01BC080E290E0B3010E94110B8A94AD
:100F4000882D90E0E816F906A8F30FC0F50117FD0B
:100F5000859117FF81915F0190E0B3010E94110B11
:100F600081108A940894E108F108E114F10471F702
:100F7000F2C0943611F0993689F517FF08C0F601D2
:100F8000208131814281538184E090E00AC0F601E2
:100F9000808191819C01442737FD4095542F82E048
:100FA00090E0C80ED91E9FE6F92EF12257FF09C026
:100FB00050954095309521953F4F4F4F5F4F90E8AA
:100FC000F92ACA01B901AE014F5F5F4F2AE030E054
:100FD0000E94520BE82EE889EE1A41C0953721F4A1
:100FE0001F7E2AE030E01CC0197F9F3661F09037E9
:100FF00020F4983509F0B2C00FC0903739F0983717
:1010000009F0ACC004C028E030E00AC0106114FD53
:10101000146020E130E004C014FD166020E132E0ED
:1010200017FF08C0F601608171818281938144E0DD
:1010300050E008C0F60180819181BC0180E090E021
:1010400042E050E0C40ED51EAE014F5F5F4F0E94DC
:10105000520BE82E5889E51A8FE7F82EF122F6FE9A
:101060000BC08EEFF822E91438F4F4FE07C0F2FC4E
:1010700005C09FEEF92202C01E2D01C0192DF4FEFD
:101080000DC0FE01EE0DF11D8081803319F4E9EEF3
:10109000FE2208C01F5FF2FE05C003C08F2D8678B8
:1010A00009F01F5F0F2DF3FC14C0F0FE0FC01815E0
:1010B00010F09E2C0BC09E2C980C911A182D06C077
:1010C00080E290E0B3010E94110B1F5F1815C0F37E
:1010D00004C0181510F4811A01C0882404FF0FC041
:1010E00080E390E0B3010E94110B02FF1DC001FDDF
:1010F00003C088E790E00EC088E590E00BC0802F29
:10110000867891F001FF02C08BE201C080E2F7FC1B
:101110008DE290E0B3010E94110B06C080E390E0E5
:10112000B3010E94110B9A94E914C0F3EA94E1E030
:10113000F0E0EC0FFD1FEE0DF11D808190E0B3019A
:101140000E94110BEE2091F706C080E290E0B301FF
:101150000E94110B8A948820C1F799CCF301668113
:101160007781CB016196E2E10C94080A04D068947F
:10117000B1118DC0089570D088F09F5790F0B92FAD
:101180009927B751A0F0D1F0660F771F881F991FDC
:101190001AF0BA95C9F712C0B13081F077D0B1E03A
:1011A000089574C0672F782F8827B85F39F0B93F4A
:1011B000CCF3869577956795B395D9F73EF49095DE
:1011C0008095709561957F4F8F4F9F4F0895E8945C
:1011D00009C097FB3EF490958095709561957F4F7F
:1011E0008F4F9F4F9923A9F0F92F96E9BB2793952D
:1011F000F695879577956795B795F111F8CFFAF43D
:10120000BB0F11F460FF1BC06F5F7F4F8F4F9F4F6D
:1012100016C0882311F096E911C0772321F09EE8CB
:10122000872F762F05C0662371F096E8862F70E031
:1012300060E02AF09A95660F771F881FDAF7880F0B
:101240009695879597F9089557FD9058440F551F27
:1012500059F05F3F71F04795880F97FB991F61F038
:101260009F3F79F087950895121613061406551FAF
:10127000F2CF4695F1DF08C0161617061806991F1B
:10128000F1CF86957105610508940895E894BB2710
:1012900066277727CB0197F908950BD078C069D0DE
:1012A00028F06ED018F0952309F05AC05FC01124C1
:1012B000EECFCADFA0F3959FD1F3950F50E0551FF5
:1012C000629FF001729FBB27F00DB11D639FAA279B
:1012D000F00DB11DAA1F649F6627B00DA11D661FEA
:1012E000829F2227B00DA11D621F739FB00DA11D0B
:1012F000621F839FA00D611D221F749F3327A00DC5
:10130000611D231F849F600D211D822F762F6A2F60
:1013100011249F5750408AF0E1F088234AF0EE0FE5
:10132000FF1FBB1F661F771F881F91505040A9F7F2
:101330009E3F510570F014C0AACF5F3FECF3983E7A
:10134000DCF3869577956795B795F795E7959F5F59
:10135000C1F7FE2B880F911D9695879597F90895F3
:1013600097F99F6780E870E060E008959FEF80EC58
:10137000089500240A9416161706180609060895FB
:1013800000240A9412161306140605060895092E61
:101390000394000C11F4882352F0BB0F40F4BF2BD0
:1013A00011F460FF04C06F5F7F4F8F4F9F4F089510
:1013B000AA1BBB1B51E107C0AA1FBB1FA617B7077B
:1013C00010F0A61BB70B881F991F5A95A9F7809597
:1013D0009095BC01CD0108952F923F924F925F925C
:1013E0006F927F928F929F92AF92BF92CF92DF9235
:1013F000EF92FF920F931F93CF93DF93CDB7DEB79A
:10140000CA1BDB0B0FB6F894DEBF0FBECDBF09942D
:101410002A88398848885F846E847D848C849B8484
:10142000AA84B984C884DF80EE80FD800C811B8192
:10143000AA81B981CE0FD11D0FB6F894DEBF0FBEC1
:10144000CDBFED010895283008F027E03327DA01F9
:10145000990F311D87FD916000966105710539F482
:1014600032602E5F3D9330E32A95E1F708959F3F68
:1014700030F080387105610509F03C5F3C5F3D93B9
:10148000913008F08068911DDF93CF931F930F93E5
:10149000FF92EF92192F987F9695E92F9695969542
:1014A000E90FFF27E653FF4F99273327EE24FF2448
:1014B000A701E70105900894079428F4360FE71E6A
:1014C000F81E491F511D660F771F881F991F06942C
:1014D000A1F70590079428F4E70EF81E491F561F40
:1014E000C11D770F881F991F661F0694A1F70590ED
:1014F000079428F4F80E491F561FC71FD11D880FE7
:10150000991F661F771F0694A1F70590079420F492
:10151000490F561FC71FD81F990F661F771F881FB7
:101520000694A9F784911095177041F0D695C79548
:1015300057954795F794E7941A95C1F7E0E7F0E0DF
:1015400068941590159135916591959105907FE27C
:101550007395E118F10A430B560BC90BD009C0F77C
:10156000E10CF11E431F561FC91FD01D7EF47033BE
:1015700011F48A95E6CFE894015030F0080F0AF490
:101580000027021708F4202F2395022F7A3328F022
:1015900079E37D932A95E9F710C07D932A9589F622
:1015A000069497956795379517951794E118F10A62
:1015B000430B560BC90BD00998F023957E91739578
:1015C0007A3308F070E37C932013B8F77E91706152
:1015D0007D9330F0839571E37D9370E32A95E1F775
:1015E0001124EF90FF900F911F91CF91DF919927D8
:1015F00087FD90950895FC010590615070400110A1
:10160000D8F7809590958E0F9F1F0895FC0161502B
:10161000704001900110D8F7809590958E0F9F1F14
:1016200008950F931F93CF93DF938C01EB018B8170
:1016300081FF1BC082FF0DC02E813F818C819D8167
:101640002817390764F4E881F9810193F983E88365
:1016500006C0E885F985802F0995892B31F48E81A4
:101660009F8101969F838E8302C00FEF1FEFC801F9
:10167000DF91CF911F910F910895A0E0B0E0E3E4D6
:10168000FBE00C94FC09FE0135966191719180910B
:10169000300190913101AF010E942F052096E2E0C8
:1016A0000C94180AFA01AA27283051F1203181F14F
:1016B000E8946F936E7F6E5F7F4F8F4F9F4FAF4F5A
:1016C000B1E03ED0B4E03CD0670F781F891F9A1F6D
:1016D000A11D680F791F8A1F911DA11D6A0F711D21
:1016E000811D911DA11D20D009F468943F912AE02D
:1016F000269F11243019305D3193DEF6CF01089515
:10170000462F4770405D4193B3E00FD0C9F7F6CF45
:10171000462F4F70405D4A3318F0495D31FD40520D
:10172000419302D0A9F7EACFB4E0A69597958795A3
:1017300077956795BA95C9F7009761057105089582
:101740009B01AC010A2E069457954795379527952E
:10175000BA95C9F7620F731F841F951FA01D0895C6
:04176000F894FFCF2B
:1017640070657263656E743D25640A0D00612F64B3
:101774003D25356C642C20000000000200000000B0
:06178400CA030000000092
:00000001FF

555
hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/makefile vendored

@ -0,0 +1,555 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# MCU name
MCU = atmega328p
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
F_CPU = 8000000
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = main
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS =
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here
CDEFS = -DF_CPU=$(F_CPU)UL
# Place -I options here
CINCS =
#---------------- Compiler Options ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS) $(CINCS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -Wall -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlms: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
#PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
#---------------- External Memory Options ----------------
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
EXTMEMOPTS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#---------------- Programming Options (avrdude serial bootloader) ----------------
#"C:\arduino\hardware\tools\avr\bin\avrdude" -PCOM3 -c stk500v1 -patmega168 -b19200 -Uflash:w:Simon-PTH-v1.hex -V -F -C"C:\arduino\hardware\tools\avr\etc\avrdude.conf"
SERIAL_AVRDUDE = "C:\Documents and Settings\aweiss\My Documents\arduino-0022\arduino-0022\hardware/tools/avr/bin/avrdude"
SERIAL_AVRDUDE_CONFIG = "C:\Documents and Settings\aweiss\My Documents\arduino-0022\arduino-0022\hardware/tools/avr/etc/avrdude.conf"
SERIAL_AVRDUDE_PORT = COM4
SERIAL_AVRDUDE_SPEED = 57600
SERIAL_AVRDUDE_PROGRAMMER = stk500v1
SERIAL_AVRDUDE_FLAGS = -p $(MCU) -P $(SERIAL_AVRDUDE_PORT) -c $(SERIAL_AVRDUDE_PROGRAMMER) -b $(SERIAL_AVRDUDE_SPEED)
SERIAL_AVRDUDE_FLAGS += -C$(SERIAL_AVRDUDE_CONFIG)
SERIAL_AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
SERIAL_AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
SERIAL_AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Programming Options (avrdude) ----------------
# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
# to get a full listing.
AVRDUDE_PROGRAMMER = stk500v1
#AVRDUDE_PROGRAMMER = ponyser
# com1 = serial port. Use lpt1 to connect to parallel port.
#AVRDUDE_PORT = lpt1
AVRDUDE_PORT = COM5
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Programming Options (STK500) ----------------
# Programming hardware: stk500 (the AVR MKII ISP version)
STK500 = stk500
# Location of STK500.exe - no trailing '\'
STK500_PATH = C:\Program Files\Atmel\AVR Tools\STK500
# The STK500 AVR ISP MKII is USB. The USB drivers must already be installed.
# Do this normally by installing AVR Studio.
STK500_PORT = USB
#-erase chip -Program Flash -Verify Flash -File name -Serial programing(ISP)
STK500_WRITE_FLASH = -e -pf -vf -if$(TARGET).hex -ms
STK500_FLAGS = -d$(MCU) -c$(STK500_PORT)
#-Set ISP frequency to 250kHz. Limit is 1/4 of internal osc which is default 1MHz
#Reduce this to 100kHz if you run into flash verification problems in low-voltage systems
STK500_FLAGS += -I250kHz
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
# Define all object files.
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
# Define all listing files.
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all: begin gccversion sizebefore build sizeafter end
build: elf hex eep lss sym
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
#New
ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
#Old
#ELFSIZE = $(SIZE) -A $(TARGET).elf
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
$(AVRMEM) 2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
$(AVRMEM) 2>/dev/null; echo; fi
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
program_stk500: $(TARGET).hex $(TARGET).eep
$(STK500_PATH)\$(STK500) $(STK500_FLAGS) $(STK500_WRITE_FLASH)
program_serial: $(TARGET).hex $(TARGET).eep
$(SERIAL_AVRDUDE) $(SERIAL_AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT=$(OBJCOPY) --debugging \
--change-section-address .data-0x800000 \
--change-section-address .bss-0x800000 \
--change-section-address .noinit-0x800000 \
--change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list end
clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(OBJ)
$(REMOVE) $(LST)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) .dep/*
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff \
clean clean_list program debug gdb-config

65
hardware/arduino/Plant_Monitor/extern/lipo_fuelgauge-v10/types.h vendored

@ -0,0 +1,65 @@
//useful things to include in code
#ifndef TYPES_H
#define TYPES_H