mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-01 03:47:23 +03:00
[sam] adding untested production test firmware
This commit is contained in:
23
hardware/sam/cores/sam/prod_test_due/build_gcc/Makefile
Normal file
23
hardware/sam/cores/sam/prod_test_due/build_gcc/Makefile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Rules
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
all: prod_test_due
|
||||||
|
|
||||||
|
.PHONY: prod_test_due
|
||||||
|
prod_test_due:
|
||||||
|
@echo --- Making prod_test_due
|
||||||
|
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f prod_test_due.mk
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
@echo --- Cleaning prod_test_due
|
||||||
|
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f prod_test_due.mk $@
|
||||||
|
|
||||||
|
.PHONY: debug
|
||||||
|
debug:
|
||||||
|
@echo --- Debugging prod_test_due
|
||||||
|
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f prod_test_due.mk $@
|
||||||
|
|
7
hardware/sam/cores/sam/prod_test_due/build_gcc/debug.mk
Normal file
7
hardware/sam/cores/sam/prod_test_due/build_gcc/debug.mk
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Optimization level
|
||||||
|
# -O1 Optimize
|
||||||
|
# -O2 Optimize even more
|
||||||
|
# -O3 Optimize yet more
|
||||||
|
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||||
|
# -Os Optimize for size
|
||||||
|
OPTIMIZATION = -g -O0 -DDEBUG
|
62
hardware/sam/cores/sam/prod_test_due/build_gcc/gcc.mk
Normal file
62
hardware/sam/cores/sam/prod_test_due/build_gcc/gcc.mk
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
|
||||||
|
# Tool suffix when cross-compiling
|
||||||
|
#CROSS_COMPILE = ../../../../tools/CodeSourcery_arm/bin/arm-none-eabi-
|
||||||
|
#CROSS_COMPILE = C:/CodeSourcery_2011.03-42/bin/arm-none-eabi-
|
||||||
|
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
|
||||||
|
|
||||||
|
# Compilation tools
|
||||||
|
AR = $(CROSS_COMPILE)ar
|
||||||
|
CC = $(CROSS_COMPILE)gcc
|
||||||
|
CXX = $(CROSS_COMPILE)g++
|
||||||
|
AS = $(CROSS_COMPILE)as
|
||||||
|
GDB = $(CROSS_COMPILE)gdb
|
||||||
|
SIZE = $(CROSS_COMPILE)size
|
||||||
|
NM = $(CROSS_COMPILE)nm
|
||||||
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||||
|
RM=cs-rm -Rf
|
||||||
|
SEP=\\
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------------------
|
||||||
|
# C Flags
|
||||||
|
|
||||||
|
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
|
||||||
|
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
|
||||||
|
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||||
|
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||||
|
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
|
||||||
|
CFLAGS += -Wsign-compare -Waggregate-return -Wstrict-prototypes
|
||||||
|
CFLAGS += -Wmissing-prototypes -Wmissing-declarations
|
||||||
|
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||||
|
CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
|
||||||
|
CFLAGS += -Wunreachable-code
|
||||||
|
CFLAGS += -Wcast-align
|
||||||
|
|
||||||
|
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -nostdlib
|
||||||
|
CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT)
|
||||||
|
|
||||||
|
# To reduce application size use only integer printf function.
|
||||||
|
CFLAGS += -Dprintf=iprintf
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------------------
|
||||||
|
# CPP Flags
|
||||||
|
|
||||||
|
CPPFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2
|
||||||
|
CPPFLAGS += -Wmain -Wparentheses -Wcast-align -Wunreachable-code
|
||||||
|
CPPFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||||
|
CPPFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||||
|
CPPFLAGS += -Wshadow -Wpointer-arith -Wwrite-strings
|
||||||
|
CPPFLAGS += -Wsign-compare -Waggregate-return -Wmissing-declarations
|
||||||
|
CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||||
|
CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long
|
||||||
|
|
||||||
|
#-fno-rtti -fno-exceptions
|
||||||
|
CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections
|
||||||
|
CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
|
||||||
|
|
||||||
|
# To reduce application size use only integer printf function.
|
||||||
|
CPPFLAGS += -Dprintf=iprintf
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------------------
|
||||||
|
# ASM Flags
|
||||||
|
|
||||||
|
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES)
|
165
hardware/sam/cores/sam/prod_test_due/build_gcc/prod_test_due.mk
Normal file
165
hardware/sam/cores/sam/prod_test_due/build_gcc/prod_test_due.mk
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
# Makefile for compiling libArduino
|
||||||
|
.SUFFIXES: .o .a .c .s
|
||||||
|
|
||||||
|
# putting default variant
|
||||||
|
ifeq ("$(VARIANT)", "")
|
||||||
|
#VARIANT=sam3s_ek
|
||||||
|
VARIANT=sam3u_ek
|
||||||
|
#VARIANT=arduino_due
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ("$(VARIANT)", "sam3s_ek")
|
||||||
|
CHIP=__SAM3S4C__
|
||||||
|
else ifeq ("$(VARIANT)", "sam3u_ek")
|
||||||
|
CHIP=__SAM3U4E__
|
||||||
|
else ifeq ("$(VARIANT)", "arduino_due")
|
||||||
|
CHIP=__SAM3U4E__
|
||||||
|
endif
|
||||||
|
|
||||||
|
TOOLCHAIN=gcc
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Path
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
PROJECT_BASE_PATH = ./..
|
||||||
|
SYSTEM_PATH = ../../../../system
|
||||||
|
CMSIS_BASE_PATH = $(SYSTEM_PATH)/CMSIS/Include
|
||||||
|
VARIANT_PATH = ../../../../variants/$(VARIANT)
|
||||||
|
|
||||||
|
ifeq ($(CHIP), __SAM3S4C__)
|
||||||
|
CHIP_NAME=sam3s4c
|
||||||
|
CHIP_SERIE=sam3s
|
||||||
|
else ifeq ($(CHIP), __SAM3U4E__)
|
||||||
|
CHIP_NAME=sam3u4e
|
||||||
|
CHIP_SERIE=sam3u
|
||||||
|
else ifeq ($(CHIP), __SAM3N4C__)
|
||||||
|
CHIP_NAME=sam3n4c
|
||||||
|
CHIP_SERIE=sam3n
|
||||||
|
else ifeq ($(CHIP), __SAM3X8H__)
|
||||||
|
CHIP_NAME=sam3x8h
|
||||||
|
CHIP_SERIE=sam3xa
|
||||||
|
else
|
||||||
|
endif
|
||||||
|
|
||||||
|
CMSIS_CHIP_PATH=$(SYSTEM_PATH)/libsam/cmsis/$(CHIP_SERIE)
|
||||||
|
|
||||||
|
# Output directories
|
||||||
|
OUTPUT_PATH = debug_$(VARIANT)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Files
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
vpath %.h $(PROJECT_BASE_PATH)/.. $(VARIANT_PATH) $(SYSTEM_PATH) $(CMSIS_BASE_PATH)
|
||||||
|
vpath %.cpp $(PROJECT_BASE_PATH)
|
||||||
|
|
||||||
|
VPATH+=$(PROJECT_BASE_PATH)
|
||||||
|
|
||||||
|
INCLUDES = -I$(PROJECT_BASE_PATH)/..
|
||||||
|
INCLUDES += -I$(VARIANT_PATH)
|
||||||
|
INCLUDES += -I$(VARIANT_PATH)/..
|
||||||
|
INCLUDES += -I$(SYSTEM_PATH)
|
||||||
|
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||||
|
INCLUDES += -I$(CMSIS_BASE_PATH)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
ifdef DEBUG
|
||||||
|
include debug.mk
|
||||||
|
else
|
||||||
|
include release.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Tools
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(TOOLCHAIN).mk
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
ifdef DEBUG
|
||||||
|
OUTPUT_OBJ=debug
|
||||||
|
LIBS_POSTFIX=dbg
|
||||||
|
else
|
||||||
|
OUTPUT_OBJ=release
|
||||||
|
LIBS_POSTFIX=rel
|
||||||
|
endif
|
||||||
|
|
||||||
|
OUTPUT_BIN=test_$(TOOLCHAIN)_$(LIBS_POSTFIX)
|
||||||
|
#LIBS=-L../libsam_$(CHIP_NAME)_$(TOOLCHAIN)_rel.a -L../arduino_$(VARIANT)_$(TOOLCHAIN)_rel.a
|
||||||
|
#
|
||||||
|
LIBS=-Wl,--start-group -lgcc -lc -lstdc++ -lsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -larduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -lvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -Wl,--end-group
|
||||||
|
|
||||||
|
LIB_PATH =-L$(PROJECT_BASE_PATH)/..
|
||||||
|
LIB_PATH+=-L=/lib/thumb2
|
||||||
|
#LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.5.2/thumb2
|
||||||
|
|
||||||
|
LDFLAGS= -mcpu=cortex-m3 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# CPP source files and objects
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp)
|
||||||
|
|
||||||
|
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||||
|
|
||||||
|
# during development, remove some files
|
||||||
|
CPP_OBJ_FILTER=
|
||||||
|
|
||||||
|
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Rules
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
all: prod_test_due
|
||||||
|
|
||||||
|
prod_test_due: create_output $(OUTPUT_BIN)
|
||||||
|
|
||||||
|
.PHONY: create_output
|
||||||
|
create_output:
|
||||||
|
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||||
|
@echo -------------------------
|
||||||
|
@echo *$(INCLUDES)
|
||||||
|
@echo -------------------------
|
||||||
|
@echo *$(C_SRC)
|
||||||
|
@echo -------------------------
|
||||||
|
@echo *$(C_OBJ)
|
||||||
|
@echo -------------------------
|
||||||
|
@echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||||
|
@echo -------------------------
|
||||||
|
@echo *$(CPP_SRC)
|
||||||
|
@echo -------------------------
|
||||||
|
@echo *$(CPP_OBJ)
|
||||||
|
@echo -------------------------
|
||||||
|
@echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||||
|
@echo -------------------------
|
||||||
|
@echo *$(A_SRC)
|
||||||
|
@echo -------------------------
|
||||||
|
|
||||||
|
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||||
|
|
||||||
|
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||||
|
# @$(CC) -c $(CPPFLAGS) $< -o $@
|
||||||
|
@$(CXX) -c $(CPPFLAGS) $< -o $@
|
||||||
|
# @$(CXX) -v -c $(CPPFLAGS) $< -o $@
|
||||||
|
|
||||||
|
$(OUTPUT_BIN): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||||
|
@$(CC) $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/flash.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||||
|
# @$(CC) $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/sram.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||||
|
@$(NM) $(OUTPUT_PATH)/$@.elf >$(OUTPUT_PATH)/$@.elf.txt
|
||||||
|
@$(OBJCOPY) -O binary $(OUTPUT_PATH)/$@.elf $(OUTPUT_PATH)/$@.bin
|
||||||
|
$(SIZE) $^ $(OUTPUT_PATH)/$@.elf
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
@echo --- Cleaning test files
|
||||||
|
-@$(RM) $(OUTPUT_PATH)/test.o 1>NUL 2>&1
|
||||||
|
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf 1>NUL 2>&1
|
||||||
|
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf.txt 1>NUL 2>&1
|
||||||
|
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).bin 1>NUL 2>&1
|
||||||
|
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).map 1>NUL 2>&1
|
||||||
|
|
||||||
|
debug: test
|
||||||
|
@$(GDB) -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_flash.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||||
|
# @$(GDB) -w -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_sram.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
# Optimization level
|
||||||
|
# -O1 Optimize
|
||||||
|
# -O2 Optimize even more
|
||||||
|
# -O3 Optimize yet more
|
||||||
|
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||||
|
# -Os Optimize for size
|
||||||
|
OPTIMIZATION = -Os
|
1769
hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewd
Normal file
1769
hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewd
Normal file
File diff suppressed because it is too large
Load Diff
1834
hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewp
Normal file
1834
hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewp
Normal file
File diff suppressed because it is too large
Load Diff
227
hardware/sam/cores/sam/prod_test_due/main.cpp
Normal file
227
hardware/sam/cores/sam/prod_test_due/main.cpp
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* SAM Software Package License
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
* Copyright (c) 2011, Atmel Corporation
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the disclaimer below.
|
||||||
|
*
|
||||||
|
* Atmel's name may not be used to endorse or promote products derived from
|
||||||
|
* this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||||
|
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "variant.h"
|
||||||
|
|
||||||
|
/* Ensure we are compiling this for Arduino Due */
|
||||||
|
#if !defined( arduino_due )
|
||||||
|
#error "Error: wrong variant chosen"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum _ePins
|
||||||
|
{
|
||||||
|
/* LEDs */
|
||||||
|
PIN_13=0,
|
||||||
|
PIN_RXL=1,
|
||||||
|
PIN_TXL=2,
|
||||||
|
|
||||||
|
/* UART */
|
||||||
|
PIN_URXD=3,
|
||||||
|
PIN_UTXD=4,
|
||||||
|
PIN_UART=5,
|
||||||
|
|
||||||
|
/* USART0 */
|
||||||
|
PIN_RXD0=6,
|
||||||
|
PIN_TXD0=7,
|
||||||
|
PIN_USART0=8,
|
||||||
|
|
||||||
|
/* USART1 */
|
||||||
|
PIN_RXD1=9,
|
||||||
|
PIN_TXD1=10,
|
||||||
|
PIN_USART1=11,
|
||||||
|
|
||||||
|
/* USART2 */
|
||||||
|
PIN_RXD2=12,
|
||||||
|
PIN_TXD2=13,
|
||||||
|
PIN_USART2=14,
|
||||||
|
|
||||||
|
/* SPI */
|
||||||
|
PIN_MISO=15,
|
||||||
|
PIN_MOSI=16,
|
||||||
|
PIN_SPCK=17,
|
||||||
|
PIN_NPCS0=18,
|
||||||
|
|
||||||
|
/* TWI0 */
|
||||||
|
PIN_SDA1=19,
|
||||||
|
PIN_SCL1=20,
|
||||||
|
PIN_TWI0=21,
|
||||||
|
|
||||||
|
/* TWI1 */
|
||||||
|
PIN_SDA0=22,
|
||||||
|
PIN_SCL0=23,
|
||||||
|
PIN_TWI1=24,
|
||||||
|
|
||||||
|
/* Analog */
|
||||||
|
PIN_AD0=25,
|
||||||
|
PIN_AD1=26,
|
||||||
|
PIN_AD2=27,
|
||||||
|
PIN_AD3=28,
|
||||||
|
PIN_AD4=29,
|
||||||
|
PIN_AD5=30,
|
||||||
|
PIN_AD6=31,
|
||||||
|
PIN_AD7=32,
|
||||||
|
PIN_AD8=33,
|
||||||
|
PIN_AD9=34,
|
||||||
|
PIN_AD10=35,
|
||||||
|
PIN_AD11=36,
|
||||||
|
PIN_AD12=37,
|
||||||
|
PIN_AD13=38,
|
||||||
|
|
||||||
|
/* External DAC */
|
||||||
|
PIN_DAC_CS=39,
|
||||||
|
PIN_DAC_SCK=40,
|
||||||
|
PIN_DAC_DIN=41,
|
||||||
|
|
||||||
|
/* PWM */
|
||||||
|
PIN_PWM=42,
|
||||||
|
PIN_PWMH0=43,
|
||||||
|
PIN_PWMH1=44,
|
||||||
|
PIN_PWMH2=45,
|
||||||
|
PIN_PWMH3=46,
|
||||||
|
PIN_PWML0=47,
|
||||||
|
PIN_PWML1=48,
|
||||||
|
PIN_PWML2=49,
|
||||||
|
PIN_PWML3=50,
|
||||||
|
|
||||||
|
PIN_10=51,
|
||||||
|
|
||||||
|
PIN_22=52,
|
||||||
|
PIN_23=53,
|
||||||
|
PIN_24=54,
|
||||||
|
PIN_25=55,
|
||||||
|
PIN_26=56,
|
||||||
|
PIN_27=57,
|
||||||
|
PIN_28=58,
|
||||||
|
PIN_29=59,
|
||||||
|
PIN_30=60,
|
||||||
|
PIN_31=61,
|
||||||
|
PIN_32=62,
|
||||||
|
PIN_33=63,
|
||||||
|
PIN_34=64,
|
||||||
|
PIN_35=65,
|
||||||
|
PIN_36=66,
|
||||||
|
PIN_37=67,
|
||||||
|
PIN_38=68,
|
||||||
|
PIN_39=69,
|
||||||
|
PIN_40=70,
|
||||||
|
PIN_41=71,
|
||||||
|
PIN_42=72,
|
||||||
|
PIN_43=73,
|
||||||
|
PIN_44=74,
|
||||||
|
PIN_45=75,
|
||||||
|
PIN_46=76,
|
||||||
|
PIN_47=77,
|
||||||
|
PIN_48=78,
|
||||||
|
PIN_49=79,
|
||||||
|
PIN_50=80,
|
||||||
|
PIN_51=81,
|
||||||
|
PIN_52=82,
|
||||||
|
PIN_53=83
|
||||||
|
} ePins ;
|
||||||
|
|
||||||
|
#define PIN_FIRST PIN_13
|
||||||
|
#define PIN_LAST PIN_53
|
||||||
|
|
||||||
|
void setup( void )
|
||||||
|
{
|
||||||
|
// Initialize all digital pins in output mode.
|
||||||
|
for ( dwIndex=PIN_FIRST ; dwIndex <= PIN_LAST ; dwIndex++ )
|
||||||
|
{
|
||||||
|
if ( ((g_APinDescription[dwIndex].ulPinAttribute & PIN_ATTR_COMBO) == 0) && ((g_APinDescription[dwIndex].ulPinAttribute & PIN_ATTR_ANALOG) == 0) )
|
||||||
|
{
|
||||||
|
pinMode( dwIndex, OUTPUT ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop( void )
|
||||||
|
{
|
||||||
|
uint32_t dwIndex ;
|
||||||
|
uint32_t adwAnalogValues[PIN_AD13-PIN_AD0+1] ;
|
||||||
|
uint32_t dwChaserIndex=PIN_FIRST ;
|
||||||
|
uint32_t dwChaserIndexLast=PIN_FIRST ;
|
||||||
|
|
||||||
|
// production test loop
|
||||||
|
for ( ;; )
|
||||||
|
{
|
||||||
|
// Read analog values
|
||||||
|
for ( dwIndex=PIN_AD0 ; dwIndex <= PIN_AD13 ; dwIndex++ )
|
||||||
|
{
|
||||||
|
// adwAnalogValues[dwIndex]= ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transmit analog values on USB CDC
|
||||||
|
for ( dwIndex=PIN_AD0 ; dwIndex <= PIN_AD13 ; dwIndex++ )
|
||||||
|
{
|
||||||
|
// CDC_Print( adwAnalogValues[dwIndex] ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do chaser
|
||||||
|
// set the current pin output to VCC
|
||||||
|
digitalWrite( dwChaserIndex, HIGH ) ;
|
||||||
|
|
||||||
|
// set the previous pin output to GND
|
||||||
|
if ( dwChaserIndexLast != dwChaserIndex )
|
||||||
|
{
|
||||||
|
digitalWrite( dwChaserIndex, LOW ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// backup current chaser pin index
|
||||||
|
dwChaserIndexLast=dwChaserIndex ;
|
||||||
|
dwChaserIndex++ ;
|
||||||
|
|
||||||
|
// find next chaser pin
|
||||||
|
for ( ; ; )
|
||||||
|
{
|
||||||
|
// Go circular if we reached the end of pins
|
||||||
|
if ( dwChaserIndex > PIN_LAST )
|
||||||
|
{
|
||||||
|
dwChaserIndex=PIN_FIRST ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bypass combo and analog pins
|
||||||
|
if ( ((g_APinDescription[dwChaserIndex].ulPinAttribute & PIN_ATTR_COMBO) != 0) || ((g_APinDescription[dwChaserIndex].ulPinAttribute & PIN_ATTR_ANALOG) != 0) )
|
||||||
|
{
|
||||||
|
dwChaserIndex++ ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go circular if we reached the end of pins
|
||||||
|
if ( dwChaserIndex > PIN_LAST )
|
||||||
|
{
|
||||||
|
dwChaserIndex=PIN_FIRST ;
|
||||||
|
}
|
||||||
|
|
||||||
|
delay( 500 ) ; // wait for a second
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user