00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef ATMEGA668
00024 #define ATMEGA668
00025
00026 #include "avrdevice.h"
00027 #include "hardware.h"
00028 #include "rwmem.h"
00029 #include "externalirq.h"
00030 #include "hwuart.h"
00031 #include "hwad.h"
00032 #include "hwport.h"
00033 #include "hwspi.h"
00034 #include "hwtimer/timerprescaler.h"
00035 #include "hwtimer/hwtimer.h"
00036
00041 class AvrDevice_atmega668base: public AvrDevice {
00042
00043 protected:
00044 Pin aref;
00045 Pin adc6;
00046 Pin adc7;
00047 HWPort portb;
00048 HWPort portc;
00049 HWPort portd;
00050 IOSpecialReg gtccr_reg;
00051 IOSpecialReg assr_reg;
00052 HWPrescaler prescaler01;
00053 HWPrescalerAsync prescaler2;
00054 ExternalIRQHandler* extirq01;
00055 IOSpecialReg* eicra_reg;
00056 IOSpecialReg* eimsk_reg;
00057 IOSpecialReg* eifr_reg;
00058 ExternalIRQHandler* extirqpc;
00059 IOSpecialReg* pcicr_reg;
00060 IOSpecialReg* pcifr_reg;
00061 IOSpecialReg* pcmsk0_reg;
00062 IOSpecialReg* pcmsk1_reg;
00063 IOSpecialReg* pcmsk2_reg;
00064 HWAdmux admux;
00065 HWAd* ad;
00066 HWSpi* spi;
00067 HWUsart* usart0;
00068 TimerIRQRegister* timerIrq0;
00069 HWTimer8_2C* timer0;
00070 ICaptureSource* inputCapture1;
00071 TimerIRQRegister* timerIrq1;
00072 HWTimer16_2C3* timer1;
00073 TimerIRQRegister* timerIrq2;
00074 HWTimer8_2C* timer2;
00075 GPIORegister* gpior0_reg;
00076 GPIORegister* gpior1_reg;
00077 GPIORegister* gpior2_reg;
00078
00079 public:
00080
00085 AvrDevice_atmega668base(unsigned ram_bytes, unsigned flash_bytes,
00086 unsigned ee_bytes );
00087
00088 ~AvrDevice_atmega668base();
00089
00090 };
00091
00093 class AvrDevice_atmega328: public AvrDevice_atmega668base {
00094 public:
00096 AvrDevice_atmega328() : AvrDevice_atmega668base(2 * 1024, 32 * 1024, 1024) {}
00097 };
00098
00100 class AvrDevice_atmega168: public AvrDevice_atmega668base {
00101 public:
00103 AvrDevice_atmega168() : AvrDevice_atmega668base(1024, 16 * 1024, 512) {}
00104 };
00105
00107 class AvrDevice_atmega88:public AvrDevice_atmega668base {
00108 public:
00110 AvrDevice_atmega88() : AvrDevice_atmega668base(1024, 8 * 1024, 512) {}
00111 };
00112
00114 class AvrDevice_atmega48:public AvrDevice_atmega668base {
00115 public:
00117 AvrDevice_atmega48() : AvrDevice_atmega668base(512, 4 * 1024, 256) {}
00118 };
00119
00120 #endif