├── .cproject
├── .github
├── ISSUE_TEMPLATE
│ ├── BugReport.yml
│ ├── FeatureRequest.yml
│ └── config.yml
└── workflows
│ └── issues.yml
├── .gitignore
├── .gitmodules
├── .project
├── CMakeLists.txt
├── License.txt
├── Readme.md
├── SplashScreens
├── SplashScreen-Duet3D-480x272.bin
└── SplashScreen-Duet3D-800x480.bin
├── Tools
├── bmp2c
│ ├── Release
│ │ └── bmp2c-escher3d.exe
│ ├── archive.cpp
│ ├── archive.h
│ ├── bmp2c.cpp
│ ├── bmp2c.sln
│ ├── bmp2c.vcxproj
│ ├── bmp2c_private.h
│ ├── bmp2c_private.rc
│ ├── bmp2c_private.res
│ ├── bmp_ffi.cpp
│ ├── bmp_ffi.h
│ ├── error_msg.cpp
│ ├── error_msg.h
│ ├── missing.h
│ ├── numconv_stringstream.cpp
│ ├── numconv_stringstream.h
│ ├── string_ext.cpp
│ ├── string_ext.h
│ ├── win32ext.cpp
│ └── win32ext.h
├── gobmp2c
│ ├── bmp2c.go
│ ├── go.mod
│ ├── go.sum
│ ├── linux
│ │ └── bmp2c
│ ├── macos
│ │ └── bmp2c
│ └── win
│ │ └── bmp2c.exe
└── list-locales
│ ├── Hardware
│ └── UTFT.hpp
│ ├── Makefile
│ ├── UI
│ └── UserInterfaceConstants.hpp
│ ├── asf.h
│ └── list-locales.cpp
├── env.cmake.example
├── src
├── ASF
│ ├── common
│ │ ├── boards
│ │ │ ├── board.h
│ │ │ └── user_board
│ │ │ │ ├── init.c
│ │ │ │ └── user_board.h
│ │ ├── services
│ │ │ ├── clock
│ │ │ │ ├── genclk.h
│ │ │ │ ├── osc.h
│ │ │ │ ├── pll.h
│ │ │ │ ├── sam3s
│ │ │ │ │ ├── genclk.h
│ │ │ │ │ ├── osc.h
│ │ │ │ │ ├── pll.h
│ │ │ │ │ ├── sysclk.c
│ │ │ │ │ └── sysclk.h
│ │ │ │ ├── sam4s
│ │ │ │ │ ├── genclk.h
│ │ │ │ │ ├── module_config
│ │ │ │ │ │ └── conf_clock.h
│ │ │ │ │ ├── osc.h
│ │ │ │ │ ├── pll.h
│ │ │ │ │ ├── sysclk.c
│ │ │ │ │ └── sysclk.h
│ │ │ │ └── sysclk.h
│ │ │ └── delay
│ │ │ │ ├── delay.h
│ │ │ │ └── sam
│ │ │ │ ├── cycle_counter.c
│ │ │ │ └── cycle_counter.h
│ │ └── utils
│ │ │ ├── interrupt.h
│ │ │ ├── interrupt
│ │ │ ├── interrupt_sam_nvic.c
│ │ │ └── interrupt_sam_nvic.h
│ │ │ └── parts.h
│ ├── sam
│ │ ├── drivers
│ │ │ ├── chipid
│ │ │ │ ├── chipid.c
│ │ │ │ └── chipid.h
│ │ │ ├── efc
│ │ │ │ ├── efc.c
│ │ │ │ └── efc.h
│ │ │ ├── matrix
│ │ │ │ ├── matrix.c
│ │ │ │ └── matrix.h
│ │ │ ├── pio
│ │ │ │ ├── pio.c
│ │ │ │ ├── pio.h
│ │ │ │ ├── pio_handler.c
│ │ │ │ └── pio_handler.h
│ │ │ ├── pmc
│ │ │ │ ├── pmc.c
│ │ │ │ └── pmc.h
│ │ │ ├── pwm
│ │ │ │ ├── pwm.c
│ │ │ │ └── pwm.h
│ │ │ ├── rstc
│ │ │ │ ├── rstc.c
│ │ │ │ └── rstc.h
│ │ │ ├── uart
│ │ │ │ ├── uart.c
│ │ │ │ └── uart.h
│ │ │ └── wdt
│ │ │ │ ├── wdt.c
│ │ │ │ └── wdt.h
│ │ ├── services
│ │ │ └── flash_efc
│ │ │ │ ├── flash_efc.c
│ │ │ │ └── flash_efc.h
│ │ └── utils
│ │ │ ├── cmsis
│ │ │ ├── sam3s
│ │ │ │ ├── include
│ │ │ │ │ ├── component
│ │ │ │ │ │ ├── component_acc.h
│ │ │ │ │ │ ├── component_adc.h
│ │ │ │ │ │ ├── component_chipid.h
│ │ │ │ │ │ ├── component_crccu.h
│ │ │ │ │ │ ├── component_dacc.h
│ │ │ │ │ │ ├── component_efc.h
│ │ │ │ │ │ ├── component_gpbr.h
│ │ │ │ │ │ ├── component_hsmci.h
│ │ │ │ │ │ ├── component_matrix.h
│ │ │ │ │ │ ├── component_pdc.h
│ │ │ │ │ │ ├── component_pio.h
│ │ │ │ │ │ ├── component_pmc.h
│ │ │ │ │ │ ├── component_pwm.h
│ │ │ │ │ │ ├── component_rstc.h
│ │ │ │ │ │ ├── component_rtc.h
│ │ │ │ │ │ ├── component_rtt.h
│ │ │ │ │ │ ├── component_smc.h
│ │ │ │ │ │ ├── component_spi.h
│ │ │ │ │ │ ├── component_ssc.h
│ │ │ │ │ │ ├── component_supc.h
│ │ │ │ │ │ ├── component_tc.h
│ │ │ │ │ │ ├── component_twi.h
│ │ │ │ │ │ ├── component_uart.h
│ │ │ │ │ │ ├── component_udp.h
│ │ │ │ │ │ ├── component_usart.h
│ │ │ │ │ │ └── component_wdt.h
│ │ │ │ │ ├── instance
│ │ │ │ │ │ ├── instance_acc.h
│ │ │ │ │ │ ├── instance_adc.h
│ │ │ │ │ │ ├── instance_chipid.h
│ │ │ │ │ │ ├── instance_crccu.h
│ │ │ │ │ │ ├── instance_dacc.h
│ │ │ │ │ │ ├── instance_efc.h
│ │ │ │ │ │ ├── instance_gpbr.h
│ │ │ │ │ │ ├── instance_hsmci.h
│ │ │ │ │ │ ├── instance_matrix.h
│ │ │ │ │ │ ├── instance_pioa.h
│ │ │ │ │ │ ├── instance_piob.h
│ │ │ │ │ │ ├── instance_pioc.h
│ │ │ │ │ │ ├── instance_pmc.h
│ │ │ │ │ │ ├── instance_pwm.h
│ │ │ │ │ │ ├── instance_rstc.h
│ │ │ │ │ │ ├── instance_rtc.h
│ │ │ │ │ │ ├── instance_rtt.h
│ │ │ │ │ │ ├── instance_smc.h
│ │ │ │ │ │ ├── instance_spi.h
│ │ │ │ │ │ ├── instance_ssc.h
│ │ │ │ │ │ ├── instance_supc.h
│ │ │ │ │ │ ├── instance_tc0.h
│ │ │ │ │ │ ├── instance_tc1.h
│ │ │ │ │ │ ├── instance_twi0.h
│ │ │ │ │ │ ├── instance_twi1.h
│ │ │ │ │ │ ├── instance_uart0.h
│ │ │ │ │ │ ├── instance_uart1.h
│ │ │ │ │ │ ├── instance_udp.h
│ │ │ │ │ │ ├── instance_usart0.h
│ │ │ │ │ │ ├── instance_usart1.h
│ │ │ │ │ │ └── instance_wdt.h
│ │ │ │ │ ├── pio
│ │ │ │ │ │ ├── pio_sam3s1a.h
│ │ │ │ │ │ ├── pio_sam3s1b.h
│ │ │ │ │ │ ├── pio_sam3s1c.h
│ │ │ │ │ │ ├── pio_sam3s2a.h
│ │ │ │ │ │ ├── pio_sam3s2b.h
│ │ │ │ │ │ ├── pio_sam3s2c.h
│ │ │ │ │ │ ├── pio_sam3s4a.h
│ │ │ │ │ │ ├── pio_sam3s4b.h
│ │ │ │ │ │ └── pio_sam3s4c.h
│ │ │ │ │ ├── sam3s.h
│ │ │ │ │ ├── sam3s1a.h
│ │ │ │ │ ├── sam3s1b.h
│ │ │ │ │ ├── sam3s1c.h
│ │ │ │ │ ├── sam3s2a.h
│ │ │ │ │ ├── sam3s2b.h
│ │ │ │ │ ├── sam3s2c.h
│ │ │ │ │ ├── sam3s4a.h
│ │ │ │ │ ├── sam3s4b.h
│ │ │ │ │ └── sam3s4c.h
│ │ │ │ └── source
│ │ │ │ │ └── templates
│ │ │ │ │ ├── exceptions.c
│ │ │ │ │ ├── exceptions.h
│ │ │ │ │ ├── gcc
│ │ │ │ │ └── startup_sam3s.c
│ │ │ │ │ ├── system_sam3s.c
│ │ │ │ │ └── system_sam3s.h
│ │ │ └── sam4s
│ │ │ │ ├── include
│ │ │ │ ├── component
│ │ │ │ │ ├── component_acc.h
│ │ │ │ │ ├── component_adc.h
│ │ │ │ │ ├── component_chipid.h
│ │ │ │ │ ├── component_cmcc.h
│ │ │ │ │ ├── component_crccu.h
│ │ │ │ │ ├── component_dacc.h
│ │ │ │ │ ├── component_efc.h
│ │ │ │ │ ├── component_gpbr.h
│ │ │ │ │ ├── component_hsmci.h
│ │ │ │ │ ├── component_matrix.h
│ │ │ │ │ ├── component_pdc.h
│ │ │ │ │ ├── component_pio.h
│ │ │ │ │ ├── component_pmc.h
│ │ │ │ │ ├── component_pwm.h
│ │ │ │ │ ├── component_rstc.h
│ │ │ │ │ ├── component_rtc.h
│ │ │ │ │ ├── component_rtt.h
│ │ │ │ │ ├── component_smc.h
│ │ │ │ │ ├── component_spi.h
│ │ │ │ │ ├── component_ssc.h
│ │ │ │ │ ├── component_supc.h
│ │ │ │ │ ├── component_tc.h
│ │ │ │ │ ├── component_twi.h
│ │ │ │ │ ├── component_uart.h
│ │ │ │ │ ├── component_udp.h
│ │ │ │ │ ├── component_usart.h
│ │ │ │ │ └── component_wdt.h
│ │ │ │ ├── instance
│ │ │ │ │ ├── instance_acc.h
│ │ │ │ │ ├── instance_adc.h
│ │ │ │ │ ├── instance_chipid.h
│ │ │ │ │ ├── instance_cmcc.h
│ │ │ │ │ ├── instance_crccu.h
│ │ │ │ │ ├── instance_dacc.h
│ │ │ │ │ ├── instance_efc0.h
│ │ │ │ │ ├── instance_efc1.h
│ │ │ │ │ ├── instance_gpbr.h
│ │ │ │ │ ├── instance_hsmci.h
│ │ │ │ │ ├── instance_matrix.h
│ │ │ │ │ ├── instance_pioa.h
│ │ │ │ │ ├── instance_piob.h
│ │ │ │ │ ├── instance_pioc.h
│ │ │ │ │ ├── instance_pmc.h
│ │ │ │ │ ├── instance_pwm.h
│ │ │ │ │ ├── instance_rstc.h
│ │ │ │ │ ├── instance_rtc.h
│ │ │ │ │ ├── instance_rtt.h
│ │ │ │ │ ├── instance_smc.h
│ │ │ │ │ ├── instance_spi.h
│ │ │ │ │ ├── instance_ssc.h
│ │ │ │ │ ├── instance_supc.h
│ │ │ │ │ ├── instance_tc0.h
│ │ │ │ │ ├── instance_tc1.h
│ │ │ │ │ ├── instance_twi0.h
│ │ │ │ │ ├── instance_twi1.h
│ │ │ │ │ ├── instance_uart0.h
│ │ │ │ │ ├── instance_uart1.h
│ │ │ │ │ ├── instance_udp.h
│ │ │ │ │ ├── instance_usart0.h
│ │ │ │ │ ├── instance_usart1.h
│ │ │ │ │ └── instance_wdt.h
│ │ │ │ ├── pio
│ │ │ │ │ ├── pio_sam4s16b.h
│ │ │ │ │ ├── pio_sam4s16c.h
│ │ │ │ │ ├── pio_sam4s2a.h
│ │ │ │ │ ├── pio_sam4s2b.h
│ │ │ │ │ ├── pio_sam4s2c.h
│ │ │ │ │ ├── pio_sam4s4a.h
│ │ │ │ │ ├── pio_sam4s4b.h
│ │ │ │ │ ├── pio_sam4s4c.h
│ │ │ │ │ ├── pio_sam4s8b.h
│ │ │ │ │ ├── pio_sam4s8c.h
│ │ │ │ │ ├── pio_sam4sa16b.h
│ │ │ │ │ ├── pio_sam4sa16c.h
│ │ │ │ │ ├── pio_sam4sd16b.h
│ │ │ │ │ ├── pio_sam4sd16c.h
│ │ │ │ │ ├── pio_sam4sd32b.h
│ │ │ │ │ └── pio_sam4sd32c.h
│ │ │ │ ├── sam4s.h
│ │ │ │ ├── sam4s16b.h
│ │ │ │ ├── sam4s16c.h
│ │ │ │ ├── sam4s2a.h
│ │ │ │ ├── sam4s2b.h
│ │ │ │ ├── sam4s2c.h
│ │ │ │ ├── sam4s4a.h
│ │ │ │ ├── sam4s4b.h
│ │ │ │ ├── sam4s4c.h
│ │ │ │ ├── sam4s8b.h
│ │ │ │ ├── sam4s8c.h
│ │ │ │ ├── sam4sa16b.h
│ │ │ │ ├── sam4sa16c.h
│ │ │ │ ├── sam4sd16b.h
│ │ │ │ ├── sam4sd16c.h
│ │ │ │ ├── sam4sd32b.h
│ │ │ │ ├── sam4sd32c.h
│ │ │ │ └── system_sam4s.h
│ │ │ │ └── source
│ │ │ │ └── templates
│ │ │ │ ├── gcc
│ │ │ │ └── startup_sam4s.c
│ │ │ │ └── system_sam4s.c
│ │ │ ├── compiler.h
│ │ │ ├── header_files
│ │ │ └── io.h
│ │ │ ├── linker_scripts
│ │ │ ├── sam3s
│ │ │ │ ├── sam3s2
│ │ │ │ │ └── gcc
│ │ │ │ │ │ └── flash.ld
│ │ │ │ └── sam3s4
│ │ │ │ │ └── gcc
│ │ │ │ │ └── flash.ld
│ │ │ └── sam4s
│ │ │ │ ├── sam4s4
│ │ │ │ └── gcc
│ │ │ │ │ └── flash.ld
│ │ │ │ └── sam4s8
│ │ │ │ └── gcc
│ │ │ │ └── flash.ld
│ │ │ ├── make
│ │ │ └── Makefile.sam.in
│ │ │ ├── preprocessor
│ │ │ ├── mrepeat.h
│ │ │ ├── preprocessor.h
│ │ │ ├── stringz.h
│ │ │ └── tpaste.h
│ │ │ ├── status_codes.h
│ │ │ └── syscalls
│ │ │ └── gcc
│ │ │ └── syscalls.c
│ └── thirdparty
│ │ └── CMSIS
│ │ ├── CMSIS END USER LICENCE AGREEMENT.pdf
│ │ ├── Include
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cmFunc.h
│ │ ├── core_cmInstr.h
│ │ └── core_cmSimd.h
│ │ ├── Lib
│ │ └── GCC
│ │ │ ├── libarm_cortexM3l_math.a
│ │ │ └── libarm_cortexM4l_math.a
│ │ └── README.txt
├── Bugs.txt
├── Configuration.hpp
├── ControlCommands.hpp
├── Debug.hpp
├── FileManager.cpp
├── FileManager.hpp
├── FirmwareFeatures.hpp
├── FlashData.cpp
├── FlashData.hpp
├── Fonts
│ ├── glcd19x21.cpp
│ └── glcd28x32.cpp
├── Hardware
│ ├── Backlight.cpp
│ ├── Backlight.hpp
│ ├── Buzzer.cpp
│ ├── Buzzer.hpp
│ ├── DisplayOrientation.hpp
│ ├── FlashStorage.cpp
│ ├── FlashStorage.hpp
│ ├── Mem.cpp
│ ├── Mem.hpp
│ ├── OneBitPort.cpp
│ ├── OneBitPort.hpp
│ ├── Reset.cpp
│ ├── Reset.hpp
│ ├── RotaryEncoder.cpp
│ ├── RotaryEncoder.hpp
│ ├── SerialIo.cpp
│ ├── SerialIo.hpp
│ ├── SysTick.cpp
│ ├── SysTick.hpp
│ ├── UTFT.cpp
│ ├── UTFT.hpp
│ ├── UTouch.cpp
│ ├── UTouch.hpp
│ └── memorysaver.h
├── Icons
│ ├── Backspace_21h.bmp
│ ├── Backspace_30h.bmp
│ ├── BedComp_21h.bmp
│ ├── BedComp_30h.bmp
│ ├── Bed_21h.bmp
│ ├── Bed_30h.bmp
│ ├── Cancel_21h.bmp
│ ├── Cancel_30h.bmp
│ ├── Chamber_21h.bmp
│ ├── Chamber_30h.bmp
│ ├── DownArrow_21h.bmp
│ ├── DownArrow_30h.bmp
│ ├── Enter_21h.bmp
│ ├── Enter_30h.bmp
│ ├── File_21h.bmp
│ ├── File_30h.bmp
│ ├── HomeAll_21h.bmp
│ ├── HomeAll_30h.bmp
│ ├── HomeIcons.cpp
│ ├── HomeU_21h.bmp
│ ├── HomeU_30h.bmp
│ ├── HomeV_30h.bmp
│ ├── HomeW_30h.bmp
│ ├── HomeX_21h.bmp
│ ├── HomeX_30h.bmp
│ ├── HomeY_21h.bmp
│ ├── HomeY_30h.bmp
│ ├── HomeZ_21h.bmp
│ ├── HomeZ_30h.bmp
│ ├── Icons.hpp
│ ├── KeyIcons.cpp
│ ├── Keyboard_21h.bmp
│ ├── Keyboard_30h.bmp
│ ├── MiscIcons.cpp
│ ├── Nozzle1_21h.bmp
│ ├── Nozzle1_30h.bmp
│ ├── Nozzle2_21h.bmp
│ ├── Nozzle2_30h.bmp
│ ├── Nozzle3_21h.bmp
│ ├── Nozzle3_30h.bmp
│ ├── Nozzle4_21h.bmp
│ ├── Nozzle4_30h.bmp
│ ├── Nozzle5_30h.bmp
│ ├── Nozzle6_30h.bmp
│ ├── NozzleIcons.cpp
│ ├── Nozzle_21h.bmp
│ ├── Nozzle_30h.bmp
│ ├── OK_21h.bmp
│ ├── OK_30h.bmp
│ ├── Spindle_21h.bmp
│ ├── Spindle_30h.bmp
│ ├── UpArrow_21h.bmp
│ ├── UpArrow_30h.bmp
│ ├── bmp2c.ini
│ ├── nozzle-21h-base.bmp
│ ├── trash_21h.bmp
│ └── trash_30h.bmp
├── Library
│ ├── Misc.cpp
│ ├── Misc.hpp
│ ├── Thumbnail.cpp
│ └── Thumbnail.hpp
├── ObjectModel
│ ├── Axis.cpp
│ ├── Axis.hpp
│ ├── BedOrChamber.cpp
│ ├── BedOrChamber.hpp
│ ├── ListHelpers.hpp
│ ├── PrinterStatus.hpp
│ ├── Spindle.cpp
│ ├── Spindle.hpp
│ ├── Tool.cpp
│ ├── Tool.hpp
│ ├── Utils.cpp
│ └── Utils.hpp
├── PanelDue.cpp
├── PanelDue.hpp
├── RequestTimer.cpp
├── RequestTimer.hpp
├── UI
│ ├── Alert.hpp
│ ├── ColourSchemes.cpp
│ ├── ColourSchemes.hpp
│ ├── Display.cpp
│ ├── Display.hpp
│ ├── DisplaySize.hpp
│ ├── Events.hpp
│ ├── MessageLog.cpp
│ ├── MessageLog.hpp
│ ├── Popup.cpp
│ ├── Popup.hpp
│ ├── Strings.hpp
│ ├── UserInterface.cpp
│ ├── UserInterface.hpp
│ └── UserInterfaceConstants.hpp
├── Version.hpp
├── asf.h
├── config
│ ├── conf_board.h
│ └── conf_clock.h
└── ecv.h
├── tests
├── test-m291-s0.g
├── test-m291-s1.g
├── test-m291-s2.g
├── test-m291-s3.g
├── test-m291-s4-three-items.g
├── test-m291-s4.g
├── test-m291-s5.g
├── test-m291-s6.g
├── test-m291-s7.g
└── test-m291.g
├── toolchains
├── arm-none-eabi.cmake
└── sam4s4-flash.ld
└── whatsnew.md
/.github/ISSUE_TEMPLATE/BugReport.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: File a bug report
3 | title: "ADD A MEANINGFUL TITLE FOR YOUR BUG REPORT"
4 | labels: [bug]
5 | body:
6 | - type: textarea
7 | id: description
8 | validations:
9 | required: true
10 | attributes:
11 | label: Description
12 | value: |
13 | Before posting a bug report here, please check the forum and gitlab issue tracker if it was already reported.
14 |
15 | - https://forum.duet3d.com/category/14/paneldue
16 | - https://github.com/Duet3D/PanelDueFirmware/issues
17 |
18 | If you need help configuring your device please visit the forum and post your questions there.
19 |
20 | ## Description
21 | Please add a brief description of your bug here.
22 |
23 | ## Versions
24 | Please add a list of products and software versions involved.
25 |
26 | ## Process
27 | Please add a step by step description on how to reproduce the bug.
28 |
29 | ## Experienced Result
30 | Please describe experienced result.
31 |
32 | ## Expected Result
33 | Please describe the expected result.
34 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/FeatureRequest.yml:
--------------------------------------------------------------------------------
1 | name: Feature Request
2 | description: Suggest an idea for this project
3 | title: "ADD A MEANINGFUL TITLE FOR YOUR FEATURE REQUEST"
4 | labels: [enhancement]
5 | body:
6 | - type: textarea
7 | id: description
8 | validations:
9 | required: true
10 | attributes:
11 | label: Description
12 | value: |
13 | The Duet forums have wishlist sections for feature requests if you'd like to check if your request already exists or to discuss your feature request there first.
14 |
15 | https://forum.duet3d.com/category/9/hardware-wishlist
16 | https://forum.duet3d.com/category/8/firmware-wishlist
17 | https://forum.duet3d.com/category/11/duet-web-control-wishlist
18 | https://forum.duet3d.com/category/14/paneldue
19 |
20 | ## Description
21 | Please add a detailed description of the feature.
22 |
23 | ## What problem does this feature try to solve?
24 | Please add a clear and concise description.
25 |
26 | ## Proposed Solution
27 | Please add a clear and concise description.
28 |
29 | Please add any further or additional information like photos, sketches, mockups, etc.
30 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 | contact_links:
3 | - name: Duet3D Community Support
4 | url: https://forum.duet3d.com//
5 | about: Please ask and answer questions here.
6 | - name: Duet3D Documentation
7 | url: https://docs.duet3d.com
8 | about: Detailed documentation for Duet electronics and RepRapFirmware.
9 |
--------------------------------------------------------------------------------
/.github/workflows/issues.yml:
--------------------------------------------------------------------------------
1 | name: Auto-close blank templates
2 | on:
3 | issues:
4 | types: [opened]
5 | jobs:
6 | add-comment:
7 | runs-on: ubuntu-latest
8 | permissions:
9 | issues: write
10 | steps:
11 | - name: Check user permission
12 | id: check
13 | uses: scherermichael-oss/action-has-permission@master
14 | with:
15 | required-permission: write
16 | env:
17 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 | - if: steps.check.outputs.has-permission == false && contains(github.event.issue.labels.*.name, 'bug') == false && contains(github.event.issue.labels.*.name, 'enhancement') == false
19 | name: Close Issue
20 | uses: peter-evans/close-issue@v1
21 | with:
22 | comment: |
23 | This issue has been automatically closed because it does not originate from a Duet3D administrator.
24 | Please create a discussion on https://forum.duet3d.com first and fill out the corresponding GitHub template if the bug or feature request is acknowledged.
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # tag files
21 | tags
22 | cscope.out
23 |
24 | # =========================
25 | # Operating System Files
26 | # =========================
27 |
28 | # OSX
29 | # =========================
30 |
31 | .DS_Store
32 | .AppleDouble
33 | .LSOverride
34 |
35 | # Thumbnails
36 | ._*
37 |
38 | # Files that might appear in the root of a volume
39 | .DocumentRevisions-V100
40 | .fseventsd
41 | .Spotlight-V100
42 | .TemporaryItems
43 | .Trashes
44 | .VolumeIcon.icns
45 |
46 | # Directories potentially created on remote AFP share
47 | .AppleDB
48 | .AppleDesktop
49 | Network Trash Folder
50 | Temporary Items
51 | .apdisk
52 |
53 | # Directories created during build
54 | build
55 |
56 | # Local configuration file
57 | env.cmake
58 |
59 | # Customer-specific folders
60 | src/OEM
61 |
62 | # Misc
63 | .settings/language.settings.xml
64 | compile_commands.json
65 |
66 | # IDEs
67 | .vscode
68 |
69 | # Eclipse output folders
70 | /Release-4.3/
71 | /Release-5.0/
72 | /Release-5.0i-7.0i/
73 | /Release-5.0i-7.0i-encoder/
74 | /Release-7.0/
75 | /Release-7.0CPLD/
76 | /Release-v3-4.3/
77 | /Release-v3-5.0/
78 | /Release-v3-7.0/
79 | /Release-v3-7.0CPLD/
80 | /Release-v2-4.3/
81 | /Release-v2-5.0/
82 | /Release-v2-7.0/
83 | /Release-v2-7.0CPLD/
84 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "lib/librrf"]
2 | path = lib/librrf
3 | url = https://github.com/Duet3D/RRFLibraries.git
4 | [submodule "lib/qoi"]
5 | path = lib/qoi
6 | url = https://github.com/Duet3D/qoi.git
7 | [submodule "lib/base64"]
8 | path = lib/base64
9 | url = https://github.com/Duet3D/base64.git
10 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | PanelDueFirmware
4 |
5 |
6 | RRFLibraries
7 |
8 |
9 |
10 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
11 | clean,full,incremental,
12 |
13 |
14 |
15 |
16 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
17 | full,incremental,
18 |
19 |
20 |
21 |
22 |
23 | org.eclipse.cdt.core.cnature
24 | org.eclipse.cdt.core.ccnature
25 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
26 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/SplashScreens/SplashScreen-Duet3D-480x272.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/SplashScreens/SplashScreen-Duet3D-480x272.bin
--------------------------------------------------------------------------------
/SplashScreens/SplashScreen-Duet3D-800x480.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/SplashScreens/SplashScreen-Duet3D-800x480.bin
--------------------------------------------------------------------------------
/Tools/bmp2c/Release/bmp2c-escher3d.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/Tools/bmp2c/Release/bmp2c-escher3d.exe
--------------------------------------------------------------------------------
/Tools/bmp2c/bmp2c.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/Tools/bmp2c/bmp2c.cpp
--------------------------------------------------------------------------------
/Tools/bmp2c/bmp2c.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual C++ Express 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bmp2c", "bmp2c.vcxproj", "{19728825-999B-6297-E8ED-C918D8E5EA7A}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {19728825-999B-6297-E8ED-C918D8E5EA7A}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {19728825-999B-6297-E8ED-C918D8E5EA7A}.Debug|Win32.Build.0 = Debug|Win32
14 | {19728825-999B-6297-E8ED-C918D8E5EA7A}.Release|Win32.ActiveCfg = Release|Win32
15 | {19728825-999B-6297-E8ED-C918D8E5EA7A}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Tools/bmp2c/bmp2c_private.h:
--------------------------------------------------------------------------------
1 | /* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
2 | /* DO NOT EDIT ! */
3 |
4 | #ifndef BMP2C_PRIVATE_H
5 | #define BMP2C_PRIVATE_H
6 |
7 | /* VERSION DEFINITIONS */
8 | #define VER_STRING "0.0.2.72"
9 | #define VER_MAJOR 0
10 | #define VER_MINOR 0
11 | #define VER_RELEASE 2
12 | #define VER_BUILD 72
13 | #define COMPANY_NAME "nimp software"
14 | #define FILE_VERSION ""
15 | #define FILE_DESCRIPTION "please visit www.nimp.co.uk/software for updates"
16 | #define INTERNAL_NAME ""
17 | #define LEGAL_COPYRIGHT "Copyright (c) 2007, Sebastien Riou"
18 | #define LEGAL_TRADEMARKS ""
19 | #define ORIGINAL_FILENAME "bmp2c.exe"
20 | #define PRODUCT_NAME "bmp2c"
21 | #define PRODUCT_VERSION "0002"
22 |
23 | #endif /*BMP2C_PRIVATE_H*/
24 |
--------------------------------------------------------------------------------
/Tools/bmp2c/bmp2c_private.rc:
--------------------------------------------------------------------------------
1 | /* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
2 | /* DO NOT EDIT! */
3 |
4 | #include // include for version info constants
5 |
6 |
7 | //
8 | // TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS...
9 | //
10 | 1 VERSIONINFO
11 | FILEVERSION 0,0,2,72
12 | PRODUCTVERSION 0,0,2,72
13 | FILETYPE VFT_APP
14 | {
15 | BLOCK "StringFileInfo"
16 | {
17 | BLOCK "080904E4"
18 | {
19 | VALUE "CompanyName", "nimp software"
20 | VALUE "FileVersion", ""
21 | VALUE "FileDescription", "please visit www.nimp.co.uk/software for updates"
22 | VALUE "InternalName", ""
23 | VALUE "LegalCopyright", "Copyright (c) 2007, Sebastien Riou"
24 | VALUE "LegalTrademarks", ""
25 | VALUE "OriginalFilename", "bmp2c.exe"
26 | VALUE "ProductName", "bmp2c"
27 | VALUE "ProductVersion", "0002"
28 | }
29 | }
30 | BLOCK "VarFileInfo"
31 | {
32 | VALUE "Translation", 0x0809, 1252
33 | }
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/Tools/bmp2c/bmp2c_private.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/Tools/bmp2c/bmp2c_private.res
--------------------------------------------------------------------------------
/Tools/bmp2c/error_msg.cpp:
--------------------------------------------------------------------------------
1 | /*This software is under the BSD licence:
2 | Copyright (c) 2007, Sebastien Riou
3 |
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 |
8 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | Neither the name of "nimp software" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
15 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
22 |
23 | #include "error_msg.h"
24 | using namespace std;
25 |
26 |
27 | error_msg::error_msg(int err_code, std::string err_text)
28 | {
29 | m_err_text="\n";
30 | m_err_text+=err_text;
31 | m_err_code=err_code;
32 | }
33 | error_msg::error_msg(std::string err_text)
34 | {
35 | m_err_text="\n";
36 | m_err_text+=err_text;
37 | m_err_code=-1;
38 | }
39 | error_msg::~error_msg()
40 | {
41 | }
42 | int error_msg::get_err_code()
43 | {
44 | return m_err_code;
45 | }
46 | std::string error_msg::get_err_text()
47 | {
48 | return m_err_text;
49 | }
50 | void error_msg::set_err_code(int err_code)
51 | {
52 | m_err_code=err_code;
53 | }
54 | int error_msg::add_to_err_text(std::string err_text)
55 | {
56 | m_err_text=m_err_text+"\n"+err_text;
57 | return 0;
58 | }
59 |
--------------------------------------------------------------------------------
/Tools/bmp2c/error_msg.h:
--------------------------------------------------------------------------------
1 | /*This software is under the BSD licence:
2 | Copyright (c) 2007, Sebastien Riou
3 |
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 |
8 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | Neither the name of "nimp software" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
15 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
22 |
23 | #ifndef __ERROR_MSG_H__
24 | #define __ERROR_MSG_H__
25 |
26 | #include
27 |
28 | #define ERROR_MSG_CATCH(func_name) catch(error_msg &e)\
29 | {\
30 | e.add_to_err_text(func_name);\
31 | throw(e);\
32 | }\
33 | catch(std::exception &std_e)\
34 | {\
35 | error_msg e(std_e.what());\
36 | e.add_to_err_text("std::exception");\
37 | e.add_to_err_text(func_name);\
38 | throw e;\
39 | }\
40 | catch(...)\
41 | {\
42 | error_msg e("unknown exception caught");\
43 | e.add_to_err_text(func_name);\
44 | throw e;\
45 | };
46 | class error_msg
47 | {
48 | public:
49 | error_msg::error_msg(int err_code, std::string err_text);
50 | error_msg::error_msg(std::string err_text);
51 | error_msg::~error_msg();
52 | int error_msg::get_err_code();
53 | std::string error_msg::get_err_text();
54 | void error_msg::set_err_code(int err_code);
55 | int error_msg::add_to_err_text(std::string err_text);
56 | private:
57 | std::string m_err_text;
58 | int m_err_code;
59 | };
60 | enum error_msgStdExceptionCodes { UNKNOWN_EXCEPTION=0x10000000,
61 | UNEXPECTED_RESULT_FORMAT,
62 | UNEXPECTED_RESULT,
63 | OBJECT_CORRUPTED,
64 | SYS_FAILURE,
65 | BAD_ARGUMENT};
66 | #endif //__ERROR_MSG_H__
67 |
--------------------------------------------------------------------------------
/Tools/bmp2c/numconv_stringstream.cpp:
--------------------------------------------------------------------------------
1 | /*This software is under the BSD licence:
2 | Copyright (c) 2007, Sebastien Riou
3 |
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 |
8 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | Neither the name of "nimp software" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
15 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
22 |
23 |
24 | #include
25 | #include
26 | using namespace std;
27 | #include "numconv_stringstream.h"
28 | #include "error_msg.h"
29 |
30 | numconv_stringstream::numconv_stringstream()
31 | {
32 | }
33 |
34 | numconv_stringstream::~numconv_stringstream()
35 | {
36 | }
37 |
38 | ////////////////////////////////////////////////////////
39 | numconv_stringstream & operator<<(numconv_stringstream &s,const char & c)
40 | {
41 | stringstream * ss=&s;
42 | (*ss)<<(const int)c;
43 | return s;
44 | }
45 |
46 | numconv_stringstream & operator>>(numconv_stringstream &s,char & c)
47 | {
48 | s>>(int &)c;
49 | return s;
50 | }
51 |
52 | ////////////////////////////////////////////////////////
53 | numconv_stringstream & operator<<(numconv_stringstream &s,const unsigned char & uc)
54 | {
55 | stringstream * ss=&s;
56 | (*ss)<<(const unsigned int)uc;
57 | return s;
58 | }
59 |
60 | numconv_stringstream & operator>>(numconv_stringstream &s,unsigned char & uc)
61 | {
62 | s>>(unsigned int &)uc;
63 | return s;
64 | }
65 |
--------------------------------------------------------------------------------
/Tools/bmp2c/numconv_stringstream.h:
--------------------------------------------------------------------------------
1 | /*This software is under the BSD licence:
2 | Copyright (c) 2007, Sebastien Riou
3 |
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 |
8 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | Neither the name of "nimp software" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
15 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
22 |
23 |
24 | //The numconv_stringstream class is dedicated to conversions of number into or from text:
25 | //numconv_stringstream s;
26 | //unsigned int number=41;
27 | //string number_as_text;
28 | //s<> for char and unsigned char because a conversion
32 | // of those types with regular stringstream requires a cast
33 | //for example a_stringstream<
42 | #include
43 | #include
44 | #include
45 |
46 | class numconv_stringstream : public std::stringstream
47 | {
48 | public:
49 | numconv_stringstream();
50 | ~numconv_stringstream();
51 |
52 | friend numconv_stringstream & operator<<(numconv_stringstream &s,const char & c);
53 | friend numconv_stringstream & operator>>(numconv_stringstream &s,char & c);
54 |
55 | friend numconv_stringstream & operator<<(numconv_stringstream &s,const unsigned char & uc);
56 | friend numconv_stringstream & operator>>(numconv_stringstream &s,unsigned char & uc);
57 |
58 | protected:
59 | private:
60 | };
61 |
62 | #endif // __NUMCONV_STRINGSTREAM_H__
63 |
--------------------------------------------------------------------------------
/Tools/bmp2c/string_ext.h:
--------------------------------------------------------------------------------
1 | /*This software is under the BSD licence:
2 | Copyright (c) 2007, Sebastien Riou
3 |
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 |
8 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | Neither the name of "nimp software" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
15 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
22 |
23 |
24 | #ifndef __STRINGEXT_H__
25 | #define __STRINGEXT_H__
26 | #include
27 | #include "wchar.h"
28 | namespace stringext
29 | {
30 | std::string letters();
31 | std::string numeric_digits();
32 | std::string hex_numeric_digits();
33 | std::string blank();
34 | std::string valid_cpp_id_first_char();
35 | std::string valid_cpp_id();
36 |
37 | //replace each occurence of any character in targets by replacement in the string s
38 | void replace_each_of(std::string &s,
39 | const std::string &targets,
40 | const std::string &replacement);
41 | //replace each occurence of target by replacement in the string s
42 | void replace(std::string &s,
43 | const std::string &target,
44 | const std::string &replacement);
45 |
46 | void remove_white_spaces(std::string &s, bool remove_cr_lf=false);
47 |
48 | bool is_not_blank(const std::string &s);
49 | bool is_blank(const std::string &s);
50 | wchar_t *ansi2unicode(const std::string &s); //the returned buffer must be deleted using the "delete" keyword
51 | std::string unicode2ansi(wchar_t *s);
52 | std::string cpp_encode(const std::string &text);
53 | std::string cpp_decode(const std::string &source, unsigned int *index=0);
54 | }
55 | #endif //__STRINGEXT_H__
56 |
--------------------------------------------------------------------------------
/Tools/bmp2c/win32ext.h:
--------------------------------------------------------------------------------
1 | /*This software is under the BSD licence:
2 | Copyright (c) 2007, Sebastien Riou
3 |
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 |
8 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | Neither the name of "nimp software" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
15 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
22 |
23 | #ifndef __WIN32EXT_H__
24 | #define __WIN32EXT_H__
25 |
26 | #include
27 | #include
28 | #include "wchar.h"
29 | #include "windows.h"
30 |
31 | namespace win32ext
32 | {
33 | void center_child_window(HWND child);
34 | std::string remove_return_file_extension(std::string &file_name);
35 | std::string remove_return_file_name(std::string &full_file_name);
36 | std::string get_module_path();
37 | std::string get_module_file_name();
38 |
39 | enum compare_last_write_time_result { unknown_error=0, file_A_not_found,
40 | file_B_not_found, newer_is_A, same_write_time, newer_is_B};
41 | int compare_last_write_time(std::string file_nameA, std::string file_nameB);
42 |
43 | bool is_file_exist(std::string file_name);
44 |
45 | enum file_existence {any_file_name=0,file_must_exist};
46 | std::string get_file_name( std::string window_title,
47 | file_existence exist_spec=file_must_exist,
48 | const char *filter=0,
49 | std::string def_ext="");
50 | std::string get_current_directory();
51 | void relative_path_to_absolute(std::string &path);//absolute path can be passed as well
52 | bool create_long_directory(const std::string &path);
53 | bool is_directory(const std::string &path);
54 | void find_files(const std::string &file_name_filter, std::list *results);
55 | }
56 | #endif //__WIN32EXT_H__
57 |
--------------------------------------------------------------------------------
/Tools/gobmp2c/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/Duet3D/PanelDueFirmware/Tools/gobmp2c
2 |
3 | go 1.21
4 |
5 | require golang.org/x/image v0.18.0
6 |
--------------------------------------------------------------------------------
/Tools/gobmp2c/go.sum:
--------------------------------------------------------------------------------
1 | golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
2 | golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
3 |
--------------------------------------------------------------------------------
/Tools/gobmp2c/linux/bmp2c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/Tools/gobmp2c/linux/bmp2c
--------------------------------------------------------------------------------
/Tools/gobmp2c/macos/bmp2c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/Tools/gobmp2c/macos/bmp2c
--------------------------------------------------------------------------------
/Tools/gobmp2c/win/bmp2c.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/Tools/gobmp2c/win/bmp2c.exe
--------------------------------------------------------------------------------
/Tools/list-locales/Hardware/UTFT.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Dummy header to avoid unnecessary includes
3 | */
4 |
5 | #ifndef UTFT_h
6 | #define UTFT_h
7 |
8 | #include
9 |
10 | typedef uint16_t Colour;
11 |
12 | const Colour black = 0x0000;
13 | const Colour white = 0xFFFF;
14 |
15 | typedef const uint16_t *Palette;
16 |
17 | namespace UTFT {
18 | inline constexpr uint16_t fromRGB(uint8_t r, uint8_t g, uint8_t b)
19 | {
20 | return ((r & 248) << 8) | ((g & 252) << 3) | (b >> 3);
21 | }
22 | }
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/Tools/list-locales/Makefile:
--------------------------------------------------------------------------------
1 | # TARGET SETTINGS ==============================================================
2 | MAIN = list-locales
3 | PREFIX = /usr/local
4 | BINDIR = $(PREFIX)/bin
5 |
6 | # TOOL SETTINGS ================================================================
7 | CROSS_COMPILE :=
8 | CC = $(CROSS_COMPILE)gcc
9 | CPP = $(CROSS_COMPILE)g++
10 | OBJCOPY = $(CROSS_COMPILE)objcopy
11 | OBJDUMP = $(CROSS_COMPILE)objdump
12 | SIZE = $(CROSS_COMPILE)size
13 | FIND = find
14 | XARGS = xargs
15 | RM = rm -rf
16 | SED = sed
17 | AVRDUDE = avrdude
18 | SREC_CAT = srec_cat
19 | MKDIR = mkdir
20 | INSTALL = install
21 |
22 | # GCC SETTINGS =================================================================
23 | C_STD = gnu99
24 | DEPEND = -E -MD -MP -MF
25 |
26 | CPP_STD =
27 |
28 |
29 | INCLUDE = -I./ -I../../src -I../../lib/librrf/src -I../../lib/qoi
30 | DEFINES = -DSCREEN_70E=1
31 | OPTIMIZE =
32 | WARN = -W -Wall -Wundef -Wextra
33 |
34 | CFLAGS = -std=$(C_STD) $(OPTIMIZE) $(WARN) -Wstrict-prototypes $(INCLUDE) $(DEFINES) -g
35 | CPPFLAGS = $(OPTIMIZE) $(WARN) $(INCLUDE) $(DEFINES) -g
36 | LDFLAGS =
37 |
38 | # MAKE SETTINGS =============================================================
39 | ifneq ($(V),1)
40 | Q := @
41 | endif
42 |
43 | ECHO=@echo
44 | UNAME_S = $(shell uname -s)
45 | ifeq ($(UNAME_S),Linux)
46 | ECHO=@echo -e
47 | endif
48 |
49 | # SOURCES ========================================================================
50 | MAIN_SRCS := list-locales.cpp
51 | MAIN_OBJS := $(MAIN_SRCS:.cpp=.o)
52 | MAIN_DEPS := $(MAIN_SRCS:.cpp=.d)
53 |
54 | # RULES ========================================================================
55 |
56 | all: main
57 | main: $(MAIN)
58 |
59 | -include $(MAIN_DEPS)
60 |
61 | %.d: %.c
62 | $(ECHO) " DEP\t$@"
63 | $(Q)$(CC) $(CFLAGS) $(DEPEND) $@ -c $< 1>/dev/null
64 |
65 | %.o: %.c
66 | $(ECHO) " CC\t$@"
67 | $(Q)$(CC) $(CFLAGS) -c -o $@ $<
68 |
69 | %.d: %.cpp
70 | $(ECHO) " DEP\t$@"
71 | $(Q)$(CPP) $(CPPFLAGS) $(DEPEND) $@ -c $< 1>/dev/null
72 |
73 | %.o: %.cpp
74 | $(ECHO) " CPP\t$@"
75 | $(Q)$(CPP) $(CPPFLAGS) -c -o $@ $<
76 |
77 | $(MAIN): $(MAIN_OBJS) $(MAIN_DEPS)
78 | $(ECHO) " LD\t$@"
79 | $(Q)$(MKDIR) -p $(@D)
80 | $(Q)$(CPP) $(LDFLAGS) -o $@ $(MAIN_OBJS) -Wl,-Map=$(MAIN).map
81 |
82 | clean:
83 | $(FIND) . -regex '.*\.\(d\|map\|o\)$\' | $(XARGS) $(RM)
84 | $(RM) $(MAIN)
85 |
86 | install: $(MAIN)
87 | $(INSTALL) -d $(DESTDIR)$(BINDIR)
88 | $(INSTALL) $(MAIN) $(DESTDIR)$(BINDIR)
89 |
90 | .PHONY: all clean
91 |
--------------------------------------------------------------------------------
/Tools/list-locales/UI/UserInterfaceConstants.hpp:
--------------------------------------------------------------------------------
1 | #ifndef USER_INTERFACE_CONSTANTS
2 | #define USER_INTERFACE_CONSTANTS 1
3 |
4 | #define DEGREE_SYMBOL "\xC2\xB0"
5 | #define THIN_SPACE "\xC2\x80"
6 |
7 | #endif /* ifndef USER_INTERFACE_CONSTANTS */
8 |
9 |
--------------------------------------------------------------------------------
/Tools/list-locales/asf.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dummy header to avoid unnecessary includes
3 | */
4 |
5 | #ifndef ASF_H
6 | #define ASF_H
7 |
8 | #endif // ASF_H
9 |
--------------------------------------------------------------------------------
/env.cmake.example:
--------------------------------------------------------------------------------
1 | # copy or rename this file to env.cmake to store local configuration
2 | # set device
3 | #set( DEVICE "5.0i" )
4 |
5 | # set cross compiler prefix
6 | #set( CROSS_COMPILE "C:/Program\ Files/arm-none-eabi/bin/arm-none-eabi-" )
7 | #set( CROSS_COMPILE "arm-none-eabi-" )
8 |
--------------------------------------------------------------------------------
/src/ASF/common/boards/user_board/init.c:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief User board initialization template
5 | *
6 | */
7 |
8 | #include
9 | #include
10 | #include
11 |
12 | void board_init(void)
13 | {
14 | /* This function is meant to contain board-specific initialization code
15 | * for, e.g., the I/O pins. The initialization can rely on application-
16 | * specific board configuration, found in conf_board.h.
17 | */
18 | }
19 |
--------------------------------------------------------------------------------
/src/ASF/common/boards/user_board/user_board.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief User board definition template
5 | *
6 | */
7 |
8 | /* This file is intended to contain definitions and configuration details for
9 | * features and devices that are available on the board, e.g., frequency and
10 | * startup time for an external crystal, external memory devices, LED and USART
11 | * pins.
12 | */
13 |
14 | #ifndef USER_BOARD_H
15 | #define USER_BOARD_H
16 |
17 | #include
18 |
19 | // External oscillator settings.
20 | // Uncomment and set correct values if external oscillator is used.
21 |
22 | // External oscillator frequency
23 | //#define BOARD_XOSC_HZ 8000000
24 |
25 | // External oscillator type.
26 | //!< External clock signal
27 | //#define BOARD_XOSC_TYPE XOSC_TYPE_EXTERNAL
28 | //!< 32.768 kHz resonator on TOSC
29 | //#define BOARD_XOSC_TYPE XOSC_TYPE_32KHZ
30 | //!< 0.4 to 16 MHz resonator on XTALS
31 | //#define BOARD_XOSC_TYPE XOSC_TYPE_XTAL
32 |
33 | // External oscillator startup time
34 | //#define BOARD_XOSC_STARTUP_US 500000
35 |
36 | #define BOARD_FREQ_SLCK_XTAL (32768UL)
37 | #define BOARD_FREQ_SLCK_BYPASS (32768UL)
38 | #define BOARD_FREQ_MAINCK_XTAL (12000000UL)
39 | #define BOARD_FREQ_MAINCK_BYPASS (12000000UL)
40 | #define BOARD_OSC_STARTUP_US (15625UL)
41 |
42 | #endif // USER_BOARD_H
43 |
--------------------------------------------------------------------------------
/src/ASF/common/services/delay/sam/cycle_counter.c:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief ARM functions for busy-wait delay loops
5 | *
6 | * Copyright (c) 2012-2013 Atmel Corporation. All rights reserved.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * Redistribution and use in source and binary forms, with or without
13 | * modification, are permitted provided that the following conditions are met:
14 | *
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | *
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | *
22 | * 3. The name of Atmel may not be used to endorse or promote products derived
23 | * from this software without specific prior written permission.
24 | *
25 | * 4. This software may only be redistributed and used in connection with an
26 | * Atmel microcontroller product.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 | * POSSIBILITY OF SUCH DAMAGE.
39 | *
40 | * \asf_license_stop
41 | *
42 | */
43 |
44 | #include "cycle_counter.h"
45 |
46 | // Delay loop is put to SRAM so that FWS will not affect delay time
47 | OPTIMIZE_HIGH
48 | RAMFUNC
49 | void portable_delay_cycles(unsigned long n)
50 | {
51 | UNUSED(n);
52 |
53 | __asm (
54 | "loop: DMB \n"
55 | "SUBS R0, R0, #1 \n"
56 | "BNE.N loop "
57 | );
58 | }
59 |
--------------------------------------------------------------------------------
/src/ASF/common/utils/interrupt/interrupt_sam_nvic.c:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Global interrupt management for SAM D20, SAM3 and SAM4 (NVIC based)
5 | *
6 | * Copyright (c) 2012-2013 Atmel Corporation. All rights reserved.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * Redistribution and use in source and binary forms, with or without
13 | * modification, are permitted provided that the following conditions are met:
14 | *
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | *
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | *
22 | * 3. The name of Atmel may not be used to endorse or promote products derived
23 | * from this software without specific prior written permission.
24 | *
25 | * 4. This software may only be redistributed and used in connection with an
26 | * Atmel microcontroller product.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 | * POSSIBILITY OF SUCH DAMAGE.
39 | *
40 | * \asf_license_stop
41 | *
42 | */
43 |
44 | #include "interrupt_sam_nvic.h"
45 |
46 | #if !defined(__DOXYGEN__)
47 | /* Deprecated - global flag to determine the global interrupt state. Required by
48 | * QTouch library, however new applications should use cpu_irq_is_enabled()
49 | * which probes the true global interrupt state from the CPU special registers.
50 | */
51 | volatile bool g_interrupt_enabled = true;
52 | #endif
53 |
54 | void cpu_irq_enter_critical(void)
55 | {
56 | if (cpu_irq_critical_section_counter == 0) {
57 | if (cpu_irq_is_enabled()) {
58 | cpu_irq_disable();
59 | cpu_irq_prev_interrupt_state = true;
60 | } else {
61 | /* Make sure the to save the prev state as false */
62 | cpu_irq_prev_interrupt_state = false;
63 | }
64 |
65 | }
66 |
67 | cpu_irq_critical_section_counter++;
68 | }
69 |
70 | void cpu_irq_leave_critical(void)
71 | {
72 | /* Check if the user is trying to leave a critical section when not in a critical section */
73 | Assert(cpu_irq_critical_section_counter > 0);
74 |
75 | cpu_irq_critical_section_counter--;
76 |
77 | /* Only enable global interrupts when the counter reaches 0 and the state of the global interrupt flag
78 | was enabled when entering critical state */
79 | if ((cpu_irq_critical_section_counter == 0) && (cpu_irq_prev_interrupt_state)) {
80 | cpu_irq_enable();
81 | }
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/src/ASF/sam/drivers/chipid/chipid.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Chip Identifier (CHIPID) driver for SAM.
5 | *
6 | * Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * Subject to your compliance with these terms, you may use Microchip
13 | * software and any derivatives exclusively with Microchip products.
14 | * It is your responsibility to comply with third party license terms applicable
15 | * to your use of third party software (including open source software) that
16 | * may accompany Microchip software.
17 | *
18 | * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
19 | * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
20 | * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
21 | * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
22 | * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
23 | * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
24 | * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
25 | * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
26 | * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
27 | * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
28 | * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
29 | *
30 | * \asf_license_stop
31 | *
32 | */
33 | /*
34 | * Support and FAQ: visit Microchip Support
35 | */
36 |
37 | #ifndef CHIPID_H_INCLUDED
38 | #define CHIPID_H_INCLUDED
39 |
40 | #include "compiler.h"
41 |
42 | /// @cond 0
43 | /**INDENT-OFF**/
44 | #ifdef __cplusplus
45 | extern "C" {
46 | #endif
47 | /**INDENT-ON**/
48 | /// @endcond
49 |
50 | //! Definition for chip id register data struct
51 | typedef struct chipid_data {
52 |
53 | //! Version of the device
54 | uint32_t ul_version;
55 | //! Embedded processor
56 | uint32_t ul_eproc;
57 | //! Non-volatile program memory size
58 | uint32_t ul_nvpsiz;
59 | //! Second non-volatile program memory size
60 | uint32_t ul_nvpsiz2;
61 | //! Internal SRAM size
62 | uint32_t ul_sramsiz;
63 | //! Architecture identifier
64 | uint32_t ul_arch;
65 | //! Non-volatile program memory type
66 | uint32_t ul_nvptyp;
67 | //! Extension flag
68 | uint32_t ul_extflag;
69 | //! Chip ID extension
70 | uint32_t ul_extid;
71 | } chipid_data_t;
72 |
73 | uint32_t chipid_read(Chipid *p_chipid, chipid_data_t *p_chipid_data);
74 | uint32_t chipid_read_version(Chipid *p_chipid);
75 | uint32_t chipid_read_processor(Chipid *p_chipid);
76 | uint32_t chipid_read_arch(Chipid *p_chipid);
77 | uint32_t chipid_read_sramsize(Chipid *p_chipid);
78 | uint32_t chipid_read_nvpmsize(Chipid *p_chipid);
79 | uint32_t chipid_read_nvpm2size(Chipid *p_chipid);
80 | uint32_t chipid_read_nvpmtype(Chipid *p_chipid);
81 | uint32_t chipid_read_extchipid(Chipid *p_chipid);
82 |
83 | /// @cond 0
84 | /**INDENT-OFF**/
85 | #ifdef __cplusplus
86 | }
87 | #endif
88 | /**INDENT-ON**/
89 | /// @endcond
90 |
91 | #endif /* CHIPID_H_INCLUDED */
92 |
--------------------------------------------------------------------------------
/src/ASF/sam/drivers/pio/pio_handler.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Parallel Input/Output (PIO) interrupt handler for SAM.
5 | *
6 | * Copyright (c) 2011-2013 Atmel Corporation. All rights reserved.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * Redistribution and use in source and binary forms, with or without
13 | * modification, are permitted provided that the following conditions are met:
14 | *
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | *
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | *
22 | * 3. The name of Atmel may not be used to endorse or promote products derived
23 | * from this software without specific prior written permission.
24 | *
25 | * 4. This software may only be redistributed and used in connection with an
26 | * Atmel microcontroller product.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 | * POSSIBILITY OF SUCH DAMAGE.
39 | *
40 | * \asf_license_stop
41 | *
42 | */
43 |
44 | #ifndef PIO_HANDLER_H_INCLUDED
45 | #define PIO_HANDLER_H_INCLUDED
46 |
47 | #ifdef __cplusplus
48 | extern "C" {
49 | #endif
50 |
51 | void pio_handler_process(Pio *p_pio, uint32_t ul_id);
52 | void pio_handler_set_priority(Pio *p_pio, IRQn_Type ul_irqn, uint32_t ul_priority);
53 | uint32_t pio_handler_set(Pio *p_pio, uint32_t ul_id, uint32_t ul_mask,
54 | uint32_t ul_attr, void (*p_handler) (uint32_t, uint32_t));
55 | uint32_t pio_handler_set_pin(uint32_t ul_pin, uint32_t ul_flag,
56 | void (*p_handler) (uint32_t, uint32_t));
57 |
58 | #if (SAM3S || SAM4S || SAM4E)
59 | void pio_capture_handler_set(void (*p_handler)(Pio *));
60 | #endif
61 |
62 | #ifdef __cplusplus
63 | }
64 | #endif
65 |
66 | #endif /* PIO_HANDLER_H_INCLUDED */
67 |
--------------------------------------------------------------------------------
/src/ASF/sam/drivers/wdt/wdt.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Watchdog Timer (WDT) driver for SAM.
5 | *
6 | * Copyright (c) 2011-2014 Atmel Corporation. All rights reserved.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * Redistribution and use in source and binary forms, with or without
13 | * modification, are permitted provided that the following conditions are met:
14 | *
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | *
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | *
22 | * 3. The name of Atmel may not be used to endorse or promote products derived
23 | * from this software without specific prior written permission.
24 | *
25 | * 4. This software may only be redistributed and used in connection with an
26 | * Atmel microcontroller product.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 | * POSSIBILITY OF SUCH DAMAGE.
39 | *
40 | * \asf_license_stop
41 | *
42 | */
43 |
44 | #ifndef WDT_H_INCLUDED
45 | #define WDT_H_INCLUDED
46 |
47 | #include "compiler.h"
48 |
49 | /// @cond 0
50 | /**INDENT-OFF**/
51 | #ifdef __cplusplus
52 | extern "C" {
53 | #endif
54 | /**INDENT-ON**/
55 | /// @endcond
56 |
57 | #define WDT_INVALID_ARGUMENT 0xFFFF
58 |
59 | uint32_t wdt_get_timeout_value(uint32_t ul_us, uint32_t ul_sclk);
60 | void wdt_init(Wdt *p_wdt, uint32_t ul_mode, uint16_t us_counter,
61 | uint16_t us_delta);
62 | void wdt_disable(Wdt *p_wdt);
63 | void wdt_restart(Wdt *p_wdt);
64 | uint32_t wdt_get_status(Wdt *p_wdt);
65 | uint32_t wdt_get_us_timeout_period(Wdt *p_wdt, uint32_t ul_sclk);
66 |
67 | /// @cond 0
68 | /**INDENT-OFF**/
69 | #ifdef __cplusplus
70 | }
71 | #endif
72 | /**INDENT-ON**/
73 | /// @endcond
74 |
75 | #endif /* WDT_H_INCLUDED */
76 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/include/component/component_gpbr.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 |
42 | #ifndef _SAM3S_GPBR_COMPONENT_
43 | #define _SAM3S_GPBR_COMPONENT_
44 |
45 | /* ============================================================================= */
46 | /** SOFTWARE API DEFINITION FOR General Purpose Backup Register */
47 | /* ============================================================================= */
48 | /** \addtogroup SAM3S_GPBR General Purpose Backup Register */
49 | /*@{*/
50 |
51 | #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
52 | /** \brief Gpbr hardware registers */
53 | typedef struct {
54 | RwReg SYS_GPBR[8]; /**< \brief (Gpbr Offset: 0x0) General Purpose Backup Register */
55 | } Gpbr;
56 | #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
57 | /* -------- SYS_GPBR[8] : (GPBR Offset: 0x0) General Purpose Backup Register -------- */
58 | #define SYS_GPBR_GPBR_VALUE_Pos 0
59 | #define SYS_GPBR_GPBR_VALUE_Msk (0xffffffffu << SYS_GPBR_GPBR_VALUE_Pos) /**< \brief (SYS_GPBR[8]) Value of GPBR x */
60 | #define SYS_GPBR_GPBR_VALUE(value) ((SYS_GPBR_GPBR_VALUE_Msk & ((value) << SYS_GPBR_GPBR_VALUE_Pos)))
61 |
62 | /*@}*/
63 |
64 |
65 | #endif /* _SAM3S_GPBR_COMPONENT_ */
66 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/include/instance/instance_chipid.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 |
42 | #ifndef _SAM3S_CHIPID_INSTANCE_
43 | #define _SAM3S_CHIPID_INSTANCE_
44 |
45 | /* ========== Register definition for CHIPID peripheral ========== */
46 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
47 | #define REG_CHIPID_CIDR (0x400E0740U) /**< \brief (CHIPID) Chip ID Register */
48 | #define REG_CHIPID_EXID (0x400E0744U) /**< \brief (CHIPID) Chip ID Extension Register */
49 | #else
50 | #define REG_CHIPID_CIDR (*(RoReg*)0x400E0740U) /**< \brief (CHIPID) Chip ID Register */
51 | #define REG_CHIPID_EXID (*(RoReg*)0x400E0744U) /**< \brief (CHIPID) Chip ID Extension Register */
52 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
53 |
54 | #endif /* _SAM3S_CHIPID_INSTANCE_ */
55 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/include/instance/instance_efc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 |
42 | #ifndef _SAM3S_EFC_INSTANCE_
43 | #define _SAM3S_EFC_INSTANCE_
44 |
45 | /* ========== Register definition for EFC peripheral ========== */
46 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
47 | #define REG_EFC_FMR (0x400E0A00U) /**< \brief (EFC) EEFC Flash Mode Register */
48 | #define REG_EFC_FCR (0x400E0A04U) /**< \brief (EFC) EEFC Flash Command Register */
49 | #define REG_EFC_FSR (0x400E0A08U) /**< \brief (EFC) EEFC Flash Status Register */
50 | #define REG_EFC_FRR (0x400E0A0CU) /**< \brief (EFC) EEFC Flash Result Register */
51 | #else
52 | #define REG_EFC_FMR (*(RwReg*)0x400E0A00U) /**< \brief (EFC) EEFC Flash Mode Register */
53 | #define REG_EFC_FCR (*(WoReg*)0x400E0A04U) /**< \brief (EFC) EEFC Flash Command Register */
54 | #define REG_EFC_FSR (*(RoReg*)0x400E0A08U) /**< \brief (EFC) EEFC Flash Status Register */
55 | #define REG_EFC_FRR (*(RoReg*)0x400E0A0CU) /**< \brief (EFC) EEFC Flash Result Register */
56 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
57 |
58 | #endif /* _SAM3S_EFC_INSTANCE_ */
59 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/include/instance/instance_gpbr.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 |
42 | #ifndef _SAM3S_GPBR_INSTANCE_
43 | #define _SAM3S_GPBR_INSTANCE_
44 |
45 | /* ========== Register definition for GPBR peripheral ========== */
46 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
47 | #define REG_GPBR_GPBR (0x400E1490U) /**< \brief (GPBR) General Purpose Backup Register */
48 | #else
49 | #define REG_GPBR_GPBR (*(RwReg*)0x400E1490U) /**< \brief (GPBR) General Purpose Backup Register */
50 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
51 |
52 | #endif /* _SAM3S_GPBR_INSTANCE_ */
53 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/include/instance/instance_rstc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 |
42 | #ifndef _SAM3S_RSTC_INSTANCE_
43 | #define _SAM3S_RSTC_INSTANCE_
44 |
45 | /* ========== Register definition for RSTC peripheral ========== */
46 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
47 | #define REG_RSTC_CR (0x400E1400U) /**< \brief (RSTC) Control Register */
48 | #define REG_RSTC_SR (0x400E1404U) /**< \brief (RSTC) Status Register */
49 | #define REG_RSTC_MR (0x400E1408U) /**< \brief (RSTC) Mode Register */
50 | #else
51 | #define REG_RSTC_CR (*(WoReg*)0x400E1400U) /**< \brief (RSTC) Control Register */
52 | #define REG_RSTC_SR (*(RoReg*)0x400E1404U) /**< \brief (RSTC) Status Register */
53 | #define REG_RSTC_MR (*(RwReg*)0x400E1408U) /**< \brief (RSTC) Mode Register */
54 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
55 |
56 | #endif /* _SAM3S_RSTC_INSTANCE_ */
57 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/include/instance/instance_rtt.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 |
42 | #ifndef _SAM3S_RTT_INSTANCE_
43 | #define _SAM3S_RTT_INSTANCE_
44 |
45 | /* ========== Register definition for RTT peripheral ========== */
46 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
47 | #define REG_RTT_MR (0x400E1430U) /**< \brief (RTT) Mode Register */
48 | #define REG_RTT_AR (0x400E1434U) /**< \brief (RTT) Alarm Register */
49 | #define REG_RTT_VR (0x400E1438U) /**< \brief (RTT) Value Register */
50 | #define REG_RTT_SR (0x400E143CU) /**< \brief (RTT) Status Register */
51 | #else
52 | #define REG_RTT_MR (*(RwReg*)0x400E1430U) /**< \brief (RTT) Mode Register */
53 | #define REG_RTT_AR (*(RwReg*)0x400E1434U) /**< \brief (RTT) Alarm Register */
54 | #define REG_RTT_VR (*(RoReg*)0x400E1438U) /**< \brief (RTT) Value Register */
55 | #define REG_RTT_SR (*(RoReg*)0x400E143CU) /**< \brief (RTT) Status Register */
56 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
57 |
58 | #endif /* _SAM3S_RTT_INSTANCE_ */
59 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/include/instance/instance_supc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 |
42 | #ifndef _SAM3S_SUPC_INSTANCE_
43 | #define _SAM3S_SUPC_INSTANCE_
44 |
45 | /* ========== Register definition for SUPC peripheral ========== */
46 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
47 | #define REG_SUPC_CR (0x400E1410U) /**< \brief (SUPC) Supply Controller Control Register */
48 | #define REG_SUPC_SMMR (0x400E1414U) /**< \brief (SUPC) Supply Controller Supply Monitor Mode Register */
49 | #define REG_SUPC_MR (0x400E1418U) /**< \brief (SUPC) Supply Controller Mode Register */
50 | #define REG_SUPC_WUMR (0x400E141CU) /**< \brief (SUPC) Supply Controller Wake Up Mode Register */
51 | #define REG_SUPC_WUIR (0x400E1420U) /**< \brief (SUPC) Supply Controller Wake Up Inputs Register */
52 | #define REG_SUPC_SR (0x400E1424U) /**< \brief (SUPC) Supply Controller Status Register */
53 | #else
54 | #define REG_SUPC_CR (*(WoReg*)0x400E1410U) /**< \brief (SUPC) Supply Controller Control Register */
55 | #define REG_SUPC_SMMR (*(RwReg*)0x400E1414U) /**< \brief (SUPC) Supply Controller Supply Monitor Mode Register */
56 | #define REG_SUPC_MR (*(RwReg*)0x400E1418U) /**< \brief (SUPC) Supply Controller Mode Register */
57 | #define REG_SUPC_WUMR (*(RwReg*)0x400E141CU) /**< \brief (SUPC) Supply Controller Wake Up Mode Register */
58 | #define REG_SUPC_WUIR (*(RwReg*)0x400E1420U) /**< \brief (SUPC) Supply Controller Wake Up Inputs Register */
59 | #define REG_SUPC_SR (*(RoReg*)0x400E1424U) /**< \brief (SUPC) Supply Controller Status Register */
60 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
61 |
62 | #endif /* _SAM3S_SUPC_INSTANCE_ */
63 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/include/instance/instance_wdt.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 |
42 | #ifndef _SAM3S_WDT_INSTANCE_
43 | #define _SAM3S_WDT_INSTANCE_
44 |
45 | /* ========== Register definition for WDT peripheral ========== */
46 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
47 | #define REG_WDT_CR (0x400E1450U) /**< \brief (WDT) Control Register */
48 | #define REG_WDT_MR (0x400E1454U) /**< \brief (WDT) Mode Register */
49 | #define REG_WDT_SR (0x400E1458U) /**< \brief (WDT) Status Register */
50 | #else
51 | #define REG_WDT_CR (*(WoReg*)0x400E1450U) /**< \brief (WDT) Control Register */
52 | #define REG_WDT_MR (*(RwReg*)0x400E1454U) /**< \brief (WDT) Mode Register */
53 | #define REG_WDT_SR (*(RoReg*)0x400E1458U) /**< \brief (WDT) Status Register */
54 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
55 |
56 | #endif /* _SAM3S_WDT_INSTANCE_ */
57 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/include/sam3s.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 |
42 | #ifndef _SAM3S_
43 | #define _SAM3S_
44 |
45 | #if defined __SAM3S1A__
46 | #include "sam3s1a.h"
47 | #elif defined __SAM3S1B__
48 | #include "sam3s1b.h"
49 | #elif defined __SAM3S1C__
50 | #include "sam3s1c.h"
51 | #elif defined __SAM3S2A__
52 | #include "sam3s2a.h"
53 | #elif defined __SAM3S2B__
54 | #include "sam3s2b.h"
55 | #elif defined __SAM3S2C__
56 | #include "sam3s2c.h"
57 | #elif defined __SAM3S4A__
58 | #include "sam3s4a.h"
59 | #elif defined __SAM3S4B__
60 | #include "sam3s4b.h"
61 | #elif defined __SAM3S4C__
62 | #include "sam3s4c.h"
63 | #else
64 | #error Library does not support the specified device.
65 | #endif
66 |
67 | #endif /* _SAM3S_ */
68 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/source/templates/exceptions.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief This file contains the interface for default exception handlers.
5 | *
6 | * Copyright (c) 2011 Atmel Corporation. All rights reserved.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * Redistribution and use in source and binary forms, with or without
13 | * modification, are permitted provided that the following conditions are met:
14 | *
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | *
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | *
22 | * 3. The name of Atmel may not be used to endorse or promote products derived
23 | * from this software without specific prior written permission.
24 | *
25 | * 4. This software may only be redistributed and used in connection with an
26 | * Atmel microcontroller product.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 | * POSSIBILITY OF SUCH DAMAGE.
39 | *
40 | * \asf_license_stop
41 | *
42 | */
43 |
44 | #ifndef EXCEPTIONS_H_INCLUDED
45 | #define EXCEPTIONS_H_INCLUDED
46 |
47 | #include "sam3s.h"
48 |
49 | /* @cond 0 */
50 | /**INDENT-OFF**/
51 | #ifdef __cplusplus
52 | extern "C" {
53 | #endif
54 | /**INDENT-ON**/
55 | /* @endcond */
56 |
57 | /* Function prototype for exception table items (interrupt handler). */
58 | typedef void (*IntFunc) (void);
59 |
60 | /* Default empty handler */
61 | void Dummy_Handler(void);
62 |
63 | /* @cond 0 */
64 | /**INDENT-OFF**/
65 | #ifdef __cplusplus
66 | }
67 | #endif
68 | /**INDENT-ON**/
69 | /* @endcond */
70 |
71 | #endif /* EXCEPTIONS_H_INCLUDED */
72 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam3s/source/templates/system_sam3s.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Provides the low-level initialization functions that called
5 | * on chip startup.
6 | *
7 | * Copyright (c) 2011-2012 Atmel Corporation. All rights reserved.
8 | *
9 | * \asf_license_start
10 | *
11 | * \page License
12 | *
13 | * Redistribution and use in source and binary forms, with or without
14 | * modification, are permitted provided that the following conditions are met:
15 | *
16 | * 1. Redistributions of source code must retain the above copyright notice,
17 | * this list of conditions and the following disclaimer.
18 | *
19 | * 2. Redistributions in binary form must reproduce the above copyright notice,
20 | * this list of conditions and the following disclaimer in the documentation
21 | * and/or other materials provided with the distribution.
22 | *
23 | * 3. The name of Atmel may not be used to endorse or promote products derived
24 | * from this software without specific prior written permission.
25 | *
26 | * 4. This software may only be redistributed and used in connection with an
27 | * Atmel microcontroller product.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
30 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
32 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
33 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 | * POSSIBILITY OF SUCH DAMAGE.
40 | *
41 | * \asf_license_stop
42 | *
43 | */
44 |
45 | #ifndef SYSTEM_SAM3S_H_INCLUDED
46 | #define SYSTEM_SAM3S_H_INCLUDED
47 |
48 | /* @cond 0 */
49 | /**INDENT-OFF**/
50 | #ifdef __cplusplus
51 | extern "C" {
52 | #endif
53 | /**INDENT-ON**/
54 | /* @endcond */
55 |
56 | #include
57 |
58 | extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
59 |
60 | /**
61 | * @brief Setup the microcontroller system.
62 | * Initialize the System and update the SystemCoreClock variable.
63 | */
64 | void SystemInit(void);
65 |
66 | /**
67 | * @brief Updates the SystemCoreClock with current core Clock
68 | * retrieved from cpu registers.
69 | */
70 | void SystemCoreClockUpdate(void);
71 |
72 | /**
73 | * Initialize flash.
74 | */
75 | void system_init_flash(uint32_t ul_clk);
76 |
77 | /* @cond 0 */
78 | /**INDENT-OFF**/
79 | #ifdef __cplusplus
80 | }
81 | #endif
82 | /**INDENT-ON**/
83 | /* @endcond */
84 |
85 | #endif /* SYSTEM_SAM3S_H_INCLUDED */
86 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/component/component_gpbr.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 | /*
42 | * Support and FAQ: visit Atmel Support
43 | */
44 |
45 | #ifndef _SAM4S_GPBR_COMPONENT_
46 | #define _SAM4S_GPBR_COMPONENT_
47 |
48 | /* ============================================================================= */
49 | /** SOFTWARE API DEFINITION FOR General Purpose Backup Registers */
50 | /* ============================================================================= */
51 | /** \addtogroup SAM4S_GPBR General Purpose Backup Registers */
52 | /*@{*/
53 |
54 | #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
55 | /** \brief Gpbr hardware registers */
56 | typedef struct {
57 | __IO uint32_t SYS_GPBR[8]; /**< \brief (Gpbr Offset: 0x0) General Purpose Backup Register */
58 | } Gpbr;
59 | #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
60 | /* -------- SYS_GPBR[8] : (GPBR Offset: 0x0) General Purpose Backup Register -------- */
61 | #define SYS_GPBR_GPBR_VALUE_Pos 0
62 | #define SYS_GPBR_GPBR_VALUE_Msk (0xffffffffu << SYS_GPBR_GPBR_VALUE_Pos) /**< \brief (SYS_GPBR[8]) Value of GPBR x */
63 | #define SYS_GPBR_GPBR_VALUE(value) ((SYS_GPBR_GPBR_VALUE_Msk & ((value) << SYS_GPBR_GPBR_VALUE_Pos)))
64 |
65 | /*@}*/
66 |
67 |
68 | #endif /* _SAM4S_GPBR_COMPONENT_ */
69 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/instance/instance_chipid.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 | /*
42 | * Support and FAQ: visit Atmel Support
43 | */
44 |
45 | #ifndef _SAM4S_CHIPID_INSTANCE_
46 | #define _SAM4S_CHIPID_INSTANCE_
47 |
48 | /* ========== Register definition for CHIPID peripheral ========== */
49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
50 | #define REG_CHIPID_CIDR (0x400E0740U) /**< \brief (CHIPID) Chip ID Register */
51 | #define REG_CHIPID_EXID (0x400E0744U) /**< \brief (CHIPID) Chip ID Extension Register */
52 | #else
53 | #define REG_CHIPID_CIDR (*(__I uint32_t*)0x400E0740U) /**< \brief (CHIPID) Chip ID Register */
54 | #define REG_CHIPID_EXID (*(__I uint32_t*)0x400E0744U) /**< \brief (CHIPID) Chip ID Extension Register */
55 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
56 |
57 | #endif /* _SAM4S_CHIPID_INSTANCE_ */
58 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/instance/instance_efc0.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 | /*
42 | * Support and FAQ: visit Atmel Support
43 | */
44 |
45 | #ifndef _SAM4S_EFC0_INSTANCE_
46 | #define _SAM4S_EFC0_INSTANCE_
47 |
48 | /* ========== Register definition for EFC0 peripheral ========== */
49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
50 | #define REG_EFC0_FMR (0x400E0A00U) /**< \brief (EFC0) EEFC Flash Mode Register */
51 | #define REG_EFC0_FCR (0x400E0A04U) /**< \brief (EFC0) EEFC Flash Command Register */
52 | #define REG_EFC0_FSR (0x400E0A08U) /**< \brief (EFC0) EEFC Flash Status Register */
53 | #define REG_EFC0_FRR (0x400E0A0CU) /**< \brief (EFC0) EEFC Flash Result Register */
54 | #else
55 | #define REG_EFC0_FMR (*(__IO uint32_t*)0x400E0A00U) /**< \brief (EFC0) EEFC Flash Mode Register */
56 | #define REG_EFC0_FCR (*(__O uint32_t*)0x400E0A04U) /**< \brief (EFC0) EEFC Flash Command Register */
57 | #define REG_EFC0_FSR (*(__I uint32_t*)0x400E0A08U) /**< \brief (EFC0) EEFC Flash Status Register */
58 | #define REG_EFC0_FRR (*(__I uint32_t*)0x400E0A0CU) /**< \brief (EFC0) EEFC Flash Result Register */
59 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
60 |
61 | #endif /* _SAM4S_EFC0_INSTANCE_ */
62 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/instance/instance_efc1.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 | /*
42 | * Support and FAQ: visit Atmel Support
43 | */
44 |
45 | #ifndef _SAM4S_EFC1_INSTANCE_
46 | #define _SAM4S_EFC1_INSTANCE_
47 |
48 | /* ========== Register definition for EFC1 peripheral ========== */
49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
50 | #define REG_EFC1_FMR (0x400E0C00U) /**< \brief (EFC1) EEFC Flash Mode Register */
51 | #define REG_EFC1_FCR (0x400E0C04U) /**< \brief (EFC1) EEFC Flash Command Register */
52 | #define REG_EFC1_FSR (0x400E0C08U) /**< \brief (EFC1) EEFC Flash Status Register */
53 | #define REG_EFC1_FRR (0x400E0C0CU) /**< \brief (EFC1) EEFC Flash Result Register */
54 | #else
55 | #define REG_EFC1_FMR (*(__IO uint32_t*)0x400E0C00U) /**< \brief (EFC1) EEFC Flash Mode Register */
56 | #define REG_EFC1_FCR (*(__O uint32_t*)0x400E0C04U) /**< \brief (EFC1) EEFC Flash Command Register */
57 | #define REG_EFC1_FSR (*(__I uint32_t*)0x400E0C08U) /**< \brief (EFC1) EEFC Flash Status Register */
58 | #define REG_EFC1_FRR (*(__I uint32_t*)0x400E0C0CU) /**< \brief (EFC1) EEFC Flash Result Register */
59 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
60 |
61 | #endif /* _SAM4S_EFC1_INSTANCE_ */
62 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/instance/instance_gpbr.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 | /*
42 | * Support and FAQ: visit Atmel Support
43 | */
44 |
45 | #ifndef _SAM4S_GPBR_INSTANCE_
46 | #define _SAM4S_GPBR_INSTANCE_
47 |
48 | /* ========== Register definition for GPBR peripheral ========== */
49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
50 | #define REG_GPBR_GPBR (0x400E1490U) /**< \brief (GPBR) General Purpose Backup Register */
51 | #else
52 | #define REG_GPBR_GPBR (*(__IO uint32_t*)0x400E1490U) /**< \brief (GPBR) General Purpose Backup Register */
53 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
54 |
55 | #endif /* _SAM4S_GPBR_INSTANCE_ */
56 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/instance/instance_rstc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 | /*
42 | * Support and FAQ: visit Atmel Support
43 | */
44 |
45 | #ifndef _SAM4S_RSTC_INSTANCE_
46 | #define _SAM4S_RSTC_INSTANCE_
47 |
48 | /* ========== Register definition for RSTC peripheral ========== */
49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
50 | #define REG_RSTC_CR (0x400E1400U) /**< \brief (RSTC) Control Register */
51 | #define REG_RSTC_SR (0x400E1404U) /**< \brief (RSTC) Status Register */
52 | #define REG_RSTC_MR (0x400E1408U) /**< \brief (RSTC) Mode Register */
53 | #else
54 | #define REG_RSTC_CR (*(__O uint32_t*)0x400E1400U) /**< \brief (RSTC) Control Register */
55 | #define REG_RSTC_SR (*(__I uint32_t*)0x400E1404U) /**< \brief (RSTC) Status Register */
56 | #define REG_RSTC_MR (*(__IO uint32_t*)0x400E1408U) /**< \brief (RSTC) Mode Register */
57 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
58 |
59 | #endif /* _SAM4S_RSTC_INSTANCE_ */
60 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/instance/instance_rtt.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 | /*
42 | * Support and FAQ: visit Atmel Support
43 | */
44 |
45 | #ifndef _SAM4S_RTT_INSTANCE_
46 | #define _SAM4S_RTT_INSTANCE_
47 |
48 | /* ========== Register definition for RTT peripheral ========== */
49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
50 | #define REG_RTT_MR (0x400E1430U) /**< \brief (RTT) Mode Register */
51 | #define REG_RTT_AR (0x400E1434U) /**< \brief (RTT) Alarm Register */
52 | #define REG_RTT_VR (0x400E1438U) /**< \brief (RTT) Value Register */
53 | #define REG_RTT_SR (0x400E143CU) /**< \brief (RTT) Status Register */
54 | #else
55 | #define REG_RTT_MR (*(__IO uint32_t*)0x400E1430U) /**< \brief (RTT) Mode Register */
56 | #define REG_RTT_AR (*(__IO uint32_t*)0x400E1434U) /**< \brief (RTT) Alarm Register */
57 | #define REG_RTT_VR (*(__I uint32_t*)0x400E1438U) /**< \brief (RTT) Value Register */
58 | #define REG_RTT_SR (*(__I uint32_t*)0x400E143CU) /**< \brief (RTT) Status Register */
59 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
60 |
61 | #endif /* _SAM4S_RTT_INSTANCE_ */
62 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/instance/instance_wdt.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 | /*
42 | * Support and FAQ: visit Atmel Support
43 | */
44 |
45 | #ifndef _SAM4S_WDT_INSTANCE_
46 | #define _SAM4S_WDT_INSTANCE_
47 |
48 | /* ========== Register definition for WDT peripheral ========== */
49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
50 | #define REG_WDT_CR (0x400E1450U) /**< \brief (WDT) Control Register */
51 | #define REG_WDT_MR (0x400E1454U) /**< \brief (WDT) Mode Register */
52 | #define REG_WDT_SR (0x400E1458U) /**< \brief (WDT) Status Register */
53 | #else
54 | #define REG_WDT_CR (*(__O uint32_t*)0x400E1450U) /**< \brief (WDT) Control Register */
55 | #define REG_WDT_MR (*(__IO uint32_t*)0x400E1454U) /**< \brief (WDT) Mode Register */
56 | #define REG_WDT_SR (*(__I uint32_t*)0x400E1458U) /**< \brief (WDT) Status Register */
57 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
58 |
59 | #endif /* _SAM4S_WDT_INSTANCE_ */
60 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/sam4s.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
5 | *
6 | * \asf_license_start
7 | *
8 | * \page License
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted provided that the following conditions are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | *
20 | * 3. The name of Atmel may not be used to endorse or promote products derived
21 | * from this software without specific prior written permission.
22 | *
23 | * 4. This software may only be redistributed and used in connection with an
24 | * Atmel microcontroller product.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 | * POSSIBILITY OF SUCH DAMAGE.
37 | *
38 | * \asf_license_stop
39 | *
40 | */
41 | /*
42 | * Support and FAQ: visit Atmel Support
43 | */
44 |
45 | #ifndef _SAM4S_
46 | #define _SAM4S_
47 |
48 | #if defined __SAM4SA16B__
49 | #include "sam4sa16b.h"
50 | #elif defined __SAM4SA16C__
51 | #include "sam4sa16c.h"
52 | #elif defined __SAM4SD16B__
53 | #include "sam4sd16b.h"
54 | #elif defined __SAM4SD16C__
55 | #include "sam4sd16c.h"
56 | #elif defined __SAM4SD32B__
57 | #include "sam4sd32b.h"
58 | #elif defined __SAM4SD32C__
59 | #include "sam4sd32c.h"
60 | #elif defined __SAM4S2A__
61 | #include "sam4s2a.h"
62 | #elif defined __SAM4S2B__
63 | #include "sam4s2b.h"
64 | #elif defined __SAM4S2C__
65 | #include "sam4s2c.h"
66 | #elif defined __SAM4S4A__
67 | #include "sam4s4a.h"
68 | #elif defined __SAM4S4B__
69 | #include "sam4s4b.h"
70 | #elif defined __SAM4S4C__
71 | #include "sam4s4c.h"
72 | #elif defined __SAM4S8B__
73 | #include "sam4s8b.h"
74 | #elif defined __SAM4S8C__
75 | #include "sam4s8c.h"
76 | #elif defined __SAM4S16B__
77 | #include "sam4s16b.h"
78 | #elif defined __SAM4S16C__
79 | #include "sam4s16c.h"
80 | #else
81 | #error Library does not support the specified device.
82 | #endif
83 |
84 | #endif /* _SAM4S_ */
85 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/cmsis/sam4s/include/system_sam4s.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Provides the low-level initialization functions that called
5 | * on chip startup.
6 | *
7 | * Copyright (c) 2011-2015 Atmel Corporation. All rights reserved.
8 | *
9 | * \asf_license_start
10 | *
11 | * \page License
12 | *
13 | * Redistribution and use in source and binary forms, with or without
14 | * modification, are permitted provided that the following conditions are met:
15 | *
16 | * 1. Redistributions of source code must retain the above copyright notice,
17 | * this list of conditions and the following disclaimer.
18 | *
19 | * 2. Redistributions in binary form must reproduce the above copyright notice,
20 | * this list of conditions and the following disclaimer in the documentation
21 | * and/or other materials provided with the distribution.
22 | *
23 | * 3. The name of Atmel may not be used to endorse or promote products derived
24 | * from this software without specific prior written permission.
25 | *
26 | * 4. This software may only be redistributed and used in connection with an
27 | * Atmel microcontroller product.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
30 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
32 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
33 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 | * POSSIBILITY OF SUCH DAMAGE.
40 | *
41 | * \asf_license_stop
42 | *
43 | */
44 | /*
45 | * Support and FAQ: visit Atmel Support
46 | */
47 |
48 | #ifndef SYSTEM_SAM4S_H_INCLUDED
49 | #define SYSTEM_SAM4S_H_INCLUDED
50 |
51 | /* @cond 0 */
52 | /**INDENT-OFF**/
53 | #ifdef __cplusplus
54 | extern "C" {
55 | #endif
56 | /**INDENT-ON**/
57 | /* @endcond */
58 |
59 | #include
60 |
61 | extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
62 |
63 | /**
64 | * @brief Setup the microcontroller system.
65 | * Initialize the System and update the SystemCoreClock variable.
66 | */
67 | void SystemInit(void);
68 |
69 | /**
70 | * @brief Updates the SystemCoreClock with current core Clock
71 | * retrieved from cpu registers.
72 | */
73 | void SystemCoreClockUpdate(void);
74 |
75 | /**
76 | * Initialize flash.
77 | */
78 | void system_init_flash(uint32_t dw_clk);
79 |
80 | /* @cond 0 */
81 | /**INDENT-OFF**/
82 | #ifdef __cplusplus
83 | }
84 | #endif
85 | /**INDENT-ON**/
86 | /* @endcond */
87 |
88 | #endif /* SYSTEM_SAM4S_H_INCLUDED */
89 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/header_files/io.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Arch file for SAM.
5 | *
6 | * This file defines common SAM series.
7 | *
8 | * Copyright (c) 2011 - 2014 Atmel Corporation. All rights reserved.
9 | *
10 | * \asf_license_start
11 | *
12 | * \page License
13 | *
14 | * Redistribution and use in source and binary forms, with or without
15 | * modification, are permitted provided that the following conditions are met:
16 | *
17 | * 1. Redistributions of source code must retain the above copyright notice,
18 | * this list of conditions and the following disclaimer.
19 | *
20 | * 2. Redistributions in binary form must reproduce the above copyright notice,
21 | * this list of conditions and the following disclaimer in the documentation
22 | * and/or other materials provided with the distribution.
23 | *
24 | * 3. The name of Atmel may not be used to endorse or promote products derived
25 | * from this software without specific prior written permission.
26 | *
27 | * 4. This software may only be redistributed and used in connection with an
28 | * Atmel microcontroller product.
29 | *
30 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
31 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
33 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
34 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
38 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 | * POSSIBILITY OF SUCH DAMAGE.
41 | *
42 | * \asf_license_stop
43 | *
44 | */
45 |
46 | #ifndef _SAM_IO_
47 | #define _SAM_IO_
48 |
49 | /* SAM3 family */
50 |
51 | /* SAM3S series */
52 | #if (SAM3S)
53 | # if (SAM3S8 || SAM3SD8)
54 | # include "sam3s8.h"
55 | # else
56 | # include "sam3s.h"
57 | # endif
58 | #endif
59 |
60 | /* SAM3U series */
61 | #if (SAM3U)
62 | # include "sam3u.h"
63 | #endif
64 |
65 | /* SAM3N series */
66 | #if (SAM3N)
67 | # include "sam3n.h"
68 | #endif
69 |
70 | /* SAM3XA series */
71 | #if (SAM3XA)
72 | # include "sam3xa.h"
73 | #endif
74 |
75 | /* SAM4S series */
76 | #if (SAM4S)
77 | # include "sam4s.h"
78 | #endif
79 |
80 | /* SAM4L series */
81 | #if (SAM4L)
82 | # include "sam4l.h"
83 | #endif
84 |
85 | /* SAM4E series */
86 | #if (SAM4E)
87 | # include "sam4e.h"
88 | #endif
89 |
90 | /* SAM4N series */
91 | #if (SAM4N)
92 | # include "sam4n.h"
93 | #endif
94 |
95 | /* SAM4C series */
96 | #if (SAM4C)
97 | # include "sam4c.h"
98 | #endif
99 |
100 | /* SAM4CM series */
101 | #if (SAM4CM)
102 | # if (SAM4CMP32 || SAM4CMS32)
103 | # include "sam4cm32.h"
104 | # else
105 | # include "sam4cm.h"
106 | # endif
107 | #endif
108 |
109 | /* SAM4CP series */
110 | #if (SAM4CP)
111 | # include "sam4cp.h"
112 | #endif
113 |
114 | /* SAMG51 series */
115 | #if (SAMG51)
116 | # include "samg51.h"
117 | #endif
118 |
119 | /* SAMG53 series */
120 | #if (SAMG53)
121 | # include "samg53.h"
122 | #endif
123 |
124 | /* SAMG54 series */
125 | #if (SAMG54)
126 | # include "samg54.h"
127 | #endif
128 |
129 | #endif /* _SAM_IO_ */
130 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/preprocessor/preprocessor.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Preprocessor utils.
5 | *
6 | * Copyright (c) 2010-2012 Atmel Corporation. All rights reserved.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * Redistribution and use in source and binary forms, with or without
13 | * modification, are permitted provided that the following conditions are met:
14 | *
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | *
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | *
22 | * 3. The name of Atmel may not be used to endorse or promote products derived
23 | * from this software without specific prior written permission.
24 | *
25 | * 4. This software may only be redistributed and used in connection with an
26 | * Atmel microcontroller product.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 | * POSSIBILITY OF SUCH DAMAGE.
39 | *
40 | * \asf_license_stop
41 | *
42 | */
43 |
44 | #ifndef _PREPROCESSOR_H_
45 | #define _PREPROCESSOR_H_
46 |
47 | #include "tpaste.h"
48 | #include "stringz.h"
49 | #include "mrepeat.h"
50 |
51 |
52 | #endif // _PREPROCESSOR_H_
53 |
--------------------------------------------------------------------------------
/src/ASF/sam/utils/preprocessor/stringz.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Preprocessor stringizing utils.
5 | *
6 | * Copyright (c) 2010-2012 Atmel Corporation. All rights reserved.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * Redistribution and use in source and binary forms, with or without
13 | * modification, are permitted provided that the following conditions are met:
14 | *
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | *
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | *
22 | * 3. The name of Atmel may not be used to endorse or promote products derived
23 | * from this software without specific prior written permission.
24 | *
25 | * 4. This software may only be redistributed and used in connection with an
26 | * Atmel microcontroller product.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 | * POSSIBILITY OF SUCH DAMAGE.
39 | *
40 | * \asf_license_stop
41 | *
42 | */
43 |
44 | #ifndef _STRINGZ_H_
45 | #define _STRINGZ_H_
46 |
47 | /**
48 | * \defgroup group_sam_utils_stringz Preprocessor - Stringize
49 | *
50 | * \ingroup group_sam_utils
51 | *
52 | * \{
53 | */
54 |
55 | /*! \brief Stringize.
56 | *
57 | * Stringize a preprocessing token, this token being allowed to be \#defined.
58 | *
59 | * May be used only within macros with the token passed as an argument if the token is \#defined.
60 | *
61 | * For example, writing STRINGZ(PIN) within a macro \#defined by PIN_NAME(PIN)
62 | * and invoked as PIN_NAME(PIN0) with PIN0 \#defined as A0 is equivalent to
63 | * writing "A0".
64 | */
65 | #define STRINGZ(x) #x
66 |
67 | /*! \brief Absolute stringize.
68 | *
69 | * Stringize a preprocessing token, this token being allowed to be \#defined.
70 | *
71 | * No restriction of use if the token is \#defined.
72 | *
73 | * For example, writing ASTRINGZ(PIN0) anywhere with PIN0 \#defined as A0 is
74 | * equivalent to writing "A0".
75 | */
76 | #define ASTRINGZ(x) STRINGZ(x)
77 |
78 | /**
79 | * \}
80 | */
81 |
82 | #endif // _STRINGZ_H_
83 |
--------------------------------------------------------------------------------
/src/ASF/thirdparty/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/ASF/thirdparty/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf
--------------------------------------------------------------------------------
/src/ASF/thirdparty/CMSIS/Lib/GCC/libarm_cortexM3l_math.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/ASF/thirdparty/CMSIS/Lib/GCC/libarm_cortexM3l_math.a
--------------------------------------------------------------------------------
/src/ASF/thirdparty/CMSIS/Lib/GCC/libarm_cortexM4l_math.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/ASF/thirdparty/CMSIS/Lib/GCC/libarm_cortexM4l_math.a
--------------------------------------------------------------------------------
/src/ASF/thirdparty/CMSIS/README.txt:
--------------------------------------------------------------------------------
1 | * -------------------------------------------------------------------
2 | * Copyright (C) 2011 ARM Limited. All rights reserved.
3 | *
4 | * Date: 11 October 2011
5 | * Revision: V3.00
6 | *
7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS)
8 | * Title: Release Note for CMSIS
9 | *
10 | * -------------------------------------------------------------------
11 |
12 |
13 | NOTE - Open the index.html file to access CMSIS documentation
14 |
15 |
16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all
17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects
18 | and reduces time-to-market for new embedded applications.
19 |
20 | CMSIS is released under the terms of the end user license agreement ("CMSIS END USER LICENCE AGREEMENT.pdf").
21 | Any user of the software package is bound to the terms and conditions of the end user license agreement.
22 |
23 |
24 | You will find the following sub-directories:
25 |
26 | Documentation - Contains CMSIS documentation.
27 |
28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the
29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors.
30 |
31 | Include - CMSIS Core Support and CMSIS DSP Include Files.
32 |
33 | Lib - CMSIS DSP Libraries.
34 |
35 | RTOS - CMSIS RTOS API template header file.
36 |
37 | SVD - CMSIS SVD Schema files and Conversion Utility.
38 |
--------------------------------------------------------------------------------
/src/Configuration.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Configuration.hpp
3 | *
4 | * Created: 16/01/2015 13:18:16
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef CONFIGURATION_H_
10 | #define CONFIGURATION_H_
11 |
12 | #include
13 | #include
14 |
15 | #define DISPLAY_TYPE_ITDB02_43 (1) // Itead 4.3 inch display (480 x 272) or alternative 4.3 inch display with 24-bit colour
16 | #define DISPLAY_TYPE_ITDB02_50 (2) // Itead 5.0 inch display (800 x 480) or alternative 5 or 7 inch display with 24-bit colour
17 | #define DISPLAY_TYPE_ITDB02_70 (3) // 7.0 inch display (800 x 480) with 18-bit colour
18 | #define DISPLAY_TYPE_ER_50_70 (4) // 5.0 or 7.0 inch East Rising display (800 x 480) with 24-bit colour
19 | #define DISPLAY_TYPE_CPLD_70 (5) // 7.0 inch CPLD display (800 x 480) with 24-bit colour
20 |
21 | // Define DISPLAY_TYPE to be one of the above 5 types of display
22 |
23 | #ifdef SCREEN_43
24 | #define DISPLAY_TYPE DISPLAY_TYPE_ITDB02_43
25 | #define LARGE_FONT (0)
26 | #define IS_24BIT (true)
27 | #define IS_ER (false)
28 | #endif
29 |
30 | #ifdef SCREEN_50
31 | #define DISPLAY_TYPE DISPLAY_TYPE_ITDB02_50
32 | #define LARGE_FONT (1)
33 | #define IS_24BIT (true)
34 | #define IS_ER (false)
35 | #endif
36 |
37 | #ifdef SCREEN_70
38 | #define DISPLAY_TYPE DISPLAY_TYPE_ITDB02_70
39 | #define LARGE_FONT (1)
40 | #define IS_24BIT (false)
41 | #define IS_ER (false)
42 | #endif
43 |
44 | #if defined(SCREEN_70E) || defined(SCREEN_50E)
45 | #define DISPLAY_TYPE DISPLAY_TYPE_ER_50_70
46 | #define LARGE_FONT (1)
47 | #define IS_24BIT (true)
48 | #define IS_ER (true)
49 | #endif
50 |
51 | #ifdef SCREEN_70CPLD
52 | #define DISPLAY_TYPE DISPLAY_TYPE_CPLD_70
53 | #define LARGE_FONT (1)
54 | #define IS_24BIT (true)
55 | #define IS_ER (false)
56 | #endif
57 |
58 | #define USE_CYRILLIC_CHARACTERS (1)
59 | #define USE_JAPANESE_CHARACTERS (0)
60 |
61 | const uint32_t DefaultBaudRate = 57600;
62 | const uint32_t DimDisplayTimeout = 60000; // dim this display after no activity for this number of milliseconds
63 | const uint32_t DefaultScreensaverTimeout = 120000; // enable screensaver after no activity for this number of milliseconds
64 | const uint32_t ScreensaverMoveTime = 10000; // Jog around screen saver text after this number of milliseconds
65 | const uint32_t DefaultInfoTimeout = 5; // information message timeout in seconds
66 | const uint8_t DefaultBabystepAmountIndex = 1; // default babystep amount of 0.02mm
67 | const uint16_t DefaultFeedrate = 6000; // default feedrate in mm/min
68 |
69 | const uint32_t MinimumEncoderCommandInterval = 100; // minimum time in milliseconds between serial commands sent due to encoder movement
70 |
71 | constexpr uint32_t MinimumLineQuietTime = 200; // the minimum time in milliseconds that we require the receive data line to be quiet before we transmit a non-command request
72 |
73 | const size_t MaxFilnameLength = 120;
74 |
75 | #endif /* CONFIGURATION_H_ */
76 |
--------------------------------------------------------------------------------
/src/ControlCommands.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * ControlCommands.hpp
3 | *
4 | * Created on: 4 Nov 2020
5 | * Author: manuel
6 | */
7 |
8 | #ifndef SRC_CONTROLCOMMANDS_HPP_
9 | #define SRC_CONTROLCOMMANDS_HPP_
10 |
11 | enum class ControlCommand
12 | {
13 | invalid,
14 | reset,
15 | eraseAndReset,
16 | };
17 |
18 |
19 | struct ControlCommandMapEntry
20 | {
21 | const char* key;
22 | const ControlCommand val;
23 | };
24 |
25 | // This table has to be kept in alphabetical order of the keys
26 | const ControlCommandMapEntry controlCommandMap[] =
27 | {
28 | { "eraseAndReset", ControlCommand::eraseAndReset },
29 | { "reset", ControlCommand::reset },
30 | };
31 |
32 | #endif /* SRC_CONTROLCOMMANDS_HPP_ */
33 |
--------------------------------------------------------------------------------
/src/Debug.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DEBUG_HPP
2 | #define DEBUG_HPP 1
3 |
4 | // enable debugging output globally set DEBUG here
5 | // enable debugging locally set DEBUG before including this header
6 | //#define DEBUG (0) // 0: off, 1: MessageLog, 2: Uart
7 |
8 | #if (DEBUG == 1)
9 | #include
10 |
11 | #define dbg(fmt, args...) do { MessageLog::AppendMessageF(MessageLog::LogLevel::Verbose, "%s(%d): " fmt , __FUNCTION__, __LINE__, ##args); } while(0)
12 |
13 | #elif (DEBUG == 2)
14 | #include "Hardware/SerialIo.hpp"
15 |
16 | #define dbg(fmt, args...) do { SerialIo::Dbg("%s(%d): " fmt, __FUNCTION__, __LINE__, ##args); } while(0)
17 |
18 | #else
19 | #define dbg(fmt, args...) do {} while(0)
20 |
21 | #endif
22 |
23 |
24 | #endif /* ifndef DEBUG_HPP */
25 |
--------------------------------------------------------------------------------
/src/FileManager.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * FileManager.h
3 | *
4 | * Created: 06/11/2015 10:52:38
5 | * Author: David
6 | */
7 |
8 | #ifndef FILEMANAGER_H_
9 | #define FILEMANAGER_H_
10 |
11 | #include "Configuration.hpp"
12 | #include "RequestTimer.hpp"
13 | #include "FirmwareFeatures.hpp"
14 | #include
15 |
16 | namespace FileManager
17 | {
18 | const size_t maxPathLength = 100;
19 | typedef String Path;
20 |
21 | class FileSet
22 | {
23 | private:
24 | const unsigned numDisplayed;
25 | Path requestedPath;
26 | Path currentPath;
27 | RequestTimer timer;
28 | int whichList;
29 | int scrollOffset;
30 | bool IsInSubdir() const;
31 | const bool isFilesList; // true for a file list, false for a macro list
32 | uint8_t cardNumber;
33 |
34 | public:
35 | FileSet(const char * _ecv_array rootDir, unsigned numDisp, bool pIsFilesList);
36 | void Display();
37 | void Reload(int whichList, const Path& dir, int errCode);
38 | void ReloadMacroShortList(int errorCode);
39 | void FileListUpdated();
40 | void Scroll(int amount);
41 | void SetIndex(int index) { whichList = index; }
42 | int GetIndex() const { return whichList; }
43 | void SetPath(const char * _ecv_array pPath);
44 | const char * _ecv_array GetPath() { return currentPath.c_str(); }
45 | void RequestParentDir()
46 | pre(IsInSubdir());
47 | void RequestSubdir(const char * _ecv_array dir);
48 | void SetPending();
49 | void StopTimer() { timer.Stop(); }
50 | bool ProcessTimer() { return timer.Process(); }
51 | bool NextCard();
52 | bool SelectCard(unsigned int cardNum);
53 | void FirmwareFeaturesChanged();
54 |
55 | private:
56 | void SetupRootPath();
57 | };
58 |
59 | void BeginNewMessage();
60 | void EndReceivedMessage();
61 | void BeginReceivingFiles();
62 | void ReceiveFile(const char * _ecv_array data);
63 | void ReceiveDirectoryName(const char * _ecv_array data);
64 | void ReceiveErrorCode(int err);
65 |
66 | void DisplayFilesList();
67 | void DisplayMacrosList();
68 | void ScrollFiles(int amount);
69 | void ScrollMacros(int amount);
70 |
71 | void RequestFilesSubdir(const char * _ecv_array dir);
72 | void RequestMacrosSubdir(const char * _ecv_array dir);
73 | void RequestFilesParentDir();
74 | void RequestMacrosParentDir();
75 | const char * _ecv_array GetFilesDir();
76 | const char * _ecv_array GetMacrosDir();
77 | const char * _ecv_array GetMacrosRootDir();
78 |
79 | void RefreshFilesList();
80 | void RefreshMacrosList();
81 | bool ProcessTimers();
82 | bool NextCard();
83 | bool SelectCard(unsigned int cardNum);
84 | void SetNumVolumes(size_t n);
85 | void FirmwareFeaturesChanged();
86 | }
87 |
88 | #endif /* FILEMANAGER_H_ */
89 |
--------------------------------------------------------------------------------
/src/FirmwareFeatures.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * FirmwareFeatures.hpp
3 | *
4 | * Created on: 28 Jan 2017
5 | * Author: David
6 | */
7 |
8 | #ifndef SRC_FIRMWAREFEATURES_HPP_
9 | #define SRC_FIRMWAREFEATURES_HPP_
10 |
11 | #include
12 |
13 | // Firmware features bitmap definition
14 | typedef Bitmap FirmwareFeatureMap;
15 | enum FirmwareFeatures : uint8_t
16 | {
17 | noGcodesFolder = 0, // gcodes files are in 0:/ not 0:/gcodes
18 | noStandbyTemps, // firmware does not support separate tool active and standby temperatures
19 | noG10Temps, // firmware does not support using G10 to set temperatures
20 | noDriveNumber, // firmware does not handle drive numbers at the start of file paths
21 | noM20M36, // firmware does not handle M20 S2 or M36 commands. Use M408 S20 and M408 S36 instead.
22 | quoteFilenames, // filenames should always be quoted in GCode commands
23 | m568TempAndRPM, // firmware supports M568 to set tool temps and tool spindle RPM
24 | };
25 |
26 | #endif /* SRC_FIRMWAREFEATURES_HPP_ */
27 |
--------------------------------------------------------------------------------
/src/Hardware/Backlight.cpp:
--------------------------------------------------------------------------------
1 | #include "Hardware/Backlight.hpp"
2 |
3 | Backlight::Backlight(pwm_channel_t *p_pwm,
4 | uint32_t p_pwmFrequency, uint32_t p_frequency,
5 | uint32_t p_dimBrightness, uint32_t p_normalBrightness,
6 | uint32_t p_minDuty, uint32_t p_maxDuty)
7 | {
8 | pwm = p_pwm;
9 |
10 | frequency = p_frequency;
11 | period = p_pwmFrequency / p_frequency;
12 |
13 | dimBrightness = p_dimBrightness;
14 | normalBrightness = p_normalBrightness;
15 |
16 | minDuty = p_minDuty;
17 | maxDuty = p_maxDuty;
18 |
19 | state = BacklightStateNormal;
20 |
21 | pwm->ul_period = period;
22 | pwm->ul_duty = maxDuty * (period - 1) / Backlight::MaxDutyRange;
23 |
24 | // backlight pwm pin
25 | pio_configure(PIOB, PIO_PERIPH_A, PIO_PB1, 0);
26 |
27 | pwm_channel_init(PWM, pwm);
28 | pwm_channel_enable(PWM, pwm->channel);
29 | }
30 |
31 | void Backlight::UpdateBrightness(uint32_t brightness)
32 | {
33 | pwm->ul_period = period;
34 | pwm->ul_duty = (minDuty + (maxDuty - minDuty) * brightness / Backlight::MaxDutyRange) * (period - 1) / Backlight::MaxBrightness;
35 |
36 | pwm_channel_init(PWM, pwm);
37 | pwm_channel_enable(PWM, pwm->channel);
38 | }
39 |
40 | void Backlight::SetState(enum BacklightState newState)
41 | {
42 | uint32_t brightness = 100;
43 |
44 | if (state == newState)
45 | {
46 | return;
47 | }
48 |
49 | switch (newState)
50 | {
51 | case BacklightStateDimmed:
52 | brightness = dimBrightness;
53 | break;
54 | case BacklightStateNormal:
55 | brightness = normalBrightness;
56 | break;
57 | default:
58 | break;
59 | }
60 |
61 | state = newState;
62 | UpdateBrightness(brightness);
63 | }
64 |
--------------------------------------------------------------------------------
/src/Hardware/Backlight.hpp:
--------------------------------------------------------------------------------
1 | #ifndef HARDWARE_BACKLIGHT_HPP
2 | #define HARDWARE_BACKLIGHT_HPP 1
3 |
4 | #include "asf.h"
5 | #include
6 |
7 | enum BacklightState {
8 | BacklightStateNormal,
9 | BacklightStateDimmed
10 | };
11 |
12 | class Backlight
13 | {
14 | public:
15 | static const uint32_t MinBrightness = 0;
16 | static const uint32_t MaxBrightness = 100;
17 |
18 | static const uint32_t MaxDutyRange = 100;
19 |
20 | Backlight(pwm_channel_t *pwm,
21 | uint32_t pwmFrequency, uint32_t frequency,
22 | uint32_t dimBrightness, uint32_t normalBrightness,
23 | uint32_t minDuty, uint32_t maxDuty);
24 |
25 | void SetDimBrightness(uint32_t p_dimBrightness) { dimBrightness = p_dimBrightness; UpdateBrightness(dimBrightness); }
26 | void SetNormalBrightness(uint32_t p_normalBrightness) { normalBrightness = p_normalBrightness; UpdateBrightness(normalBrightness); }
27 |
28 | void SetState(enum BacklightState state);
29 | enum BacklightState GetState() { return state; }
30 |
31 | private:
32 | pwm_channel_t *pwm;
33 |
34 | uint32_t frequency;
35 | uint32_t period;
36 | uint32_t channel;
37 |
38 | uint32_t dimBrightness;
39 | uint32_t normalBrightness;
40 |
41 | uint32_t minDuty; // in per cent
42 | uint32_t maxDuty; // in per cent
43 |
44 | enum BacklightState state;
45 |
46 | void UpdateBrightness(uint32_t brightness);
47 | };
48 |
49 | #endif /* ifndef HARDWARE_BACKLIGHT_HPP */
50 |
--------------------------------------------------------------------------------
/src/Hardware/Buzzer.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Buzzer.h
3 | *
4 | * Created: 13/11/2014 22:56:34
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef BUZZER_H_
10 | #define BUZZER_H_
11 |
12 | #include
13 |
14 | namespace Buzzer
15 | {
16 | void Init();
17 |
18 | void Beep(uint32_t frequency, uint32_t ms, uint32_t volume);
19 |
20 | void Tick();
21 |
22 | bool Noisy();
23 |
24 | const uint32_t MaxVolume = 5;
25 | const uint32_t DefaultVolume = 3;
26 | }
27 |
28 | #endif /* BUZZER_H_ */
29 |
--------------------------------------------------------------------------------
/src/Hardware/DisplayOrientation.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * DisplayOrientation.hpp
3 | *
4 | * Created: 04/11/2014 17:34:21
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef DISPLAYORIENTATION_H_
10 | #define DISPLAYORIENTATION_H_
11 |
12 | // Enumeration to define the orientation of the display.
13 | // To keep the code small and fast, we use individual bits to say what needs to be done on the display.
14 | // Then we define the supported orientations in terms of those bits.
15 | enum DisplayOrientation : uint8_t {
16 | Default = 0x00,
17 | SwapXY = 0x01,
18 | ReverseX = 0x02,
19 | ReverseY = 0x04,
20 | InvertText = ReverseY,
21 | InvertBitmap = ReverseX
22 | };
23 |
24 | #endif /* DISPLAYORIENTATION_H_ */
25 |
--------------------------------------------------------------------------------
/src/Hardware/FlashStorage.cpp:
--------------------------------------------------------------------------------
1 | #include "FlashStorage.hpp"
2 | #include
3 | #include
4 | #include
5 |
6 | extern int __flash_start__, __flash_end__;
7 |
8 | #define DEBUG 0
9 | #include "Debug.hpp"
10 |
11 | #define FLASH_DEBUG(x) dbg(x)
12 |
13 | static const uint32_t NVPSizes[] =
14 | {
15 | 0,
16 | 8 * 1024,
17 | 16 * 1024,
18 | 32 * 1024,
19 | 0,
20 | 64 * 1024,
21 | 0,
22 | 128 * 1024,
23 | 160 * 1024,
24 | 256 * 1024,
25 | 512 * 1024,
26 | 0,
27 | 1024 * 1024,
28 | 0,
29 | 2048 * 1024,
30 | 0
31 | };
32 |
33 | static_assert(ARRAY_SIZE(NVPSizes) == 16, "invalid NVPSizes table");
34 |
35 | static uint32_t GetFlashSize()
36 | {
37 | return NVPSizes[chipid_read_nvpmsize(CHIPID)];
38 | }
39 |
40 | // Return the start address of the area we use to store non-volatile data.
41 | // Version 2 boards use either a SAM3S2 or a SAM3S4 chip, so the address depends on which one is fitted.
42 | static uint32_t GetNvDataStartAddress()
43 | {
44 | return (uint32_t)(&__flash_start__) + GetFlashSize() - FLASH_DATA_LENGTH;
45 | }
46 |
47 | void FlashStorage::read(uint32_t address, void *data, uint32_t dataLength)
48 | {
49 | memcpy(data, reinterpret_cast(GetNvDataStartAddress()) + address, dataLength);
50 | }
51 |
52 | bool FlashStorage::write(uint32_t address, const void *data, uint32_t dataLength)
53 | {
54 | const uint32_t nvStart = GetNvDataStartAddress();
55 | if (nvStart + address < (uint32_t)&__flash_start__)
56 | {
57 | FLASH_DEBUG("Flash write address too low");
58 | return false; // write address too low
59 | }
60 |
61 | if (nvStart + address + dataLength > (uint32_t)&__flash_start__ + GetFlashSize())
62 | {
63 | FLASH_DEBUG("Flash write address too high");
64 | return false; // write address too high
65 | }
66 |
67 | if (((nvStart + address) & 3) != 0)
68 | {
69 | FLASH_DEBUG("Flash start address must be on 4-byte boundary\n");
70 | return false;
71 | }
72 |
73 | // The flash management code in the ASF is fragile and has a tendency to fail to return. Help it by disabling interrupts.
74 | #if SAM4S
75 | efc_disable_frdy_interrupt(EFC0); // should not be enabled already, but disable it just in case
76 | #else
77 | efc_disable_frdy_interrupt(EFC); // should not be enabled already, but disable it just in case
78 | #endif
79 | irqflags_t flags = cpu_irq_save();
80 |
81 | // Unlock page
82 | uint32_t retCode = flash_unlock(nvStart + address, (uint32_t)GetNvDataStartAddress() + address + dataLength - 1, NULL, NULL);
83 | if (retCode != FLASH_RC_OK)
84 | {
85 | FLASH_DEBUG("Failed to unlock flash for write");
86 | }
87 | else
88 | {
89 | // Write data
90 | retCode = flash_write(nvStart + address, data, dataLength, 1);
91 | if (retCode != FLASH_RC_OK)
92 | {
93 | FLASH_DEBUG("Flash write failed");
94 | }
95 | else
96 | {
97 | // Lock page
98 | retCode = flash_lock(nvStart + address, nvStart + address + dataLength - 1, NULL, NULL);
99 | if (retCode != FLASH_RC_OK)
100 | {
101 | FLASH_DEBUG("Failed to lock flash page");
102 | }
103 | }
104 | }
105 |
106 | cpu_irq_restore(flags);
107 | return retCode == FLASH_RC_OK;
108 | }
109 |
110 | // End
111 |
--------------------------------------------------------------------------------
/src/Hardware/FlashStorage.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | DueFlashStorage saves non-volatile data for Arduino Due.
3 | The library is made to be similar to EEPROM library
4 | Uses flash block 1 per default.
5 |
6 | Note: uploading new software will erase all flash so data written to flash
7 | using this library will not survive a new software upload.
8 |
9 | Inspiration from Pansenti at https://github.com/Pansenti/DueFlash
10 | Rewritten and modified by Sebastian Nilsson
11 | Further modified up by David Crocker
12 | */
13 |
14 |
15 | #ifndef FLASHSTORAGE_H
16 | #define FLASHSTORAGE_H
17 |
18 | #include "asf.h"
19 |
20 | #define FLASH_DATA_LENGTH (64) // 64 bytes of storage
21 |
22 | // FlashStorage is the main namespace for flash functions
23 | namespace FlashStorage
24 | {
25 | // address is the offset into the flash storage area where we want to write the data
26 | // data is a pointer to the data to be written
27 | // dataLength is length of data in bytes
28 |
29 | void read(uint32_t address, void *data, uint32_t dataLength);
30 | bool write(uint32_t address, const void *data, uint32_t dataLength);
31 | };
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/Hardware/Mem.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * mem.cpp
3 | *
4 | * Created: 03/11/2014 14:14:17
5 | * Author: David
6 | */
7 |
8 | #include "Mem.hpp"
9 | #include
10 |
11 | #define MEM_DEBUG 0
12 |
13 | const uint32_t memPattern = 0xA5A5A5A5;
14 |
15 | extern int _end; // end of allocated data, always on a 4-byte boundary
16 |
17 | static unsigned char *heap = nullptr;
18 |
19 | void InitMemory()
20 | {
21 | if (heap == nullptr)
22 | {
23 | heap = (unsigned char *)&_end;
24 | }
25 |
26 | register const uint32_t* stack_ptr asm ("sp");
27 | uint32_t *heapend = reinterpret_cast(heap);
28 | while (heapend + 16 < stack_ptr)
29 | {
30 | *heapend++ = memPattern;
31 | }
32 | }
33 |
34 | void* operator new(size_t objsize)
35 | {
36 | if (heap == nullptr)
37 | {
38 | heap = (unsigned char *)&_end;
39 | }
40 |
41 | void *prev_heap = heap;
42 | heap += (objsize + 3) & (~3);
43 | return prev_heap;
44 | }
45 |
46 | void operator delete(void* obj) { (void)obj; }
47 | void operator delete(void* obj, unsigned int) { (void)obj; }
48 |
49 | static const uint32_t SramSizes[] =
50 | {
51 | 48 * 1024,
52 | 192 * 1024,
53 | 384 * 1024,
54 | 6 * 1024,
55 | 24 * 1024,
56 | 4 * 1024,
57 | 80 * 1024,
58 | 160 * 1024,
59 | 8 * 1024,
60 | 16 * 1024,
61 | 32 * 1024,
62 | 64 * 1024,
63 | 128 * 1024,
64 | 256 * 1024,
65 | 96 * 1024,
66 | 512 * 1024
67 | };
68 |
69 | static_assert(ARRAY_SIZE(SramSizes) == 16, "invalid NVPSizes table");
70 |
71 | uint32_t GetRamSize()
72 | {
73 | return SramSizes[chipid_read_sramsize(CHIPID)];
74 | }
75 |
76 | uint32_t GetFreeMemory()
77 | {
78 | #if MEM_DEBUG
79 | register const uint32_t * stack_ptr asm ("sp");
80 | const uint32_t *heapend = reinterpret_cast(heap);
81 | while (heapend < stack_ptr && *heapend == memPattern)
82 | {
83 | ++heapend;
84 | }
85 |
86 | return (unsigned char*)heapend - heap;
87 | #else
88 | register const unsigned char* stack_ptr asm ("sp");
89 |
90 | return stack_ptr - heap;
91 | #endif
92 | }
93 |
94 | // End
95 |
--------------------------------------------------------------------------------
/src/Hardware/Mem.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * memh.h
3 | *
4 | * Created: 03/11/2014 14:18:15
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef MEM_H_
10 | #define MEM_H_
11 |
12 | #include
13 | #include "chipid.h"
14 |
15 | void* operator new(size_t objsize);
16 |
17 | void operator delete(void* obj);
18 |
19 | uint32_t GetRamEnd();
20 | void InitMemory();
21 | uint32_t GetRamSize();
22 | uint32_t GetFreeMemory();
23 |
24 | #endif /* MEMH_H_ */
25 |
26 | // End
27 |
--------------------------------------------------------------------------------
/src/Hardware/OneBitPort.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * OneBitPort.cpp
3 | *
4 | * Created: 04/11/2014 11:28:10
5 | * Author: David
6 | */
7 |
8 | #include "OneBitPort.hpp"
9 |
10 | OneBitPort::OneBitPort(unsigned int pin)
11 | : port((pin < 32) ? PIOA : PIOB), mask(1u << (pin & 31))
12 | {
13 | }
14 |
15 | void OneBitPort::setMode(PortMode mode) const
16 | {
17 | pio_configure(port, (mode == Output) ? PIO_OUTPUT_0 : PIO_INPUT, mask, (mode == InputPullup) ? PIO_PULLUP : 0);
18 | }
19 |
20 | /*static*/ void OneBitPort::delay(uint8_t del)
21 | {
22 | do
23 | {
24 | asm volatile ("nop\n");
25 | --del;
26 | } while (del != 0);
27 | }
28 |
29 | // End
30 |
--------------------------------------------------------------------------------
/src/Hardware/OneBitPort.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * OneBitPort.hpp
3 | *
4 | * Created: 04/11/2014 11:28:28
5 | * Author: David
6 | */
7 |
8 | #ifndef ONEBITPORT_H_
9 | #define ONEBITPORT_H_
10 |
11 | #include "ecv.h"
12 | #undef array
13 | #undef result
14 | #undef value
15 | #include "asf.h"
16 |
17 | class OneBitPort
18 | {
19 | public:
20 | enum PortMode { Output, Input, InputPullup };
21 |
22 | OneBitPort(unsigned int pin);
23 |
24 | void setMode(PortMode mode) const;
25 |
26 | void setLow() const
27 | {
28 | port->PIO_CODR = mask;
29 | }
30 |
31 | void setHigh() const
32 | {
33 | port->PIO_SODR = mask;
34 | }
35 |
36 | // Pulse the pin high
37 | void pulseHigh() const
38 | {
39 | setHigh();
40 | delay(delay_100ns);
41 | setLow();
42 | }
43 |
44 | // Pulse the pin low
45 | void pulseLow() const
46 | {
47 | setLow();
48 | delay(delay_100ns);
49 | setHigh();
50 | }
51 |
52 | bool read() const
53 | {
54 | return (port->PIO_PDSR & mask) != 0;
55 | }
56 |
57 | static void delay(uint8_t del);
58 |
59 | static const uint8_t delay_100ns = 1; // delay argument for 100ns
60 | static const uint8_t delay_200ns = 2; // delay argument for 200ns
61 |
62 | private:
63 |
64 | Pio * const port; // PIO address
65 | const uint32_t mask; // bit mask
66 | };
67 |
68 | #endif /* ONEBITPORT_H_ */
69 |
--------------------------------------------------------------------------------
/src/Hardware/Reset.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012 Arduino. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include "Reset.hpp"
20 |
21 | #ifdef __cplusplus
22 | extern "C" {
23 | #endif
24 |
25 | void Reset()
26 | {
27 | rstc_start_software_reset(RSTC);
28 | __builtin_unreachable();
29 | }
30 |
31 | // Switch into boot mode and reset
32 | void EraseAndReset()
33 | {
34 | cpu_irq_disable(); // disable interrupts before we call any flash functions. We don't enable them again.
35 |
36 | #if SAM4S
37 | #define IFLASH_ADDR IFLASH0_ADDR
38 | #define IFLASH_PAGE_SIZE IFLASH0_PAGE_SIZE
39 | #define IFLASH_NB_OF_PAGES (IFLASH0_SIZE / IFLASH_PAGE_SIZE)
40 |
41 | WDT->WDT_CR = WDT_CR_KEY_PASSWD | WDT_CR_WDRSTT; // kick the watchdog
42 | #endif
43 |
44 | for(size_t i = 0; i <= IFLASH_NB_OF_PAGES; i++)
45 | {
46 | #if SAM4S
47 | WDT->WDT_CR = WDT_CR_KEY_PASSWD | WDT_CR_WDRSTT; // kick the watchdog
48 | #endif
49 | wdt_restart(WDT);
50 | size_t pageStartAddr = IFLASH_ADDR + i * IFLASH_PAGE_SIZE;
51 | flash_unlock(pageStartAddr, pageStartAddr + IFLASH_PAGE_SIZE - 1, nullptr, nullptr);
52 | }
53 |
54 | flash_clear_gpnvm(1); // tell the system to boot from ROM next time
55 | rstc_start_software_reset(RSTC);
56 | __builtin_unreachable();
57 | }
58 |
59 | #ifdef __cplusplus
60 | }
61 | #endif
62 |
--------------------------------------------------------------------------------
/src/Hardware/Reset.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Reset.h
3 | *
4 | * Created: 07/11/2015 11:46:58
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef RESET_H_
10 | #define RESET_H_
11 |
12 | #include "asf.h"
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | // Restart the hardware
19 | void Reset() noexcept __attribute__((noreturn));
20 | void EraseAndReset() noexcept __attribute__((noreturn));
21 |
22 | #ifdef __cplusplus
23 | }
24 | #endif
25 |
26 | #endif /* RESET_H_ */
27 |
--------------------------------------------------------------------------------
/src/Hardware/RotaryEncoder.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * RotaryEncoder.cpp
3 | *
4 | * Created on: 13 Mar 2020
5 | * Author: David
6 | */
7 |
8 | #include "RotaryEncoder.hpp"
9 | #include
10 | #include "SysTick.hpp"
11 | #include
12 |
13 | RotaryEncoder::RotaryEncoder(unsigned int p0, unsigned int p1, unsigned int pb) noexcept
14 | : pin0(p0), pin1(p1), pinButton(pb),
15 | ppc(2), encoderChange(0), encoderState(0), buttonState(0),
16 | newPress(false), reverseDirection(false), whenSame(0) {}
17 |
18 | inline unsigned int RotaryEncoder::ReadEncoderState() const noexcept
19 | {
20 | return (pin0.read() ? 1u : 0u) | (pin1.read() ? 2u : 0u);
21 | }
22 |
23 | void RotaryEncoder::Init(int pulsesPerClick) noexcept
24 | {
25 | ppc = max(abs(pulsesPerClick), 1);
26 | reverseDirection = (pulsesPerClick < 0);
27 |
28 | // Set up pins
29 | pin0.setMode(OneBitPort::InputPullup);
30 | pin1.setMode(OneBitPort::InputPullup);
31 | pinButton.setMode(OneBitPort::InputPullup);
32 | OneBitPort::delay(200 * OneBitPort::delay_100ns); // ensure we read the initial state correctly
33 |
34 | // Initialise encoder variables
35 | encoderChange = 0;
36 | encoderState = ReadEncoderState();
37 |
38 | // Initialise button variables
39 | buttonState = !pinButton.read();
40 | whenSame = SystemTick::GetTickCount();
41 | newPress = false;
42 | }
43 |
44 | void RotaryEncoder::Poll() noexcept
45 | {
46 | // State transition table. Each entry has the following meaning:
47 | // 0 - the encoder hasn't moved
48 | // 1 or 2 - the encoder has moved 1 or 2 units clockwise
49 | // -1 or -2 = the encoder has moved 1 or 2 units anticlockwise
50 | static const int tbl[16] =
51 | {
52 | 0, +1, -1, 0, // position 3 = 00 to 11, can't really do anything, so 0
53 | -1, 0, -2, +1, // position 2 = 01 to 10, assume it was a bounce and should be 01 -> 00 -> 10
54 | +1, +2, 0, -1, // position 1 = 10 to 01, assume it was a bounce and should be 10 -> 00 -> 01
55 | 0, -1, +1, 0 // position 0 = 11 to 00, can't really do anything
56 | };
57 |
58 | // Poll the encoder
59 | const unsigned int t = ReadEncoderState();
60 | const int movement = tbl[(encoderState << 2) | t];
61 | if (movement != 0)
62 | {
63 | encoderChange += movement;
64 | encoderState = t;
65 | }
66 |
67 | // Poll the button
68 | const uint32_t now = SystemTick::GetTickCount();
69 | const bool b = !pinButton.read();
70 | if (b == buttonState)
71 | {
72 | whenSame = now;
73 | }
74 | else if (now - whenSame > DebounceMillis)
75 | {
76 | buttonState = b;
77 | whenSame = now;
78 | if (buttonState)
79 | {
80 | newPress = true;
81 | }
82 | }
83 | }
84 |
85 | int RotaryEncoder::GetChange() noexcept
86 | {
87 | const int rounding = (ppc - 1)/2;
88 | int r;
89 | if (encoderChange + rounding >= ppc - rounding)
90 | {
91 | r = (encoderChange + rounding)/ppc;
92 | }
93 | else if (encoderChange - rounding <= -ppc)
94 | {
95 | r = -((rounding - encoderChange)/ppc);
96 | }
97 | else
98 | {
99 | r = 0;
100 | }
101 | encoderChange -= (r * ppc);
102 | return (reverseDirection) ? -r : r;
103 | }
104 |
105 | bool RotaryEncoder::GetButtonPress() noexcept
106 | {
107 | const bool ret = newPress;
108 | newPress = false;
109 | return ret;
110 | }
111 |
112 | // End
113 |
--------------------------------------------------------------------------------
/src/Hardware/RotaryEncoder.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * RotaryEncoder.h
3 | *
4 | * Created on: 13 Mar 2020
5 | * Author: David
6 | */
7 |
8 | #ifndef __RotaryEncoderIncluded
9 | #define __RotaryEncoderIncluded
10 |
11 | #include "OneBitPort.hpp"
12 |
13 | // Class to manage a rotary encoder with a push button
14 | class RotaryEncoder
15 | {
16 | const OneBitPort pin0, pin1, pinButton;
17 | int ppc;
18 | int encoderChange;
19 | unsigned int encoderState;
20 | bool buttonState;
21 | bool newPress;
22 | bool reverseDirection;
23 | uint32_t whenSame;
24 |
25 | unsigned int ReadEncoderState() const noexcept;
26 |
27 | static constexpr uint32_t DebounceMillis = 5;
28 |
29 | public:
30 | RotaryEncoder(unsigned int p0, unsigned int p1, unsigned int pb) noexcept;
31 |
32 | void Init(int pulsesPerClick) noexcept;
33 | void Poll() noexcept;
34 | int GetChange() noexcept;
35 | bool GetButtonPress() noexcept;
36 | int GetPulsesPerClick() const noexcept { return ppc; }
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/Hardware/SerialIo.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * SerialIo.hpp
3 | *
4 | * Created: 09/11/2014 09:20:46
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef SERIALIO_H_
10 | #define SERIALIO_H_
11 |
12 | #include
13 | #include
14 | #include
15 | #include "ecv.h"
16 | #undef array
17 | #undef result
18 | #undef value
19 |
20 | namespace SerialIo
21 | {
22 | struct SerialIoCbs
23 | {
24 | void (*StartReceivedMessage)(void);
25 | void (*EndReceivedMessage)(void);
26 | void (*ProcessReceivedValue)(StringRef id, const char val[], const size_t indices[]);
27 | void (*ProcessArrayElementEnd)(const char id[], const size_t index);
28 | void (*ProcessArrayEnd)(const char id[], const size_t indices[]);
29 | void (*ParserErrorEncountered)(int currentState, const char* id, int errors);
30 | };
31 |
32 | void Init(uint32_t baudRate, struct SerialIoCbs *callbacks);
33 | void SetBaudRate(uint32_t baudRate);
34 | void SendChar(char c);
35 | void SetCRC16(bool enable);
36 | size_t Sendf(const char *fmt, ...) __attribute__((format (printf, 1, 0)));
37 | size_t Dbg(const char *fmt, ...) __attribute__((format (printf, 1, 0)));
38 | void SendFilename(const char * _ecv_array dir, const char * _ecv_array name);
39 | void CheckInput();
40 | bool SerialLineQuiet();
41 | }
42 |
43 | #endif /* SERIALIO_H_ */
44 |
--------------------------------------------------------------------------------
/src/Hardware/SysTick.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * SysTick.cpp
3 | *
4 | * Created: 13/11/2014 23:03:37
5 | * Author: David
6 | */
7 |
8 | #include "SysTick.hpp"
9 | #include
10 | #include "asf.h"
11 | #include "Buzzer.hpp"
12 |
13 | namespace SystemTick
14 | {
15 | volatile uint32_t tickCount;
16 |
17 | uint32_t GetTickCount()
18 | {
19 | return tickCount;
20 | }
21 | }
22 |
23 | void SysTick_Handler()
24 | {
25 | wdt_restart(WDT);
26 | ++SystemTick::tickCount;
27 | Buzzer::Tick();
28 | UI::Tick();
29 | }
30 |
31 | // End
32 |
--------------------------------------------------------------------------------
/src/Hardware/SysTick.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * SysTick.hpp
3 | *
4 | * Created: 13/11/2014 23:04:31
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef SYSTICK_H_
10 | #define SYSTICK_H_
11 |
12 | #include
13 |
14 | namespace SystemTick
15 | {
16 | constexpr uint32_t TicksPerSecond = 1000;
17 |
18 | uint32_t GetTickCount(); // get the number of milliseconds since we started
19 | }
20 |
21 | #endif /* SYSTICK_H_ */
22 |
--------------------------------------------------------------------------------
/src/Hardware/UTouch.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | UTouch.cpp - library support for Color TFT LCD Touch screens on SAM3X
3 | Originally based on Utouch library by Henning Karlsen.
4 | Rewritten by D Crocker using the approach described in TI app note http://www.ti.com/lit/pdf/sbaa036.
5 | */
6 |
7 | #ifndef UTouch_h
8 | #define UTouch_h
9 |
10 | #include "asf.h"
11 | #include "OneBitPort.hpp"
12 | #include "DisplayOrientation.hpp"
13 |
14 | class UTouch
15 | {
16 | public:
17 | UTouch(unsigned int tclk, unsigned int tcs, unsigned int tdin, unsigned int dout, unsigned int irq);
18 |
19 | void init(uint16_t xp, uint16_t yp, DisplayOrientation orientationAdjust = Default);
20 | bool read(uint16_t &x, uint16_t &y, bool &repeat, uint16_t * null rawX = nullptr, uint16_t * null rawY = nullptr);
21 | void calibrate(uint16_t xlow, uint16_t xhigh, uint16_t ylow, uint16_t yhigh, uint16_t margin);
22 | void adjustOrientation(DisplayOrientation a) { orientAdjust = (DisplayOrientation) (orientAdjust ^ a); }
23 | DisplayOrientation getOrientation() const { return orientAdjust; }
24 |
25 | private:
26 | OneBitPort portCLK, portCS, portDIN, portDOUT, portIRQ;
27 | DisplayOrientation orientAdjust;
28 | uint16_t disp_x_size, disp_y_size;
29 | uint16_t scaleX, scaleY;
30 | int16_t offsetX, offsetY;
31 |
32 | enum {
33 | released,
34 | pressed
35 | } state;
36 |
37 | bool getTouchData(bool wantY, uint16_t &rslt);
38 | void touch_WriteCommand(uint8_t command);
39 | uint16_t touch_ReadData(uint8_t command);
40 | uint16_t diff(uint16_t a, uint16_t b) { return (a < b) ? b - a : a - b; }
41 | };
42 |
43 | #endif
--------------------------------------------------------------------------------
/src/Hardware/memorysaver.h:
--------------------------------------------------------------------------------
1 | // UTFT Memory Saver
2 | // -----------------
3 | //
4 | // Since most people have only one or possibly two different display modules a lot
5 | // of memory has been wasted to keep support for many unneeded controller chips.
6 | // You now have the option to remove this unneeded code from the library with
7 | // this file.
8 | // By disabling the controllers you don't need you can reduce the memory footprint
9 | // of the library by several Kb.
10 | //
11 | // Uncomment the lines for the display controllers that you don't use to save
12 | // some flash memory by not including the init code for that particular
13 | // controller.
14 |
15 | #define DISABLE_HX8347A 1
16 | #define DISABLE_ILI9327 1
17 | #define DISABLE_SSD1289 1
18 | #define DISABLE_ILI9325C 1
19 | #define DISABLE_ILI9325D 1
20 | #define DISABLE_HX8340B 1
21 | #define DISABLE_HX8340B_8 1
22 | #define DISABLE_HX8340B_S 1
23 | #define DISABLE_HX8352A 1
24 | #define DISABLE_ST7735 1
25 | #define DISABLE_PCF8833 1
26 | #define DISABLE_S1D19122 1
27 | #ifdef SCREEN_70CPLD
28 | #define DISABLE_SSD1963_480 1
29 | #define DISABLE_SSD1963_800 1
30 | #else
31 | #define DISABLE_CPLD_800 1
32 | #endif
33 | #define DISABLE_S6D1121 1
34 |
35 | // End
36 |
--------------------------------------------------------------------------------
/src/Icons/Backspace_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Backspace_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Backspace_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Backspace_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/BedComp_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/BedComp_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/BedComp_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/BedComp_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Bed_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Bed_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Bed_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Bed_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Cancel_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Cancel_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Cancel_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Cancel_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Chamber_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Chamber_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Chamber_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Chamber_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/DownArrow_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/DownArrow_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/DownArrow_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/DownArrow_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Enter_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Enter_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Enter_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Enter_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/File_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/File_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/File_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/File_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeAll_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeAll_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeAll_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeAll_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeU_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeU_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeU_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeU_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeV_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeV_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeW_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeW_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeX_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeX_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeX_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeX_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeY_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeY_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeY_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeY_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeZ_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeZ_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/HomeZ_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/HomeZ_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Icons.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Icons.h
3 | *
4 | * Created: 29/11/2015 12:11:34
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef ICONS_H_
10 | #define ICONS_H_
11 |
12 | extern const uint16_t IconPaletteLight[];
13 | extern const uint16_t IconPaletteDark[];
14 |
15 | extern const uint8_t IconNozzle[], IconSpindle[];
16 |
17 | extern const uint8_t IconHomeAll[], IconBedComp[];
18 |
19 | extern const uint8_t IconBed[], IconChamber[], IconOk[], IconCancel[], IconFiles[], IconKeyboard[], IconTrash[];
20 | extern const uint8_t IconBackspace[], IconUp[], IconDown[], IconEnter[];
21 |
22 | #endif /* ICONS_H_ */
23 |
--------------------------------------------------------------------------------
/src/Icons/Keyboard_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Keyboard_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Keyboard_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Keyboard_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle1_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle1_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle1_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle1_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle2_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle2_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle2_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle2_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle3_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle3_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle3_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle3_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle4_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle4_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle4_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle4_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle5_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle5_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle6_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle6_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Nozzle_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Nozzle_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/OK_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/OK_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/OK_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/OK_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/Spindle_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Spindle_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/Spindle_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/Spindle_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/UpArrow_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/UpArrow_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/UpArrow_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/UpArrow_30h.bmp
--------------------------------------------------------------------------------
/src/Icons/bmp2c.ini:
--------------------------------------------------------------------------------
1 | /*This software is under the BSD licence:
2 | Copyright (c) 2007, Sebastien Riou
3 |
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 |
8 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | Neither the name of "nimp software" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
15 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
22 |
23 |
24 |
25 | [bmp2c]
26 | min_version =0001
27 | x_decl =#define x_#bmp2c_input_file_name_id#
28 | x_decl_postfix =;//width of the picture
29 | y_decl =#define y_#bmp2c_input_file_name_id#
30 | y_decl_postfix =;//height of the picture
31 |
32 | array_decl =static const uint16_t pic_#bmp2c_input_file_name_id#[] =
33 |
34 | data_size =16
35 |
36 | data_map = r7 r6 r5 r4 r3 g7 g6 g5 g4 g3 g2 b7 b6 b5 b4 b3
37 | preview_map = d23 d22 d21 d20 d19 d18 d17 d16 d15 d14 d13 d12 d11 d10 d9 d8 d7 d6 d5 d4 d3 d2 d1 d0
38 | dummy line r7 r6 r5 r4 r3 r2 r1 r0 g7 g6 g5 g4 g3 g2 g1 g0 b7 b6 b5 b4 b3 b2 b1 b0
39 | just to
40 | help to write
41 | the preview_map
42 |
43 | generate_preview_bmp =1
44 | pause =0
45 | src_endl_param =CR_LF
46 |
--------------------------------------------------------------------------------
/src/Icons/nozzle-21h-base.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/nozzle-21h-base.bmp
--------------------------------------------------------------------------------
/src/Icons/trash_21h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/trash_21h.bmp
--------------------------------------------------------------------------------
/src/Icons/trash_30h.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Duet3D/PanelDueFirmware/00f8e9f439eb107230d65a7cb667085b5d4b86f0/src/Icons/trash_30h.bmp
--------------------------------------------------------------------------------
/src/Library/Misc.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Misc.cpp
3 | *
4 | * Created: 14/11/2014 19:58:50
5 | * Author: David
6 | */
7 |
8 | #include
9 | #include "Misc.hpp"
10 |
11 | // If the text starts with decimal digits followed by underscore, skip that bit
12 | const char * _ecv_array SkipDigitsAndUnderscore(const char * _ecv_array text)
13 | {
14 | const char * const _ecv_array originalText = text;
15 | if (isdigit(*text))
16 | {
17 | do
18 | {
19 | ++text;
20 | } while (isdigit(*text));
21 | return (*text == '_') ? text + 1 : originalText;
22 | }
23 | return originalText;
24 | }
25 |
26 | // End
27 |
--------------------------------------------------------------------------------
/src/Library/Misc.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Misc.h
3 | *
4 | * Created: 14/11/2014 19:56:03
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef MISC_H_
10 | #define MISC_H_
11 |
12 | #include
13 | #include "ecv.h"
14 | #undef array
15 | #undef result
16 | #undef value
17 |
18 | // If the text starts with decimal digits followed by underscore, skip that bit
19 | const char * _ecv_array SkipDigitsAndUnderscore(const char * _ecv_array text);
20 |
21 | #endif /* MISC_H_ */
22 |
--------------------------------------------------------------------------------
/src/Library/Thumbnail.cpp:
--------------------------------------------------------------------------------
1 | #include "Library/Thumbnail.hpp"
2 |
3 | extern "C"
4 | {
5 | #include "base64.h"
6 | }
7 |
8 | #include "sys/param.h"
9 |
10 | #define QOI_IMPLEMENTATION 1
11 | #include "qoi.h"
12 |
13 | #define DEBUG 0
14 | #include "Debug.hpp"
15 |
16 | bool ThumbnailIsValid(struct Thumbnail &thumbnail)
17 | {
18 | if (thumbnail.imageFormat != Thumbnail::ImageFormat::Qoi)
19 | {
20 | return false;
21 | }
22 |
23 | if (thumbnail.height == 0 || thumbnail.width == 0)
24 | {
25 | return false;
26 | }
27 |
28 | return true;
29 | }
30 |
31 | bool ThumbnailDataIsValid(struct ThumbnailData &data)
32 | {
33 | return data.size != 0;
34 | }
35 |
36 | int ThumbnailInit(struct Thumbnail &thumbnail)
37 | {
38 | thumbnail.width = 0;
39 | thumbnail.height = 0;
40 | thumbnail.pixel_count = 0;
41 | thumbnail.imageFormat = Thumbnail::ImageFormat::Invalid;
42 |
43 | return qoi_decode_init(&thumbnail.qoi);
44 | }
45 |
46 | int ThumbnailDecodeChunk(struct Thumbnail &thumbnail, struct ThumbnailData &data, ThumbnailProcessCb callback)
47 | {
48 | if (!ThumbnailIsValid(thumbnail))
49 | {
50 | dbg("meta invalid.\n");
51 | return -1;
52 | }
53 |
54 | if (!ThumbnailDataIsValid(data))
55 | {
56 | dbg("data invalid.\n");
57 | return -2;
58 | }
59 |
60 | int ret = base64_decode((const char *)data.buffer, data.size, data.buffer);
61 | if (ret < 0)
62 | {
63 | dbg("decode error %d size %d data\n%s\n",
64 | ret, data.size, data.buffer);
65 | return -3;
66 | }
67 |
68 | dbg("*** received size %d decoded size %d\n", data.size, ret);
69 |
70 | data.size = ret;
71 |
72 | int size_done = 0;
73 | int pixel_decoded = 0;
74 | qoi_rgba_t rgba_buffer[64];
75 |
76 | do
77 | {
78 | dbg("buffer %08x size %d/%d pixbuf %08x pixbuf size %d decoded %08x\n",
79 | data.buffer, data.size, size_done, rgba_buffer, &pixel_decoded);
80 | ret = qoi_decode_chunked(&thumbnail.qoi, (data.buffer) + size_done, data.size - size_done, rgba_buffer, sizeof(rgba_buffer), &pixel_decoded);
81 | if (ret < 0)
82 | {
83 | dbg("failed qoi decoding state %d %d.\n", qoi_decode_state_get(&thumbnail.qoi), ret);
84 | return -4;
85 | }
86 |
87 | if (thumbnail.qoi.height != thumbnail.height ||
88 | thumbnail.qoi.width != thumbnail.width)
89 | {
90 | return -5;
91 | }
92 |
93 | size_done += ret;
94 |
95 | if (callback)
96 | {
97 | //dbg("calling callback\n");
98 | bool cont = callback(thumbnail, thumbnail.pixel_count, rgba_buffer, pixel_decoded);
99 | if (!cont)
100 | return -6;
101 | }
102 |
103 | thumbnail.pixel_count += pixel_decoded;
104 |
105 | dbg("ret %d done %d/%d decoded %d missing %d(%02x) count %d/%d/%d\n",
106 | ret, size_done, data.size, pixel_decoded, thumbnail.qoi.last_bytes_size, thumbnail.qoi.last_bytes[0] & 0xc0,
107 | thumbnail.qoi.pixels_count, thumbnail.pixel_count, thumbnail.height * thumbnail.width);
108 |
109 |
110 | } while (size_done < data.size && qoi_decode_state_get(&thumbnail.qoi) == qoi_decoder_body);
111 |
112 | dbg("done %d/%d pixels %d/%d\n",
113 | size_done, data.size, thumbnail.pixel_count, thumbnail.height * thumbnail.width);
114 |
115 | return qoi_decode_state_get(&thumbnail.qoi) != qoi_decoder_done;
116 | }
117 |
--------------------------------------------------------------------------------
/src/Library/Thumbnail.hpp:
--------------------------------------------------------------------------------
1 | #ifndef THUMBNAIL_HPP
2 | #define THUMBNAIL_HPP 1
3 |
4 | #include
5 | #include
6 |
7 | #include "qoi.h"
8 |
9 |
10 | struct Thumbnail
11 | {
12 | uint16_t width;
13 | uint16_t height;
14 |
15 | uint32_t pixel_count;
16 |
17 | enum ImageFormat {
18 | Invalid = 0,
19 | Qoi,
20 | } imageFormat;
21 |
22 | qoi_desc qoi;
23 | };
24 |
25 | struct ThumbnailData
26 | {
27 | uint16_t size;
28 | unsigned char buffer[1024];
29 | };
30 |
31 | typedef bool (*ThumbnailProcessCb)(const struct Thumbnail &thumbnail, uint32_t pixels_offset, const qoi_rgba_t *pixels, size_t pixels_count);
32 |
33 | bool ThumbnailIsValid(struct Thumbnail &thumbnail);
34 | bool ThumbnailDataIsValid(struct ThumbnailData &data);
35 |
36 | int ThumbnailInit(struct Thumbnail &thumbnail);
37 | int ThumbnailDecodeChunk(struct Thumbnail &thumbnail, struct ThumbnailData &data, ThumbnailProcessCb callback);
38 |
39 | #endif /* ifndef THUMBNAIL_HPP */
40 |
--------------------------------------------------------------------------------
/src/ObjectModel/Axis.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Axis.cpp
3 | *
4 | * Created on: 17 Feb 2021
5 | * Author: manuel
6 | */
7 |
8 | #include "Axis.hpp"
9 | #include "ListHelpers.hpp"
10 | #include
11 | #include
12 |
13 | typedef Vector AxisList;
14 | static AxisList axes;
15 |
16 | namespace OM
17 | {
18 | void OM::Axis::Reset()
19 | {
20 | index = 0;
21 | babystep = 0.0f;
22 | letter[0] = 0;
23 | letter[1] = 0;
24 | for (size_t i = 0; i < Workplaces::MaxTotalWorkplaces; ++i)
25 | {
26 | workplaceOffsets[i] = 0.0f;
27 | }
28 | homed = false;
29 | visible = false;
30 | slot = MaxSlots;
31 | }
32 |
33 | Axis* GetAxis(const size_t index)
34 | {
35 | if (index >= MaxTotalAxes)
36 | {
37 | return nullptr;
38 | }
39 | return GetOrCreate(axes, index, false);
40 | }
41 |
42 | Axis* GetOrCreateAxis(const size_t index)
43 | {
44 | if (index >= MaxTotalAxes)
45 | {
46 | return nullptr;
47 | }
48 | return GetOrCreate(axes, index, true);
49 | }
50 |
51 | bool IterateAxesWhile(function_ref func, const size_t startAt)
52 | {
53 | return axes.IterateWhile(func, startAt);
54 | }
55 |
56 | size_t RemoveAxis(const size_t index, const bool allFollowing)
57 | {
58 | return Remove(axes, index, allFollowing);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/ObjectModel/Axis.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Axis.hpp
3 | *
4 | * Created on: 17 Feb 2021
5 | * Author: manuel
6 | */
7 |
8 | #ifndef SRC_OBJECTMODEL_AXIS_HPP_
9 | #define SRC_OBJECTMODEL_AXIS_HPP_
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | namespace OM
16 | {
17 | enum Workplaces
18 | {
19 | G54,
20 | G55,
21 | G56,
22 | G57,
23 | G58,
24 | G59,
25 | G59_1,
26 | G59_2,
27 | G59_3,
28 | MaxTotalWorkplaces
29 | };
30 |
31 | struct Axis
32 | {
33 | void* operator new(size_t) noexcept { return FreelistManager::Allocate(); }
34 | void operator delete(void* p) noexcept { FreelistManager::Release(p); }
35 |
36 | uint8_t index;
37 | float babystep;
38 | char letter[2];
39 | float workplaceOffsets[9];
40 | uint8_t homed : 1,
41 | visible : 1,
42 | slot : 6;
43 |
44 | void Reset();
45 | };
46 |
47 | Axis* GetAxis(const size_t index);
48 | Axis* GetOrCreateAxis(const size_t index);
49 | bool IterateAxesWhile(function_ref func, const size_t startAt = 0);
50 | size_t RemoveAxis(const size_t index, const bool allFollowing);
51 | }
52 |
53 |
54 | #endif /* SRC_OBJECTMODEL_AXIS_HPP_ */
55 |
--------------------------------------------------------------------------------
/src/ObjectModel/BedOrChamber.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * BedOrChamber.cpp
3 | *
4 | * Created on: 17 Feb 2021
5 | * Author: manuel
6 | */
7 |
8 | #include "BedOrChamber.hpp"
9 | #include "ListHelpers.hpp"
10 | #include
11 | #include
12 |
13 | #define DEBUG 0
14 | #include "Debug.hpp"
15 |
16 | typedef Vector BedList;
17 | typedef Vector ChamberList;
18 |
19 | static BedList beds;
20 | static ChamberList chambers;
21 |
22 | namespace OM
23 | {
24 | void BedOrChamber::Reset()
25 | {
26 | index = 0;
27 | heater = -1;
28 | heaterStatus = HeaterStatus::off;
29 | slot = MaxSlots;
30 | }
31 |
32 | Bed* GetBed(const size_t index)
33 | {
34 | return GetOrCreate(beds, index, false);
35 | }
36 |
37 | Bed* GetOrCreateBed(const size_t index)
38 | {
39 | return GetOrCreate(beds, index, true);
40 | }
41 |
42 | Bed* GetFirstBed()
43 | {
44 | return Find(beds, [](Bed* bed) { return bed->heater > -1; });
45 | }
46 |
47 | size_t GetBedCount()
48 | {
49 | return beds.Size();
50 | }
51 |
52 | bool IterateBedsWhile(function_ref func, const size_t startAt)
53 | {
54 | return beds.IterateWhile(func, startAt);
55 | }
56 |
57 | size_t RemoveBed(const size_t index, const bool allFollowing)
58 | {
59 | return Remove(beds, index, allFollowing);
60 | }
61 |
62 | Chamber* GetChamber(const size_t index)
63 | {
64 | return GetOrCreate(chambers, index, false);
65 | }
66 |
67 | Chamber* GetOrCreateChamber(const size_t index)
68 | {
69 | return GetOrCreate(chambers, index, true);
70 | }
71 |
72 | Chamber* GetFirstChamber()
73 | {
74 | return Find(chambers, [](Chamber* chamber) { return chamber->heater > -1; });
75 | }
76 |
77 | size_t GetChamberCount()
78 | {
79 | return chambers.Size();
80 | }
81 |
82 | bool IterateChambersWhile(function_ref func, const size_t startAt)
83 | {
84 | return chambers.IterateWhile(func, startAt);
85 | }
86 |
87 | size_t RemoveChamber(const size_t index, const bool allFollowing)
88 | {
89 | return Remove(chambers, index, allFollowing);
90 | }
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/src/ObjectModel/BedOrChamber.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * BedOrChamber.hpp
3 | *
4 | * Created on: 17 Feb 2021
5 | * Author: manuel
6 | */
7 |
8 | #ifndef SRC_OBJECTMODEL_BEDORCHAMBER_HPP_
9 | #define SRC_OBJECTMODEL_BEDORCHAMBER_HPP_
10 |
11 |
12 | #include
13 | #include
14 | #include
15 |
16 | namespace OM
17 | {
18 | enum class HeaterStatus
19 | {
20 | off = 0,
21 | standby,
22 | active,
23 | fault,
24 | tuning,
25 | offline
26 | };
27 |
28 |
29 | struct HeaterStatusMapEntry
30 | {
31 | const char* key;
32 | const HeaterStatus val;
33 | };
34 |
35 | // This table has to be kept in alphabetical order of the keys
36 | const HeaterStatusMapEntry heaterStatusMap[] =
37 | {
38 | { "active", HeaterStatus::active },
39 | { "fault", HeaterStatus::fault },
40 | { "off", HeaterStatus::off },
41 | { "offline", HeaterStatus::offline },
42 | { "standby", HeaterStatus::standby },
43 | { "tuning", HeaterStatus::tuning },
44 | };
45 |
46 | struct BedOrChamber
47 | {
48 | void* operator new(size_t) noexcept { return FreelistManager::Allocate(); }
49 | void operator delete(void* p) noexcept { FreelistManager::Release(p); }
50 |
51 | // Index within configured heaters
52 | uint8_t index;
53 | // Id of heater
54 | int8_t heater;
55 | HeaterStatus heaterStatus;
56 | // Slot for display on panel
57 | uint8_t slot;
58 |
59 | void Reset();
60 | };
61 |
62 | typedef BedOrChamber Bed;
63 | typedef BedOrChamber Chamber;
64 |
65 | Bed* GetBed(const size_t index);
66 | Bed* GetOrCreateBed(const size_t index);
67 | Bed* GetFirstBed();
68 | size_t GetBedCount();
69 | bool IterateBedsWhile(function_ref func, const size_t startAt = 0);
70 | size_t RemoveBed(const size_t index, const bool allFollowing);
71 |
72 | Chamber* GetChamber(const size_t index);
73 | Chamber* GetOrCreateChamber(const size_t index);
74 | Chamber* GetFirstChamber();
75 | size_t GetChamberCount();
76 | bool IterateChambersWhile(function_ref func, const size_t startAt = 0);
77 | size_t RemoveChamber(const size_t index, const bool allFollowing);
78 | }
79 |
80 | #endif /* SRC_OBJECTMODEL_BEDORCHAMBER_HPP_ */
81 |
--------------------------------------------------------------------------------
/src/ObjectModel/ListHelpers.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * ListHelpers.hpp
3 | *
4 | * Created on: 17 Feb 2021
5 | * Author: manuel
6 | */
7 |
8 | #ifndef SRC_OBJECTMODEL_LISTHELPERS_HPP_
9 | #define SRC_OBJECTMODEL_LISTHELPERS_HPP_
10 |
11 | #include
12 | #include
13 |
14 | template
15 | T* GetOrCreate(L& list, const size_t index, const bool create)
16 | {
17 | const size_t count = list.Size();
18 | for (size_t i = 0; i < count; ++i)
19 | {
20 | if (list[i]->index == index)
21 | {
22 | return list[i];
23 | }
24 | }
25 |
26 | if (create && !list.Full())
27 | {
28 | T* elem = new T;
29 | elem->Reset();
30 | elem->index = index;
31 | list.Add(elem);
32 | list.Sort([] (T* e1, T* e2) { return e1->index > e2->index; });
33 | return elem;
34 | }
35 |
36 | return nullptr;
37 | }
38 |
39 | template
40 | T* Find(L& list, function_ref filter)
41 | {
42 | const size_t count = list.Size();
43 | for (size_t i = 0; i < count; ++i)
44 | {
45 | if (filter(list[i]))
46 | {
47 | return list[i];
48 | }
49 | }
50 | return nullptr;
51 | }
52 |
53 | template
54 | size_t Remove(L& list, const size_t index, const bool allFollowing)
55 | {
56 | // Nothing to do on an empty list or
57 | // if the last element is already smaller than what we look for
58 | if (list.IsEmpty() || list[list.Size()-1]->index < index)
59 | {
60 | return 0;
61 | }
62 |
63 | size_t removed = 0;
64 | for (size_t i = list.Size(); i != 0;)
65 | {
66 | --i;
67 | T* elem = list[i];
68 | if (elem->index == index || (allFollowing && elem->index > index))
69 | {
70 | list.Erase(i);
71 | delete elem;
72 | ++removed;
73 | if (!allFollowing)
74 | {
75 | break;
76 | }
77 | }
78 | }
79 | return removed;
80 | }
81 |
82 | #endif /* SRC_OBJECTMODEL_LISTHELPERS_HPP_ */
83 |
--------------------------------------------------------------------------------
/src/ObjectModel/PrinterStatus.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * PrinterStatus.hpp
3 | *
4 | * Created on: 6 Jan 2017
5 | * Author: David
6 | */
7 |
8 | #ifndef SRC_OBJECTMODEL_PRINTERSTATUS_HPP_
9 | #define SRC_OBJECTMODEL_PRINTERSTATUS_HPP_
10 |
11 |
12 | namespace OM {
13 | // Status that the printer may report to us.
14 | // The array 'statusText' must be kept in sync with this!
15 | enum class PrinterStatus
16 | {
17 | connecting = 0,
18 | idle = 1,
19 | printing = 2,
20 | stopped = 3,
21 | configuring = 4,
22 | paused = 5,
23 | busy = 6,
24 | pausing = 7,
25 | resuming = 8,
26 | flashing = 9,
27 | toolChange = 10,
28 | simulating = 11,
29 | off = 12,
30 | cancelling = 13,
31 | NumTypes
32 | };
33 |
34 | struct PrinterStatusMapEntry
35 | {
36 | const char* key;
37 | PrinterStatus val;
38 | };
39 |
40 | // This table must be kept in case-insensitive alphabetical order of the search string.
41 | const PrinterStatusMapEntry printerStatusMap[] =
42 | {
43 | {"busy", PrinterStatus::busy },
44 | {"cancelling", PrinterStatus::cancelling },
45 | {"changingTool", PrinterStatus::toolChange },
46 | {"halted", PrinterStatus::stopped },
47 | {"idle", PrinterStatus::idle },
48 | {"off", PrinterStatus::off },
49 | {"paused", PrinterStatus::paused },
50 | {"pausing", PrinterStatus::pausing },
51 | {"processing", PrinterStatus::printing },
52 | {"resuming", PrinterStatus::resuming },
53 | {"simulating", PrinterStatus::simulating },
54 | {"starting", PrinterStatus::configuring },
55 | {"updating", PrinterStatus::flashing },
56 | };
57 | }
58 |
59 | #endif /* SRC_OBJECTMODEL_PRINTERSTATUS_HPP_ */
60 |
--------------------------------------------------------------------------------
/src/ObjectModel/Spindle.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Spindle.cpp
3 | *
4 | * Created on: 17 Feb 2021
5 | * Author: manuel
6 | */
7 |
8 | #include "Spindle.hpp"
9 | #include "ListHelpers.hpp"
10 | #include
11 | #include
12 |
13 | typedef Vector SpindleList;
14 | static SpindleList spindles;
15 |
16 | namespace OM
17 | {
18 | void Spindle::Reset()
19 | {
20 | index = 0;
21 | active = 0;
22 | current = 0;
23 | max = 10000;
24 | min = 0;
25 | state = OM::SpindleState::stopped;
26 | }
27 |
28 | Spindle* GetSpindle(const size_t index)
29 | {
30 | return GetOrCreate(spindles, index, false);
31 | }
32 |
33 | Spindle* GetOrCreateSpindle(const size_t index)
34 | {
35 | return GetOrCreate(spindles, index, true);
36 | }
37 |
38 | size_t RemoveSpindle(const size_t index, const bool allFollowing)
39 | {
40 | return Remove(spindles, index, allFollowing);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/ObjectModel/Spindle.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Spindle.hpp
3 | *
4 | * Created on: 17 Feb 2021
5 | * Author: manuel
6 | */
7 |
8 | #ifndef SRC_OBJECTMODEL_SPINDLE_HPP_
9 | #define SRC_OBJECTMODEL_SPINDLE_HPP_
10 |
11 | #include
12 | #include
13 |
14 | namespace OM
15 | {
16 | enum SpindleState : uint8_t {
17 | stopped, forward, reverse
18 | };
19 |
20 | struct SpindleStateMapEntry
21 | {
22 | const char* key;
23 | const SpindleState val;
24 | };
25 |
26 | // This table has to be kept in alphabetical order of the keys
27 | const SpindleStateMapEntry spindleStateMap[] =
28 | {
29 | { "forward", SpindleState::forward },
30 | { "reverse", SpindleState::reverse },
31 | { "stopped", SpindleState::stopped },
32 | };
33 |
34 | struct Spindle
35 | {
36 | void* operator new(size_t) noexcept { return FreelistManager::Allocate(); }
37 | void operator delete(void* p) noexcept { FreelistManager::Release(p); }
38 |
39 | // Index within configured spindles
40 | uint8_t index;
41 | uint32_t active;
42 | uint32_t current;
43 | uint32_t max;
44 | uint32_t min;
45 | SpindleState state;
46 |
47 | void Reset();
48 | };
49 |
50 | Spindle* GetSpindle(const size_t index);
51 | Spindle* GetOrCreateSpindle(const size_t index);
52 | size_t RemoveSpindle(const size_t index, const bool allFollowing);
53 | }
54 |
55 | #endif /* SRC_OBJECTMODEL_SPINDLE_HPP_ */
56 |
--------------------------------------------------------------------------------
/src/ObjectModel/Tool.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Tool.hpp
3 | *
4 | * Created on: 17 Feb 2021
5 | * Author: manuel
6 | */
7 |
8 | #ifndef SRC_OBJECTMODEL_TOOL_HPP_
9 | #define SRC_OBJECTMODEL_TOOL_HPP_
10 |
11 | #include
12 | #include "Spindle.hpp"
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 |
19 | namespace OM
20 | {
21 | typedef Bitmap ExtrudersBitmap; // Type of a bitmap representing a set of extruder drive numbers
22 | typedef Bitmap FansBitmap; // Type of a bitmap representing a set of fan numbers
23 |
24 | struct ToolHeater
25 | {
26 | void* operator new(size_t) noexcept { return FreelistManager::Allocate(); }
27 | void operator delete(void* p) noexcept { FreelistManager::Release(p); }
28 |
29 | uint8_t heaterIndex; // This is the heater number
30 | int16_t activeTemp;
31 | int16_t standbyTemp;
32 |
33 | void Reset();
34 | };
35 |
36 | // Status that a tool may report to us.
37 | enum class ToolStatus
38 | {
39 | off = 0,
40 | active = 1,
41 | standby = 2,
42 | };
43 |
44 | struct ToolStatusMapEntry
45 | {
46 | const char* key;
47 | ToolStatus val;
48 | };
49 |
50 | // This table must be kept in case-insensitive alphabetical order of the search string.
51 | const ToolStatusMapEntry toolStatusMap[] =
52 | {
53 | {"active", ToolStatus::active },
54 | {"off", ToolStatus::off },
55 | {"standby", ToolStatus::standby },
56 | };
57 |
58 | struct Tool
59 | {
60 | void* operator new(size_t) noexcept { return FreelistManager::Allocate(); }
61 | void operator delete(void* p) noexcept;
62 |
63 | // tool number
64 | uint8_t index;
65 | ToolHeater* heaters[MaxHeatersPerTool];
66 | ExtrudersBitmap extruders;
67 | FansBitmap fans;
68 | Spindle* spindle;
69 | int32_t spindleRpm;
70 | float offsets[MaxTotalAxes];
71 | ToolStatus status;
72 | uint8_t slot;
73 |
74 | ToolHeater* GetOrCreateHeater(const uint8_t toolHeaterIndex);
75 | bool GetHeaterTemps(const StringRef& ref, const bool active);
76 | int8_t HasHeater(const uint8_t heaterIndex) const;
77 | void IterateHeaters(function_ref func, const size_t startAt = 0);
78 | size_t RemoveHeatersFrom(const uint8_t toolHeaterIndex);
79 | void UpdateTemp(const uint8_t toolHeaterIndex, const int32_t temp, const bool active);
80 |
81 | void Reset();
82 | };
83 |
84 | Tool* GetTool(const size_t index);
85 | Tool* GetOrCreateTool(const size_t index);
86 | bool IterateToolsWhile(function_ref func, const size_t startAt = 0);
87 | size_t RemoveTool(const size_t index, const bool allFollowing);
88 | }
89 |
90 | #endif /* SRC_OBJECTMODEL_TOOL_HPP_ */
91 |
--------------------------------------------------------------------------------
/src/ObjectModel/Utils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * ObjectModel.cpp
3 | *
4 | * Created on: 7 Sep 2020
5 | * Author: manuel
6 | */
7 |
8 | #include
9 | #include "Axis.hpp"
10 | #include "BedOrChamber.hpp"
11 | #include "Spindle.hpp"
12 | #include "Tool.hpp"
13 | #include "ListHelpers.hpp"
14 | #include "FlashData.hpp"
15 |
16 | namespace OM
17 | {
18 | void GetHeaterSlots(
19 | const size_t heaterIndex,
20 | Slots& slots,
21 | const bool addTools,
22 | const bool addBeds,
23 | const bool addChambers)
24 | {
25 | if (addBeds)
26 | {
27 | IterateBedsWhile(
28 | [&slots, heaterIndex](Bed*& bed, size_t) {
29 | if (bed->slot < MaxSlots && bed->heater == (int)heaterIndex)
30 | {
31 | slots.Add(bed->slot);
32 | }
33 | return bed->slot < MaxSlots;
34 | });
35 | }
36 | if (addChambers)
37 | {
38 | IterateChambersWhile(
39 | [&slots, heaterIndex](Chamber*& chamber, size_t) {
40 | if (chamber->slot < MaxSlots && chamber->heater == (int)heaterIndex)
41 | {
42 | slots.Add(chamber->slot);
43 | }
44 | return chamber->slot < MaxSlots;
45 | });
46 | }
47 | if (addTools)
48 | {
49 | IterateToolsWhile(
50 | [&slots, heaterIndex](Tool*& tool, size_t) {
51 | if (tool->slot < MaxSlots)
52 | {
53 | if (nvData.GetHeaterCombineType() == HeaterCombineType::notCombined)
54 | {
55 | tool->IterateHeaters([tool, &slots, heaterIndex](ToolHeater* th, size_t index) {
56 | if (tool->slot + index < MaxSlots && th->heaterIndex == (int) heaterIndex)
57 | {
58 | slots.Add(tool->slot + index);
59 | }
60 | });
61 | }
62 | else
63 | {
64 | if (tool->slot < MaxSlots && tool->heaters[0] != nullptr && tool->heaters[0]->heaterIndex == (int) heaterIndex)
65 | {
66 | slots.Add(tool->slot);
67 | }
68 | }
69 | }
70 | return tool->slot < MaxSlots;
71 | });
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/ObjectModel/Utils.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * ObjectModel.hpp
3 | *
4 | * Created on: 7 Sep 2020
5 | * Author: manuel
6 | */
7 |
8 | #ifndef SRC_OBJECTMODEL_UTILS_HPP_
9 | #define SRC_OBJECTMODEL_UTILS_HPP_
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | namespace OM {
16 | typedef Vector Slots;
17 |
18 | void GetHeaterSlots(
19 | const size_t heaterIndex,
20 | Slots& slots,
21 | const bool addTools = true,
22 | const bool addBeds = true,
23 | const bool addChambers = true);
24 | }
25 |
26 | #endif /* SRC_OBJECTMODEL_UTILS_HPP_ */
27 |
--------------------------------------------------------------------------------
/src/PanelDue.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * PanelDue.hpp
3 | *
4 | * Created: 06/12/2014 14:23:38
5 | * Author: David
6 | */
7 |
8 | #ifndef PANELDUE_H_
9 | #define PANELDUE_H_
10 |
11 | #include "ecv.h"
12 | #undef array
13 | #undef result
14 | #undef value
15 | #include "FirmwareFeatures.hpp"
16 | #include "FlashData.hpp"
17 | #include
18 | #include
19 |
20 | // Functions called from module UserInterface
21 | extern bool IsPrintingStatus(OM::PrinterStatus status);
22 | extern bool PrintInProgress();
23 | extern OM::PrinterStatus GetStatus();
24 | extern void TouchBeep();
25 | extern void ErrorBeep();
26 | extern void CalibrateTouch();
27 |
28 | // Functions called from module UserInterface to manipulate non-volatile settings and associated hardware
29 | extern void FactoryReset();
30 | extern void SaveSettings();
31 | extern bool IsSaveNeeded();
32 | extern void MirrorDisplay();
33 | extern void InvertDisplay();
34 | extern void LandscapeDisplay(const bool withTouch = true);
35 | extern void PortraitDisplay(const bool withTouch = true);
36 | extern void SetBaudRate(uint32_t rate);
37 | extern void SetBrightness(int percent);
38 |
39 | extern void CurrentAlertModeClear();
40 |
41 | extern FirmwareFeatureMap GetFirmwareFeatures();
42 | extern const char* _ecv_array CondStripDrive(const char* _ecv_array arg);
43 | extern void Delay(uint32_t milliSeconds);
44 |
45 | // Global data in PanelDue.cpp that is used elsewhere
46 | extern UTFT lcd;
47 |
48 | const size_t MIN_AXES = 2; // the minimum number of axes we support
49 |
50 | #endif /* PANELDUE_H_ */
51 |
--------------------------------------------------------------------------------
/src/RequestTimer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * RequestTimer.cpp
3 | *
4 | * Created: 06/11/2015 14:22:55
5 | * Author: David
6 | */
7 |
8 | #include "RequestTimer.hpp"
9 | #include "asf.h"
10 | #include
11 | #include
12 |
13 | RequestTimer::RequestTimer(uint32_t del, const char * _ecv_array cmd, const char * _ecv_array null ex)
14 | : startTime(SystemTick::GetTickCount()), delayTime(del), command(cmd), extra(ex), quoteArgument(false)
15 | {
16 | timerState = stopped;
17 | }
18 |
19 | bool RequestTimer::Process()
20 | {
21 | if (timerState == running)
22 | {
23 | uint32_t now = SystemTick::GetTickCount();
24 | if (now - startTime > delayTime)
25 | {
26 | timerState = ready;
27 | }
28 | }
29 |
30 | if (timerState == ready && SerialIo::SerialLineQuiet())
31 | {
32 | SerialIo::Sendf(command);
33 | if (extra != nullptr)
34 | {
35 | if (quoteArgument)
36 | {
37 | SerialIo::Sendf("\"%s\"", not_null(extra));
38 | }
39 | else
40 | {
41 | SerialIo::Sendf(not_null(extra));
42 | }
43 | }
44 | SerialIo::SendChar('\n');
45 | startTime = SystemTick::GetTickCount();
46 | timerState = running;
47 | return true;
48 | }
49 | return false;
50 | }
51 |
52 | // End
53 |
--------------------------------------------------------------------------------
/src/RequestTimer.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * RequestTimer.h
3 | *
4 | * Created: 06/11/2015 14:22:05
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef REQUESTTIMER_H_
10 | #define REQUESTTIMER_H_
11 |
12 | #include
13 | #include "ecv.h"
14 | #undef array
15 | #undef result
16 | #undef value
17 |
18 | class RequestTimer
19 | {
20 | enum { stopped, running, ready } timerState;
21 | uint32_t startTime;
22 | uint32_t delayTime;
23 | const char * _ecv_array command;
24 | const char * _ecv_array null extra;
25 | bool quoteArgument;
26 |
27 | public:
28 | RequestTimer(uint32_t del, const char * _ecv_array cmd, const char * _ecv_array null ex = nullptr);
29 | void SetCommand(const char * _ecv_array cmd) { command = cmd; }
30 | void SetArgument(const char * _ecv_array null arg, bool doQuote) { extra = arg; quoteArgument = doQuote; }
31 | void SetPending() { timerState = ready; }
32 | void Stop() { timerState = stopped; }
33 | bool Process();
34 | };
35 |
36 | #endif /* REQUESTTIMER_H_ */
37 |
--------------------------------------------------------------------------------
/src/UI/Alert.hpp:
--------------------------------------------------------------------------------
1 | #ifndef UI_ALERT_HPP
2 | #define UI_ALERT_HPP 1
3 |
4 | #include
5 | #include
6 | #include
7 | #include "General/Bitmap.h"
8 | #include "General/SimpleMath.h"
9 | #include "General/String.h"
10 | #include "General/Vector.hpp"
11 |
12 | const size_t alertTextLength = 165; // maximum characters in the alert text
13 | const size_t alertTitleLength = 50; // maximum characters in the alert title
14 |
15 | struct Alert
16 | {
17 | enum Mode : int32_t {
18 | None = -1,
19 | Info = 0,
20 | InfoClose = 1,
21 | InfoConfirm = 2,
22 | ConfirmCancel = 3,
23 | Choices = 4,
24 | NumberInt = 5,
25 | NumberFloat = 6,
26 | Text = 7,
27 | Max
28 | } mode;
29 | uint32_t seq;
30 | uint32_t controls;
31 | float timeout;
32 | Bitmap flags;
33 | String<50> title;
34 | String text;
35 |
36 | static constexpr uint8_t GotMode = 0;
37 | static constexpr uint8_t GotSeq = 1;
38 | static constexpr uint8_t GotTimeout = 2;
39 | static constexpr uint8_t GotTitle = 3;
40 | static constexpr uint8_t GotText = 4;
41 | static constexpr uint8_t GotControls = 5;
42 | static constexpr uint8_t GotAll =
43 | (1 << GotMode)
44 | | (1 << GotSeq)
45 | | (1 << GotTimeout)
46 | | (1 << GotTitle)
47 | | (1 << GotText)
48 | | (1 << GotControls);
49 |
50 | bool cancelButton;
51 | String<32> choices[10];
52 | size_t choices_count;
53 |
54 | struct Limits {
55 | struct {
56 | int32_t min;
57 | int32_t max;
58 | int32_t valueDefault;
59 | } numberInt;
60 | struct {
61 | float min;
62 | float max;
63 | float valueDefault;
64 | } numberFloat;
65 | struct {
66 | int32_t min;
67 | int32_t max;
68 | String<32> valueDefault;
69 | } text;
70 | } limits;
71 |
72 | Alert() : mode(Mode::Info), seq(0), controls(0), timeout(0.0) { Reset(); }
73 |
74 | bool AllFlagsSet() const { return flags.GetRaw() == GotAll; }
75 | void Reset()
76 | {
77 | mode = Mode::None;
78 | flags.Clear();
79 | for (size_t i = 0; i < ARRAY_SIZE(choices); i++)
80 | {
81 | choices[i].Clear();
82 | }
83 | limits.numberInt.min = 0;
84 | limits.numberInt.max = INT32_MAX;
85 | limits.numberFloat.min = 0;
86 | limits.numberFloat.max = FLT_MAX;
87 | limits.text.min = 1;
88 | limits.text.max = 10;
89 | }
90 | };
91 |
92 | #endif /* ifndef UI_ALERT_HPP */
93 |
--------------------------------------------------------------------------------
/src/UI/ColourSchemes.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * ColourScheme.h
3 | *
4 | * Created: 01/09/2016 13:13:05
5 | * Author: David
6 | */
7 |
8 | #ifndef COLOURSCHEME_H_
9 | #define COLOURSCHEME_H_
10 |
11 | #include
12 |
13 | // Definition of a colour scheme
14 | struct ColourScheme
15 | {
16 | size_t index;
17 | Palette pal;
18 |
19 | Colour titleBarTextColour;
20 | Colour titleBarBackColour;
21 | Colour labelTextColour;
22 | Colour infoTextColour;
23 | Colour infoBackColour;
24 | Colour defaultBackColour;
25 | Colour activeBackColour;
26 | Colour standbyBackColour;
27 | Colour tuningBackColour;
28 | Colour errorTextColour;
29 | Colour errorBackColour;
30 |
31 | Colour popupBorderColour;
32 | Colour popupBackColour;
33 | Colour popupTextColour;
34 | Colour popupButtonTextColour;
35 | Colour popupButtonBackColour;
36 | Colour popupInfoTextColour;
37 | Colour popupInfoBackColour;
38 |
39 | Colour alertPopupBackColour;
40 | Colour alertPopupTextColour;
41 |
42 | Colour buttonTextColour;
43 | Colour buttonPressedTextColour;
44 | Colour buttonTextBackColour;
45 | Colour buttonImageBackColour;
46 | Colour buttonGradColour;
47 | Colour buttonPressedBackColour;
48 | Colour buttonPressedGradColour;
49 | Colour buttonBorderColour;
50 | Colour homedButtonBackColour;
51 | Colour notHomedButtonBackColour;
52 | Colour pauseButtonBackColour;
53 | Colour resumeButtonBackColour;
54 | Colour resetButtonBackColour;
55 |
56 | Colour progressBarColour;
57 | Colour progressBarBackColour;
58 |
59 | Colour stopButtonTextColour;
60 | Colour stopButtonBackColour;
61 | };
62 |
63 | const size_t NumColourSchemes = 3;
64 |
65 | extern const ColourScheme colourSchemes[];
66 |
67 | #endif /* COLOURSCHEME_H_ */
68 |
--------------------------------------------------------------------------------
/src/UI/DisplaySize.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * DisplaySize.hpp
3 | *
4 | * Created on: 10 Jan 2017
5 | * Author: David
6 | */
7 |
8 | #ifndef SRC_UI_DISPLAYSIZE_HPP_
9 | #define SRC_UI_DISPLAYSIZE_HPP_
10 |
11 | #include "Configuration.hpp"
12 | #include "Hardware/DisplayOrientation.hpp"
13 |
14 | typedef uint16_t PixelNumber;
15 |
16 | // From the display type, we determine the display controller type and touch screen orientation adjustment
17 | #if DISPLAY_TYPE == DISPLAY_TYPE_ITDB02_43
18 |
19 | # define DISPLAY_CONTROLLER SSD1963_480
20 | const DisplayOrientation DefaultDisplayOrientAdjust = static_cast(Default);
21 | const DisplayOrientation DefaultTouchOrientAdjust = SwapXY;
22 | # define DISPLAY_X (480)
23 | # define DISPLAY_Y (272)
24 |
25 | #elif (DISPLAY_TYPE == DISPLAY_TYPE_ITDB02_50) || (DISPLAY_TYPE == DISPLAY_TYPE_ER_50_70)
26 |
27 | # define DISPLAY_CONTROLLER SSD1963_800
28 | const DisplayOrientation DefaultDisplayOrientAdjust = static_cast(Default);
29 | const DisplayOrientation DefaultTouchOrientAdjust = static_cast(SwapXY | ReverseY);
30 | # define DISPLAY_X (800)
31 | # define DISPLAY_Y (480)
32 |
33 | #elif DISPLAY_TYPE == DISPLAY_TYPE_ITDB02_70
34 |
35 | # define DISPLAY_CONTROLLER SSD1963_800
36 | const DisplayOrientation DefaultDisplayOrientAdjust = static_cast(ReverseY);
37 | const DisplayOrientation DefaultTouchOrientAdjust = static_cast(SwapXY | ReverseY);
38 | # define DISPLAY_X (800)
39 | # define DISPLAY_Y (480)
40 |
41 | #elif DISPLAY_TYPE == DISPLAY_TYPE_CPLD_70
42 |
43 | # define DISPLAY_CONTROLLER CPLD_800
44 | const DisplayOrientation DefaultDisplayOrientAdjust = static_cast(Default);
45 | const DisplayOrientation DefaultTouchOrientAdjust = static_cast(SwapXY);
46 | # define DISPLAY_X (800)
47 | # define DISPLAY_Y (480)
48 |
49 | #else
50 | # error DISPLAY_TYPE is not defined correctly
51 | #endif
52 |
53 | const PixelNumber DisplayX = DISPLAY_X;
54 | const PixelNumber DisplayY = DISPLAY_Y;
55 |
56 | const PixelNumber DisplayXP = DISPLAY_Y;
57 | const PixelNumber DisplayYP = DISPLAY_X;
58 |
59 | #endif /* SRC_UI_DISPLAYSIZE_HPP_ */
60 |
--------------------------------------------------------------------------------
/src/UI/Events.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Events.hpp
3 | *
4 | * Created on: 6 Jan 2017
5 | * Author: David
6 | */
7 |
8 | #ifndef SRC_UI_EVENTS_HPP_
9 | #define SRC_UI_EVENTS_HPP_
10 |
11 | // Event numbers, used to say what we need to do when a field is touched
12 | // *** MUST leave value 0 free to mean "no event"
13 | enum Event : uint8_t
14 | {
15 | evNull = 0, // value must match nullEvent declared in Display.hpp
16 |
17 | evDefaultRoot, evScreensaverRoot,
18 |
19 | // Page selection
20 | evTabControl, evTabStatus, evTabMsg, evTabSetup,
21 |
22 | // Heater control
23 | evSelectHead, evSelectBed, evSelectChamber,
24 | evAdjustToolActiveTemp, evAdjustToolStandbyTemp,
25 | evAdjustBedActiveTemp, evAdjustBedStandbyTemp,
26 | evAdjustChamberActiveTemp, evAdjustChamberStandbyTemp,
27 |
28 | // Spindle control
29 | evAdjustActiveRPM,
30 |
31 | // Control functions
32 | evMovePopup, evExtrudePopup, evFan, evListMacros,
33 | evMoveAxis,
34 | evMoveSelectAxis,
35 | evExtrudeAmount, evExtrudeRate, evExtrude, evRetract,
36 | evHomeAxis,
37 |
38 | // Print functions
39 | evExtrusionFactor,
40 | evAdjustFan,
41 | evAdjustInt,
42 | evSetInt,
43 | evListFiles,
44 |
45 | evFile, evMacro, evMacroControlPage,
46 | evPrintFile,
47 | evSendCommand,
48 | evFactoryReset,
49 | evAdjustSpeed,
50 |
51 | evScrollFiles, evScrollMacros, evFilesUp, evMacrosUp, evChangeCard,
52 |
53 | evKeyboard,
54 |
55 | // Setup functions
56 | evCalTouch, evSetBaudRate, evInvertX, evInvertY, evAdjustBaudRate, evSetVolume, evAdjustVolume, evSetInfoTimeout, evAdjustInfoTimeout, evReset,
57 |
58 | evYes,
59 | evCancel,
60 | evDeleteFile,
61 | evSimulateFile,
62 | evPausePrint,
63 | evResumePrint,
64 | evReprint, evResimulate,
65 | evBabyStepPopup, evBabyStepMinus, evBabyStepPlus,
66 |
67 | evKey, evShift, evBackspace, evSendKeyboardCommand, evUp, evDown,
68 |
69 | evAdjustLanguage, evSetLanguage,
70 | evAdjustColours, evSetColours,
71 | evBrighter, evDimmer,
72 | evSetDimmingType,
73 | evSetScreensaverTimeout, evAdjustScreensaverTimeout,
74 | evSetBabystepAmount, evAdjustBabystepAmount,
75 | evSetFeedrate, evAdjustFeedrate,
76 | evSetHeaterCombineType,
77 | evSetLogLevel,
78 |
79 | evEmergencyStop,
80 |
81 | evJogZ,
82 | evCloseAlert, evOkAlert, evChoiceAlert, evEditAlert
83 | };
84 |
85 | #endif /* SRC_UI_EVENTS_HPP_ */
86 |
--------------------------------------------------------------------------------
/src/UI/MessageLog.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * MessageLog.h
3 | *
4 | * Created: 15/11/2015 10:55:02
5 | * Author: David
6 | */
7 |
8 |
9 | #ifndef MESSAGELOG_H_
10 | #define MESSAGELOG_H_
11 |
12 | #include
13 | #include
14 | #include
15 | #include "ecv.h"
16 | #undef array
17 | #undef result
18 | #undef value
19 |
20 | namespace MessageLog
21 | {
22 | enum class LogLevel : uint8_t {
23 | Normal,
24 | Verbose,
25 | NumTypes
26 | };
27 |
28 | void Init();
29 |
30 | void LogLevelSet(LogLevel logLevelNew);
31 | LogLevel LogLevelGet();
32 |
33 | // Update the messages on the message tab. If 'all' is true we do the times and the text, else we just do the times.
34 | void UpdateMessages(bool all);
35 |
36 | // Add a message to the end of the list immediately
37 | void AppendMessage(LogLevel logLevel, const char* data);
38 |
39 | // Add a message via printf to the end of the list immediately (mainly for debugging)
40 | void AppendMessageF(LogLevel logLevel, const char *format, ...) __attribute__((format (printf, 2, 0)));
41 |
42 | // Save a message for possible display later
43 | void SaveMessage(const char* data);
44 |
45 | // If we saved a message, display it
46 | void DisplayNewMessage();
47 |
48 | // This is called when we receive a new response from the host, which may or may not include a new message for the log
49 | void BeginNewMessage();
50 |
51 | // Find where we need to split a text string so that it will fit in a field
52 | size_t FindSplitPoint(const char * _ecv_array s, size_t maxChars, PixelNumber width);
53 | }
54 |
55 | #endif /* MESSAGELOG_H_ */
56 |
--------------------------------------------------------------------------------
/src/UI/Popup.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SRC_UI_POPUP_HPP_
2 | #define SRC_UI_POPUP_HPP_ 1
3 |
4 | #include "FlashData.hpp"
5 | #include "Icons/Icons.hpp"
6 | #include "General/SimpleMath.h"
7 | #include "General/String.h"
8 | #include "UI/Alert.hpp"
9 | #include "UI/ColourSchemes.hpp"
10 | #include "UI/Display.hpp"
11 | #include "UI/Events.hpp"
12 | #include "UI/MessageLog.hpp"
13 | #include "UI/Strings.hpp"
14 | #include "UI/UserInterfaceConstants.hpp"
15 |
16 | class StandardPopupWindow : public PopupWindow
17 | {
18 | public:
19 | StandardPopupWindow(PixelNumber ph, PixelNumber pw, Colour pb, Colour pBorder, Colour textColour, Colour imageBackColour,
20 | const char * null title, PixelNumber topMargin = popupTopMargin);
21 |
22 | protected:
23 | StaticTextField *titleField;
24 | IconButton *closeButton;
25 | };
26 |
27 | class AlertPopup : public StandardPopupWindow
28 | {
29 | public:
30 | AlertPopup(const ColourScheme& colours);
31 | void Set(const char *title, const char *text, int32_t mode, uint32_t controls);
32 | void Set(const Alert &alert);
33 | void ChangeLetter(const size_t index);
34 |
35 | void UpdateData(const char *data);
36 | void ProcessOkButton();
37 | void ProcessChoice(uint32_t choice);
38 |
39 | bool Validate(int value);
40 | bool Validate(float value);
41 | bool Validate(const char *value);
42 |
43 | private:
44 | String alertTitle;
45 | String alertText1, alertText2, alertText3;
46 |
47 | String warningText;
48 | StaticTextField *warning;
49 |
50 | String<2> driveLetter;
51 |
52 | String<32> okCommand;
53 | String<32> cancelCommand;
54 |
55 | TextButton *okButton;
56 | TextButton *cancelButton;
57 |
58 | bool showCancelButton;
59 |
60 | TextButton *axisMap[10] = {
61 | nullptr,
62 | nullptr,
63 | nullptr,
64 | nullptr,
65 | nullptr,
66 | nullptr,
67 | nullptr,
68 | nullptr,
69 | nullptr,
70 | nullptr,
71 | };
72 |
73 | StaticTextField *driveLetterField;
74 |
75 | struct DirMap {
76 | const char *text;
77 | const char *param;
78 | TextButtonForAxis *button;
79 | } dirMap[6] {
80 | { .text = LESS_ARROW "2.0", .param = "-2.0", .button = nullptr },
81 | { .text = LESS_ARROW "0.2", .param = "-0.2", .button = nullptr },
82 | { .text = LESS_ARROW "0.02", .param = "-0.02", .button = nullptr },
83 | { .text = MORE_ARROW "0.02", .param = "0.02", .button = nullptr },
84 | { .text = MORE_ARROW "0.2", .param = "0.2", .button = nullptr },
85 | { .text = MORE_ARROW "2.0", .param = "2.0", .button = nullptr },
86 | };
87 |
88 | struct {
89 | TextButton *button;
90 | String<32> text;
91 | } selectionMap[10];
92 | String<32> valueText;
93 | TextButton *value;
94 |
95 | static_assert(ARRAY_SIZE(Alert::choices) == ARRAY_SIZE(selectionMap));
96 |
97 | uint32_t seq;
98 | Alert::Mode mode;
99 | Alert::Limits limits;
100 | };
101 |
102 | #endif /* ifndef SRC_UI_POPUP_HPP_ */
103 |
--------------------------------------------------------------------------------
/src/Version.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Version.hpp
3 | *
4 | * Created on: 15 Mar 2018
5 | * Author: David
6 | */
7 |
8 | #ifndef SRC_VERSION_HPP_
9 | #define SRC_VERSION_HPP_
10 |
11 | #define VERSION_MAIN "3.5.2"
12 |
13 | #ifdef SUPPORT_ENCODER
14 | # define VERSION_ENCODER "+enc"
15 | #else
16 | # define VERSION_ENCODER
17 | #endif
18 |
19 | #ifdef DEVICE
20 | # define STRINGIFY(x) #x
21 | # define TOSTRING(x) STRINGIFY(x)
22 | # define VERSION_DEVICE "-" TOSTRING(DEVICE)
23 | #else
24 | # define VERSION_DEVICE
25 | #endif
26 |
27 | #define VERSION_TEXT VERSION_MAIN VERSION_ENCODER VERSION_DEVICE
28 |
29 | #endif /* SRC_VERSION_HPP_ */
30 |
--------------------------------------------------------------------------------
/src/config/conf_board.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief User board configuration template
5 | *
6 | */
7 |
8 | #ifndef CONF_BOARD_H
9 | #define CONF_BOARD_H
10 |
11 | #endif // CONF_BOARD_H
12 |
--------------------------------------------------------------------------------
/tests/test-m291-s0.g:
--------------------------------------------------------------------------------
1 | M291 P"test message mode 0" R"test mode S0" S0
2 |
--------------------------------------------------------------------------------
/tests/test-m291-s1.g:
--------------------------------------------------------------------------------
1 | M291 P"test message mode 1" R"test mode S1" S1
2 |
--------------------------------------------------------------------------------
/tests/test-m291-s2.g:
--------------------------------------------------------------------------------
1 | M291 P"test message mode 2" R"test mode S2" S2
2 |
--------------------------------------------------------------------------------
/tests/test-m291-s3.g:
--------------------------------------------------------------------------------
1 | M291 P"test message mode 3" R"test mode S3" S3
2 |
--------------------------------------------------------------------------------
/tests/test-m291-s4-three-items.g:
--------------------------------------------------------------------------------
1 | M291 P"select a choice" R"test mode 4" S4 K{"choice1", "choice2", "choice3"}
2 |
--------------------------------------------------------------------------------
/tests/test-m291-s4.g:
--------------------------------------------------------------------------------
1 | M291 P"select a choice" R"test mode 4" S4 K{"choice1", "choice2", "choice3", "choice4", "choice5", "choice6", "choice7", "choice8", "choice9", "choice10" }
2 |
--------------------------------------------------------------------------------
/tests/test-m291-s5.g:
--------------------------------------------------------------------------------
1 | M291 P"enter an integer number" R"test mode 5" S5 L10 H100 F50
2 |
--------------------------------------------------------------------------------
/tests/test-m291-s6.g:
--------------------------------------------------------------------------------
1 | M291 P"enter a float number" R"test mode 6" S6 L0.1 H1.0 F0.5
2 |
--------------------------------------------------------------------------------
/tests/test-m291-s7.g:
--------------------------------------------------------------------------------
1 | M291 P"enter a text" R"test mode 7" S7 L2 H20 F"abc"
2 |
--------------------------------------------------------------------------------
/tests/test-m291.g:
--------------------------------------------------------------------------------
1 | M291 P"test message mode 0" R"test title" S0
2 | M291 P"test message mode 1" R"test title" S1
3 | M291 P"test message mode 2" R"test title" S2
4 | M291 P"test message mode 3" R"test title" S3
5 |
--------------------------------------------------------------------------------
/toolchains/arm-none-eabi.cmake:
--------------------------------------------------------------------------------
1 |
2 | set( CROSS_COMPILE "arm-none-eabi-" CACHE STRING "cross compile prefix" )
3 |
4 | set( CMAKE_SYSTEM_NAME Generic )
5 | set( CMAKE_SYSTEM_PROCESSOR cortex-m4 )
6 | set( CMAKE_EXECUTABLE_SUFFIX ".elf" )
7 |
8 | if ( WIN32 )
9 | set( CMAKE_ASM_COMPILER "${CROSS_COMPILE}gcc.exe" )
10 | set( CMAKE_AR "${CROSS_COMPILE}ar.exe" )
11 | set( CMAKE_ASM_COMPILER "${CROSS_COMPILE}gcc.exe" )
12 | set( CMAKE_C_COMPILER "${CROSS_COMPILE}gcc.exe" )
13 | set( CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++.exe" )
14 | set( CMAKE_OBJCOPY "${CROSS_COMPILE}objcopy.exe"
15 | CACHE FILEPATH "The toolchain objcopy command " FORCE )
16 | set( CMAKE_OBJDUMP "${CROSS_COMPILE}objdump.exe"
17 | CACHE FILEPATH "The toolchain objcopy command " FORCE )
18 | else()
19 | set( CMAKE_ASM_COMPILER "${CROSS_COMPILE}gcc" )
20 | set( CMAKE_AR "${CROSS_COMPILE}ar" )
21 | set( CMAKE_ASM_COMPILER "${CROSS_COMPILE}gcc" )
22 | set( CMAKE_C_COMPILER "${CROSS_COMPILE}gcc" )
23 | set( CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++" )
24 | set( CMAKE_OBJCOPY "${CROSS_COMPILE}objcopy"
25 | CACHE FILEPATH "The toolchain objcopy command " FORCE )
26 | set( CMAKE_OBJDUMP "${CROSS_COMPILE}objdump"
27 | CACHE FILEPATH "The toolchain objcopy command " FORCE )
28 | endif()
29 |
30 | # Set the common build flags
31 |
32 | # Common flags shared by asm, c and cpp
33 | set( COMMON_FLAGS "--param max-inline-insns-single=500 -mlong-calls -ffunction-sections -fdata-sections -fno-exceptions -fsingle-precision-constant -Wall -Wextra -Wundef -Wdouble-promotion -Wno-expansion-to-defined -fdiagnostics-color")
34 |
35 | set( CMAKE_ASM_FLAGS "${COMMON_FLAGS}" )
36 | set( CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu17" )
37 | set( CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=gnu++17 -fno-threadsafe-statics -fno-rtti" )
38 | set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" )
39 |
40 | message( "Toolchain definition:" )
41 | message( " CROSS_COMPILE prefix: ${CROSS_COMPILE}" )
42 | message( " asm: " "${CMAKE_ASM_COMPILER}" )
43 | message( " c: " "${CMAKE_C_COMPILER}" )
44 | message( " cxx: " "${CMAKE_CXX_COMPILER}" )
45 | message( " ar: " "${CMAKE_AR}" )
46 | message( " objcopy: " "${CMAKE_OBJCOPY}" )
47 | message( " objdump: " "${CMAKE_OBJDUMP}" )
48 | message( " C_FLAGS: " ${CMAKE_C_FLAGS} )
49 | message( " CXX_FLAGS: " ${CMAKE_CXX_FLAGS} )
50 | message( " ASM_FLAGS: " ${CMAKE_ASM_FLAGS} )
51 | message( " LD_FLAGS: " ${CMAKE_EXE_LINKER_FLAGS} )
52 |
--------------------------------------------------------------------------------