mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Optimized size of core, fixed some warnings in libraries.
This commit is contained in:
parent
77ecc6476c
commit
4ba8ffb6ee
@ -13,19 +13,6 @@
|
||||
buildPhases = (
|
||||
33ACA202097AF31C00BEC3A2 /* ShellScript */,
|
||||
);
|
||||
buildSettings = {
|
||||
OPTIMIZATION_CFLAGS = "";
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
OTHER_REZFLAGS = "";
|
||||
PRODUCT_NAME = Distribute;
|
||||
SECTORDER_FLAGS = "";
|
||||
WARNING_CFLAGS = (
|
||||
"-Wmost",
|
||||
"-Wno-four-char-constants",
|
||||
"-Wno-unknown-pragmas",
|
||||
);
|
||||
};
|
||||
dependencies = (
|
||||
33ACA1F8097AF14400BEC3A2 /* PBXTargetDependency */,
|
||||
);
|
||||
@ -43,19 +30,6 @@
|
||||
33FF071D0965C1C20016AC38 /* CopyFiles */,
|
||||
33FF07170965BFFE0016AC38 /* ShellScript */,
|
||||
);
|
||||
buildSettings = {
|
||||
OPTIMIZATION_CFLAGS = "";
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
OTHER_REZFLAGS = "";
|
||||
PRODUCT_NAME = Arduino;
|
||||
SECTORDER_FLAGS = "";
|
||||
WARNING_CFLAGS = (
|
||||
"-Wmost",
|
||||
"-Wno-four-char-constants",
|
||||
"-Wno-unknown-pragmas",
|
||||
);
|
||||
};
|
||||
dependencies = (
|
||||
);
|
||||
name = Setup;
|
||||
@ -74,24 +48,6 @@
|
||||
33AF61670965C4C600B514A9 /* Frameworks */,
|
||||
33CF03C809662DA200F2C9A9 /* CopyFiles */,
|
||||
);
|
||||
buildSettings = {
|
||||
JAVA_COMPILER = /usr/bin/javac;
|
||||
JAVA_COMPILER_FLAGS = "";
|
||||
JAVA_ONLY = YES;
|
||||
JAVA_SOURCE_SUBDIR = .;
|
||||
OPTIMIZATION_CFLAGS = "";
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
OTHER_REZFLAGS = "";
|
||||
PRODUCT_NAME = App;
|
||||
SECTORDER_FLAGS = "";
|
||||
WARNING_CFLAGS = (
|
||||
"-Wmost",
|
||||
"-Wno-four-char-constants",
|
||||
"-Wno-unknown-pragmas",
|
||||
);
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
dependencies = (
|
||||
33AF61710965C51E00B514A9 /* PBXTargetDependency */,
|
||||
);
|
||||
@ -255,23 +211,6 @@
|
||||
33FF07FD0965C3560016AC38 /* targets in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF07D50965C3560016AC38 /* targets */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXBuildStyle section */
|
||||
33AF609C0965C4B700B514A9 /* Development */ = {
|
||||
isa = PBXBuildStyle;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = NO;
|
||||
};
|
||||
name = Development;
|
||||
};
|
||||
33AF609D0965C4B700B514A9 /* Deployment */ = {
|
||||
isa = PBXBuildStyle;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = YES;
|
||||
};
|
||||
name = Deployment;
|
||||
};
|
||||
/* End PBXBuildStyle section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
33ACA1F7097AF14400BEC3A2 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
@ -993,12 +932,6 @@
|
||||
33FFFD3F0965B1E40016AC38 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 33FFFD400965B1E40016AC38 /* Build configuration list for PBXProject "Arduino" */;
|
||||
buildSettings = {
|
||||
};
|
||||
buildStyles = (
|
||||
33AF609C0965C4B700B514A9 /* Development */,
|
||||
33AF609D0965C4B700B514A9 /* Deployment */,
|
||||
);
|
||||
hasScannedForEncodings = 0;
|
||||
mainGroup = 33FFFD3D0965B1E40016AC38;
|
||||
productRefGroup = 33FFFD3D0965B1E40016AC38;
|
||||
@ -1228,6 +1161,7 @@
|
||||
33ACA1FD097AF16500BEC3A2 /* work */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = work;
|
||||
};
|
||||
33AF616B0965C4CB00B514A9 /* Build configuration list for PBXApplicationTarget "App" */ = {
|
||||
isa = XCConfigurationList;
|
||||
@ -1235,6 +1169,7 @@
|
||||
33AF616C0965C4CB00B514A9 /* work */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = work;
|
||||
};
|
||||
33FFFD400965B1E40016AC38 /* Build configuration list for PBXProject "Arduino" */ = {
|
||||
isa = XCConfigurationList;
|
||||
@ -1242,6 +1177,7 @@
|
||||
33FFFD410965B1E40016AC38 /* work */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = work;
|
||||
};
|
||||
33FFFE1F0965BC300016AC38 /* Build configuration list for PBXAggregateTarget "Setup" */ = {
|
||||
isa = XCConfigurationList;
|
||||
@ -1249,6 +1185,7 @@
|
||||
33FFFE200965BC300016AC38 /* work */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = work;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
17
readme.txt
17
readme.txt
@ -32,15 +32,20 @@ Arduino board and point the Windows Add Hardware wizard to the FTDI USB Drivers
|
||||
directory.
|
||||
|
||||
On the Mac, mount the FTDIUSBSerialDriver_v2_0_1.dmg disk image and run the
|
||||
included FTDIUSBSerialDriver.pkg.
|
||||
|
||||
Also, on the Mac, run the macosx_setup.command (after moving the Arduino
|
||||
distribution to your /Applications folder). It corrects permission on a few
|
||||
files for use with the serial port and will prompt you for your password. You
|
||||
may need to reboot after running this script.
|
||||
included FTDIUSBSerialDriver.pkg. Also run the macosx_setup.command (after
|
||||
moving the Arduino distribution to your /Applications folder). It corrects
|
||||
permission on a few files for use with the serial port and will prompt you
|
||||
for your password. You may need to reboot after running this script.
|
||||
|
||||
UPDATES
|
||||
|
||||
0005
|
||||
|
||||
Fixed bug that sometimes caused uploading of old versions of a sketch.
|
||||
Serial monitor nows include an interface to send messages to the Arduino
|
||||
board. Pressing return appends a newline, pushing the send button doesn't.
|
||||
Now displaying "burning bootloader..." and "compiling..." status messages.
|
||||
|
||||
0004 - 2006.04.26
|
||||
|
||||
Main sketch is now compiled as C++ (instead of C).
|
||||
|
@ -1 +1 @@
|
||||
#include "wiring.h"
|
||||
#include "wiring.h"
|
||||
|
@ -14,6 +14,8 @@
|
||||
// which can be found at http://www.gnu.org/licenses/gpl.txt
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Modified by David A. Mellis, 9 July 2006.
|
||||
|
||||
#ifndef WIN32
|
||||
#include <avr/io.h>
|
||||
@ -57,7 +59,7 @@ void delay_us(unsigned short time_us)
|
||||
|
||||
// one loop takes 5 cpu cycles
|
||||
for (i=0; i < delay_loops; i++) {};
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
void delay_ms(unsigned char time_ms)
|
||||
@ -76,7 +78,7 @@ void delay_ms(unsigned char time_ms)
|
||||
:"r"(time_ms), "r"((unsigned short) (delay_count))
|
||||
);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
/*
|
||||
void timerInit(void)
|
||||
{
|
||||
@ -94,7 +96,7 @@ void timerInit(void)
|
||||
// enable interrupts
|
||||
sei();
|
||||
}
|
||||
*/
|
||||
|
||||
void timer0Init()
|
||||
{
|
||||
// initialize timer 0
|
||||
@ -104,7 +106,7 @@ void timer0Init()
|
||||
|
||||
timer0ClearOverflowCount(); // initialize time registers
|
||||
}
|
||||
|
||||
*/
|
||||
void timer1Init(void)
|
||||
{
|
||||
// initialize timer 1
|
||||
@ -125,13 +127,13 @@ void timer2Init(void)
|
||||
timer2ClearOverflowCount(); // initialize time registers
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
void timer0SetPrescaler(u08 prescale)
|
||||
{
|
||||
// set prescaler on timer 0
|
||||
outb(TCCR0, (inb(TCCR0) & ~TIMER_PRESCALE_MASK) | prescale);
|
||||
}
|
||||
|
||||
*/
|
||||
void timer1SetPrescaler(u08 prescale)
|
||||
{
|
||||
// set prescaler on timer 1
|
||||
@ -145,13 +147,13 @@ void timer2SetPrescaler(u08 prescale)
|
||||
outb(TCCR2, (inb(TCCR2) & ~TIMER_PRESCALE_MASK) | prescale);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
u16 timer0GetPrescaler(void)
|
||||
{
|
||||
// get the current prescaler setting
|
||||
return (pgm_read_word(TimerPrescaleFactor+(inb(TCCR0) & TIMER_PRESCALE_MASK)));
|
||||
}
|
||||
/*
|
||||
|
||||
u16 timer1GetPrescaler(void)
|
||||
{
|
||||
// get the current prescaler setting
|
||||
@ -188,7 +190,7 @@ void timerDetach(u08 interruptNum)
|
||||
// set the interrupt function to run nothing
|
||||
TimerIntFunc[interruptNum] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
u32 timerMsToTics(u16 ms)
|
||||
@ -206,8 +208,8 @@ u16 timerTicsToMs(u32 tics)
|
||||
// calculate the number of milliseconds in x timer tics
|
||||
return (tics*1000*(prescaleDiv*256))/F_CPU;
|
||||
}
|
||||
*/
|
||||
|
||||
*/
|
||||
/*
|
||||
void timerPause(unsigned short pause_ms)
|
||||
{
|
||||
// pauses for exactly <pause_ms> number of milliseconds
|
||||
@ -232,10 +234,10 @@ void timerPause(unsigned short pause_ms)
|
||||
|
||||
// loop until time expires
|
||||
while( ((TimerPauseReg<<8) | inb(TCNT0)) < (pause+timerThres) )
|
||||
{
|
||||
// DAM: these lines (in particular, the call to set_sleep_mode)
|
||||
// caused avr-gcc to give an error about a misplaced } in linux,
|
||||
// presumambly caused by a macro somewhere. Since they're not
|
||||
{
|
||||
// DAM: these lines (in particular, the call to set_sleep_mode)
|
||||
// caused avr-gcc to give an error about a misplaced } in linux,
|
||||
// presumambly caused by a macro somewhere. Since they're not
|
||||
// vital (and are causing problems), I'm commenting them out.
|
||||
//if( TimerPauseReg < (pause>>8));
|
||||
//{
|
||||
@ -245,16 +247,14 @@ void timerPause(unsigned short pause_ms)
|
||||
//}
|
||||
}
|
||||
|
||||
/* old inaccurate code, for reference
|
||||
// old inaccurate code, for reference
|
||||
|
||||
// calculate delay for [pause_ms] milliseconds
|
||||
u16 prescaleDiv = 1<<(pgm_read_byte(TimerPrescaleFactor+inb(TCCR0)));
|
||||
u32 pause = (pause_ms*(F_CPU/(prescaleDiv*256)))/1000;
|
||||
//u16 prescaleDiv = 1<<(pgm_read_byte(TimerPrescaleFactor+inb(TCCR0)));
|
||||
//u32 pause = (pause_ms*(F_CPU/(prescaleDiv*256)))/1000;
|
||||
|
||||
TimerPauseReg = 0;
|
||||
while(TimerPauseReg < pause);
|
||||
|
||||
*/
|
||||
//TimerPauseReg = 0;
|
||||
//while(TimerPauseReg < pause);
|
||||
}
|
||||
|
||||
void timer0ClearOverflowCount(void)
|
||||
@ -269,7 +269,7 @@ long timer0GetOverflowCount(void)
|
||||
// (this is since the last timer0ClearOverflowCount() command was called)
|
||||
return Timer0Reg0;
|
||||
}
|
||||
|
||||
*/
|
||||
#ifdef TCNT2 // support timer2 only if it exists
|
||||
void timer2ClearOverflowCount(void)
|
||||
{
|
||||
@ -282,7 +282,7 @@ long timer2GetOverflowCount(void)
|
||||
// return the current timer overflow count
|
||||
// (this is since the last timer2ClearOverflowCount() command was called)
|
||||
return Timer2Reg0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
@ -403,7 +403,7 @@ void timer1PWMBSet(u16 pwmDuty)
|
||||
//outp( (pwmDuty&0x00FF), OCR1BL); // set the low 8bits of OCR1B
|
||||
OCR1B = pwmDuty;
|
||||
}
|
||||
|
||||
/*
|
||||
//! Interrupt handler for tcnt0 overflow interrupt
|
||||
TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW0)
|
||||
{
|
||||
@ -416,7 +416,7 @@ TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW0)
|
||||
if(TimerIntFunc[TIMER0OVERFLOW_INT])
|
||||
TimerIntFunc[TIMER0OVERFLOW_INT]();
|
||||
}
|
||||
|
||||
*/
|
||||
//! Interrupt handler for tcnt1 overflow interrupt
|
||||
TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW1)
|
||||
{
|
||||
@ -438,6 +438,7 @@ TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW2)
|
||||
#endif
|
||||
|
||||
#ifdef OCR0
|
||||
/*
|
||||
// include support for Output Compare 0 for new AVR processors that support it
|
||||
//! Interrupt handler for OutputCompare0 match (OC0) interrupt
|
||||
TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE0)
|
||||
@ -446,6 +447,7 @@ TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE0)
|
||||
if(TimerIntFunc[TIMER0OUTCOMPARE_INT])
|
||||
TimerIntFunc[TIMER0OUTCOMPARE_INT]();
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
//! Interrupt handler for CutputCompare1A match (OC1A) interrupt
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
wiring.c - Wiring API Partial Implementation
|
||||
Part of Arduino - http://arduino.berlios.de/
|
||||
wiring.c - Partial implementation of the Wiring API for the ATmega8.
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2005-2006 David A. Mellis
|
||||
|
||||
@ -48,6 +48,10 @@
|
||||
|
||||
#include "wiring.h"
|
||||
|
||||
// The number of times timer 0 has overflowed since the program started.
|
||||
// Must be volatile or gcc will optimize away some uses of it.
|
||||
volatile unsigned long timer0_overflow_count;
|
||||
|
||||
// Get the hardware port of the given virtual pin number. This comes from
|
||||
// the pins_*.c file for the active board configuration.
|
||||
int digitalPinToPort(int pin)
|
||||
@ -315,19 +319,30 @@ void print(const char *format, ...)
|
||||
}
|
||||
*/
|
||||
|
||||
TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW0)
|
||||
{
|
||||
timer0_overflow_count++;
|
||||
}
|
||||
|
||||
unsigned long millis()
|
||||
{
|
||||
// timer 0 increments every timer0GetPrescaler() cycles, and
|
||||
// overflows when it reaches 256. we calculate the total
|
||||
// number of clock cycles, then divide by the number of clock
|
||||
// cycles per millisecond.
|
||||
return (unsigned long) timer0GetOverflowCount() *
|
||||
timer0GetPrescaler() * 2UL / (F_CPU / 128000UL);
|
||||
// timer 0 increments every 8 cycles, and overflows when it reaches 256.
|
||||
// we calculate the total number of clock cycles, then divide by the
|
||||
// number of clock cycles per millisecond.
|
||||
//return timer0_overflow_count * 8UL * 256UL / (F_CPU / 1000UL);
|
||||
|
||||
// calculating the total number of clock cycles overflows an
|
||||
// unsigned long, so instead find 1/128th the number of clock cycles
|
||||
// and divide by 1/128th the number of clock cycles per millisecond.
|
||||
return timer0_overflow_count * 8UL * 2UL / (F_CPU / 128000UL);
|
||||
}
|
||||
|
||||
void delay(unsigned long ms)
|
||||
{
|
||||
timerPause(ms);
|
||||
unsigned long start = millis();
|
||||
|
||||
while (millis() - start < ms)
|
||||
;
|
||||
}
|
||||
|
||||
/* Delay for the given number of microseconds. Assumes a 16 MHz clock.
|
||||
@ -389,7 +404,7 @@ unsigned long pulseIn(int pin, int state)
|
||||
{
|
||||
// cache the port and bit of the pin in order to speed up the
|
||||
// pulse width measuring loop and achieve finer resolution. calling
|
||||
// digitalWrite() instead yields much coarser resolution.
|
||||
// digitalRead() instead yields much coarser resolution.
|
||||
int r = port_to_input[digitalPinToPort(pin)];
|
||||
int bit = digitalPinToBit(pin);
|
||||
int mask = 1 << bit;
|
||||
@ -423,7 +438,12 @@ int main(void)
|
||||
sei();
|
||||
|
||||
// timer 0 is used for millis() and delay()
|
||||
timer0Init();
|
||||
//timer0Init();
|
||||
timer0_overflow_count = 0;
|
||||
// set timer 0 prescale factor to 8
|
||||
sbi(TCCR0, CS01);
|
||||
// enable timer 0 overflow interrupt
|
||||
sbi(TIMSK, TOIE0);
|
||||
|
||||
// timers 1 & 2 are used for the hardware pwm
|
||||
timer1Init();
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*
|
||||
wiring.h - Wiring API Partial Implementation
|
||||
Part of Arduino / Wiring Lite
|
||||
wiring.h - Partial implementation of the Wiring API for the ATmega8.
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2005 David A. Mellis
|
||||
Copyright (c) 2005-2006 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
@ -55,9 +55,6 @@ extern "C"{
|
||||
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
||||
#define sq(x) ((x)*(x))
|
||||
|
||||
#define NOT_A_PIN 0
|
||||
#define NOT_A_PORT -1
|
||||
|
||||
typedef uint8_t boolean;
|
||||
typedef uint8_t byte;
|
||||
|
||||
@ -82,7 +79,6 @@ void printBinary(unsigned long n);
|
||||
|
||||
unsigned long millis(void);
|
||||
void delay(unsigned long);
|
||||
void delay_ms(unsigned short ms);
|
||||
void delayMicroseconds(unsigned int us);
|
||||
unsigned long pulseIn(int pin, int state);
|
||||
|
||||
@ -90,6 +86,9 @@ void setup(void);
|
||||
void loop(void);
|
||||
|
||||
// XXX: internal definitions, should be moved to another header file
|
||||
#define NOT_A_PIN 0
|
||||
#define NOT_A_PORT -1
|
||||
|
||||
typedef struct {
|
||||
int port;
|
||||
int bit;
|
||||
|
@ -129,7 +129,9 @@ void Matrix::setRegister(uint8_t reg, uint8_t data)
|
||||
void Matrix::syncRow(uint8_t row)
|
||||
{
|
||||
if (!_buffer) return;
|
||||
if (row < 0 || row >= 8) return;
|
||||
|
||||
// uint8_t's can't be negative, so don't test for negative row
|
||||
if (row >= 8) return;
|
||||
digitalWrite(_pinLoad, HIGH); // begin
|
||||
for(uint8_t i = 0; i < _screens; ++i){
|
||||
putByte(8 - row); // specify register
|
||||
@ -162,7 +164,9 @@ void Matrix::setBrightness(uint8_t value)
|
||||
void Matrix::buffer(uint8_t x, uint8_t y, uint8_t value)
|
||||
{
|
||||
if (!_buffer) return;
|
||||
if (x < 0 || x >= _maximumX || y < 0 || y >= 8) return;
|
||||
|
||||
// uint8_t's can't be negative, so don't test for negative x and y.
|
||||
if (x >= _maximumX || y >= 8) return;
|
||||
|
||||
uint8_t offset = x; // record x
|
||||
x %= 8; // make x relative to a single matrix
|
||||
|
@ -75,7 +75,9 @@ uint8_t Sprite::height() const
|
||||
void Sprite::write(uint8_t x, uint8_t y, uint8_t value)
|
||||
{
|
||||
if (!_buffer) return;
|
||||
if (x < 0 || x >= _width || y < 0 || y >= _height) return;
|
||||
|
||||
// uint8_t's can't be negative, so don't test for negative x and y.
|
||||
if (x >= _width || y >= _height) return;
|
||||
|
||||
// we need to bitwise-or the value of the other pixels in the byte with
|
||||
// the new value, masked and shifted into the proper bits.
|
||||
@ -85,7 +87,9 @@ void Sprite::write(uint8_t x, uint8_t y, uint8_t value)
|
||||
uint8_t Sprite::read(uint8_t x, uint8_t y) const
|
||||
{
|
||||
if (!_buffer) return 0;
|
||||
if (x < 0 || x >= _width || y < 0 || y >= _height) return 0;
|
||||
|
||||
// uint8_t's can't be negative, so don't test for negative x and y.
|
||||
if (x >= _width || y >= _height) return 0;
|
||||
|
||||
return (_buffer[y] >> x) & 0x01;
|
||||
}
|
||||
}
|
||||
|
@ -45,4 +45,4 @@ class Sprite
|
||||
uint8_t read(uint8_t x, uint8_t y) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -512,4 +512,4 @@
|
||||
#define B11111110 254
|
||||
#define B11111111 255
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user