From 482612524d786c2c8f5dbabc9eb304508e504d89 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 1 May 2018 22:18:39 +0200 Subject: Add HAL generated by MCC --- hwconfig.mc3 | 8495 +++++++++++++++++++++++++++++ main.cpp | 96 +- mcc_generated_files/interrupt_manager.cpp | 67 + mcc_generated_files/interrupt_manager.hpp | 78 + mcc_generated_files/mcc.cpp | 156 + mcc_generated_files/mcc.hpp | 134 + mcc_generated_files/pin_manager.cpp | 131 + mcc_generated_files/pin_manager.hpp | 530 ++ mcc_generated_files/uart1.cpp | 390 ++ mcc_generated_files/uart1.hpp | 624 +++ nbproject/Makefile-default.mk | 80 +- nbproject/Makefile-genesis.properties | 14 +- nbproject/Makefile-local-default.mk | 29 +- nbproject/configurations.xml | 28 +- nbproject/project.xml | 2 +- 15 files changed, 10749 insertions(+), 105 deletions(-) create mode 100644 hwconfig.mc3 create mode 100644 mcc_generated_files/interrupt_manager.cpp create mode 100644 mcc_generated_files/interrupt_manager.hpp create mode 100644 mcc_generated_files/mcc.cpp create mode 100644 mcc_generated_files/mcc.hpp create mode 100644 mcc_generated_files/pin_manager.cpp create mode 100644 mcc_generated_files/pin_manager.hpp create mode 100644 mcc_generated_files/uart1.cpp create mode 100644 mcc_generated_files/uart1.hpp diff --git a/hwconfig.mc3 b/hwconfig.mc3 new file mode 100644 index 0000000..b2d8b40 --- /dev/null +++ b/hwconfig.mc3 @@ -0,0 +1,8495 @@ + + + + System Module + class com.microchip.mcc.mcu32.systemManager.DefaultSystemManagerMcu32 + + + INTERNAL OSCILLATOR + class com.microchip.mcc.mcu32.systemManager.clk.Clock + + + WDT + class com.microchip.mcc.mcu32.systemManager.wdt.Wdt + + + Pin Module + class com.microchip.mcc.mcu32.pinManager.PinManager + + + ICD + class com.microchip.mcc.mcu32.systemManager.icd.Icd + + + Interrupt Module + class com.microchip.mcc.mcu32.interruptManager.InterruptManager + + + UART1 + class com.microchip.mcc.mcu32.modules.uart_irda_pb.Uart + + + + + + + + + disabled + + + + clear + + + + disabled + + + + disabled + + + + 0 + + + + 12x Divider + + + + 0 + + + + UNSUPPORTED + + + + 1 + + + + analog + + + + 0 + + + + 0 + + + + 16 + + + + 24 + + + + 0 + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + 8 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 1048576 + + + + disabled + + + + 1 + + + + ISR_UART1_URXI + + + + 815104 + + + + clear + + + + analog + + + + disabled + + + + 0 + + + + 1 + + + + 1 + + + + disabled + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + disabled + + + + SYSCLK + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + 6 + + + + disabled + + + + 1 + + + + 679936 + + + + 15 + + + + 1 + + + + 0 + + + + disabled + + + + analog + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + analog + + + + disabled + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + clear + + + + disabled + + + + disabled + + + + 0 + + + + 1 + + + + 544768 + + + + 0 + + + + 593920 + + + + 0 + + + + 1 + + + + disabled + + + + 1 + + + + 15 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + 15 + + + + 0 + + + + 0 + + + + disabled + + + + 0 + + + + none + + + + none + + + + Active + + + + 0 + + + + 5 + + + + 6 + + + + 1 + + + + 1 + + + + 7 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + none + + + + clear + + + + 3 + + + + none + + + + none + + + + none + + + + none + + + + none + + + + disabled + + + + 2 + + + + 25 + + + + 3 + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + 811008 + + + + 4 + + + + analog + + + + 15 + + + + 0 + + + + disabled + + + + 15 + + + + disabled + + + + ISR_UART1_UTXI + + + + 0 + + + + 1 + + + + 1 + + + + 4 + + + + 0 + + + + disabled + + + + 1 + + + + 0 + + + + 0 + + + + none + + + + none + + + + 0 + + + + none + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + clear + + + + 0 + + + + 1310720 + + + + 0 + + + + 724992 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + none + + + + disabled + + + + 0 + + + + none + + + + none + + + + disabled + + + + none + + + + 1 + + + + disabled + + + + 15 + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + analog + + + + 1 + + + + 589824 + + + + FRCDIV + + + + 0 + + + + 32768 + + + + disabled + + + + 0 + + + + 1 + + + + 1 + + + + disabled + + + + 1 + + + + + + + + disabled + + + + disabled + + + + 1 + + + + 16777216 + + + + 1 + + + + analog + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 4 + + + + disabled + + + + clear + + + + clear + + + + 1 + + + + 0 + + + + 0 + + + + disabled + + + + 0 + + + + disabled + + + + 0 + + + + RX_ONE_CHAR + + + + 1 + + + + 16777216 + + + + disabled + + + + 774144 + + + + 8000000 + + + + 909312 + + + + 1 + + + + none + + + + none + + + + 0 + + + + none + + + + none + + + + none + + + + none + + + + 0 + + + + none + + + + none + + + + DIV_12 + + + + none + + + + none + + + + disabled + + + + none + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + disabled + + + + 1 + + + + 638976 + + + + OFF + + + + clear + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + disabled + + + + none + + + + none + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 1 + + + + 552960 + + + + 0 + + + + 1 + + + + none + + + + none + + + + none + + + + none + + + + none + + + + none + + + + none + + + + none + + + + none + + + + disabled + + + + + + + + enabled + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 15 + + + + disabled + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + clear + + + + 0 + + + + analog + + + + 1 + + + + clear + + + + 1007616 + + + + AVAILABLE + + + + disabled + + + + no clock failure + + + + 1 + + + + 770048 + + + + 0 + + + + disabled + + + + clear + + + + 819200 + + + + disabled + + + + 0 + + + + 0 + + + + 905216 + + + + 0 + + + + 1 + + + + PRIORITY_7 + + + + disabled + + + + 0 + + + + disabled + + + + analog + + + + 0 + + + + 15 + + + + 1 + + + + 684032 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + clear + + + + 524288 + + + + 0 + + + + 0 + + + + 50331648 + + + + disabled + + + + 0 + + + + DIV_256 + + + + 0 + + + + 1 + + + + clear + + + + 1 + + + + 1 + + + + 548864 + + + + 0 + + + + 1 + + + + disabled + + + + 33554432 + + + + 8 + + + + AVAILABLE + + + + disabled + + + + 1179648 + + + + 1 + + + + 768 + + + + 6 + + + + analog + + + + 0 + + + + 0 + + + + clear + + + + 0 + + + + 1 + + + + 1011712 + + + + 1 + + + + OFF + + + + 0 + + + + disabled + + + + disabled + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + 868352 + + + + disabled + + + + output + + + + 0 + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + disabled + + + + 1 + + + + 0 + + + + disabled + + + + disabled + + + + 3 + + + + 0 + + + + 0 + + + + analog + + + + disabled + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + disabled + + + + disabled + + + + input + + + + 1 + + + + 1 + + + + WINSZ_25 + + + + disabled + + + + 1 + + + + 1 + + + + 1 + + + + 15 + + + + clear + + + + disabled + + + + input + + + + 0 + + + + 1 + + + + 0 + + + + 966656 + + + + AVAILABLE + + + + 1 + + + + 0 + + + + disabled + + + + 1 + + + + 1 + + + + 15 + + + + 1 + + + + 864256 + + + + 778240 + + + + 0 + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + enabled + + + + 1 + + + + output + + + + 0 + + + + clear + + + + 1S + + + + + + + + 643072 + + + + 0 + + + + 1 + + + + disabled + + + + 2 + + + + 0 + + + + 1 + + + + analog + + + + OFF + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + 15 + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + 3 + + + + analog + + + + 1 + + + + 1 + + + + 15 + + + + DIV_8 + + + + none + + + + none + + + + disabled + + + + 0 + + + + 0 + + + + disabled + + + + 15 + + + + 1 + + + + + + + + + + + + clear + + + + 1 + + + + disabled + + + + disabled + + + + input + + + + disabled + + + + disabled + + + + 1 + + + + digital + + + + analog + + + + 0 + + + + disabled + + + + disabled + + + + 970752 + + + + 1 + + + + 0 + + + + FRC Oscillator (8 MHz) + + + + 1 + + + + 733184 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + input + + + + 1 + + + + + + + + 0 + + + + 0 + + + + 15 + + + + + + + + unlocked + + + + disabled + + + + 1 + + + + disabled + + + + 0 + + + + 598016 + + + + 1 + + + + 1 + + + + input + + + + 1 + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + digital + + + + analog + + + + disabled + + + + disabled + + + + 1 + + + + analog + + + + 1 + + + + disabled + + + + 1 + + + + 0 + + + + analog + + + + 0 + + + + 0 + + + + 1 + + + + 128 + + + + 1 + + + + 1 + + + + disabled + + + + 1 + + + + 0 + + + + output + + + + 1 + + + + analog + + + + AVAILABLE + + + + 0 + + + + 1 + + + + disabled + + + + 729088 + + + + AVAILABLE + + + + analog + + + + 1 + + + + disabled + + + + 1 + + + + 0 + + + + disabled + + + + 1 + + + + disabled + + + + 1 + + + + 1 + + + + DIV_8 + + + + disabled + + + + input + + + + clear + + + + 1 + + + + 1 + + + + 1 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 8000000 + + + + disabled + + + + disabled + + + + 0 + + + + 1 + + + + ISR_Pin Module_CNGI + + + + 15 + + + + input + + + + 5 + + + + ISR_Pin Module_CNDI + + + + input + + + + input + + + + 1 + + + + 0 + + + + 3 + + + + 1 + + + + 0 + + + + ON + + + + 827392 + + + + 0 + + + + input + + + + UNSUPPORTED + + + + 1 + + + + disabled + + + + 1 + + + + 913408 + + + + 1 + + + + 0 + + + + input + + + + 15 + + + + disabled + + + + 0 + + + + Not Driven out on REFCLKO pin + + + + input + + + + 692224 + + + + disabled + + + + 8388608 + + + + 0 + + + + disabled + + + + 1 + + + + 0 + + + + 1 + + + + 1 + + + + 256 + + + + disabled + + + + 1 + + + + 557056 + + + + 0 + + + + 6 + + + + ISR_Pin Module_CNCI + + + + 0 + + + + disabled + + + + 1 + + + + 1 + + + + disabled + + + + 0 + + + + input + + + + 1 + + + + 0 + + + + 0 + + + + 4 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + 31000 + + + + 0 + + + + 2 + + + + 1 + + + + 1 + + + + disabled + + + + disabled + + + + input + + + + 0 + + + + 823296 + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + 1 + + + + 983040 + + + + disabled + + + + 1 + + + + 0 + + + + input + + + + 5 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 688128 + + + + 737280 + + + + disabled + + + + 0 + + + + 1 + + + + Center Frequency + + + + 0 + + + + 0 + + + + + + + + 32768 + + + + 0 + + + + QFN64 + + + + 15 + + + + 0 + + + + 16384 + + + + input + + + + 602112 + + + + disabled + + + + 0 + + + + input + + + + 1 + + + + 1 + + + + 131072 + + + + 0 + + + + 65536 + + + + 0 + + + + 0 + + + + 0 + + + + 1114112 + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + + + + + + + + + 0 + + + + 786432 + + + + 921600 + + + + 1 + + + + disabled + + + + 872448 + + + + 0 + + + + 1 + + + + disabled + + + + 1 + + + + 0 + + + + CLOCK_LPRC + + + + disabled + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + enabled + + + + 0 + + + + 0 + + + + 651264 + + + + FRC/1 + + + + 1 + + + + 0 + + + + disabled + + + + 1 + + + + 0 + + + + 0 + + + + 15 + + + + 0 + + + + 0 + + + + 0 + + + + 15 + + + + 1 + + + + 0 + + + + 196608 + + + + UNSUPPORTED + + + + 0 + + + + 0 + + + + 0 + + + + 3 + + + + 1 + + + + 1 + + + + 131072 + + + + disabled + + + + 0 + + + + 65536 + + + + 196608 + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + none + + + + OFF + + + + disabled + + + + 995328 + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + 782336 + + + + disabled + + + + disabled + + + + disabled + + + + input + + + + disabled + + + + 917504 + + + + 1 + + + + 768 + + + + 1024 + + + + 1 + + + + 1280 + + + + 1 + + + + 0 + + + + 0 + + + + 256 + + + + 512 + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 647168 + + + + 458752 + + + + 696320 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + 0 + + + + 561152 + + + + 0 + + + + disabled + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + input + + + + 0 + + + + 0 + + + + 32 + + + + CSDCMD + + + + disabled + + + + 589824 + + + + 7 + + + + 15 + + + + 1 + + + + 0 + + + + disabled + + + + disabled + + + + 0 + + + + 24:1 + + + + 999424 + + + + 0 + + + + 0 + + + + 880640 + + + + 745472 + + + + 0 + + + + 1 + + + + 2 + + + + 0 + + + + disabled + + + + 286257182 + + + + 0 + + + + 1 + + + + input + + + + 0 + + + + 1 + + + + 1 + + + + disabled + + + + 15 + + + + disabled + + + + 15 + + + + disabled + + + + 0 + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + 4 + + + + 5 + + + + 2 + + + + 3 + + + + 0 + + + + 1 + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + 1 + + + + disabled + + + + 1 + + + + 15 + + + + 0 + + + + 32 + + + + 954368 + + + + 0 + + + + 0 + + + + 256 + + + + 1 + + + + 0 + + + + 741376 + + + + 876544 + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 1003520 + + + + 2 + + + + 4 + + + + 15 + + + + disabled + + + + 1 + + + + 1 + + + + disabled + + + + 0 + + + + 655360 + + + + 1 + + + + disabled + + + + 1000000 + + + + disabled + + + + 1 + + + + 1 + + + + 1 + + + + 4 + + + + 15 + + + + 0 + + + + 1 + + + + 0 + + + + OFF + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + 0 + + + + disabled + + + + 520192 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + 1 + + + + TX_ONE_CHAR + + + + + + + + + + + + + + + + 1 + + + + + + + + 831488 + + + + 0 + + + + 0 + + + + 960 + + + + disabled + + + + 1 + + + + 1 + + + + 0 + + + + input + + + + 15 + + + + MUL_24 + + + + 958464 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + disabled + + + + 14 + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 15 + + + + input + + + + disabled + + + + disabled + + + + 1044480 + + + + 8 + + + + 0 + + + + disabled + + + + 1 + + + + disabled + + + + 610304 + + + + 244 + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + UNSUPPORTED + + + + 15 + + + + 1 + + + + disabled + + + + 15 + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + 493431 + + + + 0 + + + + 0 + + + + disabled + + + + 65532 + + + + 25 + + + + 0 + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 5 + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + 0 + + + + 0 + + + + 55900071 + + + + disabled + + + + 0 + + + + 0 + + + + 61440 + + + + input + + + + 1 + + + + 1 + + + + disabled + + + + 962560 + + + + 7 + + + + 0 + + + + 1 + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + none + + + + none + + + + none + + + + TX_RX + + + + 15 + + + + disabled + + + + 1 + + + + none + + + + 1 + + + + output + + + + disabled + + + + output + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + 606208 + + + + disabled + + + + disabled + + + + 61447 + + + + 0 + + + + enabled + + + + output + + + + disabled + + + + 1 + + + + disabled + + + + input + + + + 0 + + + + 1 + + + + 2 + + + + analog + + + + 15 + + + + 0 + + + + 1 + + + + 0 + + + + 61440 + + + + disabled + + + + 0 + + + + 0 + + + + input + + + + 1 + + + + 2 + + + + 1 + + + + disabled + + + + 0 + + + + ON + + + + 65535 + + + + 790528 + + + + 0 + + + + clear + + + + 1 + + + + 839680 + + + + 917504 + + + + 0 + + + + 1 + + + + 925696 + + + + 0 + + + + 1 + + + + 0 + + + + 1 + + + + 3 + + + + input + + + + analog + + + + 0 + + + + 0 + + + + disabled + + + + 1 + + + + 704512 + + + + 0 + + + + 1 + + + + disabled + + + + enabled + + + + 58 + + + + 1 + + + + disabled + + + + clear + + + + 0 + + + + 0.1602565 % + + + + DIV_256 + + + + 0 + + + + 15 + + + + 1 + + + + 1 + + + + 1024 + + + + disabled + + + + 4095 + + + + 569344 + + + + 47 + + + + 0 + + + + disabled + + + + 1 + + + + OFF + + + + 0 + + + + 0 + + + + disabled + + + + 1 + + + + 0 + + + + 4096 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + clear + + + + 0 + + + + 0 + + + + clear + + + + 0 + + + + 835584 + + + + 0 + + + + 1 + + + + 941586176 + + + + clear + + + + 1 + + + + 1 + + + + 0 + + + + 15 + + + + OFF + + + + 700416 + + + + 1 + + + + 0 + + + + 1 + + + + disabled + + + + 0 + + + + disabled + + + + 4 + + + + 3 + + + + 6 + + + + 5 + + + + 7 + + + + + + + + 1 + + + + + + + + + + + + 458752 + + + + 0 + + + + + + + + + + + + 2 + + + + + + + + 1 + + + + 1 + + + + clear + + + + ON + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 1 + + + + 565248 + + + + disabled + + + + 0 + + + + 0 + + + + 614400 + + + + disabled + + + + 1 + + + + 5 + + + + 1000000 + + + + clear + + + + 0 + + + + 1 + + + + 15 + + + + 1 + + + + disabled + + + + 15 + + + + input + + + + 720896 + + + + 1 + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + analog + + + + 749568 + + + + 1028096 + + + + 0 + + + + 798720 + + + + 0 + + + + 884736 + + + + Switch is Complete + + + + 1 + + + + 4 + + + + 1 + + + + + + + + 1 + + + + clear + + + + 1 + + + + 0 + + + + 663552 + + + + OFF + + + + 0 + + + + 1 + + + + 15 + + + + 0 + + + + input + + + + 1 + + + + 0 + + + + 1 + + + + 0 + + + + none + + + + 0 + + + + disabled + + + + 0 + + + + 0 + + + + 1 + + + + analog + + + + 8000000 + + + + 3 + + + + 1 + + + + clear + + + + 1 + + + + 1 + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + 1 + + + + analog + + + + input + + + + 1 + + + + 8192 + + + + 0 + + + + 1 + + + + 1032192 + + + + 6 + + + + 1 + + + + + + + + 0 + + + + 1 + + + + 794624 + + + + disabled + + + + 1 + + + + 929792 + + + + 15 + + + + 960 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + disabled + + + + 0 + + + + 1 + + + + 659456 + + + + 1 + + + + 0 + + + + 8 + + + + input + + + + 1 + + + + 1 + + + + analog + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + 1 + + + + 573440 + + + + 0 + + + + analog + + + + 5 + + + + 15 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + 524288 + + + + disabled + + + + 1 + + + + 1:256 + + + + 1 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + disabled + + + + 15 + + + + disabled + + + + 0 + + + + 0 + + + + 987136 + + + + disabled + + + + 1 + + + + 0 + + + + 843776 + + + + + + + + 1 + + + + 0 + + + + 757760 + + + + 0 + + + + disabled + + + + Idle on WAIT instruction + + + + 393216 + + + + 1 + + + + 3 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 6 + + + + disabled + + + + 512 + + + + 1 + + + + 0 + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + 1 + + + + 851968 + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 15 + + + + 2 + + + + 1 + + + + 0 + + + + 1 + + + + 1 + + + + 1 + + + + 0 + + + + + + + + 0 + + + + 0 + + + + clear + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + 7 + + + + 1 + + + + 6 + + + + 0 + + + + 991232 + + + + 1 + + + + 1 + + + + 1 + + + + ICS_PGx1 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 888832 + + + + 753664 + + + + 15 + + + + disabled + + + + disabled + + + + ON + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + 0 + + + + disabled + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + disabled + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + 4 + + + + 1 + + + + 0 + + + + clear + + + + 1 + + + + 1 + + + + 532480 + + + + disabled + + + + NOTAVAILABLE + + + + disabled + + + + disabled + + + + 0 + + + + clear + + + + 49152 + + + + 0 + + + + None + + + + NOTAVAILABLE + + + + 0 + + + + 946176 + + + + 0 + + + + 0 + + + + MUL_24 + + + + 0 + + + + 1 + + + + 2 + + + + 1 + + + + 3 + + + + disabled + + + + 1 + + + + disabled + + + + clear + + + + 708608 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + disabled + + + + 0 + + + + 622592 + + + + 4096 + + + + 0 + + + + disabled + + + + 0 + + + + 0 + + + + 4194304 + + + + 0 + + + + 7 + + + + 0 + + + + 1 + + + + 528384 + + + + 0 + + + + none + + + + clear + + + + none + + + + none + + + + AVAILABLE + + + + none + + + + disabled + + + + 1 + + + + 327680 + + + + none + + + + none + + + + disabled + + + + 1 + + + + 1 + + + + 262144 + + + + 0 + + + + 847872 + + + + 15 + + + + 0 + + + + 0 + + + + 15 + + + + 0 + + + + disabled + + + + 0 + + + + 0 + + + + disabled + + + + 950272 + + + + 1 + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + clear + + + + 0 + + + + 0 + + + + ON + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + clear + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + 618496 + + + + 1 + + + + 1 + + + + 2 + + + + 5 + + + + disabled + + + + 1 + + + + disabled + + + + 1 + + + + ISR_Pin Module_CNEI + + + + ISR_Pin Module_CNFI + + + + 1 + + + + disabled + + + + analog + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + 1 + + + + disabled + + + + 802816 + + + + disabled + + + + 0 + + + + 0 + + + + input + + + + 1 + + + + 937984 + + + + clear + + + + 1 + + + + 0 + + + + 1 + + + + + + + + 1040384 + + + + 15 + + + + 667648 + + + + 1 + + + + enabled + + + + 716800 + + + + 1 + + + + PS1048576 + + + + disabled + + + + analog + + + + 31 + + + + 1 + + + + 0 + + + + disabled + + + + clear + + + + disabled + + + + 1 + + + + 581632 + + + + 0 + + + + disabled + + + + 0 + + + + 32.768s + + + + ISR_Pin Module_CNBI + + + + 1 + + + + disabled + + + + 0 + + + + input + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + LED1 + + + + + + + + input + + + + FRCDIV + + + + 1 + + + + 0 + + + + disabled + + + + + + + + disabled + + + + + + + + 0 + + + + 7 + + + + disabled + + + + + + + + + + + + UNSUPPORTED + + + + + + + + + + + + + + + + + + + + + + + + disabled + + + + 1 + + + + + + + + + + + + 0 + + + + 1 + + + + 933888 + + + + DIV_8 + + + + 1 + + + + + + + + LED2 + + + + LED3 + + + + 712704 + + + + 1 + + + + 8N + + + + 1 + + + + 1036288 + + + + 0 + + + + 0 + + + + disabled + + + + + + + + + + + + analog + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ON + + + + + + + + + + + + ISR_UART1_UERI + + + + 0 + + + + 577536 + + + + disabled + + + + 1 + + + + disabled + + + + disabled + + + + input + + + + 1 + + + + 15 + + + + 0 + + + + 0 + + + + 15 + + + + disabled + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 1536 + + + + 0 + + + + 1792 + + + + 1 + + + + 112 + + + + input + + + + 96 + + + + 80 + + + + clear + + + + 761856 + + + + 1015808 + + + + UNSUPPORTED + + + + 1 + + + + 897024 + + + + 2 + + + + 0 + + + + 3 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 64 + + + + 16 + + + + 0 + + + + 48 + + + + 32 + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + 15 + + + + 1 + + + + 0 + + + + 675840 + + + + input + + + + 15 + + + + disabled + + + + disabled + + + + DIV_12 + + + + 1 + + + + disabled + + + + 0 + + + + input + + + + 540672 + + + + 1 + + + + disabled + + + + clear + + + + 0 + + + + 1 + + + + disabled + + + + 15 + + + + disabled + + + + 1 + + + + disabled + + + + disabled + + + + ON + + + + disabled + + + + 1 + + + + disabled + + + + 1 + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + 1019904 + + + + 1:1 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + AVAILABLE + + + + disabled + + + + 806912 + + + + 942080 + + + + 892928 + + + + 655360 + + + + 0 + + + + input + + + + disabled + + + + disabled + + + + 1 + + + + 0 + + + + 671744 + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + 268435456 + + + + disabled + + + + 0 + + + + disabled + + + + input + + + + 1 + + + + disabled + + + + clear + + + + 0 + + + + 1 + + + + FRCDIV + + + + disabled + + + + disabled + + + + disabled + + + + 536576 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + OFF + + + + 0 + + + + AVAILABLE + + + + disabled + + + + disabled + + + + 31000 + + + + 15 + + + + 1245184 + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + 1 + + + + UNSUPPORTED + + + + 0 + + + + 7 + + + + 1 + + + + 1 + + + + 0 + + + + input + + + + input + + + + input + + + + 0 + + + + 1024000 + + + + 974848 + + + + 327680 + + + + 856064 + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + clear + + + + 1 + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + enabled + + + + 0 + + + + disabled + + + + 1 + + + + 0 + + + + enabled + + + + enabled + + + + 0 + + + + 0 + + + + 1 + + + + 6 + + + + disabled + + + + 626688 + + + + 1 + + + + clear + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 15 + + + + 262144 + + + + 0 + + + + 0 + + + + 15 + + + + 1 + + + + 1 + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + clear + + + + 978944 + + + + 0 + + + + disabled + + + + disabled + + + + 901120 + + + + disabled + + + + 1 + + + + disabled + + + + out of lock + + + + 765952 + + + + 851968 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + input + + + + clear + + + + 1 + + + + 0 + + + + 15 + + + + clear + + + + 9600 + + + + 1 + + + + disabled + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 3 + + + + 0 + + + + 0 + + + + 15 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 2 + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + 4 + + + + 15 + + + + 1 + + + + input + + + + clear + + + + easysetup + + + + 1 + + + + 15 + + + + 0 + + + + 1 + + + + 0 + + + + none + + + + 1 + + + + 1 + + + + 0 + + + + none + + + + clear + + + + 0 + + + + 1 + + + + 1 + + + + 32776 + + + + 2 + + + + 1 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 7 + + + + disabled + + + + 1 + + + + 1 + + + + 0 + + + + 983040 + + + + 720896 + + + + 1 + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + 4 + + + + clear + + + + 0 + + + + 585728 + + + + 1 + + + + 634880 + + + + enabled + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 3 + + + + 0 + + + + 1 + + + + 8192 + + + + 12288 + + + + analog + + + + 1 + + + + 1 + + + + output + + + + 1 + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + 786432 + + + + 0 + + + + input + + + + 0 + + + + 860160 + + + + 1 + + + + clear + + + + 1 + + + + 0 + + + + 1 + + + + 8 + + + + disabled + + + + 16384 + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + 393216 + + + + disabled + + + + 1 + + + + disabled + + + + 0 + + + + 1 + + + + 8000000 + + + + 630784 + + + + clear + + + + None + + + + disabled + + + + 1 + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + + mcc_generated_files/interrupt_manager.h + c7334001f9ec9f5deb7f2307fe15b54bec6effc7ece706304e908944f8ed217c + + + mcc_generated_files/pin_manager.h + de19f05a2f0c1b73df13651e2e17e3f90cd11fa4ce1ecb3fbf90998930d923d0 + + + mcc_generated_files/uart1.h + 52db729f7f5034f5698989fdbf35015c2041ca25fa1e77e95cf666dca7942e3f + + + mcc_generated_files/mcc.h + 5c5285588ee4d560ffc5426608eacd19106f34bd8e97395a62f254253ec496b8 + + + mcc_generated_files/interrupt_manager.c + 6f063efa74b34a47a047655d91e9c76e65ea2c9fe7624e4ec9f63483f12ea69c + + + mcc_generated_files/mcc.c + 22228f2b4400b7706dec6f228fc4988dd489ef919f68f823684807c5b6e73739 + + + mcc_generated_files/uart1.c + 8dfcdcf1cede042dc610f28aca7f51708f6e4009c1d4e94607d1cc1946e40f10 + + + mcc_generated_files/pin_manager.c + 40dfac0233ab3f1464596452bee8610f4d29cea756beb925c1ffe3e96da034df + + + \ No newline at end of file diff --git a/main.cpp b/main.cpp index 4189181..af9e2aa 100644 --- a/main.cpp +++ b/main.cpp @@ -1,58 +1,44 @@ - -// PIC32MX470F512H Configuration Bit Settings - -// 'C' source line config statements - -// DEVCFG3 -// USERID = No Setting -#pragma config FSRSSEL = PRIORITY_7 // Shadow Register Set Priority Select (SRS Priority 7) -#pragma config PMDL1WAY = ON // Peripheral Module Disable Configuration (Allow only one reconfiguration) -#pragma config IOL1WAY = ON // Peripheral Pin Select Configuration (Allow only one reconfiguration) -#pragma config FUSBIDIO = ON // USB USID Selection (Controlled by the USB Module) -#pragma config FVBUSONIO = ON // USB VBUS ON Selection (Controlled by USB Module) - -// DEVCFG2 -#pragma config FPLLIDIV = DIV_12 // PLL Input Divider (12x Divider) -#pragma config FPLLMUL = MUL_24 // PLL Multiplier (24x Multiplier) -#pragma config UPLLIDIV = DIV_12 // USB PLL Input Divider (12x Divider) -#pragma config UPLLEN = OFF // USB PLL Enable (Disabled and Bypassed) -#pragma config FPLLODIV = DIV_256 // System PLL Output Clock Divider (PLL Divide by 256) - -// DEVCFG1 -#pragma config FNOSC = FRCDIV // Oscillator Selection Bits (Fast RC Osc w/Div-by-N (FRCDIV)) -#pragma config FSOSCEN = ON // Secondary Oscillator Enable (Enabled) -#pragma config IESO = ON // Internal/External Switch Over (Enabled) -#pragma config POSCMOD = OFF // Primary Oscillator Configuration (Primary osc disabled) -#pragma config OSCIOFNC = OFF // CLKO Output Signal Active on the OSCO Pin (Disabled) -#pragma config FPBDIV = DIV_8 // Peripheral Clock Divisor (Pb_Clk is Sys_Clk/8) -#pragma config FCKSM = CSDCMD // Clock Switching and Monitor Selection (Clock Switch Disable, FSCM Disabled) -#pragma config WDTPS = PS1048576 // Watchdog Timer Postscaler (1:1048576) -#pragma config WINDIS = OFF // Watchdog Timer Window Enable (Watchdog Timer is in Non-Window Mode) -#pragma config FWDTEN = ON // Watchdog Timer Enable (WDT Enabled) -#pragma config FWDTWINSZ = WINSZ_25 // Watchdog Timer Window Size (Window Size is 25%) - -// DEVCFG0 -#pragma config DEBUG = OFF // Background Debugger Enable (Debugger is Disabled) -#pragma config JTAGEN = ON // JTAG Enable (JTAG Port Enabled) -#pragma config ICESEL = ICS_PGx1 // ICE/ICD Comm Channel Select (Communicate on PGEC1/PGED1) -#pragma config PWP = OFF // Program Flash Write Protect (Disable) -#pragma config BWP = OFF // Boot Flash Write Protect bit (Protection Disabled) -#pragma config CP = OFF // Code Protect (Protection Disabled) - -// #pragma config statements should precede project file includes. -// Use project enums instead of #define for ON and OFF. - -#include -#include - -#include "Led.hpp" - - - -int main(int argc, char **argv) { +/* + * File: main.c + * Author: naopross + * + * Created on May 1, 2018, 6:18 PM + */ + +#include +#include + +#include "mcc_generated_files/mcc.hpp" + +/* + * + */ +int main(int argc, char** argv) +{ + char c; - Led redLed(Led::Color::RED); - - return 0; + SYSTEM_Initialize(); + + LED1_SetHigh(); + LED2_SetHigh(); + LED3_SetHigh(); + + // UART1_WriteBuffer("Hello\n\r", 7); + UART1_Write('S'); + UART1_Write('\n'); + UART1_Write('\r'); + + while (1) { + while (UART1_ReceiveBufferIsEmpty()); + + c = UART1_Read(); + LED1_Toggle(); + + UART1_Write(c); + UART1_Write('\n'); + UART1_Write('\r'); + } + + return (EXIT_SUCCESS); } diff --git a/mcc_generated_files/interrupt_manager.cpp b/mcc_generated_files/interrupt_manager.cpp new file mode 100644 index 0000000..32ca3f4 --- /dev/null +++ b/mcc_generated_files/interrupt_manager.cpp @@ -0,0 +1,67 @@ +/** + System Interrupts Generated Driver File + + @Company: + Microchip Technology Inc. + + @File Name: + interrupt_manager.h + + @Summary: + This is the generated driver implementation file for setting up the + interrupts using PIC32MX MCUs + + @Description: + This source file provides implementations for PIC32MX MCUs interrupts. + Generation Information : + Product Revision : PIC32MX MCUs - pic32mx : v1.35 + Device : PIC32MX470F512H + Version : 1.01 + The generated drivers are tested against the following: + Compiler : XC32 1.42 + MPLAB : MPLAB X 3.55 +*/ +/* + (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this + software and any derivatives exclusively with Microchip products. + + THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER + EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A + PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION + WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. + + IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND + WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS + BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE + FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN + ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + + MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE + TERMS. +*/ + +/** + Section: Includes +*/ +#include + +/** + void INTERRUPT_Initialize (void) +*/ +void INTERRUPT_Initialize (void) +{ + // UERI: UART1 Error + // Priority: 1 + // SubPriority: 0 + IPC7bits.U1IP = 1; + IPC7bits.U1IS = 0; + + // Enable the multi vector + INTCONbits.MVEC = 1; + // Enable Global Interrupts + __builtin_mtc0(12,0,(__builtin_mfc0(12,0) | 0x0001)); + +} diff --git a/mcc_generated_files/interrupt_manager.hpp b/mcc_generated_files/interrupt_manager.hpp new file mode 100644 index 0000000..a01aacd --- /dev/null +++ b/mcc_generated_files/interrupt_manager.hpp @@ -0,0 +1,78 @@ +/** + System Interrupts Generated Driver File + + @Company: + Microchip Technology Inc. + + @File Name: + interrupt_manager.h + + @Summary: + This is the generated driver implementation file for setting up the + interrupts using PIC32MX MCUs + + @Description: + This source file provides implementations for PIC32MX MCUs interrupts. + Generation Information : + Product Revision : PIC32MX MCUs - pic32mx : v1.35 + Device : PIC32MX470F512H + Version : 1.01 + The generated drivers are tested against the following: + Compiler : XC32 1.42 + MPLAB : MPLAB X 3.55 +*/ +/* + (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this + software and any derivatives exclusively with Microchip products. + + THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER + EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A + PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION + WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. + + IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND + WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS + BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE + FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN + ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + + MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE + TERMS. +*/ + +#ifndef _INTERRUPT_MANAGER_H +#define _INTERRUPT_MANAGER_H + +/** + @Summary + Initializes the interrupt priorities of the PIC32MX470F512H + + @Description + This routine sets the interrupt priorities of the modules that have been configured + for the PIC32MX470F512H + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + void SYSTEM_Initialize(void) + { + // Other initializers are called from this function + INTERRUPT_Initialize (); + } + + +*/ +void INTERRUPT_Initialize(void); + +#endif \ No newline at end of file diff --git a/mcc_generated_files/mcc.cpp b/mcc_generated_files/mcc.cpp new file mode 100644 index 0000000..3d34379 --- /dev/null +++ b/mcc_generated_files/mcc.cpp @@ -0,0 +1,156 @@ +/** + @Generated PIC32MX MCUs Source File + + @Company: + Microchip Technology Inc. + + @File Name: + mcc.c + + @Summary: + This is the mcc.c file generated using PIC32MX MCUs + + @Description: + This header file provides implementations for driver APIs for all modules selected in the GUI. + Generation Information : + Product Revision : PIC32MX MCUs - pic32mx : v1.35 + Device : PIC32MX470F512H + Driver Version : 1.02 + The generated drivers are tested against the following: + Compiler : XC32 1.42 + MPLAB : MPLAB X 3.55 +*/ + +/* + (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this + software and any derivatives exclusively with Microchip products. + + THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER + EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A + PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION + WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. + + IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND + WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS + BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE + FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN + ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + + MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE + TERMS. +*/ + +// Configuration bits: selected in the GUI + +// DEVCFG3 +#pragma config FSRSSEL = PRIORITY_7 // Shadow Register Set Priority Select->SRS Priority 7 +#pragma config PMDL1WAY = ON // Peripheral Module Disable Configuration->Allow only one reconfiguration +#pragma config IOL1WAY = ON // Peripheral Pin Select Configuration->Allow only one reconfiguration +#pragma config FUSBIDIO = ON // USB USID Selection->Controlled by the USB Module +#pragma config FVBUSONIO = ON // USB VBUS ON Selection->Controlled by USB Module + +// DEVCFG2 +#pragma config FPLLIDIV = DIV_12 // PLL Input Divider->12x Divider +#pragma config FPLLMUL = MUL_24 // PLL Multiplier->24x Multiplier +#pragma config UPLLIDIV = DIV_12 // USB PLL Input Divider->12x Divider +#pragma config UPLLEN = OFF // USB PLL Enable->Disabled and Bypassed +#pragma config FPLLODIV = DIV_256 // System PLL Output Clock Divider->PLL Divide by 256 + +// DEVCFG1 +#pragma config FNOSC = FRCDIV // Oscillator Selection Bits->Fast RC Osc w/Div-by-N (FRCDIV) +#pragma config FSOSCEN = ON // Secondary Oscillator Enable->Enabled +#pragma config IESO = ON // Internal/External Switch Over->Enabled +#pragma config POSCMOD = OFF // Primary Oscillator Configuration->Primary osc disabled +#pragma config OSCIOFNC = OFF // CLKO Output Signal Active on the OSCO Pin->Disabled +#pragma config FPBDIV = DIV_8 // Peripheral Clock Divisor->Pb_Clk is Sys_Clk/8 +#pragma config FCKSM = CSDCMD // Clock Switching and Monitor Selection->Clock Switch Disable, FSCM Disabled +#pragma config WDTPS = PS1048576 // Watchdog Timer Postscaler->1:1048576 +#pragma config WINDIS = OFF // Watchdog Timer Window Enable->Watchdog Timer is in Non-Window Mode +#pragma config FWDTEN = OFF // Watchdog Timer Enable->WDT Disabled (SWDTEN Bit Controls) +#pragma config FWDTWINSZ = WINSZ_25 // Watchdog Timer Window Size->Window Size is 25% + +// DEVCFG0 +#pragma config DEBUG = OFF // Background Debugger Enable->Debugger is Disabled +#pragma config JTAGEN = ON // JTAG Enable->JTAG Port Enabled +#pragma config ICESEL = ICS_PGx1 // ICE/ICD Comm Channel Select->Communicate on PGEC1/PGED1 +#pragma config PWP = OFF // Program Flash Write Protect->Disable +#pragma config BWP = OFF // Boot Flash Write Protect bit->Protection Disabled +#pragma config CP = OFF // Code Protect->Protection Disabled + +#include "mcc.hpp" + +/** + @Summary + Indicates the exception cause. + + @Description + This array identifies the cause for exception. + */ + +static char *cause[] = +{ + "Interrupt", "Undefined", "Undefined", "Undefined", + "Load/fetch address error", "Store address error", + "Instruction bus error", "Data bus error", "Syscall", + "Breakpoint", "Reserved instruction", "Coprocessor unusable", + "Arithmetic overflow", "Trap", "Reserved", "Reserved", + "Reserved", "Reserved", "Reserved" +}; + +void SYSTEM_Initialize(void) +{ + PIN_MANAGER_Initialize(); + OSCILLATOR_Initialize(); + UART1_Initialize(); + INTERRUPT_Initialize(); +} + +void SYSTEM_RegUnlock(void) +{ + SYSKEY = 0x12345678; + SYSKEY = 0xAA996655; + SYSKEY = 0x556699AA; +} + +void SYSTEM_RegLock(void) +{ + SYSKEY = 0x00000000; +} + +void OSCILLATOR_Initialize(void) +{ + SYSTEM_RegUnlock(); + // CF no clock failure; COSC FRCDIV; PLLODIV DIV_256; UFRCEN disabled; PBDIVRDY disabled; SLOCK out of lock; FRCDIV FRC/1; SLPEN Idle on WAIT instruction; NOSC FRCDIV; PLLMULT MUL_24; SOSCEN disabled; PBDIV DIV_8; CLKLOCK unlocked; OSWEN Switch is Complete; SOSCRDY disabled; + OSCCON = 0x381F7700; + SYSTEM_RegLock(); + // TUN Center Frequency; + OSCTUN = 0x0; + // DIVSWEN disabled; RSLP disabled; ACTIVE Active; ROSEL SYSCLK; OE Not Driven out on REFCLKO pin; SIDL disabled; RODIV 0; ON disabled; + REFOCON = 0x100; + // ROTRIM 0; + REFOTRIM = 0x0; +} + +void _general_exception_handler () +{ + /* Mask off the ExcCode Field from the Cause Register + Refer to the MIPs Software User's manual */ + uint8_t _excep_code; + uint8_t _excep_addr; + uint8_t *_cause_str; + + _excep_code = (_CP0_GET_CAUSE() & 0x0000007C) >> 2; + _excep_addr = _CP0_GET_EPC(); + _cause_str = reinterpret_cast(cause[_excep_code]); + + while(1) { + + } +} + +/** + End of File +*/ \ No newline at end of file diff --git a/mcc_generated_files/mcc.hpp b/mcc_generated_files/mcc.hpp new file mode 100644 index 0000000..fe747b5 --- /dev/null +++ b/mcc_generated_files/mcc.hpp @@ -0,0 +1,134 @@ +/** + @Generated PIC32MX MCUs Header File + + @Company: + Microchip Technology Inc. + + @File Name: + mcc.h + + @Summary: + This is the mcc.h file generated using PIC32MX MCUs + + @Description: + This header file provides implementations for driver APIs for all modules selected in the GUI. + Generation Information : + Product Revision : PIC32MX MCUs - pic32mx : v1.35 + Device : PIC32MX470F512H + Version : 1.02 + The generated drivers are tested against the following: + Compiler : XC32 1.42 + MPLAB : MPLAB X 3.55 +*/ + +/* + (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this + software and any derivatives exclusively with Microchip products. + + THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER + EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A + PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION + WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. + + IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND + WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS + BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE + FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN + ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + + MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE + TERMS. +*/ + +#ifndef MCC_H +#define MCC_H +#include +#include "pin_manager.hpp" +#include +#include +#include "uart1.hpp" +#include "interrupt_manager.hpp" + +#define _XTAL_FREQ 8000000UL + +/** + * @Param + none + * @Returns + none + * @Description + Unlocks the write protected register to enable any write operation + * MCC GUI + * @Example + SYSTEM_RegUnlock(); + */ +void SYSTEM_RegUnlock(void); + +/** + * @Param + none + + * @Returns + none + + * @Description + Locks the write protected register to disable any write operation + + * @Example + SYSTEM_RegLock(); + */ + +void SYSTEM_RegLock(void); + +/** + * @Param + none + + * @Returns + none + + * @Description + Initializes the device to the default states configured in the + * MCC GUI + * @Example + SYSTEM_Initialize(void); + */ + +void SYSTEM_Initialize(void); + +/** + * @Param + none + * @Returns + none + * @Description + Initializes the oscillator to the default states configured in the + * MCC GUI + * @Example + OSCILLATOR_Initialize(void); + */ +void OSCILLATOR_Initialize(void); + +/** + * @Param + none + + * @Returns + none + + * @Description + Automatically called whenever there is a un-handled exception + + * @Example + none + */ + +void _general_exception_handler (void); + +#endif /* MCC_H */ +/** + End of File +*/ \ No newline at end of file diff --git a/mcc_generated_files/pin_manager.cpp b/mcc_generated_files/pin_manager.cpp new file mode 100644 index 0000000..6124d56 --- /dev/null +++ b/mcc_generated_files/pin_manager.cpp @@ -0,0 +1,131 @@ +/** + System Interrupts Generated Driver File + + @Company: + Microchip Technology Inc. + + @File Name: + pin_manager.c + + @Summary: + This is the generated manager file for the MPLAB(c) Code Configurator device. This manager + configures the pins direction, initial state, analog setting. + The peripheral pin select, PPS, configuration is also handled by this manager. + + @Description: + This source file provides implementations for MPLAB(c) Code Configurator interrupts. + Generation Information : + Product Revision : MPLAB(c) Code Configurator - 4.45 + Device : PIC32MX470F512H + Version : 1.02 + The generated drivers are tested against the following: + Compiler : XC32 1.42 + MPLAB : MPLAB X 3.55 + + Copyright (c) 2013 - 2015 released Microchip Technology Inc. All rights reserved. + + Microchip licenses to you the right to use, modify, copy and distribute + Software only when embedded on a Microchip microcontroller or digital signal + controller that is integrated into your product or third party product + (pursuant to the sublicense terms in the accompanying license agreement). + + You should refer to the license agreement accompanying this Software for + additional information regarding your rights and obligations. + + SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF + MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. + IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER + CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR + OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES + INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR + CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF + SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES + (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. + +*/ + + +/** + Section: Includes +*/ +#include +#include +#include "pin_manager.hpp" +#include "mcc.hpp" + +/** + void PIN_MANAGER_Initialize(void) +*/ +void PIN_MANAGER_Initialize(void) +{ + /**************************************************************************** + * Setting the Output Latch SFR(s) + ***************************************************************************/ + LATB = 0x0000; + LATC = 0x0000; + LATD = 0x0000; + LATE = 0x0000; + LATF = 0x0000; + LATG = 0x0000; + + /**************************************************************************** + * Setting the GPIO Direction SFR(s) + ***************************************************************************/ + TRISB = 0xFFFF; + TRISC = 0xF000; + TRISD = 0x0FFF; + TRISE = 0x002F; + TRISF = 0x003A; + TRISG = 0x03C0; + + /**************************************************************************** + * Setting the Weak Pull Up and Weak Pull Down SFR(s) + ***************************************************************************/ + CNPDB = 0x0000; + CNPDC = 0x0000; + CNPDD = 0x0000; + CNPDE = 0x0000; + CNPDF = 0x0000; + CNPDG = 0x0000; + CNPUB = 0x0000; + CNPUC = 0x0000; + CNPUD = 0x0000; + CNPUE = 0x0000; + CNPUF = 0x0000; + CNPUG = 0x0000; + + /**************************************************************************** + * Setting the Open Drain SFR(s) + ***************************************************************************/ + ODCB = 0x0000; + ODCC = 0x0000; + ODCD = 0x0000; + ODCE = 0x0000; + ODCF = 0x0000; + ODCG = 0x0000; + + /**************************************************************************** + * Setting the Analog/Digital Configuration SFR(s) + ***************************************************************************/ + ANSELB = 0xFFFC; + ANSELC = 0xF000; + ANSELD = 0x000E; + ANSELE = 0x00F4; + ANSELG = 0x03C0; + + /**************************************************************************** + * Set the PPS + ***************************************************************************/ + SYSTEM_RegUnlock(); // unlock PPS + CFGCONbits.IOLOCK = 0; + + U1RXRbits.U1RXR = 0x0004; //RF1->UART1:U1RX; + RPF0Rbits.RPF0R = 0x0003; //RF0->UART1:U1TX; + + CFGCONbits.IOLOCK = 1; // lock PPS + SYSTEM_RegLock(); + + +} + diff --git a/mcc_generated_files/pin_manager.hpp b/mcc_generated_files/pin_manager.hpp new file mode 100644 index 0000000..650fe9a --- /dev/null +++ b/mcc_generated_files/pin_manager.hpp @@ -0,0 +1,530 @@ +/** + System Interrupts Generated Driver File + + @Company: + Microchip Technology Inc. + + @File Name: + pin_manager.h + + @Summary: + This is the generated manager file for the MPLAB(c) Code Configurator device. This manager + configures the pins direction, initial state, analog setting. + The peripheral pin select, PPS, configuration is also handled by this manager. + + @Description: + This source file provides implementations for MPLAB(c) Code Configurator interrupts. + Generation Information : + Product Revision : MPLAB(c) Code Configurator - 4.45 + Device : PIC32MX470F512H + Version : 1.02 + The generated drivers are tested against the following: + Compiler : XC32 1.42 + MPLAB : MPLAB X 3.55 + + Copyright (c) 2013 - 2015 released Microchip Technology Inc. All rights reserved. + + Microchip licenses to you the right to use, modify, copy and distribute + Software only when embedded on a Microchip microcontroller or digital signal + controller that is integrated into your product or third party product + (pursuant to the sublicense terms in the accompanying license agreement). + + You should refer to the license agreement accompanying this Software for + additional information regarding your rights and obligations. + + SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF + MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. + IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER + CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR + OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES + INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR + CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF + SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES + (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. + +*/ + +#ifndef _PIN_MANAGER_H +#define _PIN_MANAGER_H +/** + Section: Includes +*/ +#include +/** + Section: Device Pin Macros +*/ +/** + @Summary + Sets the GPIO pin, RE4, high using LATEbits.LATE4. + + @Description + Sets the GPIO pin, RE4, high using LATEbits.LATE4. + + @Preconditions + The RE4 must be set to an output. + + @Returns + None. + + @Param + None. + + @Example + + // Set RE4 high (1) + LED1_SetHigh(); + + +*/ +#define LED1_SetHigh() LATEbits.LATE4 = 1 +/** + @Summary + Sets the GPIO pin, RE4, low using LATEbits.LATE4. + + @Description + Sets the GPIO pin, RE4, low using LATEbits.LATE4. + + @Preconditions + The RE4 must be set to an output. + + @Returns + None. + + @Param + None. + + @Example + + // Set RE4 low (0) + LED1_SetLow(); + + +*/ +#define LED1_SetLow() LATEbits.LATE4 = 0 +/** + @Summary + Toggles the GPIO pin, RE4, using LATEbits.LATE4. + + @Description + Toggles the GPIO pin, RE4, using LATEbits.LATE4. + + @Preconditions + The RE4 must be set to an output. + + @Returns + None. + + @Param + None. + + @Example + + // Toggle RE4 + LED1_Toggle(); + + +*/ +#define LED1_Toggle() LATEbits.LATE4 ^= 1 +/** + @Summary + Reads the value of the GPIO pin, RE4. + + @Description + Reads the value of the GPIO pin, RE4. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + uint16_t portValue; + + // Read RE4 + postValue = LED1_GetValue(); + + +*/ +#define LED1_GetValue() PORTEbits.RE4 +/** + @Summary + Configures the GPIO pin, RE4, as an input. + + @Description + Configures the GPIO pin, RE4, as an input. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + // Sets the RE4 as an input + LED1_SetDigitalInput(); + + +*/ +#define LED1_SetDigitalInput() TRISEbits.TRISE4 = 1 +/** + @Summary + Configures the GPIO pin, RE4, as an output. + + @Description + Configures the GPIO pin, RE4, as an output. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + // Sets the RE4 as an output + LED1_SetDigitalOutput(); + + +*/ +#define LED1_SetDigitalOutput() TRISEbits.TRISE4 = 0 +/** + @Summary + Sets the GPIO pin, RE6, high using LATEbits.LATE6. + + @Description + Sets the GPIO pin, RE6, high using LATEbits.LATE6. + + @Preconditions + The RE6 must be set to an output. + + @Returns + None. + + @Param + None. + + @Example + + // Set RE6 high (1) + LED2_SetHigh(); + + +*/ +#define LED2_SetHigh() LATEbits.LATE6 = 1 +/** + @Summary + Sets the GPIO pin, RE6, low using LATEbits.LATE6. + + @Description + Sets the GPIO pin, RE6, low using LATEbits.LATE6. + + @Preconditions + The RE6 must be set to an output. + + @Returns + None. + + @Param + None. + + @Example + + // Set RE6 low (0) + LED2_SetLow(); + + +*/ +#define LED2_SetLow() LATEbits.LATE6 = 0 +/** + @Summary + Toggles the GPIO pin, RE6, using LATEbits.LATE6. + + @Description + Toggles the GPIO pin, RE6, using LATEbits.LATE6. + + @Preconditions + The RE6 must be set to an output. + + @Returns + None. + + @Param + None. + + @Example + + // Toggle RE6 + LED2_Toggle(); + + +*/ +#define LED2_Toggle() LATEbits.LATE6 ^= 1 +/** + @Summary + Reads the value of the GPIO pin, RE6. + + @Description + Reads the value of the GPIO pin, RE6. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + uint16_t portValue; + + // Read RE6 + postValue = LED2_GetValue(); + + +*/ +#define LED2_GetValue() PORTEbits.RE6 +/** + @Summary + Configures the GPIO pin, RE6, as an input. + + @Description + Configures the GPIO pin, RE6, as an input. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + // Sets the RE6 as an input + LED2_SetDigitalInput(); + + +*/ +#define LED2_SetDigitalInput() TRISEbits.TRISE6 = 1 +/** + @Summary + Configures the GPIO pin, RE6, as an output. + + @Description + Configures the GPIO pin, RE6, as an output. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + // Sets the RE6 as an output + LED2_SetDigitalOutput(); + + +*/ +#define LED2_SetDigitalOutput() TRISEbits.TRISE6 = 0 +/** + @Summary + Sets the GPIO pin, RE7, high using LATEbits.LATE7. + + @Description + Sets the GPIO pin, RE7, high using LATEbits.LATE7. + + @Preconditions + The RE7 must be set to an output. + + @Returns + None. + + @Param + None. + + @Example + + // Set RE7 high (1) + LED3_SetHigh(); + + +*/ +#define LED3_SetHigh() LATEbits.LATE7 = 1 +/** + @Summary + Sets the GPIO pin, RE7, low using LATEbits.LATE7. + + @Description + Sets the GPIO pin, RE7, low using LATEbits.LATE7. + + @Preconditions + The RE7 must be set to an output. + + @Returns + None. + + @Param + None. + + @Example + + // Set RE7 low (0) + LED3_SetLow(); + + +*/ +#define LED3_SetLow() LATEbits.LATE7 = 0 +/** + @Summary + Toggles the GPIO pin, RE7, using LATEbits.LATE7. + + @Description + Toggles the GPIO pin, RE7, using LATEbits.LATE7. + + @Preconditions + The RE7 must be set to an output. + + @Returns + None. + + @Param + None. + + @Example + + // Toggle RE7 + LED3_Toggle(); + + +*/ +#define LED3_Toggle() LATEbits.LATE7 ^= 1 +/** + @Summary + Reads the value of the GPIO pin, RE7. + + @Description + Reads the value of the GPIO pin, RE7. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + uint16_t portValue; + + // Read RE7 + postValue = LED3_GetValue(); + + +*/ +#define LED3_GetValue() PORTEbits.RE7 +/** + @Summary + Configures the GPIO pin, RE7, as an input. + + @Description + Configures the GPIO pin, RE7, as an input. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + // Sets the RE7 as an input + LED3_SetDigitalInput(); + + +*/ +#define LED3_SetDigitalInput() TRISEbits.TRISE7 = 1 +/** + @Summary + Configures the GPIO pin, RE7, as an output. + + @Description + Configures the GPIO pin, RE7, as an output. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + // Sets the RE7 as an output + LED3_SetDigitalOutput(); + + +*/ +#define LED3_SetDigitalOutput() TRISEbits.TRISE7 = 0 + +/** + Section: Function Prototypes +*/ +/** + @Summary + Configures the pin settings of the PIC32MX470F512H + The peripheral pin select, PPS, configuration is also handled by this manager. + + @Description + This is the generated manager file for the MPLAB(c) Code Configurator device. This manager + configures the pins direction, initial state, analog setting. + The peripheral pin select, PPS, configuration is also handled by this manager. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Example + + void SYSTEM_Initialize(void) + { + // Other initializers are called from this function + PIN_MANAGER_Initialize(); + } + + +*/ +void PIN_MANAGER_Initialize(void); + +#endif diff --git a/mcc_generated_files/uart1.cpp b/mcc_generated_files/uart1.cpp new file mode 100644 index 0000000..96ed3e3 --- /dev/null +++ b/mcc_generated_files/uart1.cpp @@ -0,0 +1,390 @@ +/** + UART1 Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + uart1.c + + @Summary + This is the generated source file for the UART1 driver using PIC32MX MCUs + + @Description + This source file provides APIs for driver for UART1. + Generation Information : + Product Revision : PIC32MX MCUs - pic32mx : v1.35 + Device : PIC32MX470F512H + Driver Version : 0.5 + The generated drivers are tested against the following: + Compiler : XC32 1.42 + MPLAB : MPLAB X 3.55 +*/ + +/* + (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this + software and any derivatives exclusively with Microchip products. + + THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER + EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A + PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION + WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. + + IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND + WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS + BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE + FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN + ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + + MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE + TERMS. +*/ + +/** + Section: Included Files +*/ + +#include "uart1.hpp" + +/** + Section: Data Type Definitions +*/ + +/** UART Driver Queue Status + + @Summary + Defines the object required for the status of the queue. +*/ + +union UART_BYTEQ_STATUS +{ + struct + { + uint8_t full:1; + uint8_t empty:1; + uint8_t reserved:6; + } s; + uint8_t status; +}; + +/** UART Driver Hardware Instance Object + + @Summary + Defines the object required for the maintenance of the hardware instance. + +*/ +struct UART_OBJECT +{ + /* RX Byte Q */ + uint8_t *rxTail; + uint8_t *rxHead; + + /* TX Byte Q */ + uint8_t *txTail; + uint8_t *txHead; + UART_BYTEQ_STATUS rxStatus; + UART_BYTEQ_STATUS txStatus; + +}; + +static UART_OBJECT uart1_obj; + +/** UART Driver Queue Length + + @Summary + Defines the length of the Transmit and Receive Buffers + +*/ + +#define UART1_CONFIG_TX_BYTEQ_LENGTH 8 +#define UART1_CONFIG_RX_BYTEQ_LENGTH 8 + + +/** UART Driver Queue + + @Summary + Defines the Transmit and Receive Buffers + +*/ + +static uint8_t uart1_txByteQ[UART1_CONFIG_TX_BYTEQ_LENGTH]; +static uint8_t uart1_rxByteQ[UART1_CONFIG_RX_BYTEQ_LENGTH]; + +/** UART Hardware FIFO Buffer Length + + @Summary + Defines the length of the Transmit and Receive FIFOs + +*/ + +#define UART1_TX_FIFO_LENGTH 1 +#define UART1_RX_FIFO_LENGTH 1 + +/** + Section: Driver Interface +*/ + + +void UART1_Initialize (void) +{ + // STSEL 1S; IREN disabled; PDSEL 8N; RTSMD disabled; RXINV disabled; SIDL disabled; WAKE disabled; ABAUD disabled; LPBACK disabled; BRGH enabled; UEN TX_RX; ON enabled; + U1MODE = 0x8008; + // UTXISEL TX_ONE_CHAR; UTXINV disabled; ADDR 0; URXEN disabled; OERR disabled; ADM_EN disabled; URXISEL RX_ONE_CHAR; UTXBRK disabled; UTXEN disabled; ADDEN disabled; + U1STA = 0x0; + // U1TXREG 0; + U1TXREG = 0x0; + // BaudRate = 9600; Frequency = 1000000 Hz; BRG 25; + U1BRG = 0x19; + + IEC1bits.U1RXIE = 1; + + U1STAbits.UTXEN = 1; + U1STAbits.URXEN = 1; + + //Enabling UART + U1MODEbits.ON = 1; + + uart1_obj.txHead = uart1_txByteQ; + uart1_obj.txTail = uart1_txByteQ; + uart1_obj.rxHead = uart1_rxByteQ; + uart1_obj.rxTail = uart1_rxByteQ; + uart1_obj.rxStatus.s.empty = true; + uart1_obj.txStatus.s.empty = true; + uart1_obj.txStatus.s.full = false; + uart1_obj.rxStatus.s.full = false; +} + + +/** + Maintains the driver's transmitter/receiver/error state machine and implements its ISR +*/ +void __ISR(_UART_1_VECTOR, IPL1AUTO) _UART_1 (void) +{ + if(IFS1bits.U1RXIF) { + int count = 0; + + while((count < UART1_RX_FIFO_LENGTH) && (U1STAbits.URXDA == 1)) { + count++; + + *uart1_obj.rxTail = U1RXREG; + uart1_obj.rxTail++; + + if(uart1_obj.rxTail == (uart1_rxByteQ + UART1_CONFIG_RX_BYTEQ_LENGTH)) { + uart1_obj.rxTail = uart1_rxByteQ; + } + + uart1_obj.rxStatus.s.empty = false; + + if(uart1_obj.rxTail == uart1_obj.rxHead) { + //Sets the flag RX full + uart1_obj.rxStatus.s.full = true; + break; + } + } + + IFS1CLR= 1 << _IFS1_U1RXIF_POSITION; + } else if (IFS1bits.U1TXIF) { + if(uart1_obj.txStatus.s.empty) { + IEC1bits.U1TXIE = false; + return; + } + + IFS1CLR= 1 << _IFS1_U1TXIF_POSITION; + + int count = 0; + while((count < UART1_TX_FIFO_LENGTH)&& !(U1STAbits.UTXBF == 1)) { + count++; + + U1TXREG = *uart1_obj.txHead; + + uart1_obj.txHead++; + + if(uart1_obj.txHead == (uart1_txByteQ + UART1_CONFIG_TX_BYTEQ_LENGTH)) { + uart1_obj.txHead = uart1_txByteQ; + } + + uart1_obj.txStatus.s.full = false; + + if(uart1_obj.txHead == uart1_obj.txTail) { + uart1_obj.txStatus.s.empty = true; + break; + } + } + } else { + if ((U1STAbits.OERR == 1)) { + U1STAbits.OERR = 0; + } + + IFS1CLR= 1 << _IFS1_U1EIF_POSITION; + } +} + +/** + Section: UART Driver Client Routines +*/ + +uint8_t UART1_Read(void) +{ + uint8_t data = 0; + + data = *uart1_obj.rxHead; + + uart1_obj.rxHead++; + + if (uart1_obj.rxHead == (uart1_rxByteQ + UART1_CONFIG_RX_BYTEQ_LENGTH)) { + uart1_obj.rxHead = uart1_rxByteQ; + } + + if (uart1_obj.rxHead == uart1_obj.rxTail) { + uart1_obj.rxStatus.s.empty = true; + } + + uart1_obj.rxStatus.s.full = false; + + return data; +} + + +unsigned int UART1_ReadBuffer(uint8_t *buffer, const unsigned int bufLen) +{ + unsigned int numBytesRead = 0; + + while (numBytesRead < ( bufLen )) { + if(uart1_obj.rxStatus.s.empty) { + break; + } else { + buffer[numBytesRead++] = UART1_Read () ; + } + } + + return numBytesRead ; +} + + + +void UART1_Write(const uint8_t byte) +{ + IEC1bits.U1TXIE = false; + + *uart1_obj.txTail = byte; + uart1_obj.txTail++; + + if (uart1_obj.txTail == (uart1_txByteQ + UART1_CONFIG_TX_BYTEQ_LENGTH)) { + uart1_obj.txTail = uart1_txByteQ; + } + + uart1_obj.txStatus.s.empty = false; + + if (uart1_obj.txHead == uart1_obj.txTail) { + uart1_obj.txStatus.s.full = true; + } + + IEC1bits.U1TXIE = true ; + +} + + +unsigned int UART1_WriteBuffer(const uint8_t *buffer , const unsigned int bufLen ) +{ + unsigned int numBytesWritten = 0 ; + + while ( numBytesWritten < ( bufLen )) { + if((uart1_obj.txStatus.s.full)) { + break; + } else { + UART1_Write (buffer[numBytesWritten++] ) ; + } + } + + return numBytesWritten ; + +} + + +UART1_TRANSFER_STATUS UART1_TransferStatusGet (void) +{ + uint8_t status = 0; + + if(uart1_obj.txStatus.s.full) { + status |= UART1_TRANSFER_STATUS_TX_FULL; + } + + if(uart1_obj.txStatus.s.empty) { + status |= UART1_TRANSFER_STATUS_TX_EMPTY; + } + + if(uart1_obj.rxStatus.s.full) { + status |= UART1_TRANSFER_STATUS_RX_FULL; + } + + if(uart1_obj.rxStatus.s.empty) { + status |= UART1_TRANSFER_STATUS_RX_EMPTY; + } else { + status |= UART1_TRANSFER_STATUS_RX_DATA_PRESENT; + } + + return static_cast(status); +} + + +uint8_t UART1_Peek(uint16_t offset) +{ + if( (uart1_obj.rxHead + offset) > (uart1_rxByteQ + UART1_CONFIG_RX_BYTEQ_LENGTH)) { + return uart1_rxByteQ[offset - (uart1_rxByteQ + UART1_CONFIG_RX_BYTEQ_LENGTH - uart1_obj.rxHead)]; + } else { + return *(uart1_obj.rxHead + offset); + } +} + + +unsigned int UART1_ReceiveBufferSizeGet(void) +{ + if(!uart1_obj.rxStatus.s.full) { + if(uart1_obj.rxHead > uart1_obj.rxTail) { + return(uart1_obj.rxHead - uart1_obj.rxTail); + } else { + return(UART1_CONFIG_RX_BYTEQ_LENGTH - (uart1_obj.rxTail - uart1_obj.rxHead)); + } + } + return 0; +} + + +unsigned int UART1_TransmitBufferSizeGet(void) +{ + if(!uart1_obj.txStatus.s.full) { + if(uart1_obj.txHead > uart1_obj.txTail) { + return (uart1_obj.txHead - uart1_obj.txTail); + } else { + return (UART1_CONFIG_TX_BYTEQ_LENGTH - (uart1_obj.txTail - uart1_obj.txHead)); + } + } + return 0; +} + + +bool UART1_ReceiveBufferIsEmpty (void) +{ + return(uart1_obj.rxStatus.s.empty); +} + + +bool UART1_TransmitBufferIsFull(void) +{ + return(uart1_obj.txStatus.s.full); +} + + +UART1_STATUS UART1_StatusGet (void) +{ + return static_cast(U1STA); +} + + + +/** + End of File +*/ diff --git a/mcc_generated_files/uart1.hpp b/mcc_generated_files/uart1.hpp new file mode 100644 index 0000000..db61d1e --- /dev/null +++ b/mcc_generated_files/uart1.hpp @@ -0,0 +1,624 @@ +/** + UART1 Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + uart1.h + + @Summary + This is the generated header file for the UART1 driver using PIC32MX MCUs + + @Description + This header file provides APIs for driver for UART1. + Generation Information : + Product Revision : PIC32MX MCUs - pic32mx : v1.35 + Device : PIC32MX470F512H + Driver Version : 0.5 + The generated drivers are tested against the following: + Compiler : XC32 1.42 + MPLAB : MPLAB X 3.55 +*/ + +/* + (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this + software and any derivatives exclusively with Microchip products. + + THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER + EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A + PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION + WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. + + IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND + WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS + BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE + FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN + ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + + MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE + TERMS. +*/ + +#ifndef _UART1_H +#define _UART1_H + +/** + Section: Included Files +*/ + +#include +#include +#include +#include +#include +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + +/** + Section: Data Types +*/ + +/** UART1 Driver Hardware Flags + + @Summary + Specifies the status of the hardware receive or transmit + + @Description + This type specifies the status of the hardware receive or transmit. + More than one of these values may be OR'd together to create a complete + status value. To test a value of this type, the bit of interest must be + AND'ed with value and checked to see if the result is non-zero. +*/ +typedef enum +{ + /* Indicates that Receive buffer has data, at least one more character can be read */ + UART1_RX_DATA_AVAILABLE + /*DOM-IGNORE-BEGIN*/ = (1 << 0) /*DOM-IGNORE-END*/, + + /* Indicates that Receive buffer has overflowed */ + UART1_RX_OVERRUN_ERROR + /*DOM-IGNORE-BEGIN*/ = (1 << 1) /*DOM-IGNORE-END*/, + + /* Indicates that Framing error has been detected for the current character */ + UART1_FRAMING_ERROR + /*DOM-IGNORE-BEGIN*/ = (1 << 2) /*DOM-IGNORE-END*/, + + /* Indicates that Parity error has been detected for the current character */ + UART1_PARITY_ERROR + /*DOM-IGNORE-BEGIN*/ = (1 << 3) /*DOM-IGNORE-END*/, + + /* Indicates that Receiver is Idle */ + UART1_RECEIVER_IDLE + /*DOM-IGNORE-BEGIN*/ = (1 << 4) /*DOM-IGNORE-END*/, + + /* Indicates that the last transmission has completed */ + UART1_TX_COMPLETE + /*DOM-IGNORE-BEGIN*/ = (1 << 8) /*DOM-IGNORE-END*/, + + /* Indicates that Transmit buffer is full */ + UART1_TX_FULL + /*DOM-IGNORE-BEGIN*/ = (1 << 9) /*DOM-IGNORE-END*/ + +}UART1_STATUS; + + + +/** UART1 Driver Transfer Flags + + @Summary + Specifies the status of the receive or transmit + + @Description + This type specifies the status of the receive or transmit operation. + More than one of these values may be OR'd together to create a complete + status value. To test a value of this type, the bit of interest must be + AND'ed with value and checked to see if the result is non-zero. +*/ + +typedef enum +{ + /* Indicates that the core driver buffer is full */ + UART1_TRANSFER_STATUS_RX_FULL + /*DOM-IGNORE-BEGIN*/ = (1 << 0) /*DOM-IGNORE-END*/, + + /* Indicates that at least one byte of Data has been received */ + UART1_TRANSFER_STATUS_RX_DATA_PRESENT + /*DOM-IGNORE-BEGIN*/ = (1 << 1) /*DOM-IGNORE-END*/, + + /* Indicates that the core driver receiver buffer is empty */ + UART1_TRANSFER_STATUS_RX_EMPTY + /*DOM-IGNORE-BEGIN*/ = (1 << 2) /*DOM-IGNORE-END*/, + + /* Indicates that the core driver transmitter buffer is full */ + UART1_TRANSFER_STATUS_TX_FULL + /*DOM-IGNORE-BEGIN*/ = (1 << 3) /*DOM-IGNORE-END*/, + + /* Indicates that the core driver transmitter buffer is empty */ + UART1_TRANSFER_STATUS_TX_EMPTY + /*DOM-IGNORE-BEGIN*/ = (1 << 4) /*DOM-IGNORE-END*/ + +} UART1_TRANSFER_STATUS; + + +/** + Section: UART1 Driver Routines +*/ + +void _UART_1(void); + +/** + @Summary + Initializes the UART instance : 1 + + @Description + This routine initializes the UART driver instance for : 1 + index. + This routine must be called before any other UART routine is called. + + @Preconditions + None. + + @Returns + None. + + @Param + None. + + @Comment + + + @Example + + const uint8_t writeBuffer[35] = "1234567890ABCDEFGHIJKLMNOP\n" ; + unsigned int numBytes = 0; + int writebufferLen = strlen((char *)writeBuffer); + UART1_Initialize(); + while(numBytes < writebufferLen) + { + int bytesToWrite = UART1_TransmitBufferSizeGet(); + numBytes = UART1_WriteBuffer ( writeBuffer+numBytes, bytesToWrite) ; + UART1_TasksTransmit ( ); + if (!UART1_TransmitBufferisFull()) + { + //continue other operation + } + } + + +*/ + +void UART1_Initialize(void); + +/** + @Summary + Read a byte of data from the UART1 + + @Description + This routine reads a byte of data from the UART1. + + @Preconditions + UART1_Initializer function should have been called + before calling this function. The transfer status should be checked to see + if the receiver is not empty before calling this function. + + @Param + None. + + @Returns + A data byte received by the driver. + + @Example + + char myBuffer[MY_BUFFER_SIZE]; + unsigned int numBytes; + + numBytes = 0; + do + { + if( UART1_TRANSFER_STATUS_RX_DATA_PRESENT & UART1_TransferStatusGet() ) + { + myBuffer[numBytes++] = UART1_Read(); + } + + // Do something else... + + } while( numBytes < MY_BUFFER_SIZE); + +*/ + +uint8_t UART1_Read( void); + +/** + @Summary + Returns the number of bytes read by the UART1 peripheral + + @Description + This routine returns the number of bytes read by the Peripheral and fills the + application read buffer with the read data. + + @Preconditions + UART1_Initializer function should have been called + before calling this function + + @Param + buffer - Buffer into which the data read from the UART1 + + @Param + numbytes - Total number of bytes that need to be read from the UART1 + (must be equal to or less than the size of the buffer) + + @Returns + Number of bytes actually copied into the caller's buffer or -1 if there + is an error. + + @Example + + char myBuffer[MY_BUFFER_SIZE]; + unsigned int numBytes; + UART1_TRANSFER_STATUS status ; + + // Pre-initialize myBuffer with MY_BUFFER_SIZE bytes of valid data. + + numBytes = 0; + while( numBytes < MY_BUFFER_SIZE); + { + status = UART1_TransferStatusGet ( ) ; + if (status & UART1_TRANSFER_STATUS_RX_FULL) + { + numBytes += UART1_ReadBuffer( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ; + if(numBytes < readbufferLen) + { + continue; + } + else + { + break; + } + } + else + { + continue; + } + + // Do something else... + } + +*/ + +unsigned int UART1_ReadBuffer( uint8_t *buffer , const unsigned int numbytes); + +/** + @Summary + Writes a byte of data to the UART1 + + @Description + This routine writes a byte of data to the UART1. + + @Preconditions + UART1_Initializer function should have been called + before calling this function. The transfer status should be checked to see if + transmitter is not full before calling this function. + + @Param + byte - Data byte to write to the UART1 + + @Returns + None. + + @Example + + char myBuffer[MY_BUFFER_SIZE]; + unsigned int numBytes; + + // Pre-initialize myBuffer with MY_BUFFER_SIZE bytes of valid data. + + numBytes = 0; + while( numBytes < MY_BUFFER_SIZE); + { + if( !(UART1_TRANSFER_STATUS_TX_FULL & UART1_TransferStatusGet()) ) + { + UART1_Write(handle, myBuffer[numBytes++]); + } + + // Do something else... + } + +*/ + +void UART1_Write( const uint8_t byte); + +/** + @Summary + Returns the number of bytes written into the internal buffer + + @Description + This API transfers the data from application buffer to internal buffer and + returns the number of bytes added in that queue + + @Preconditions + UART1_Initializer function should have been called + before calling this function + + @Example + + char myBuffer[MY_BUFFER_SIZE]; + unsigned int numBytes; + UART1_TRANSFER_STATUS status ; + + // Pre-initialize myBuffer with MY_BUFFER_SIZE bytes of valid data. + + numBytes = 0; + while( numBytes < MY_BUFFER_SIZE); + { + status = UART1_TransferStatusGet ( ) ; + if (status & UART1_TRANSFER_STATUS_TX_EMPTY) + { + numBytes += UART1_WriteBuffer ( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ; + if(numBytes < writebufferLen) + { + continue; + } + else + { + break; + } + } + else + { + continue; + } + + // Do something else... + } + +*/ + +unsigned int UART1_WriteBuffer( const uint8_t *buffer , const unsigned int numbytes ); + +/** + @Summary + Returns the transmitter and receiver transfer status + + @Description + This returns the transmitter and receiver transfer status.The returned status + may contain a value with more than one of the bits + specified in the UART1_TRANSFER_STATUS enumeration set. + The caller should perform an "AND" with the bit of interest and verify if the + result is non-zero (as shown in the example) to verify the desired status + bit. + + @Preconditions + UART1_Initializer function should have been called + before calling this function + + @Param + None. + + @Returns + A UART1_TRANSFER_STATUS value describing the current status + of the transfer. + + @Example + Refer to UART1_ReadBuffer and UART1_WriteBuffer for example + +*/ + +UART1_TRANSFER_STATUS UART1_TransferStatusGet (void ); + +/** + @Summary + Returns the character in the read sequence at the offset provided, without + extracting it + + @Description + This routine returns the character in the read sequence at the offset provided, + without extracting it + + @Param + None. + + @Example + + const uint8_t readBuffer[5]; + unsigned int data, numBytes = 0; + unsigned int readbufferLen = sizeof(readBuffer); + UART1_Initializer(); + + while(numBytes < readbufferLen) + { + UART1_TasksReceive ( ); + //Check for data at a particular place in the buffer + data = UART1_Peek(3); + if(data == 5) + { + //discard all other data if byte that is wanted is received. + //continue other operation + numBytes += UART1_ReadBuffer ( readBuffer + numBytes , readbufferLen ) ; + } + else + { + break; + } + } + + +*/ + +uint8_t UART1_Peek(uint16_t offset); + +/** + @Summary + Returns the size of the receive buffer + + @Description + This routine returns the size of the receive buffer. + + @Param + None. + + @Returns + Size of receive buffer. + + @Example + + const uint8_t readBuffer[5]; + unsigned int size, numBytes = 0; + unsigned int readbufferLen = sizeof(readBuffer); + UART1__Initializer(); + + while(size < readbufferLen) + { + UART1_TasksReceive ( ); + size = UART1_ReceiveBufferSizeGet(); + } + numBytes = UART1_ReadBuffer ( readBuffer , readbufferLen ) ; + + +*/ + +unsigned int UART1_ReceiveBufferSizeGet(void); + +/** + @Summary + Returns the size of the transmit buffer + + @Description + This routine returns the size of the transmit buffer. + + @Param + None. + + @Returns + Size of transmit buffer. + + @Example + Refer to UART1_Initializer(); for example. +*/ + +unsigned int UART1_TransmitBufferSizeGet(void); + +/** + @Summary + Returns the status of the receive buffer + + @Description + This routine returns if the receive buffer is empty or not. + + @Param + None. + + @Returns + True if the receive buffer is empty + False if the receive buffer is not empty + + @Example + + char myBuffer[MY_BUFFER_SIZE]; + unsigned int numBytes; + UART1_TRANSFER_STATUS status ; + + // Pre-initialize myBuffer with MY_BUFFER_SIZE bytes of valid data. + + numBytes = 0; + while( numBytes < MY_BUFFER_SIZE); + { + status = UART1_TransferStatusGet ( ) ; + if (!UART1_ReceiveBufferIsEmpty()) + { + numBytes += UART1_ReadBuffer( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ; + if(numBytes < readbufferLen) + { + continue; + } + else + { + break; + } + } + else + { + continue; + } + + // Do something else... + } + + +*/ + +bool UART1_ReceiveBufferIsEmpty (void); + +/** + @Summary + Returns the status of the transmit buffer + + @Description + This routine returns if the transmit buffer is full or not. + + @Param + None. + + @Returns + True if the transmit buffer is full + False if the transmit buffer is not full + + @Example + Refer to UART1_Initializer() for example. + +*/ + +bool UART1_TransmitBufferIsFull (void); + +/** + @Summary + Returns the transmitter and receiver status + + @Description + This returns the transmitter and receiver status. The returned status may + contain a value with more than one of the bits + specified in the UART1_STATUS enumeration set. + The caller should perform an "AND" with the bit of interest and verify if the + result is non-zero (as shown in the example) to verify the desired status + bit. + + @Preconditions + UART1_Initializer function should have been called + before calling this function + + @Param + None. + + @Returns + A UART1_STATUS value describing the current status + of the transfer. + + @Example + + while(!(UART1_StatusGet & UART1_TX_COMPLETE )) + { + // Wait for the tranmission to complete + } + +*/ + +UART1_STATUS UART1_StatusGet (void ); + +#ifdef __cplusplus // Provide C++ Compatibility + + } + +#endif + +#endif // _UART1_H + +/* + End of File +*/ + diff --git a/nbproject/Makefile-default.mk b/nbproject/Makefile-default.mk index e33b6c7..a8b8034 100644 --- a/nbproject/Makefile-default.mk +++ b/nbproject/Makefile-default.mk @@ -19,7 +19,7 @@ endif endif # Environment -MKDIR=gnumkdir -p +MKDIR=mkdir -p RM=rm -f MV=mv CP=cp @@ -57,17 +57,17 @@ OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced -SOURCEFILES_QUOTED_IF_SPACED=main.cpp Led.cpp +SOURCEFILES_QUOTED_IF_SPACED=mcc_generated_files/interrupt_manager.cpp mcc_generated_files/mcc.cpp mcc_generated_files/pin_manager.cpp mcc_generated_files/uart1.cpp main.cpp # Object Files Quoted if spaced -OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/main.o ${OBJECTDIR}/Led.o -POSSIBLE_DEPFILES=${OBJECTDIR}/main.o.d ${OBJECTDIR}/Led.o.d +OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/mcc_generated_files/interrupt_manager.o ${OBJECTDIR}/mcc_generated_files/mcc.o ${OBJECTDIR}/mcc_generated_files/pin_manager.o ${OBJECTDIR}/mcc_generated_files/uart1.o ${OBJECTDIR}/main.o +POSSIBLE_DEPFILES=${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d ${OBJECTDIR}/mcc_generated_files/mcc.o.d ${OBJECTDIR}/mcc_generated_files/pin_manager.o.d ${OBJECTDIR}/mcc_generated_files/uart1.o.d ${OBJECTDIR}/main.o.d # Object Files -OBJECTFILES=${OBJECTDIR}/main.o ${OBJECTDIR}/Led.o +OBJECTFILES=${OBJECTDIR}/mcc_generated_files/interrupt_manager.o ${OBJECTDIR}/mcc_generated_files/mcc.o ${OBJECTDIR}/mcc_generated_files/pin_manager.o ${OBJECTDIR}/mcc_generated_files/uart1.o ${OBJECTDIR}/main.o # Source Files -SOURCEFILES=main.cpp Led.cpp +SOURCEFILES=mcc_generated_files/interrupt_manager.cpp mcc_generated_files/mcc.cpp mcc_generated_files/pin_manager.cpp mcc_generated_files/uart1.cpp main.cpp CFLAGS= @@ -112,31 +112,67 @@ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: compileCPP ifeq ($(TYPE_IMAGE), DEBUG_RUN) +${OBJECTDIR}/mcc_generated_files/interrupt_manager.o: mcc_generated_files/interrupt_manager.cpp nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d + @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o + @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -DPKOBSKDEPlatformTool=1 -fframe-base-loclist -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" -o ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o mcc_generated_files/interrupt_manager.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) + +${OBJECTDIR}/mcc_generated_files/mcc.o: mcc_generated_files/mcc.cpp nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.o.d + @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.o + @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/mcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -DPKOBSKDEPlatformTool=1 -fframe-base-loclist -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/mcc_generated_files/mcc.o.d" -o ${OBJECTDIR}/mcc_generated_files/mcc.o mcc_generated_files/mcc.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) + +${OBJECTDIR}/mcc_generated_files/pin_manager.o: mcc_generated_files/pin_manager.cpp nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.o.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.o + @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -DPKOBSKDEPlatformTool=1 -fframe-base-loclist -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" -o ${OBJECTDIR}/mcc_generated_files/pin_manager.o mcc_generated_files/pin_manager.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) + +${OBJECTDIR}/mcc_generated_files/uart1.o: mcc_generated_files/uart1.cpp nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/uart1.o.d + @${RM} ${OBJECTDIR}/mcc_generated_files/uart1.o + @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/uart1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -DPKOBSKDEPlatformTool=1 -fframe-base-loclist -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/mcc_generated_files/uart1.o.d" -o ${OBJECTDIR}/mcc_generated_files/uart1.o mcc_generated_files/uart1.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) + ${OBJECTDIR}/main.o: main.cpp nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/main.o.d @${RM} ${OBJECTDIR}/main.o @${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -DPKOBSKDEPlatformTool=1 -fframe-base-loclist -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/main.o.d" -o ${OBJECTDIR}/main.o main.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -${OBJECTDIR}/Led.o: Led.cpp nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} "${OBJECTDIR}" - @${RM} ${OBJECTDIR}/Led.o.d - @${RM} ${OBJECTDIR}/Led.o - @${FIXDEPS} "${OBJECTDIR}/Led.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -DPKOBSKDEPlatformTool=1 -fframe-base-loclist -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/Led.o.d" -o ${OBJECTDIR}/Led.o Led.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) - else +${OBJECTDIR}/mcc_generated_files/interrupt_manager.o: mcc_generated_files/interrupt_manager.cpp nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d + @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o + @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" -o ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o mcc_generated_files/interrupt_manager.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) + +${OBJECTDIR}/mcc_generated_files/mcc.o: mcc_generated_files/mcc.cpp nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.o.d + @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.o + @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/mcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/mcc_generated_files/mcc.o.d" -o ${OBJECTDIR}/mcc_generated_files/mcc.o mcc_generated_files/mcc.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) + +${OBJECTDIR}/mcc_generated_files/pin_manager.o: mcc_generated_files/pin_manager.cpp nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.o.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.o + @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" -o ${OBJECTDIR}/mcc_generated_files/pin_manager.o mcc_generated_files/pin_manager.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) + +${OBJECTDIR}/mcc_generated_files/uart1.o: mcc_generated_files/uart1.cpp nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/uart1.o.d + @${RM} ${OBJECTDIR}/mcc_generated_files/uart1.o + @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/uart1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/mcc_generated_files/uart1.o.d" -o ${OBJECTDIR}/mcc_generated_files/uart1.o mcc_generated_files/uart1.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) + ${OBJECTDIR}/main.o: main.cpp nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/main.o.d @${RM} ${OBJECTDIR}/main.o @${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/main.o.d" -o ${OBJECTDIR}/main.o main.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -${OBJECTDIR}/Led.o: Led.cpp nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} "${OBJECTDIR}" - @${RM} ${OBJECTDIR}/Led.o.d - @${RM} ${OBJECTDIR}/Led.o - @${FIXDEPS} "${OBJECTDIR}/Led.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CPPC} $(MP_EXTRA_CC_PRE) -g -x c++ -c -mprocessor=$(MP_PROCESSOR_OPTION) -frtti -fexceptions -fno-check-new -fenforce-eh-specs -MMD -MF "${OBJECTDIR}/Led.o.d" -o ${OBJECTDIR}/Led.o Led.cpp -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) - endif # ------------------------------------------------------------------------------------ @@ -144,13 +180,13 @@ endif ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/LiquidSmoke.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} - ${MP_CPPC} $(MP_EXTRA_LD_PRE) -g -mdebugger -DPKOBSKDEPlatformTool=1 -mprocessor=$(MP_PROCESSOR_OPTION) -o dist/${CND_CONF}/${IMAGE_TYPE}/LiquidSmoke.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -mreserve=data@0x0:0x1FC -mreserve=boot@0x1FC02000:0x1FC02FEF -mreserve=boot@0x1FC02000:0x1FC0275F -Wl,--defsym=__MPLAB_BUILD=1$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION),--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D=__DEBUG_D,--defsym=PKOBSKDEPlatformTool=1,--defsym=_min_heap_size=64K,--no-code-in-dinit,--no-dinit-in-serial-mem,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml + ${MP_CPPC} $(MP_EXTRA_LD_PRE) -g -mdebugger -DPKOBSKDEPlatformTool=1 -mprocessor=$(MP_PROCESSOR_OPTION) -o dist/${CND_CONF}/${IMAGE_TYPE}/LiquidSmoke.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -mreserve=data@0x0:0x1FC -mreserve=boot@0x1FC02000:0x1FC02FEF -mreserve=boot@0x1FC02000:0x1FC0275F -Wl,--defsym=__MPLAB_BUILD=1$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION),--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D=__DEBUG_D,--defsym=PKOBSKDEPlatformTool=1,--no-code-in-dinit,--no-dinit-in-serial-mem,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml else dist/${CND_CONF}/${IMAGE_TYPE}/LiquidSmoke.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} - ${MP_CPPC} $(MP_EXTRA_LD_PRE) -mprocessor=$(MP_PROCESSOR_OPTION) -o dist/${CND_CONF}/${IMAGE_TYPE}/LiquidSmoke.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -Wl,--defsym=__MPLAB_BUILD=1$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION),--defsym=_min_heap_size=64K,--no-code-in-dinit,--no-dinit-in-serial-mem,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml - ${MP_CC_DIR}\\xc32-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/LiquidSmoke.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} + ${MP_CPPC} $(MP_EXTRA_LD_PRE) -mprocessor=$(MP_PROCESSOR_OPTION) -o dist/${CND_CONF}/${IMAGE_TYPE}/LiquidSmoke.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -Wl,--defsym=__MPLAB_BUILD=1$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION),--no-code-in-dinit,--no-dinit-in-serial-mem,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml + ${MP_CC_DIR}/xc32-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/LiquidSmoke.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} endif @@ -169,7 +205,7 @@ endif # Enable dependency checking .dep.inc: .depcheck-impl -DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) +DEPFILES=$(shell "${PATH_TO_IDE_BIN}"mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif diff --git a/nbproject/Makefile-genesis.properties b/nbproject/Makefile-genesis.properties index 72e3287..50b6c7b 100644 --- a/nbproject/Makefile-genesis.properties +++ b/nbproject/Makefile-genesis.properties @@ -1,9 +1,9 @@ # -#Tue Apr 10 16:26:14 CEST 2018 -default.com-microchip-mplab-nbide-toolchainXC32-XC32LanguageToolchain.md5=002e07fc35a732566b3c80c1ed2897e8 -default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc32\\v1.44\\bin -configurations-xml=af4b92e7e53912485081aebfc8b92899 -com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=5d30ff5128b14865c8a3796a8f0bb8a0 -default.languagetoolchain.version=1.44 -host.platform=windows +#Tue May 01 20:55:46 CEST 2018 +default.com-microchip-mplab-nbide-toolchainXC32-XC32LanguageToolchain.md5=fcf9db1a3d46b4ef4e0a46afcbf02251 +default.languagetoolchain.dir=/opt/microchip/xc32/v2.05/bin +configurations-xml=ebbb6149d60ae60c0bd2d61a19ab44c5 +com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=c8c2915d32f5d7e4be49831bc9827ab0 +default.languagetoolchain.version=2.05 +host.platform=linux conf.ids=default diff --git a/nbproject/Makefile-local-default.mk b/nbproject/Makefile-local-default.mk index 1dd99ba..39019b0 100644 --- a/nbproject/Makefile-local-default.mk +++ b/nbproject/Makefile-local-default.mk @@ -14,24 +14,23 @@ # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # -SHELL=cmd.exe -PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v4.05/mplab_ide/platform/../mplab_ide/modules/../../bin/ +PATH_TO_IDE_BIN=/opt/microchip/mplabx/v4.15/mplab_ide/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. -PATH:=C:/Program Files/Microchip/MPLABX/v4.05/mplab_ide/platform/../mplab_ide/modules/../../bin/:$(PATH) +PATH:=/opt/microchip/mplabx/v4.15/mplab_ide/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created -MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v4.05\sys\java\jre1.8.0_144/bin/" +MP_JAVA_PATH="/opt/microchip/mplabx/v4.15/sys/java/jre1.8.0_144/bin/" OS_CURRENT="$(shell uname -s)" -MP_CC="C:\Program Files\Microchip\xc32\v1.44\bin\xc32-gcc.exe" -MP_CPPC="C:\Program Files\Microchip\xc32\v1.44\bin\xc32-g++.exe" +MP_CC="/opt/microchip/xc32/v2.05/bin/xc32-gcc" +MP_CPPC="/opt/microchip/xc32/v2.05/bin/xc32-g++" # MP_BC is not defined -MP_AS="C:\Program Files\Microchip\xc32\v1.44\bin\xc32-as.exe" -MP_LD="C:\Program Files\Microchip\xc32\v1.44\bin\xc32-ld.exe" -MP_AR="C:\Program Files\Microchip\xc32\v1.44\bin\xc32-ar.exe" -DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v4.05/mplab_ide/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" -MP_CC_DIR="C:\Program Files\Microchip\xc32\v1.44\bin" -MP_CPPC_DIR="C:\Program Files\Microchip\xc32\v1.44\bin" +MP_AS="/opt/microchip/xc32/v2.05/bin/xc32-as" +MP_LD="/opt/microchip/xc32/v2.05/bin/xc32-ld" +MP_AR="/opt/microchip/xc32/v2.05/bin/xc32-ar" +DEP_GEN=${MP_JAVA_PATH}java -jar "/opt/microchip/mplabx/v4.15/mplab_ide/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" +MP_CC_DIR="/opt/microchip/xc32/v2.05/bin" +MP_CPPC_DIR="/opt/microchip/xc32/v2.05/bin" # MP_BC_DIR is not defined -MP_AS_DIR="C:\Program Files\Microchip\xc32\v1.44\bin" -MP_LD_DIR="C:\Program Files\Microchip\xc32\v1.44\bin" -MP_AR_DIR="C:\Program Files\Microchip\xc32\v1.44\bin" +MP_AS_DIR="/opt/microchip/xc32/v2.05/bin" +MP_LD_DIR="/opt/microchip/xc32/v2.05/bin" +MP_AR_DIR="/opt/microchip/xc32/v2.05/bin" # MP_BC_DIR is not defined diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 7d7794b..e3266a6 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -4,6 +4,14 @@ + + mcc_generated_files/interrupt_manager.hpp + mcc_generated_files/mcc.hpp + mcc_generated_files/pin_manager.hpp + mcc_generated_files/uart1.hpp + + + mcc_generated_files/interrupt_manager.cpp + mcc_generated_files/mcc.cpp + mcc_generated_files/pin_manager.cpp + mcc_generated_files/uart1.cpp + main.cpp - Led.hpp - Led.cpp Makefile + hwconfig.mc3 + + mcc_generated_files + Makefile @@ -32,8 +50,8 @@ PKOBSKDEPlatformTool XC32 - 1.44 - 3 + 2.05 + 2 @@ -127,7 +145,7 @@ - + diff --git a/nbproject/project.xml b/nbproject/project.xml index b7506fd..9cfb6d3 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -4,7 +4,7 @@ LiquidSmoke - c1169538-a9f2-4a31-8441-46d4577551ac + 26976773-df1d-4341-b350-948334294bed 0 cpp -- cgit v1.2.1