Created Rowley Crossworks AVR project for BDK port to ATmega644p.
This commit is contained in:
@@ -43,7 +43,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct analog_input_descr {
|
||||
uint8_t Event_State:3;
|
||||
unsigned Event_State:3;
|
||||
float Present_Value;
|
||||
BACNET_RELIABILITY Reliability;
|
||||
bool Out_Of_Service;
|
||||
@@ -54,9 +54,9 @@ extern "C" {
|
||||
float High_Limit;
|
||||
float Low_Limit;
|
||||
float Deadband;
|
||||
uint8_t Limit_Enable:2;
|
||||
uint8_t Event_Enable:3;
|
||||
uint8_t Notify_Type:1;
|
||||
unsigned Limit_Enable:2;
|
||||
unsigned Event_Enable:3;
|
||||
unsigned Notify_Type:1;
|
||||
ACKED_INFO Acked_Transitions[MAX_BACNET_EVENT_TRANSITION];
|
||||
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
|
||||
/* time to generate event notification */
|
||||
|
||||
@@ -44,7 +44,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct analog_value_descr {
|
||||
uint8_t Event_State:3;
|
||||
unsigned Event_State:3;
|
||||
bool Out_Of_Service;
|
||||
uint8_t Units;
|
||||
/* Here is our Priority Array. They are supposed to be Real, but */
|
||||
@@ -58,9 +58,9 @@ extern "C" {
|
||||
float High_Limit;
|
||||
float Low_Limit;
|
||||
float Deadband;
|
||||
uint8_t Limit_Enable:2;
|
||||
uint8_t Event_Enable:3;
|
||||
uint8_t Notify_Type:1;
|
||||
unsigned Limit_Enable:2;
|
||||
unsigned Event_Enable:3;
|
||||
unsigned Notify_Type:1;
|
||||
ACKED_INFO Acked_Transitions[MAX_BACNET_EVENT_TRANSITION];
|
||||
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
|
||||
/* time to generate event notification */
|
||||
|
||||
@@ -1243,10 +1243,10 @@ typedef enum {
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
MAX_BACNET_ABORT_REASON = 5,
|
||||
FIRST_PROPRIETARY_ABORT_REASON = 64,
|
||||
LAST_PROPRIETARY_ABORT_REASON = 65535
|
||||
MAX_BACNET_ABORT_REASON = 5
|
||||
} BACNET_ABORT_REASON;
|
||||
#define FIRST_PROPRIETARY_ABORT_REASON 64
|
||||
#define LAST_PROPRIETARY_ABORT_REASON 65535
|
||||
|
||||
typedef enum {
|
||||
REJECT_REASON_OTHER = 0,
|
||||
@@ -1262,10 +1262,10 @@ typedef enum {
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
MAX_BACNET_REJECT_REASON = 10,
|
||||
FIRST_PROPRIETARY_REJECT_REASON = 64,
|
||||
LAST_PROPRIETARY_REJECT_REASON = 65535
|
||||
MAX_BACNET_REJECT_REASON = 10
|
||||
} BACNET_REJECT_REASON;
|
||||
#define FIRST_PROPRIETARY_REJECT_REASON 64
|
||||
#define LAST_PROPRIETARY_REJECT_REASON 65535
|
||||
|
||||
typedef enum {
|
||||
ERROR_CLASS_DEVICE = 0,
|
||||
@@ -1279,10 +1279,10 @@ typedef enum {
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
MAX_BACNET_ERROR_CLASS = 8,
|
||||
FIRST_PROPRIETARY_ERROR_CLASS = 64,
|
||||
LAST_PROPRIETARY_ERROR_CLASS = 65535
|
||||
MAX_BACNET_ERROR_CLASS = 8
|
||||
} BACNET_ERROR_CLASS;
|
||||
#define FIRST_PROPRIETARY_ERROR_CLASS 64
|
||||
#define LAST_PROPRIETARY_ERROR_CLASS 65535
|
||||
|
||||
/* These are sorted in the order given in
|
||||
Clause 18. ERROR, REJECT AND ABORT CODES
|
||||
@@ -1395,14 +1395,14 @@ typedef enum {
|
||||
ERROR_CODE_UNKNOWN_FILE_SIZE = 81,
|
||||
ERROR_CODE_BUSY = 82,
|
||||
ERROR_CODE_COMMUNICATION_DISABLED = 83,
|
||||
MAX_BACNET_ERROR_CODE = 84,
|
||||
MAX_BACNET_ERROR_CODE = 84
|
||||
/* Enumerated values 0-255 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 256-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
/* The last enumeration used in this version is 50. */
|
||||
FIRST_PROPRIETARY_ERROR_CODE = 256,
|
||||
LAST_PROPRIETARY_ERROR_CODE = 65535
|
||||
} BACNET_ERROR_CODE;
|
||||
#define FIRST_PROPRIETARY_ERROR_CODE 256
|
||||
#define LAST_PROPRIETARY_ERROR_CODE 65535
|
||||
|
||||
typedef enum {
|
||||
BACNET_REINIT_COLDSTART = 0,
|
||||
|
||||
@@ -52,12 +52,11 @@
|
||||
static volatile uint16_t Sample_Result[ADC_CHANNELS_MAX];
|
||||
static volatile uint8_t Enabled_Channels;
|
||||
|
||||
/* forward prototype */
|
||||
ISR(ADC_vect);
|
||||
|
||||
ISR(ADC_vect)
|
||||
{
|
||||
uint8_t index;
|
||||
uint8_t mask;
|
||||
uint8_t channels;
|
||||
uint16_t value = 0;
|
||||
|
||||
/* determine which conversion finished */
|
||||
@@ -66,13 +65,18 @@ ISR(ADC_vect)
|
||||
value = ADCL;
|
||||
value |= (ADCH << 8);
|
||||
Sample_Result[index] = value;
|
||||
channels = Enabled_Channels;
|
||||
__enable_interrupt();
|
||||
/* clear the mux */
|
||||
BITMASK_CLEAR(ADMUX, ((1 << MUX2) | (1 << MUX1) | (1 << MUX0)));
|
||||
/* find the next channel */
|
||||
while (Enabled_Channels) {
|
||||
index = (index + 1) % ADC_CHANNELS_MAX;
|
||||
if (BIT_CHECK(Enabled_Channels, index)) {
|
||||
/* find the next enabled channel */
|
||||
while (channels) {
|
||||
index++;
|
||||
if (index >= ADC_CHANNELS_MAX) {
|
||||
index = 0;
|
||||
}
|
||||
mask = 1 << index;
|
||||
if (channels & mask) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<!DOCTYPE CrossStudio_Project_File>
|
||||
<solution Name="bacnet" version="2">
|
||||
<project Name="bacnet">
|
||||
<configuration Name="Common" Platform="AVR" Target="ATmega644P" avr_architecture="V2E" avr_debug_interface="JTAG" avr_flash_size="128K" build_use_hardware_multiplier="Yes" c_preprocessor_definitions="BACDL_MSTP;MAX_APDU=128;BIG_ENDIAN=0;MAX_TSM_TRANSACTIONS=0;BACAPP_BOOLEAN;BACAPP_REAL;BACAPP_OBJECT_ID;BACAPP_UNSIGNED;BACAPP_ENUMERATED;BACAPP_CHARACTER_STRING;WRITE_PROPERTY" c_user_include_directories="$(ProjectDir);$(ProjectDir)/crossworks;$(ProjectDir)/../../include;$(ProjectDir)/../../demo/handler;$(ProjectDir)/../../demo/object" linker_call_stack_size="1024" linker_memory_map_file="$(PackagesDir)/targets/avr/ATmega644P.xml" project_directory="" project_type="Executable"/>
|
||||
<folder Name="Source Files">
|
||||
<configuration Name="Common" filter="c;h;s;asm;inc;s90"/>
|
||||
<file file_name="adc.c">
|
||||
<configuration Name="Common" c_user_include_directories="."/>
|
||||
</file>
|
||||
<file file_name="ai.c"/>
|
||||
<file file_name="av.c"/>
|
||||
<file file_name="bacnet.c"/>
|
||||
<file file_name="bi.c"/>
|
||||
<file file_name="bname.c"/>
|
||||
<file file_name="bo.c"/>
|
||||
<file file_name="device.c"/>
|
||||
<file file_name="dlmstp.c"/>
|
||||
<file file_name="eeprom.c"/>
|
||||
<file file_name="init.c"/>
|
||||
<file file_name="input.c"/>
|
||||
<file file_name="led.c"/>
|
||||
<file file_name="main.c"/>
|
||||
<file file_name="rs485.c"/>
|
||||
<file file_name="seeprom.c"/>
|
||||
<file file_name="serial.c"/>
|
||||
<file file_name="stack.c"/>
|
||||
<file file_name="test.c"/>
|
||||
<file file_name="timer2.c"/>
|
||||
<file file_name="timer.c"/>
|
||||
<file file_name="watchdog.c"/>
|
||||
</folder>
|
||||
<folder Name="System Files" file_name="">
|
||||
<configuration Name="Common" filter="xml"/>
|
||||
<file file_name="$(StudioDir)/src/crt0.asm"/>
|
||||
</folder>
|
||||
<folder Name="BACnet - default handlers">
|
||||
<file file_name="../../demo/handler/h_dcc.c"/>
|
||||
<file file_name="../../demo/handler/h_npdu.c"/>
|
||||
<file file_name="../../demo/handler/h_rd.c"/>
|
||||
<file file_name="../../demo/handler/h_rp.c"/>
|
||||
<file file_name="../../demo/handler/h_rpm.c"/>
|
||||
<file file_name="../../demo/handler/h_whohas.c"/>
|
||||
<file file_name="../../demo/handler/h_whois.c"/>
|
||||
<file file_name="../../demo/handler/h_wp.c"/>
|
||||
<file file_name="../../demo/handler/noserv.c"/>
|
||||
<file file_name="../../demo/handler/s_iam.c"/>
|
||||
<file file_name="../../demo/handler/s_ihave.c"/>
|
||||
<file file_name="../../demo/handler/txbuf.c"/>
|
||||
</folder>
|
||||
<folder Name="BACnet - core">
|
||||
<file file_name="../../src/abort.c"/>
|
||||
<file file_name="../../src/apdu.c"/>
|
||||
<file file_name="../../src/bacaddr.c"/>
|
||||
<file file_name="../../src/bacapp.c"/>
|
||||
<file file_name="../../src/bacdcode.c"/>
|
||||
<file file_name="../../src/bacerror.c"/>
|
||||
<file file_name="../../src/bacint.c"/>
|
||||
<file file_name="../../src/bacreal.c"/>
|
||||
<file file_name="../../src/bacstr.c"/>
|
||||
<file file_name="../../src/crc.c"/>
|
||||
<file file_name="../../src/dcc.c"/>
|
||||
<file file_name="../../src/fifo.c"/>
|
||||
<file file_name="../../src/iam.c"/>
|
||||
<file file_name="../../src/ihave.c"/>
|
||||
<file file_name="../../src/memcopy.c"/>
|
||||
<file file_name="../../src/npdu.c"/>
|
||||
<file file_name="../../src/rd.c"/>
|
||||
<file file_name="../../src/reject.c"/>
|
||||
<file file_name="../../src/ringbuf.c"/>
|
||||
<file file_name="../../src/rp.c"/>
|
||||
<file file_name="../../src/rpm.c"/>
|
||||
<file file_name="../../src/whohas.c"/>
|
||||
<file file_name="../../src/whois.c"/>
|
||||
<file file_name="../../src/wp.c"/>
|
||||
</folder>
|
||||
</project>
|
||||
<configuration Name="AVR Debug" inherited_configurations="AVR;Debug"/>
|
||||
<configuration Name="AVR" Platform="AVR" hidden="Yes"/>
|
||||
<configuration Name="Debug" build_debug_information="Yes" hidden="Yes"/>
|
||||
<configuration Name="AVR Release" inherited_configurations="AVR;Release"/>
|
||||
<configuration Name="Release" build_debug_information="No" c_preprocessor_definitions="NDEBUG" hidden="Yes" optimize_block_locality="Yes" optimize_copy_propagation="Yes" optimize_cross_calling="Standard" optimize_cross_jumping="Yes" optimize_dead_code="Yes" optimize_jump_chaining="Yes" optimize_jump_threading="Yes" optimize_tail_merging="Yes"/>
|
||||
</solution>
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef STDBOOL_H
|
||||
#define STDBOOL_H
|
||||
|
||||
/* C99 Boolean types for compilers without C99 support */
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef char _Bool;
|
||||
#ifndef bool
|
||||
#define bool _Bool
|
||||
#endif
|
||||
#ifndef true
|
||||
#define true 1
|
||||
#endif
|
||||
#ifndef false
|
||||
#define false 0
|
||||
#endif
|
||||
#define __bool_true_false_are_defined 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -30,16 +30,25 @@
|
||||
#define F_CPU 18432000UL
|
||||
#endif
|
||||
|
||||
/* IAR compiler specific configuration */
|
||||
#if defined(__ICCAVR__)
|
||||
#include <iom644p.h>
|
||||
#endif
|
||||
|
||||
/* AVR-GCC compiler specific configuration */
|
||||
#if defined(__GNUC__)
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
#if !defined(__AVR_ATmega644P__)
|
||||
#error Firmware is configured for ATmega644P only (-mmcu=atmega644p)
|
||||
#endif
|
||||
/* GCC specific configuration */
|
||||
#include <avr/wdt.h>
|
||||
#endif
|
||||
|
||||
#if defined (__CROSSWORKS_AVR)
|
||||
#include <avr.h>
|
||||
#if (__TARGET_PROCESSOR != ATmega644P)
|
||||
#error Firmware is configured for ATmega644P only
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "iar2gcc.h"
|
||||
|
||||
@@ -34,13 +34,21 @@
|
||||
#ifndef IAR2GCC_H
|
||||
#define IAR2GCC_H
|
||||
|
||||
/* common embedded extensions for different compilers */
|
||||
|
||||
#if !defined(F_CPU)
|
||||
#error You must define F_CPU - clock frequency!
|
||||
#endif
|
||||
|
||||
#if defined (__CROSSWORKS_AVR)
|
||||
#include <inavr.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
/* IAR */
|
||||
#if defined(__ICCAVR__)
|
||||
#include <inavr.h>
|
||||
#include <intrinsics.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* inline function */
|
||||
@@ -57,6 +65,52 @@ static inline void _delay_us(
|
||||
#include <util/delay.h>
|
||||
#endif
|
||||
|
||||
/* adjust some definitions to common versions */
|
||||
#if defined (__CROSSWORKS_AVR)
|
||||
#if (__TARGET_PROCESSOR == ATmega644P)
|
||||
#define PRR PRR0
|
||||
#define UBRR0 UBRR0W
|
||||
#define UBRR1 UBRR1W
|
||||
|
||||
#define PA0 PORTA0
|
||||
#define PA1 PORTA1
|
||||
#define PA2 PORTA2
|
||||
#define PA3 PORTA3
|
||||
#define PA4 PORTA4
|
||||
#define PA5 PORTA5
|
||||
#define PA6 PORTA6
|
||||
#define PA7 PORTA7
|
||||
|
||||
#define PB0 PORTB0
|
||||
#define PB1 PORTB1
|
||||
#define PB2 PORTB2
|
||||
#define PB3 PORTB3
|
||||
#define PB4 PORTB4
|
||||
#define PB5 PORTB5
|
||||
#define PB6 PORTB6
|
||||
#define PB7 PORTB7
|
||||
|
||||
#define PC0 PORTC0
|
||||
#define PC1 PORTC1
|
||||
#define PC2 PORTC2
|
||||
#define PC3 PORTC3
|
||||
#define PC4 PORTC4
|
||||
#define PC5 PORTC5
|
||||
#define PC6 PORTC6
|
||||
#define PC7 PORTC7
|
||||
|
||||
#define PD0 PORTD0
|
||||
#define PD1 PORTD1
|
||||
#define PD2 PORTD2
|
||||
#define PD3 PORTD3
|
||||
#define PD4 PORTD4
|
||||
#define PD5 PORTD5
|
||||
#define PD6 PORTD6
|
||||
#define PD7 PORTD7
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Input/Output Registers */
|
||||
#if defined(__GNUC__)
|
||||
#include <avr/io.h>
|
||||
@@ -195,24 +249,27 @@ typedef struct {
|
||||
#if defined(__ICCAVR__)
|
||||
#define PRAGMA(x) _Pragma( #x )
|
||||
#define ISR(vec) PRAGMA( vector=vec ) __interrupt void handler_##vec(void)
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#elif defined(__GNUC__)
|
||||
#include <avr/interrupt.h>
|
||||
#elif defined (__CROSSWORKS_AVR)
|
||||
#define ISR(vec) void handler_##vec(void) __interrupt[vec]
|
||||
#else
|
||||
#error ISR() not defined!
|
||||
#endif
|
||||
|
||||
/* Flash */
|
||||
#if defined(__ICCAVR__)
|
||||
#define FLASH_DECLARE(x) __flash x
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#elif defined(__GNUC__)
|
||||
#define FLASH_DECLARE(x) x __attribute__((__progmem__))
|
||||
#elif defined (__CROSSWORKS_AVR)
|
||||
#define FLASH_DECLARE (x) const __code x
|
||||
#endif
|
||||
|
||||
/* EEPROM */
|
||||
#if defined(__ICCAVR__)
|
||||
#define EEPROM_DECLARE(x) __eeprom x
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#elif defined(__GNUC__)
|
||||
#include <avr/eeprom.h>
|
||||
#define EEPROM_DECLARE(x) x __attribute__((section (".eeprom")))
|
||||
#if ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)) || \
|
||||
@@ -221,6 +278,14 @@ typedef struct {
|
||||
#define __EEPUT _EEPUT
|
||||
#define __EEGET _EEGET
|
||||
#endif
|
||||
#elif defined (__CROSSWORKS_AVR)
|
||||
/* use functions defined in crt0.s to mimic IAR macros */
|
||||
void __uint8_eeprom_store(unsigned char byte, unsigned addr);
|
||||
unsigned char __uint8_eeprom_load(unsigned addr);
|
||||
#define __EEPUT(addr, var) \
|
||||
__uint8_eeprom_store((unsigned char)(var), (unsigned)(addr))
|
||||
#define __EEGET(var, addr) \
|
||||
(var) = __uint8_eeprom_load((unsigned)(addr))
|
||||
#endif
|
||||
|
||||
/* IAR intrinsic routines */
|
||||
@@ -231,9 +296,8 @@ typedef struct {
|
||||
#define __root
|
||||
#endif
|
||||
|
||||
|
||||
/* watchdog */
|
||||
#if defined(__ICCAVR__)
|
||||
/* watchdog defines in GCC */
|
||||
#if defined(__ICCAVR__) || defined(__CROSSWORKS_AVR)
|
||||
#define WDTO_15MS 0
|
||||
#define WDTO_30MS 1
|
||||
#define WDTO_60MS 2
|
||||
@@ -244,4 +308,8 @@ typedef struct {
|
||||
#define WDTO_2S 7
|
||||
#endif
|
||||
|
||||
#if defined(__CROSSWORKS_AVR)
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -96,13 +96,13 @@ bool led_state(
|
||||
{
|
||||
switch (index) {
|
||||
case 0:
|
||||
return (BIT_CHECK(PIND, PD7));
|
||||
return (BIT_CHECK(PIND, PIND7));
|
||||
case 1:
|
||||
return (BIT_CHECK(PIND, PD6));
|
||||
return (BIT_CHECK(PIND, PIND6));
|
||||
case 2:
|
||||
return (BIT_CHECK(PINC, PC7));
|
||||
return (BIT_CHECK(PINC, PINC7));
|
||||
case 3:
|
||||
return (BIT_CHECK(PINC, PC6));
|
||||
return (BIT_CHECK(PINC, PINC6));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -39,9 +39,10 @@
|
||||
#include "bacnet.h"
|
||||
#include "test.h"
|
||||
#include "watchdog.h"
|
||||
#include "version.h"
|
||||
|
||||
/* local version override */
|
||||
char *BACnet_Version = "1.0";
|
||||
/* global - currently the version of the stack */
|
||||
char *BACnet_Version = BACNET_VERSION_TEXT;
|
||||
|
||||
/* For porting to IAR, see:
|
||||
http://www.avrfreaks.net/wiki/index.php/Documentation:AVR_GCC/IarToAvrgcc*/
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
/* me */
|
||||
#include "rs485.h"
|
||||
|
||||
/* forward prototype */
|
||||
ISR(USART0_RX_vect);
|
||||
/* baud rate */
|
||||
static uint32_t Baud_Rate = 9600;
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
/* baud rate */
|
||||
static uint32_t Baud_Rate = 9600;
|
||||
/* forward prototype */
|
||||
ISR(USART1_RX_vect);
|
||||
|
||||
/* buffer for storing received bytes - size must be power of two */
|
||||
static uint8_t Receive_Buffer_Data[128];
|
||||
|
||||
@@ -26,31 +26,7 @@
|
||||
/* me */
|
||||
#include "stack.h"
|
||||
|
||||
#if defined(__ICCAVR__)
|
||||
void stack_init(
|
||||
void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
unsigned stack_size(
|
||||
void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t stack_byte(
|
||||
unsigned offset)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned stack_unused(
|
||||
void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#if defined(__GNUC__)
|
||||
/* stack checking */
|
||||
extern uint8_t _end;
|
||||
extern uint8_t __stack;
|
||||
@@ -105,4 +81,28 @@ unsigned stack_unused(
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#else
|
||||
void stack_init(
|
||||
void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
unsigned stack_size(
|
||||
void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t stack_byte(
|
||||
unsigned offset)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned stack_unused(
|
||||
void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,9 +30,11 @@
|
||||
#error "F_CPU must be defined for Timer configuration."
|
||||
#endif
|
||||
/* Timer2 Prescaling: 1, 8, 32, 64, 128, 256, or 1024 */
|
||||
#define TIMER_MICROSECONDS 1000
|
||||
#define TIMER_TICKS(p) ((((F_CPU)/(p)/1000)*(TIMER_MICROSECONDS))/1000)
|
||||
#define TIMER_TICKS_MAX 0xff
|
||||
#define TIMER_MICROSECONDS 1000UL
|
||||
#define TIMER_TICKS(p) \
|
||||
(((((F_CPU)/(p))/1000UL) \
|
||||
*(TIMER_MICROSECONDS))/1000UL)
|
||||
#define TIMER_TICKS_MAX 255UL
|
||||
/* adjust the prescaler for the processor clock */
|
||||
#if (TIMER_TICKS(1) <= TIMER_TICKS_MAX)
|
||||
#define TIMER2_PRESCALER 1
|
||||
@@ -58,8 +60,6 @@
|
||||
/* counter for the the timer which wraps every 49.7 days */
|
||||
static volatile uint32_t Millisecond_Counter;
|
||||
static volatile uint8_t Millisecond_Counter_Byte;
|
||||
/* forward prototype */
|
||||
ISR(TIMER2_OVF_vect);
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Timer Interrupt Handler
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
#include "hardware.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
#if defined(__ICCAVR__)
|
||||
#include <intrinsics.h>
|
||||
#if !defined(__GNUC__)
|
||||
static inline void wdt_enable(
|
||||
int value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user