Index: /RF_BT_Tail/JDY08.c =================================================================== --- /RF_BT_Tail/JDY08.c (revision 244) +++ /RF_BT_Tail/JDY08.c (revision 244) @@ -0,0 +1,153 @@ +// File: JDY08.c +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// HAL for the JDY-08 Bluetooth module (based on the TI chip CC2541) +//------------------------------------------------------------------------------ + +#include "JDY08.h" +#include "Definitions.h" +#include "./mcc_generated_files/mcc.h" +#include +#include + +//AT commands +#define HOSTEN "AT+HOSTEN0" //Sets the right mode for BT serial slave +#define RST "AT+RST" //Resets the BT module +#define NAME "AT+NAME(!)Tail1" //Sets the BT name +#define REVERSE "AT+REVERSE1" // +#define SPLASH "Tail sw.ver."STR_VER //Sent after initialisation + +char rxBuff[RX_BUFF_LEN]; //rx buffer +uint8_t rxRdPtr; //Reading Pointer to rxBuff + +//Return the pointer to the buffer read, or a NULL pointer if no chars were received +char* btReadStr() +{ + char c; //temp char + uint8_t i; //iterator + uint8_t rxPtr; //index to the rx buffer + + //Flush buffer + memset(rxBuff,0,sizeof(rxBuff)); + rxPtr=0; + + //If no data received then return + if (!EUSART_is_rx_ready()) return 0; + + while (EUSART_is_rx_ready()) //Keeps reading until there is data + { + c=EUSART_Read(); + rxBuff[rxPtr++]=c; + if (c=='\n') break; + if (rxPtr>sizeof(rxBuff)-1) break; + } + + rxBuff[rxPtr]=0; //Terminates the string + rxRdPtr = 0; //Resets the buffer read pointer + + //Convert to uppercase + for (i=0; (rxBuff[i]!=0 && i='a' && c<='z') rxBuff[i]=c-('a'-'A'); + } + + if (rxPtr) return rxBuff; //Return pointer to string if not empty + else return 0; //A null pointer means nothing was received +} + +void btSendStr(const char* str,uint8_t len) +{ + uint8_t i; + + if (len==0) len=strlen(str);//+1; //if len=0 set len to strlen (+terminator) + + for (i=0; i0 if rx string contains the string passed +//Must be called after btReadStr() +//This is used to seek for a command string +uint8_t btRxStrContains(const char* str) +{ + char* currPtr = strstr(&rxBuff[rxRdPtr],str); + if (currPtr) + { + rxRdPtr+=strlen(str); //Move pointer past the recognised substring + if (rxRdPtr>=sizeof(rxBuff)) rxRdPtr=sizeof(rxBuff); + return 1; + } + else currPtr=rxBuff; + return 0; +} + +//Reads the next numerical value (must be preceded by the specified char) +//Must be called after btReadStr() +uint8_t btRxValue(uint16_t * const val,char * const type,const uint16_t maxVal) +{ + char c; + uint8_t valOK = 0; + + *type = 0; + *val = 0; + + while (rxRdPtr='A' && c<='Z') + { + *type = c; + *val = 0; + valOK = 0; + } + else if (*type && c>='0' && c<='9') + { + if (*val + +#define MAX_MOVES 5u //Max number of positions per cycle +#define MAX_PATTERNS 32u //Max steps in a LED pattern +#define MAX_CYCLES 1000u //Max number of cycles (only a safety limit, not critical) +#define MAX_MOVE_POS 9u //Max number of preset positions of the servos (P0..P8) +#define MAX_LEDS_POS 9u //Max number of preset brightness levels for the led strip +#define MAX_STEP_VAL 127u //Max value for parameter step (both servos and leds) +#define MAX_CMD_LEN 8u //Max number of char in a BT command +#define MAX_LEDS_CMDS 13u //Number of LEDs commands +#define MAX_MOVE_CMDS 16u //Number of Tail move commands + +#define MAX_USER_MOVES 4u //Max number of user presets for moves +#define MAX_USER_LEDS 4u //Max number of user presets for led patterns + +#define MAX_GRP_SLOW 3u //Slow wag group +#define MAX_GRP_FAST 3u //Fast wag group +#define MAX_GRP_TREM 3u //Trembling group +#define MAX_GRP_EREC 1u //Erected group +#define MAX_GRP_RAND 16u //Max pseudo random moves and intervals + +#define MAX_GRP_BT 3u //Number of groups +#define MAX_MOV_BT 4u //Number of moves in each group + +#define MASK_GRP_BT1 1u //Bit mask for group 1 +#define MASK_GRP_BT2 2u //Bit mask for group 2 +#define MASK_GRP_BT3 3u //Bit mask for group 3 + +#define MAX_LED_GRPA 2u //Leds ON/OFF +#define MAX_LED_GRPB 3u //Leds Rect/Tri/Saw +#define MAX_LED_GRPC 2u //Leds Beacon/SOS + +typedef struct MoveType +{ + uint8_t cycles; //Times the pattern is repeated + int8_t pos1[MAX_MOVES]; //Positions for servo 1 + int8_t pos2[MAX_MOVES]; //Positions for servo 2 + int8_t steps[MAX_MOVES]; //Total number of steps from 1 pos to next +}MoveType; + +typedef struct LedsType +{ + uint8_t cycles; //Times the patterns is repeated (0=default duration) + int8_t pos[MAX_PATTERNS]; //Brightness points + int8_t steps[MAX_PATTERNS]; //Steps in between points +}LedsType; + +typedef struct MoveCmd +{ + char cmdStr[MAX_CMD_LEN+1]; + const MoveType* cmd; +}MoveCmd; + +typedef struct LedsCmd +{ + char cmdStr[MAX_CMD_LEN+1]; + const LedsType* cmd; +}LedsCmd; + +typedef struct MoveStruct +{ + const MoveType* movePtr; + uint8_t moveIter; + uint8_t cycIter; + int16_t stepIter; + int16_t pos1,pos2,steps; + int16_t d1,d2; +}MoveStruct; + +typedef struct LedsStruct +{ + const LedsType* ledsPtr; + uint8_t moveIter; + int16_t stepIter; + int16_t cycIter; + int16_t steps; + int16_t pos; + int16_t d; +}LedsStruct; + +typedef struct AutoStruct +{ + uint8_t t1,t2; //Min and max pause time in + uint16_t timeout; //timeout in T_SERVO units + uint16_t pause; //pause in T_SERVO units + uint8_t grps; //Move groups (last 3 lsbs) +}AutoStruct; + +typedef enum +{ + ACK_WAITING=0x00, + ACK_END_MOVE=0x01, + ACK_END_LEDS=0x02, + ACK_RUNNING=0x03, + ACK_END_AUTO=0x04 +}AckEnum; + +extern const MoveCmd MOVE_CMDS[MAX_MOVE_CMDS]; +extern const LedsCmd LEDS_CMDS[MAX_LEDS_CMDS]; + +extern const MoveType* const moveGrpSlow[MAX_GRP_SLOW]; +extern const MoveType* const moveGrpFast[MAX_GRP_FAST]; +extern const MoveType* const moveGrpTrem[MAX_GRP_TREM]; +extern const MoveType* const moveGrpErec[MAX_GRP_EREC]; + +extern const MoveType* const moveRndGrp[MAX_GRP_RAND]; //Random moves +extern const uint8_t moveRndGrpT[MAX_GRP_RAND]; //Random set times + +//Move groups (used in RF mode) +extern const LedsType* const ledsGrpA[MAX_LED_GRPA]; +extern const LedsType* const ledsGrpB[MAX_LED_GRPB]; +extern const LedsType* const ledsGrpC[MAX_LED_GRPC]; + +//Move groups for 'auto moves' (used in BT mode) +extern const MoveType* const moveGrpBT[MAX_GRP_BT][MAX_MOV_BT]; + +void movesInit(); + +//Stores user-defined move/led pattern to the specified preset location +uint8_t setUserMove(uint8_t preset,uint8_t len,uint8_t cycles,int8_t *pos1,int8_t *pos2,int8_t *steps); +uint8_t setUserLeds(uint8_t preset,uint8_t len,uint8_t cycles,int8_t *pos,int8_t *steps); + +//Sets up automatic mode (random moves for a specified length of time) +void setAuto(uint8_t t1, uint8_t t2, uint8_t dur, uint8_t grps); + +//Cancels an ongoing 'auto move' session - will finish the current move if one is running +void abortAuto(); + +//Sets up move variables for updateMove() +void setMove(const MoveType* movePtr); + +//Updates the position of the servos to the next in the current move description +//Returns 1 if the move is complete (and returned home) +AckEnum updateMove(); + +//Sets up led pattern variables for updateLeds() +void setLEDs(const LedsType* patt); + +//Updates the brightness of the LED strip to the next in the current description +//Returns 1 if the pattern is complete +AckEnum updateLEDs(); + +#endif /* MOVES_H */ + Index: /RF_BT_Tail/Power.h =================================================================== --- /RF_BT_Tail/Power.h (revision 244) +++ /RF_BT_Tail/Power.h (revision 244) @@ -0,0 +1,76 @@ +// File: Power.h +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// Pushbutton, onboard LEDs and other power related functions +//------------------------------------------------------------------------------ + + + +#ifndef POWER_H +#define POWER_H + +#include + +#define ADC_BITS 10 //ADC's number of bits +#define VREF10 33 //Vref x 10 + +//Blink patterns for each function +//Power off +#define LED_RED_OFF 0x00000000 +//Power ON +#define LED_RED_ON 0x00010000 +//Unit switching off +#define LED_RED_ONOFF 0xAAAAAAAA +//Power ON, low battery +#define LED_RED_BATT 0xF000F000 + +//BT off +#define LED_BLUE_OFF 0x00000000 +//BT advertising +//#define LED_BLUE_ADVERT 0xF83E07C0 +#define LED_BLUE_ADVERT 0xFF00FF00 +//BT connected +#define LED_BLUE_CNNCTD 0x00000003 + +//RF receive +#define LED_BLUE_RFRX 0x55555555 + +#define LED_RED_On() IO_LED_RED_N_SetLow() +#define LED_RED_Off() IO_LED_RED_N_SetHigh() +#define LED_BLUE_On() IO_LED_BLUE_N_SetLow() +#define LED_BLUE_Off() IO_LED_BLUE_N_SetHigh() + + +//Called after reset to hold the LDO's enable pin high +//It also initialises all the power-related variables +void powerBootstrap(); + +//Sets flag to shut down the system +void shutDown(); + +//Manages the power button and returns 1 if pressed for >1 second +uint8_t checkPowerButton(); + +//Set the pattern for the LEDs (e.g. 0x00000000 off, 0x0F0F0F0F0F blink 0.4s on 0.4s off) +void setBluePattern(uint32_t pattern); + +//Returns the battery voltage in fractions of 2.048V, i.e. 0x00=0V, 0xFF=2V +//the lsb indicates wheather the voltage is above a set threshold THR_BATT +//if lsb=0 then the voltage is below the threshold. +//The battery voltage depends on the voltage divider between battery and ADC in. +uint16_t getBatt(); + +//Returns the battery charge remaining, expressed in 'bars', from 0 to 4 +uint8_t getBattBars(); + +//Returns 1 if battery voltage is below threshold +uint8_t isBattLow(); + +//Waits 20mS (for servo timing) +void wait20ms(); + +#endif /* POWER_H */ + Index: /RF_BT_Tail/JDY08.h =================================================================== --- /RF_BT_Tail/JDY08.h (revision 244) +++ /RF_BT_Tail/JDY08.h (revision 244) @@ -0,0 +1,35 @@ +// File: JDY08.h +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// HAL for the JDY-08 Bluetooth module (based on the TI chip CC2541) +//------------------------------------------------------------------------------ + +#ifndef JDY08_H +#define JDY08_H + +#define RX_BUFF_LEN 64 +#define MAX_AT_CMD_LEN 16 + +#include + +void initJDY08(); + +void btSendStr(const char* str,uint8_t len); + +//Return the pointer to the buffer read, or a NULL pointer if no chars were received +char* btReadStr(); + +//Returns >0 if rx string contains the string passed +//Must be called after btReadStr() +//This is used to seek for a command string +uint8_t btRxStrContains(const char* str); + +//Reads the next numerical value (must be preceded by the specified char) +//Must be called after btReadStr() +uint8_t btRxValue(uint16_t * const val,char * const type,const uint16_t maxVal); + +#endif /* JDY08_H */ + Index: /RF_BT_Tail/nbproject/Makefile-impl.mk =================================================================== --- /RF_BT_Tail/nbproject/Makefile-impl.mk (revision 244) +++ /RF_BT_Tail/nbproject/Makefile-impl.mk (revision 244) @@ -0,0 +1,69 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a pre- and a post- target defined where you can add customization code. +# +# This makefile implements macros and targets common to all configurations. +# +# NOCDDL + + +# Building and Cleaning subprojects are done by default, but can be controlled with the SUB +# macro. If SUB=no, subprojects will not be built or cleaned. The following macro +# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf +# and .clean-reqprojects-conf unless SUB has the value 'no' +SUB_no=NO +SUBPROJECTS=${SUB_${SUB}} +BUILD_SUBPROJECTS_=.build-subprojects +BUILD_SUBPROJECTS_NO= +BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} +CLEAN_SUBPROJECTS_=.clean-subprojects +CLEAN_SUBPROJECTS_NO= +CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} + + +# Project Name +PROJECTNAME=Tail.X + +# Active Configuration +DEFAULTCONF=default +CONF=${DEFAULTCONF} + +# All Configurations +ALLCONFS=default + + +# build +.build-impl: .build-pre + ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf + + +# clean +.clean-impl: .clean-pre + ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf + +# clobber +.clobber-impl: .clobber-pre .depcheck-impl + ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean + + + +# all +.all-impl: .all-pre .depcheck-impl + ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build + + + +# dependency checking support +.depcheck-impl: +# @echo "# This code depends on make tool being used" >.dep.inc +# @if [ -n "${MAKE_VERSION}" ]; then \ +# echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ +# echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ +# echo "include \$${DEPFILES}" >>.dep.inc; \ +# echo "endif" >>.dep.inc; \ +# else \ +# echo ".KEEP_STATE:" >>.dep.inc; \ +# echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ +# fi Index: /RF_BT_Tail/nbproject/Makefile-genesis.properties =================================================================== --- /RF_BT_Tail/nbproject/Makefile-genesis.properties (revision 244) +++ /RF_BT_Tail/nbproject/Makefile-genesis.properties (revision 244) @@ -0,0 +1,9 @@ +# +#Tue Oct 22 10:11:59 BST 2019 +default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc8\\v2.00\\bin +configurations-xml=6b9a1511f490942160e2dbc06a50764b +com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=24107a0c2bb6fb23e8f1a7c080ca8f8d +default.languagetoolchain.version=2.00 +host.platform=windows +conf.ids=default +default.com-microchip-mplab-nbide-toolchainXC8-XC8LanguageToolchain.md5=48436bf52f818e076a74c367ffdf6708 Index: /RF_BT_Tail/nbproject/Makefile-default.mk =================================================================== --- /RF_BT_Tail/nbproject/Makefile-default.mk (revision 244) +++ /RF_BT_Tail/nbproject/Makefile-default.mk (revision 244) @@ -0,0 +1,475 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a -pre and a -post target defined where you can add customized code. +# +# This makefile implements configuration specific macros and targets. + + +# Include project Makefile +ifeq "${IGNORE_LOCAL}" "TRUE" +# do not include local makefile. User is passing all local related variables already +else +include Makefile +# Include makefile containing local settings +ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" +include nbproject/Makefile-local-default.mk +endif +endif + +# Environment +MKDIR=gnumkdir -p +RM=rm -f +MV=mv +CP=cp + +# Macros +CND_CONF=default +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +IMAGE_TYPE=debug +OUTPUT_SUFFIX=elf +DEBUGGABLE_SUFFIX=elf +FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +else +IMAGE_TYPE=production +OUTPUT_SUFFIX=hex +DEBUGGABLE_SUFFIX=elf +FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +endif + +ifeq ($(COMPARE_BUILD), true) +COMPARISON_BUILD=--mafrlcsj +else +COMPARISON_BUILD= +endif + +ifdef SUB_IMAGE_ADDRESS + +else +SUB_IMAGE_ADDRESS_COMMAND= +endif + +# Object Directory +OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} + +# Distribution Directory +DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} + +# Source Files Quoted if spaced +SOURCEFILES_QUOTED_IF_SPACED=mcc_generated_files/pin_manager.c mcc_generated_files/eusart.c mcc_generated_files/pwm2.c mcc_generated_files/interrupt_manager.c mcc_generated_files/pwm1.c mcc_generated_files/mcc.c mcc_generated_files/device_config.c mcc_generated_files/dac.c mcc_generated_files/cmp1.c mcc_generated_files/pwm3.c mcc_generated_files/adc1.c mcc_generated_files/tmr1.c mcc_generated_files/tmr0.c main.c Servos.c JDY08.c Power.c LEDs.c Moves.c Terminal.c RF.c + +# Object Files Quoted if spaced +OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/eusart.p1 ${OBJECTDIR}/mcc_generated_files/pwm2.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/pwm1.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/dac.p1 ${OBJECTDIR}/mcc_generated_files/cmp1.p1 ${OBJECTDIR}/mcc_generated_files/pwm3.p1 ${OBJECTDIR}/mcc_generated_files/adc1.p1 ${OBJECTDIR}/mcc_generated_files/tmr1.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/Servos.p1 ${OBJECTDIR}/JDY08.p1 ${OBJECTDIR}/Power.p1 ${OBJECTDIR}/LEDs.p1 ${OBJECTDIR}/Moves.p1 ${OBJECTDIR}/Terminal.p1 ${OBJECTDIR}/RF.p1 +POSSIBLE_DEPFILES=${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d ${OBJECTDIR}/mcc_generated_files/eusart.p1.d ${OBJECTDIR}/mcc_generated_files/pwm2.p1.d ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d ${OBJECTDIR}/mcc_generated_files/pwm1.p1.d ${OBJECTDIR}/mcc_generated_files/mcc.p1.d ${OBJECTDIR}/mcc_generated_files/device_config.p1.d ${OBJECTDIR}/mcc_generated_files/dac.p1.d ${OBJECTDIR}/mcc_generated_files/cmp1.p1.d ${OBJECTDIR}/mcc_generated_files/pwm3.p1.d ${OBJECTDIR}/mcc_generated_files/adc1.p1.d ${OBJECTDIR}/mcc_generated_files/tmr1.p1.d ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d ${OBJECTDIR}/main.p1.d ${OBJECTDIR}/Servos.p1.d ${OBJECTDIR}/JDY08.p1.d ${OBJECTDIR}/Power.p1.d ${OBJECTDIR}/LEDs.p1.d ${OBJECTDIR}/Moves.p1.d ${OBJECTDIR}/Terminal.p1.d ${OBJECTDIR}/RF.p1.d + +# Object Files +OBJECTFILES=${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/eusart.p1 ${OBJECTDIR}/mcc_generated_files/pwm2.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/pwm1.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/dac.p1 ${OBJECTDIR}/mcc_generated_files/cmp1.p1 ${OBJECTDIR}/mcc_generated_files/pwm3.p1 ${OBJECTDIR}/mcc_generated_files/adc1.p1 ${OBJECTDIR}/mcc_generated_files/tmr1.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/Servos.p1 ${OBJECTDIR}/JDY08.p1 ${OBJECTDIR}/Power.p1 ${OBJECTDIR}/LEDs.p1 ${OBJECTDIR}/Moves.p1 ${OBJECTDIR}/Terminal.p1 ${OBJECTDIR}/RF.p1 + +# Source Files +SOURCEFILES=mcc_generated_files/pin_manager.c mcc_generated_files/eusart.c mcc_generated_files/pwm2.c mcc_generated_files/interrupt_manager.c mcc_generated_files/pwm1.c mcc_generated_files/mcc.c mcc_generated_files/device_config.c mcc_generated_files/dac.c mcc_generated_files/cmp1.c mcc_generated_files/pwm3.c mcc_generated_files/adc1.c mcc_generated_files/tmr1.c mcc_generated_files/tmr0.c main.c Servos.c JDY08.c Power.c LEDs.c Moves.c Terminal.c RF.c + + +CFLAGS= +ASFLAGS= +LDLIBSOPTIONS= + +############# Tool locations ########################################## +# If you copy a project from one host to another, the path where the # +# compiler is installed may be different. # +# If you open this project with MPLAB X in the new host, this # +# makefile will be regenerated and the paths will be corrected. # +####################################################################### +# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build +FIXDEPS=fixDeps + +.build-conf: ${BUILD_SUBPROJECTS} +ifneq ($(INFORMATION_MESSAGE), ) + @echo $(INFORMATION_MESSAGE) +endif + ${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} + +MP_PROCESSOR_OPTION=16F1579 +# ------------------------------------------------------------------------------------ +# Rules for buildStep: compile +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +${OBJECTDIR}/mcc_generated_files/pin_manager.p1: mcc_generated_files/pin_manager.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/pin_manager.p1 mcc_generated_files/pin_manager.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/pin_manager.d ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/eusart.p1: mcc_generated_files/eusart.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/eusart.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/eusart.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/eusart.p1 mcc_generated_files/eusart.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/eusart.d ${OBJECTDIR}/mcc_generated_files/eusart.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/eusart.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/pwm2.p1: mcc_generated_files/pwm2.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm2.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm2.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/pwm2.p1 mcc_generated_files/pwm2.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/pwm2.d ${OBJECTDIR}/mcc_generated_files/pwm2.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/pwm2.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1: mcc_generated_files/interrupt_manager.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 mcc_generated_files/interrupt_manager.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.d ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/pwm1.p1: mcc_generated_files/pwm1.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm1.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm1.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/pwm1.p1 mcc_generated_files/pwm1.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/pwm1.d ${OBJECTDIR}/mcc_generated_files/pwm1.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/pwm1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/mcc.p1: mcc_generated_files/mcc.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/mcc.p1 mcc_generated_files/mcc.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/mcc.d ${OBJECTDIR}/mcc_generated_files/mcc.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/mcc.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/device_config.p1: mcc_generated_files/device_config.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/device_config.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/device_config.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/device_config.p1 mcc_generated_files/device_config.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/device_config.d ${OBJECTDIR}/mcc_generated_files/device_config.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/device_config.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/dac.p1: mcc_generated_files/dac.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/dac.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/dac.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/dac.p1 mcc_generated_files/dac.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/dac.d ${OBJECTDIR}/mcc_generated_files/dac.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/dac.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/cmp1.p1: mcc_generated_files/cmp1.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/cmp1.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/cmp1.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/cmp1.p1 mcc_generated_files/cmp1.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/cmp1.d ${OBJECTDIR}/mcc_generated_files/cmp1.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/cmp1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/pwm3.p1: mcc_generated_files/pwm3.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm3.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm3.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/pwm3.p1 mcc_generated_files/pwm3.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/pwm3.d ${OBJECTDIR}/mcc_generated_files/pwm3.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/pwm3.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/adc1.p1: mcc_generated_files/adc1.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/adc1.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/adc1.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/adc1.p1 mcc_generated_files/adc1.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/adc1.d ${OBJECTDIR}/mcc_generated_files/adc1.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/adc1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/tmr1.p1: mcc_generated_files/tmr1.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/tmr1.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/tmr1.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/tmr1.p1 mcc_generated_files/tmr1.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/tmr1.d ${OBJECTDIR}/mcc_generated_files/tmr1.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/tmr1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/tmr0.p1: mcc_generated_files/tmr0.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/tmr0.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/tmr0.p1 mcc_generated_files/tmr0.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/tmr0.d ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/main.p1: main.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/main.p1.d + @${RM} ${OBJECTDIR}/main.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/main.p1 main.c + @-${MV} ${OBJECTDIR}/main.d ${OBJECTDIR}/main.p1.d + @${FIXDEPS} ${OBJECTDIR}/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/Servos.p1: Servos.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/Servos.p1.d + @${RM} ${OBJECTDIR}/Servos.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/Servos.p1 Servos.c + @-${MV} ${OBJECTDIR}/Servos.d ${OBJECTDIR}/Servos.p1.d + @${FIXDEPS} ${OBJECTDIR}/Servos.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/JDY08.p1: JDY08.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/JDY08.p1.d + @${RM} ${OBJECTDIR}/JDY08.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/JDY08.p1 JDY08.c + @-${MV} ${OBJECTDIR}/JDY08.d ${OBJECTDIR}/JDY08.p1.d + @${FIXDEPS} ${OBJECTDIR}/JDY08.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/Power.p1: Power.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/Power.p1.d + @${RM} ${OBJECTDIR}/Power.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/Power.p1 Power.c + @-${MV} ${OBJECTDIR}/Power.d ${OBJECTDIR}/Power.p1.d + @${FIXDEPS} ${OBJECTDIR}/Power.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/LEDs.p1: LEDs.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/LEDs.p1.d + @${RM} ${OBJECTDIR}/LEDs.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/LEDs.p1 LEDs.c + @-${MV} ${OBJECTDIR}/LEDs.d ${OBJECTDIR}/LEDs.p1.d + @${FIXDEPS} ${OBJECTDIR}/LEDs.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/Moves.p1: Moves.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/Moves.p1.d + @${RM} ${OBJECTDIR}/Moves.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/Moves.p1 Moves.c + @-${MV} ${OBJECTDIR}/Moves.d ${OBJECTDIR}/Moves.p1.d + @${FIXDEPS} ${OBJECTDIR}/Moves.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/Terminal.p1: Terminal.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/Terminal.p1.d + @${RM} ${OBJECTDIR}/Terminal.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/Terminal.p1 Terminal.c + @-${MV} ${OBJECTDIR}/Terminal.d ${OBJECTDIR}/Terminal.p1.d + @${FIXDEPS} ${OBJECTDIR}/Terminal.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/RF.p1: RF.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/RF.p1.d + @${RM} ${OBJECTDIR}/RF.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/RF.p1 RF.c + @-${MV} ${OBJECTDIR}/RF.d ${OBJECTDIR}/RF.p1.d + @${FIXDEPS} ${OBJECTDIR}/RF.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +else +${OBJECTDIR}/mcc_generated_files/pin_manager.p1: mcc_generated_files/pin_manager.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/pin_manager.p1 mcc_generated_files/pin_manager.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/pin_manager.d ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/eusart.p1: mcc_generated_files/eusart.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/eusart.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/eusart.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/eusart.p1 mcc_generated_files/eusart.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/eusart.d ${OBJECTDIR}/mcc_generated_files/eusart.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/eusart.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/pwm2.p1: mcc_generated_files/pwm2.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm2.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm2.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/pwm2.p1 mcc_generated_files/pwm2.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/pwm2.d ${OBJECTDIR}/mcc_generated_files/pwm2.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/pwm2.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1: mcc_generated_files/interrupt_manager.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 mcc_generated_files/interrupt_manager.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.d ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/pwm1.p1: mcc_generated_files/pwm1.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm1.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm1.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/pwm1.p1 mcc_generated_files/pwm1.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/pwm1.d ${OBJECTDIR}/mcc_generated_files/pwm1.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/pwm1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/mcc.p1: mcc_generated_files/mcc.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/mcc.p1 mcc_generated_files/mcc.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/mcc.d ${OBJECTDIR}/mcc_generated_files/mcc.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/mcc.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/device_config.p1: mcc_generated_files/device_config.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/device_config.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/device_config.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/device_config.p1 mcc_generated_files/device_config.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/device_config.d ${OBJECTDIR}/mcc_generated_files/device_config.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/device_config.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/dac.p1: mcc_generated_files/dac.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/dac.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/dac.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/dac.p1 mcc_generated_files/dac.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/dac.d ${OBJECTDIR}/mcc_generated_files/dac.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/dac.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/cmp1.p1: mcc_generated_files/cmp1.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/cmp1.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/cmp1.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/cmp1.p1 mcc_generated_files/cmp1.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/cmp1.d ${OBJECTDIR}/mcc_generated_files/cmp1.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/cmp1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/pwm3.p1: mcc_generated_files/pwm3.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm3.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/pwm3.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/pwm3.p1 mcc_generated_files/pwm3.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/pwm3.d ${OBJECTDIR}/mcc_generated_files/pwm3.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/pwm3.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/adc1.p1: mcc_generated_files/adc1.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/adc1.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/adc1.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/adc1.p1 mcc_generated_files/adc1.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/adc1.d ${OBJECTDIR}/mcc_generated_files/adc1.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/adc1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/tmr1.p1: mcc_generated_files/tmr1.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/tmr1.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/tmr1.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/tmr1.p1 mcc_generated_files/tmr1.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/tmr1.d ${OBJECTDIR}/mcc_generated_files/tmr1.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/tmr1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/mcc_generated_files/tmr0.p1: mcc_generated_files/tmr0.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/mcc_generated_files" + @${RM} ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d + @${RM} ${OBJECTDIR}/mcc_generated_files/tmr0.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/mcc_generated_files/tmr0.p1 mcc_generated_files/tmr0.c + @-${MV} ${OBJECTDIR}/mcc_generated_files/tmr0.d ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d + @${FIXDEPS} ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/main.p1: main.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/main.p1.d + @${RM} ${OBJECTDIR}/main.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/main.p1 main.c + @-${MV} ${OBJECTDIR}/main.d ${OBJECTDIR}/main.p1.d + @${FIXDEPS} ${OBJECTDIR}/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/Servos.p1: Servos.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/Servos.p1.d + @${RM} ${OBJECTDIR}/Servos.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/Servos.p1 Servos.c + @-${MV} ${OBJECTDIR}/Servos.d ${OBJECTDIR}/Servos.p1.d + @${FIXDEPS} ${OBJECTDIR}/Servos.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/JDY08.p1: JDY08.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/JDY08.p1.d + @${RM} ${OBJECTDIR}/JDY08.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/JDY08.p1 JDY08.c + @-${MV} ${OBJECTDIR}/JDY08.d ${OBJECTDIR}/JDY08.p1.d + @${FIXDEPS} ${OBJECTDIR}/JDY08.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/Power.p1: Power.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/Power.p1.d + @${RM} ${OBJECTDIR}/Power.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/Power.p1 Power.c + @-${MV} ${OBJECTDIR}/Power.d ${OBJECTDIR}/Power.p1.d + @${FIXDEPS} ${OBJECTDIR}/Power.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/LEDs.p1: LEDs.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/LEDs.p1.d + @${RM} ${OBJECTDIR}/LEDs.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/LEDs.p1 LEDs.c + @-${MV} ${OBJECTDIR}/LEDs.d ${OBJECTDIR}/LEDs.p1.d + @${FIXDEPS} ${OBJECTDIR}/LEDs.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/Moves.p1: Moves.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/Moves.p1.d + @${RM} ${OBJECTDIR}/Moves.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/Moves.p1 Moves.c + @-${MV} ${OBJECTDIR}/Moves.d ${OBJECTDIR}/Moves.p1.d + @${FIXDEPS} ${OBJECTDIR}/Moves.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/Terminal.p1: Terminal.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/Terminal.p1.d + @${RM} ${OBJECTDIR}/Terminal.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/Terminal.p1 Terminal.c + @-${MV} ${OBJECTDIR}/Terminal.d ${OBJECTDIR}/Terminal.p1.d + @${FIXDEPS} ${OBJECTDIR}/Terminal.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +${OBJECTDIR}/RF.p1: RF.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/RF.p1.d + @${RM} ${OBJECTDIR}/RF.p1 + ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib $(COMPARISON_BUILD) --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -o${OBJECTDIR}/RF.p1 RF.c + @-${MV} ${OBJECTDIR}/RF.d ${OBJECTDIR}/RF.p1.d + @${FIXDEPS} ${OBJECTDIR}/RF.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + +endif + +# ------------------------------------------------------------------------------------ +# Rules for buildStep: assemble +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +else +endif + +# ------------------------------------------------------------------------------------ +# Rules for buildStep: link +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +dist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} + ${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.map -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" $(COMPARISON_BUILD) --memorysummary dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml -odist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} + @${RM} dist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.hex + +else +dist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} + ${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.map --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 -I"C:/Program Files (x86)/Microchip/xc8/v2.00/pic/include/c90" --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" $(COMPARISON_BUILD) --memorysummary dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml -odist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} + +endif + + +# Subprojects +.build-subprojects: + + +# Subprojects +.clean-subprojects: + +# Clean Targets +.clean-conf: ${CLEAN_SUBPROJECTS} + ${RM} -r build/default + ${RM} -r dist/default + +# Enable dependency checking +.dep.inc: .depcheck-impl + +DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) +ifneq (${DEPFILES},) +include ${DEPFILES} +endif Index: /RF_BT_Tail/nbproject/project.xml =================================================================== --- /RF_BT_Tail/nbproject/project.xml (revision 244) +++ /RF_BT_Tail/nbproject/project.xml (revision 244) @@ -0,0 +1,17 @@ + + + com.microchip.mplab.nbide.embedded.makeproject + + + Tail + 8755594e-9917-43d5-a5b9-6ba7bc8aeee9 + 0 + c + + h + + ISO-8859-1 + + + + Index: /RF_BT_Tail/nbproject/Makefile-variables.mk =================================================================== --- /RF_BT_Tail/nbproject/Makefile-variables.mk (revision 244) +++ /RF_BT_Tail/nbproject/Makefile-variables.mk (revision 244) @@ -0,0 +1,13 @@ +# +# Generated - do not edit! +# +# NOCDDL +# +CND_BASEDIR=`pwd` +# default configuration +CND_ARTIFACT_DIR_default=dist/default/production +CND_ARTIFACT_NAME_default=Tail.X.production.hex +CND_ARTIFACT_PATH_default=dist/default/production/Tail.X.production.hex +CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package +CND_PACKAGE_NAME_default=tail.x.tar +CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/tail.x.tar Index: /RF_BT_Tail/nbproject/Package-default.bash =================================================================== --- /RF_BT_Tail/nbproject/Package-default.bash (revision 244) +++ /RF_BT_Tail/nbproject/Package-default.bash (revision 244) @@ -0,0 +1,73 @@ +#!/bin/bash -x + +# +# Generated - do not edit! +# + +# Macros +TOP=`pwd` +CND_CONF=default +CND_DISTDIR=dist +TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging +TMPDIRNAME=tmp-packaging +OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/Tail.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +OUTPUT_BASENAME=Tail.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +PACKAGE_TOP_DIR=tail.x/ + +# Functions +function checkReturnCode +{ + rc=$? + if [ $rc != 0 ] + then + exit $rc + fi +} +function makeDirectory +# $1 directory path +# $2 permission (optional) +{ + mkdir -p "$1" + checkReturnCode + if [ "$2" != "" ] + then + chmod $2 "$1" + checkReturnCode + fi +} +function copyFileToTmpDir +# $1 from-file path +# $2 to-file path +# $3 permission +{ + cp "$1" "$2" + checkReturnCode + if [ "$3" != "" ] + then + chmod $3 "$2" + checkReturnCode + fi +} + +# Setup +cd "${TOP}" +mkdir -p ${CND_DISTDIR}/${CND_CONF}/package +rm -rf ${TMPDIR} +mkdir -p ${TMPDIR} + +# Copy files and create directories and links +cd "${TOP}" +makeDirectory ${TMPDIR}/tail.x/bin +copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 + + +# Generate tar file +cd "${TOP}" +rm -f ${CND_DISTDIR}/${CND_CONF}/package/tail.x.tar +cd ${TMPDIR} +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/tail.x.tar * +checkReturnCode + +# Cleanup +cd "${TOP}" +rm -rf ${TMPDIR} Index: /RF_BT_Tail/nbproject/configurations.xml =================================================================== --- /RF_BT_Tail/nbproject/configurations.xml (revision 244) +++ /RF_BT_Tail/nbproject/configurations.xml (revision 244) @@ -0,0 +1,273 @@ + + + + + + mcc_generated_files/pin_manager.h + mcc_generated_files/eusart.h + mcc_generated_files/pwm2.h + mcc_generated_files/interrupt_manager.h + mcc_generated_files/pwm1.h + mcc_generated_files/mcc.h + mcc_generated_files/device_config.h + mcc_generated_files/dac.h + mcc_generated_files/cmp1.h + mcc_generated_files/pwm3.h + mcc_generated_files/adc1.h + mcc_generated_files/tmr1.h + mcc_generated_files/tmr0.h + + Servos.h + Power.h + Moves.h + Terminal.h + Definitions.h + JDY08.h + LEDs.h + RF.h + + + + + + mcc_generated_files/pin_manager.c + mcc_generated_files/eusart.c + mcc_generated_files/pwm2.c + mcc_generated_files/interrupt_manager.c + mcc_generated_files/pwm1.c + mcc_generated_files/mcc.c + mcc_generated_files/device_config.c + mcc_generated_files/dac.c + mcc_generated_files/cmp1.c + mcc_generated_files/pwm3.c + mcc_generated_files/adc1.c + mcc_generated_files/tmr1.c + mcc_generated_files/tmr0.c + + main.c + Servos.c + JDY08.c + Power.c + LEDs.c + Moves.c + Terminal.c + RF.c + + + Makefile + MyConfig.mc3 + + Moves.txt + + + . + + Makefile + + + + localhost + PIC16F1579 + + + PICkit3PlatformTool + XC8 + 2.00 + 3 + + + + + + + + + + false + false + + + + + + + false + + false + + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: /RF_BT_Tail/nbproject/private/configurations.xml =================================================================== --- /RF_BT_Tail/nbproject/private/configurations.xml (revision 244) +++ /RF_BT_Tail/nbproject/private/configurations.xml (revision 244) @@ -0,0 +1,25 @@ + + + Makefile + 0 + + + :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>900A:=<rev>0002:=<man>Microchip Technology Inc.:=<prod>PICkit 3:=<sn>DEFAULT_PK3 :=<drv>x:=<xpt>h:=end + C:\Program Files (x86)\Microchip\xc8\v2.00\bin + + place holder 1 + place holder 2 + + + + + true + 0 + 0 + 0 + + + + + + Index: /RF_BT_Tail/nbproject/private/private.xml =================================================================== --- /RF_BT_Tail/nbproject/private/private.xml (revision 244) +++ /RF_BT_Tail/nbproject/private/private.xml (revision 244) @@ -0,0 +1,24 @@ + + + + + + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/Moves.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/Terminal.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/Servos.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/Power.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/Terminal.h + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/Servos.h + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/LEDs.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/Power.h + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/main.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/mcc_generated_files/pwm3.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/mcc_generated_files/pwm2.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/mcc_generated_files/tmr0.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/JDY08.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/mcc_generated_files/pwm1.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/mcc_generated_files/eusart.c + file:/D:/_PROJECTS/GreyWorld/FW/Tail.X/Definitions.h + + + Index: /RF_BT_Tail/nbproject/private/SuppressibleMessageMemo.properties =================================================================== --- /RF_BT_Tail/nbproject/private/SuppressibleMessageMemo.properties (revision 244) +++ /RF_BT_Tail/nbproject/private/SuppressibleMessageMemo.properties (revision 244) @@ -0,0 +1,3 @@ +# +#Wed Oct 03 21:35:14 BST 2018 +pk3/CHECK_4_HIGH_VOLTAGE_VPP=true Index: /RF_BT_Tail/nbproject/Makefile-local-default.mk =================================================================== --- /RF_BT_Tail/nbproject/Makefile-local-default.mk (revision 244) +++ /RF_BT_Tail/nbproject/Makefile-local-default.mk (revision 244) @@ -0,0 +1,37 @@ +# +# Generated Makefile - do not edit! +# +# +# This file contains information about the location of compilers and other tools. +# If you commmit this file into your revision control server, you will be able to +# to checkout the project and build it from the command line with make. However, +# if more than one person works on the same project, then this file might show +# conflicts since different users are bound to have compilers in different places. +# In that case you might choose to not commit this file and let MPLAB X recreate this file +# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at +# least once so the file gets created and the project can be built. Finally, you can also +# avoid using this file at all if you are only building from the command line with make. +# 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 (x86)/Microchip/MPLABX/v4.10/mplab_ide/platform/../mplab_ide/modules/../../bin/ +# Adding MPLAB X bin directory to path. +PATH:=C:/Program Files (x86)/Microchip/MPLABX/v4.10/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 (x86)\Microchip\MPLABX\v4.10\sys\java\jre1.8.0_144/bin/" +OS_CURRENT="$(shell uname -s)" +MP_CC="C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8.exe" +# MP_CPPC is not defined +# MP_BC is not defined +MP_AS="C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8.exe" +MP_LD="C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8.exe" +# MP_AR is not defined +DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/v4.10/mplab_ide/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" +MP_CC_DIR="C:\Program Files (x86)\Microchip\xc8\v2.00\bin" +# MP_CPPC_DIR is not defined +# MP_BC_DIR is not defined +MP_AS_DIR="C:\Program Files (x86)\Microchip\xc8\v2.00\bin" +MP_LD_DIR="C:\Program Files (x86)\Microchip\xc8\v2.00\bin" +# MP_AR_DIR is not defined +# MP_BC_DIR is not defined Index: /RF_BT_Tail/RF.c =================================================================== --- /RF_BT_Tail/RF.c (revision 244) +++ /RF_BT_Tail/RF.c (revision 244) @@ -0,0 +1,206 @@ +// File: RF.c +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Sep 2019 +// RF remote decoder +//------------------------------------------------------------------------------ + + + +#include "RF.h" +#include "mcc_generated_files/tmr1.h" + +#define CODE_LEN 24u //Number of bits in the code (including start stop etc.; we don't care) +#define BUT_MASK (0x000000FFul) +#define CODE_MASK (0xFFFFFE00ul) +#define CODE1 (0x00430000ul) //RF code1 to match (433) +#define CODE2 (0x006AAA00ul) //RF code2 to match (315) +#define CODE3 (0x00011200ul) //RF code3 to match (new 315) + +#define T_BASE_NS 500u //T1 Clock in ns +#define T_START_MIN (8000000u/T_BASE_NS) //Min long space before code (8ms) + +#define T_MARK0_MIN ((0.8* 333333u)/T_BASE_NS) //Min 0 mark +#define T_MARK0_MAX ((1.8* 333333u)/T_BASE_NS) //Max 0 mark + +#define T_MARK1_MIN ((0.8* 1000000u)/T_BASE_NS) //Min 0 mark +#define T_MARK1_MAX ((1.8*1000000u)/T_BASE_NS) //Max 0 mark + +#define T_MARK_TOL 80000u/T_BASE_NS //Tolerance +/- 0.08ms + +#define N_LONG_PRESS 10 //# code matches for long press + +#define RF_A1 0x50 +#define RF_B1 0x48 +#define RF_C1 0x44 +#define RF_D1 0x42 + +#define RF_A2 0x18 +#define RF_B2 0x80 +#define RF_C2 0x06 +#define RF_D2 0x60 + +#define RF_A3 0x81 +#define RF_B3 0x82 +#define RF_C3 0x84 +#define RF_D3 0x88 + + +uint8_t bitPtr; //Number of bits received +uint8_t matches; //Number of code matches (for button press length) +uint8_t attempts; //Number of restarts before code detected +uint8_t waitingRelease; +uint32_t code; //Code being read +uint32_t lastCode1; //Last code read +uint32_t lastCode2; //2nd last code read +uint16_t tMark0min,tMark0max,tMark1min,tMark1max; //Current durations for 1 and 0 codes + + +void intHandler() +{ + uint16_t t; + t = TMR1_ReadTimer(); + + if (bitPtr==0) + { + TMR1G_Polarity(0); + if (t>T_START_MIN) + { + code = 0; + attempts++; + bitPtr++; + TMR1G_Polarity(1); //Looking for marks now + } + } + else + { + if (bitPtr==1) + { + if ((t>T_MARK1_MIN) && (tT_MARK0_MIN) && (ttMark0min) && (ttMark1min)&&(ttMark1min) + { + code++; + } + } + else + { + bitPtr=0; //If pulse too long or too short reset + } + } + else + { + bitPtr = 0; + attempts = 0; + if (lastCode1) lastCode2 = lastCode1; + lastCode1 = code; + if (lastCode1 == lastCode2) matches++; + } + } + + TMR1_WriteTimer(0x0000); + TMR1_StartSinglePulseAcquisition(); + +} + +void initRF() +{ + bitPtr=0; + TMR1G_Polarity(0); + TMR1G_SetInterruptHandler(intHandler); + TMR1_StartSinglePulseAcquisition(); + matches = 0; + code = 0; + lastCode1 = 0; + lastCode2 = 0; + //waitingRelease = 0; + attempts = 0; +} + +uint8_t rfGetNewCode() +{ + uint8_t res; + uint32_t maskedCode = lastCode2 & CODE_MASK; + if (lastCode2 == 0) return 0; + if ((maskedCode!=CODE1)&&(maskedCode!=CODE2)&&(maskedCode!=CODE3)) return 0; + if (matches<2) return 0; + + res=lastCode1 & BUT_MASK; + + switch (res) + { + case RF_A1: + case RF_A2: + case RF_A3: + res = RF_A; + break; + + case RF_B1: + case RF_B2: + case RF_B3: + res = RF_B; + break; + + case RF_C1: + case RF_C2: + case RF_C3: + res = RF_C; + break; + + case RF_D1: + case RF_D2: + case RF_D3: + res = RF_D; + break; + } + + if (matches>N_LONG_PRESS) //Passed long press time + { + if (waitingRelease == 0) //..for the first time + { + waitingRelease = 1; + return res|RF_LONG_MASK; + } + else res = 0; + } + + if (attempts < 2) return 0; //Button still pressed + else + { + lastCode1=lastCode2=code=0; + matches = 0; + waitingRelease = 0; + } + + return res; +} + +uint8_t isRFreceiving() +{ + return (matches>0 && attempts<1); +} + Index: /RF_BT_Tail/MyConfig.mc3 =================================================================== --- /RF_BT_Tail/MyConfig.mc3 (revision 244) +++ /RF_BT_Tail/MyConfig.mc3 (revision 244) @@ -0,0 +1,6495 @@ + + + + WDT + class com.microchip.mcc.mcu8.systemManager.wdt.WDT + + + DAC + class com.microchip.mcc.mcu8.modules.dac.DAC + + + PWM3 + class com.microchip.mcc.mcu8.modules.pwm_16bit.PWM + + + Pin Module + class com.microchip.mcc.mcu8.pinManager.PinManager + + + PWM2 + class com.microchip.mcc.mcu8.modules.pwm_16bit.PWM + + + RESET + class com.microchip.mcc.mcu8.systemManager.reset.RESET + + + Interrupt Module + class com.microchip.mcc.mcu8.interruptManager.InterruptManager + + + PWM1 + class com.microchip.mcc.mcu8.modules.pwm_16bit.PWM + + + ADC1 + class com.microchip.mcc.mcu8.modules.adc.ADC + + + TMR0 + class com.microchip.mcc.mcu8.modules.tmr0.TMR0 + + + System Module + class com.microchip.mcc.mcu8.systemManager.SystemManager + + + EUSART + class com.microchip.mcc.mcu8.modules.eusart.EUSART + + + CMP1 + class com.microchip.mcc.mcu8.modules.cmp.CMP + + + INTERNAL OSCILLATOR + class com.microchip.mcc.mcu8.systemManager.osc.Osc + + + TMR1 + class com.microchip.mcc.mcu8.modules.tmr1.TMR1 + + + + + + + + + 0 + + + + disabled + + + + clear + + + + 1 + + + + 0 + + + + 2 + + + + 1 + + + + digital + + + + 1 + + + + 1 + + + + 1 + + + + 0 + + + + enabled + + + + 0 + + + + 0 + + + + 36 + + + + 0 + + + + 1 + + + + cleared + + + + cleared + + + + cleared + + + + 2 + + + + 15 + + + + 0 + + + + digital + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + 0 + + + + 1 + + + + FOSC + + + + 0 + + + + clear + + + + 0 + + + + 0 + + + + 3 + + + + disabled + + + + 0 + + + + 31250 + + + + 1 + + + + tmrMode + + + + disabled + + + + disabled + + + + 3 + + + + 6 + + + + disabled + + + + disabled + + + + 0 + + + + 1 + + + + 1 + + + + 1 + + + + 2 + + + + 0 + + + + 0 + + + + 64 + + + + 2 + + + + 1 + + + + 14 + + + + 0 + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + disabled + + + + 0 + + + + clear + + + + 0 + + + + 1 + + + + 0 + + + + 1 + + + + 6 + + + + 1 + + + + disabled + + + + 1 + + + + 0 + + + + 4 + + + + 1 + + + + 0 + + + + disabled + + + + 16bit_generator + + + + disabled + + + + 1 + + + + 0 + + + + 0 + + + + standard_PWM + + + + 1 + + + + 1 + + + + 128 + + + + 128 + + + + 16 + + + + standard_PWM + + + + standard_PWM + + + + 1 + + + + 0 + + + + 128 + + + + disabled + + + + 0 + + + + enabled + + + + 2 + + + + 0 + + + + 1 + + + + 1 + + + + 1 + + + + 0.00 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + enabled + + + + disabled + + + + 2 + + + + disabled + + + + 0 + + + + 1 + + + + 3 + + + + 1 + + + + 1 + + + + 1 + + + + limited + + + + 0 + + + + clear + + + + 0 + + + + none + + + + none + + + + disabled + + + + none + + + + 0 + + + + lo_speed + + + + none + + + + 0 + + + + none + + + + none + + + + disabled + + + + 1 + + + + 1 + + + + 0.001 + + + + disabled + + + + 4 + + + + none + + + + 0 + + + + 1 + + + + 1 + + + + none + + + + 0 + + + + none + + + + 0 + + + + 0 + + + + none + + + + 19 + + + + 0 + + + + 1024 + + + + 1 + + + + 0 + + + + 1 + + + + 1 + + + + clear + + + + 3 + + + + 0 + + + + 1 + + + + none + + + + 0 + + + + 80 + + + + none + + + + none + + + + 0 + + + + none + + + + none + + + + limited + + + + disabled + + + + none + + + + none + + + + none + + + + output + + + + 0 + + + + 1 + + + + 9 + + + + 0 + + + + 16 + + + + 19 + + + + 0 + + + + 0 + + + + 255 + + + + 0 + + + + 0 + + + + channel_DAC + + + + disabled + + + + 1 + + + + 250000 + + + + 8000000 + + + + 2 + + + + disabled + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + limited + + + + 0 + + + + 1 + + + + 2800 + + + + 115200 + + + + limited + + + + 0 + + + + 13 + + + + 2 + + + + 1 + + + + 1 + + + + 1 + + + + 1 + + + + 0 + + + + disabled + + + + 3 + + + + 1 + + + + 0 + + + + 31 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 6 + + + + 5 + + + + 1 + + + + 7 + + + + 0 + + + + 0 + + + + disabled + + + + 1 + + + + 0 + + + + 31 + + + + 2800 + + + + 1 + + + + 0 + + + + 128 + + + + 156 + + + + 156 + + + + 11.5 us + + + + set + + + + intFlag_neg + + + + limited + + + + 1 + + + + 1 + + + + INTOSC + + + + 1 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + RxDefaultInterruptHandler + + + + 1 + + + + 4 + + + + 0 + + + + 6 + + + + 1 + + + + 9 + + + + no_intFlag + + + + 0 + + + + 3 + + + + 1 + + + + 1 + + + + limited + + + + 1 + + + + 1 + + + + ST_input + + + + disabled + + + + 0.008192 + + + + channel_Temp + + + + 1 + + + + 19 + + + + 0 + + + + 0.000004 + + + + 1 + + + + 0 + + + + 4 + + + + 1 + + + + 1 + + + + 1 + + + + ST_input + + + + 1 + + + + 0 + + + + DAC + + + + FOSC/8 + + + + limited + + + + sync_break_complete + + + + 1:1 + + + + 0 + + + + 512 + + + + 1 + + + + 0 + + + + 8MHz_HF + + + + 6 + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 0.032768 + + + + 1 + + + + 0 + + + + OFF + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + limited + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + enabled + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 0.032768 + + + + 1 + + + + 2 + + + + 1 + + + + 0 + + + + 1 + + + + 18 + + + + enabled + + + + UNUSED1 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + enabled + + + + 1 + + + + 1 + + + + 1 + + + + disabled + + + + OFF + + + + IO_LED_RED_N + + + + UNUSED2 + + + + UNUSED3 + + + + UNUSED4 + + + + IO_LED_BLUE_N + + + + 0 + + + + 0 + + + + disabled + + + + 8-bit + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 7 + + + + 2 + + + + LD1_trigger + + + + LD1_trigger + + + + LD1_trigger + + + + enabled + + + + match_incrementing + + + + match_incrementing + + + + match_incrementing + + + + 12 + + + + 1 + + + + 0 + + + + 1 + + + + 1 + + + + 1 + + + + 2 + + + + 1 + + + + 1 + + + + 1 + + + + 2 + + + + 3 + + + + 0 + + + + clear + + + + 1 + + + + 0 + + + + OFF + + + + 1 + + + + 0 + + + + 1 + + + + 0 + + + + 2 + + + + clear + + + + disabled + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + 1536 + + + + 0 + + + + IVT1 + + + + 128 + + + + 0 + + + + 1 + + + + enabled + + + + disabled + + + + enabled + + + + assigned + + + + disabled + + + + 0 + + + + enabled + + + + 0 + + + + clear + + + + 3 + + + + idle + + + + rising + + + + 1 + + + + 0 + + + + INTOSC oscillator; I/O function on CLKIN pin + + + + cleared + + + + cleared + + + + cleared + + + + 82 + + + + 1 + + + + 0 + + + + clear + + + + 2 + + + + 130 + + + + enabled + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + disabled + + + + 0 + + + + 0 + + + + 13 + + + + 1 + + + + 0 + + + + OFF + + + + 0 + + + + 1 + + + + disabled + + + + 2 + + + + 240 + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + 8000000 + + + + LO + + + + 0 + + + + clear + + + + disabled + + + + 255 + + + + 1 + + + + 0.032768 + + + + 0 + + + + 0 + + + + 5 + + + + 2 + + + + 255 + + + + 0 + + + + clear + + + + clear + + + + 2 + + + + 8000000 + + + + disabled + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + -1 + + + + 3 + + + + 0 + + + + 0 + + + + SSOP20 + + + + disabled + + + + 31.0 KHz + + + + 0 + + + + RC4 + + + + disabled + + + + 3 + + + + 8000000 + + + + 1 + + + + 0 + + + + 63 + + + + 7 + + + + 19 + + + + disabled + + + + 86.9565 kHz + + + + 0 + + + + 0 + + + + clear + + + + 2.5E-7 + + + + 0 + + + + 2 + + + + 6 + + + + 8000000 + + + + -1 + + + + ST_input + + + + -1 + + + + -1 + + + + 0 + + + + 1 + + + + clear + + + + 1 + + + + disabled + + + + 9 + + + + 5 + + + + disabled + + + + 1 + + + + T1G_pin + + + + ST_input + + + + 0 + + + + 0 + + + + 1.0E-6 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + clear + + + + clear + + + + disabled + + + + 1.0E-6 + + + + 0 + + + + disabled + + + + 2.5E-7 + + + + 0 + + + + 0 + + + + 0 + + + + disabled + + + + ST_input + + + + 0 + + + + 1 + + + + 0 + + + + 8MHz_HF + + + + 5 + + + + 4 + + + + 3 + + + + 0 + + + + 2 + + + + 0 + + + + 9 + + + + 8 + + + + 0 + + + + 7 + + + + 0 + + + + 6 + + + + disabled + + + + 6 + + + + 0 + + + + 0 + + + + 0 + + + + 8 + + + + 8000000 + + + + 0 + + + + clear + + + + clear + + + + disabled + + + + 0 + + + + stop + + + + 1 + + + + 0 + + + + disabled + + + + limited + + + + ST_input + + + + 1 + + + + 0 + + + + 0 + + + + clear + + + + 1 + + + + 3 + + + + 7 + + + + clear + + + + 1 + + + + 1.0E-6 + + + + 0 + + + + 0 + + + + 20 + + + + disabled + + + + 0 + + + + disabled + + + + disabled + + + + 0 + + + + 19 + + + + 0 + + + + 8 + + + + output + + + + 0 + + + + limited + + + + 0 + + + + 128 + + + + 0 + + + + limited + + + + OFF + + + + OF1_match + + + + OF1_match + + + + 1 + + + + enabled + + + + 0 + + + + OF1_match + + + + ISR_Pin Module_IOCI + + + + 1 + + + + 1 + + + + 0 + + + + 1 + + + + 1 + + + + 2 + + + + 1 + + + + 3 + + + + 64 + + + + 63 + + + + 63 + + + + 1.0E-6 + + + + OFF + + + + 1 + + + + 0 + + + + 1 + + + + 3 + + + + output + + + + limited + + + + 1 + + + + 1 + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + disabled + + + + 0 + + + + disabled + + + + digital + + + + disabled + + + + 4 + + + + 1 + + + + 0 + + + + 0 + + + + 5 + + + + 0 + + + + enabled + + + + 1 + + + + FOSC/4 + + + + disabled + + + + 1 + + + + 1 + + + + output + + + + 0 + + + + 256 + + + + 1 + + + + 0 + + + + 0 + + + + 10 + + + + 10 + + + + 1 + + + + 1 + + + + 1 + + + + disabled + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + output + + + + 14 + + + + 1 + + + + synchronize + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + output + + + + 0 + + + + 1 + + + + 0 + + + + 5 + + + + 3 + + + + 0 + + + + 16 + + + + 1 + + + + 0 + + + + disabled + + + + disabled + + + + 0 + + + + enabled + + + + enabled + + + + disabled + + + + 0 + + + + disabled + + + + output + + + + disabled + + + + 208 + + + + disabled + + + + disabled + + + + 1 + + + + 0 + + + + enabled + + + + disabled + + + + enabled + + + + disabled + + + + enabled + + + + disabled + + + + OFF + + + + enabled + + + + disabled + + + + 0 + + + + output + + + + 0 + + + + disabled + + + + input + + + + disabled + + + + input + + + + disabled + + + + 12 + + + + disabled + + + + output + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + asynchronous + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + 1 + + + + disabled + + + + 0 + + + + output + + + + cleared + + + + output + + + + output + + + + off + + + + cleared + + + + cleared + + + + 0 + + + + 0 + + + + disabled + + + + disabled + + + + output + + + + 1 + + + + output + + + + output + + + + digital + + + + 0 + + + + 1 + + + + 0 + + + + 1 + + + + 1 + + + + 0.0000005 + + + + active_hi + + + + active_hi + + + + 0 + + + + 0 + + + + active_hi + + + + 0 + + + + disabled + + + + 1 + + + + 1 + + + + 0 + + + + 3.3 + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + 3 + + + + 6 + + + + disabled + + + + disabled + + + + 1 + + + + disabled + + + + 0 + + + + enabled + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 1 + + + + 0 + + + + digital + + + + disabled + + + + 0 + + + + 1 + + + + disabled + + + + 11 + + + + 9 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + disabled + + + + 1 + + + + 0 + + + + enabled + + + + Increment_hi_lo + + + + enabled + + + + digital + + + + disabled + + + + 0 + + + + disabled + + + + 0 + + + + 64 + + + + 0 + + + + 0 + + + + enabled + + + + 0 + + + + 0 + + + + disabled + + + + disabled + + + + disabled + + + + 14 + + + + 0 + + + + 0 + + + + 1 + + + + 24 + + + + 0 + + + + 255 + + + + 1 + + + + 110 + + + + -1 + + + + 16 + + + + 8 + + + + 0 + + + + 6 + + + + output + + + + internal + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + enabled + + + + 0.02 + + + + 0 + + + + ST_input + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + 0.00000025 + + + + 1 + + + + 0 + + + + Divide_clock_src_by_4 + + + + 3 + + + + No_Prescalar + + + + Divide_clock_src_by_4 + + + + 1 + + + + 1 + + + + 11.5 * TAD = + + + + ST_input + + + + 0 + + + + input + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 0.02 + + + + 0.000001 + + + + 1 + + + + 0 + + + + 1 + + + + 32 + + + + 39999 + + + + 1 + + + + 112 + + + + 0 + + + + input + + + + 1 + + + + 0 + + + + 0.000001 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + enabled + + + + ISR + + + + 0 + + + + 3 + + + + 1 + + + + 4 + + + + 0 + + + + 39999 + + + + 0 + + + + 1 + + + + input + + + + 1 + + + + 1 + + + + 0 + + + + 11 + + + + 0 + + + + 0 + + + + 1 + + + + VDD + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + disabled + + + + 19 + + + + 0 + + + + 1 + + + + 0 + + + + 13 + + + + 11 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + + + + + CIN2- + + + + 1 + + + + 1 + + + + 1 + + + + 1 + + + + 8000 + + + + disabled + + + + 2000000 + + + + enabled + + + + disabled + + + + asynchronous + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + 0 + + + + 1 + + + + 1 + + + + input + + + + 0 + + + + 3 + + + + BOR Circuit is inactive + + + + TxDefaultInterruptHandler + + + + 1 + + + + 1 + + + + 7 + + + + 0 + + + + input + + + + 1 + + + + disabled + + + + 1 + + + + 2048 + + + + 1 + + + + 1 + + + + disabled + + + + output + + + + 7 + + + + no_error + + + + 1 + + + + 8-bit + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + 1 + + + + slave + + + + disabled + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 6 + + + + 8 + + + + disabled + + + + CPOL_VPVN + + + + enabled + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + easysetup + + + + 0 + + + + clear + + + + AN0 + + + + set + + + + 0 + + + + -1 + + + + 0 + + + + -1 + + + + 0 + + + + 0 + + + + 1024 + + + + 0 + + + + 7 + + + + 0.001024 + + + + 0 + + + + disabled + + + + 3 + + + + disabled + + + + 0 + + + + set + + + + 0 + + + + 0 + + + + 100000 + + + + 1 + + + + 2 + + + + disabled + + + + disabled + + + + disabled + + + + VDD + + + + 0.001 + + + + disabled + + + + 16000000 + + + + 2 + + + + %DESELECT% + + + + 5 + + + + 1 + + + + 7 + + + + independent_run + + + + independent_run + + + + ST_input + + + + disabled + + + + independent_run + + + + 1 + + + + disabled + + + + disabled + + + + disabled + + + + 3 + + + + disabled + + + + clear + + + + 0 + + + + 2 + + + + 0 + + + + 0 + + + + disabled + + + + 48 + + + + disabled + + + + TSR_empty + + + + disabled + + + + disabled + + + + 210 + + + + disabled + + + + ST_input + + + + disabled + + + + 5 + + + + disabled + + + + limited + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 0 + + + + 1 + + + + disabled + + + + ST_input + + + + disabled + + + + disabled + + + + 1 + + + + 0 + + + + 1 + + + + 5 + + + + 0 + + + + limited + + + + 3 + + + + clear + + + + do_not_load + + + + do_not_load + + + + do_not_load + + + + disabled + + + + 16 + + + + 1 + + + + 0 + + + + 0 + + + + ST_input + + + + 0 + + + + 10 + + + + 0.0000005 + + + + disabled + + + + 1:65536 + + + + 2 + + + + 7 + + + + 1 + + + + enabled + + + + 2 + + + + 2.11406 + + + + 6 + + + + disabled + + + + 22 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + output + + + + no_auto_trigger + + + + 255 + + + + clear + + + + disabled + + + + 0 + + + + disabled + + + + 32 + + + + %DESELECT% + + + + 32 + + + + 0 + + + + 3 + + + + channel_FVR + + + + enabled + + + + 0 + + + + 4 + + + + ST_input + + + + disabled + + + + 5 + + + + 8 + + + + 0 + + + + 1 + + + + 0 + + + + disabled + + + + 0 + + + + limited + + + + 5 + + + + + + + + no_error + + + + disabled + + + + 0 + + + + 0 + + + + 2 + + + + 0 + + + + ST_input + + + + 2 + + + + 1 + + + + OFF + + + + disabled + + + + 1 + + + + limited + + + + 0 + + + + 1 + + + + 0.001 + + + + 1:8 + + + + 8 + + + + GATE_ISR + + + + 1 + + + + 1 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 3 + + + + 1 + + + + 1 + + + + 4 + + + + 0 + + + + 0 + + + + 3 + + + + analog + + + + disabled + + + + clear + + + + output + + + + 0 + + + + limited + + + + 1 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 8000000 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + eusart_interrupt + + + + done + + + + analog + + + + 1 + + + + 1 + + + + 0 + + + + 1 + + + + 65535 + + + + 0 + + + + 0 + + + + output + + + + 12 + + + + clear + + + + 32768 + + + + RC3 + + + + 0 + + + + 1 + + + + 0 + + + + 1.959 + + + + 0 + + + + 1 + + + + OFF + + + + 10 + + + + 1 + + + + 0 + + + + PRESENT + + + + 1 + + + + 6 + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + clear + + + + 2 + + + + disabled + + + + IO_RC0 + + + + ADC_BATT + + + + + + + + 1 + + + + 0 + + + + 2 + + + + 1 + + + + no_overflow + + + + disabled + + + + 1 + + + + IO_PWM2 + + + + 3.3 + + + + IO_PWM_LEDS + + + + disabled + + + + IO_POW + + + + IO_PWM1 + + + + hi_speed + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 1 + + + + 1 + + + + IO_SERVOS + + + + 0 + + + + 7 + + + + 0.0000005 + + + + + + + + 0 + + + + + + + + 0 + + + + IO_PWRC + + + + IO_STA + + + + digital + + + + 0 + + + + disabled + + + + FOSC/4 + + + + 144 + + + + 0 + + + + 1 + + + + 0 + + + + enabled + + + + 1 + + + + 31 + + + + 156 + + + + disabled + + + + 8192 + + + + 156 + + + + 0 + + + + enabled + + + + digital + + + + enabled + + + + enabled + + + + enabled + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + enabled + + + + enabled + + + + 1 + + + + 9 + + + + 0 + + + + disabled + + + + 1 + + + + 500000 + + + + 2 + + + + 1 + + + + 16 + + + + 1 + + + + not inverted + + + + 0 + + + + disabled + + + + enabled + + + + high + + + + 2 + + + + enabled + + + + digital + + + + disabled + + + + enabled + + + + 15 + + + + 2 + + + + enabled + + + + 20 + + + + 1 + + + + disabled + + + + 5 + + + + 20 + + + + 8000000 + + + + 2 + + + + Non-Inverted + + + + 0 + + + + 1 + + + + disabled + + + + ON + + + + 3 + + + + 1 + + + + 0 + + + + 0 + + + + 1 + + + + 0.008192 + + + + digital + + + + 0 + + + + 0 + + + + 3 + + + + 0 + + + + disabled + + + + 1 + + + + 1 + + + + disabled + + + + cleared + + + + 1 + + + + cleared + + + + cleared + + + + output + + + + 1 + + + + 0 + + + + 0 + + + + 80 + + + + 240 + + + + 240 + + + + disabled + + + + 1 + + + + 0 + + + + Error: 2.124 % + + + + 1 + + + + 1 + + + + 19 + + + + 1 + + + + 0 + + + + ISR + + + + 0 + + + + 0 + + + + 0.032768 + + + + output + + + + 8000000 + + + + 1 + + + + enabled + + + + 1 + + + + 0 + + + + 55 + + + + 1 + + + + 3076 + + + + disabled + + + + disabled + + + + disabled + + + + enabled + + + + enabled + + + + disabled + + + + enabled + + + + disabled + + + + 5 + + + + 10 + + + + 1 + + + + 1 + + + + 2080 + + + + 0 + + + + 0.032768 + + + + disabled + + + + 2048 + + + + enabled + + + + 0 + + + + 0 + + + + enabled + + + + enabled + + + + + + + + enabled + + + + enabled + + + + -1 + + + + 0 + + + + 1 + + + + ISR + + + + 1 + + + + 1 + + + + -1 + + + + 0 + + + + 1 + + + + 0 + + + + 63 + + + + 0 + + + + 63 + + + + 0 + + + + 1 + + + + ALL + + + + 30 + + + + 20 + + + + 10 + + + + 11 + + + + 0 + + + + enabled + + + + 64 + + + + 2 + + + + right + + + + 0 + + + + disabled + + + + 1 + + + + 0 + + + + 2 + + + + 19 + + + + 1 + + + + 1 + + + + 2 + + + + disabled + + + + 2 + + + + 0 + + + + disabled + + + + disabled + + + + 1 + + + + 3 + + + + 0 + + + + 1 + + + + 0 + + + + 3 + + + + 1 + + + + 1 + + + + 15 + + + + ST_input + + + + 1 + + + + 1000000 + + + + 2 + + + + disabled + + + + 4 + + + + 0 + + + + disabled + + + + 255 + + + + disabled + + + + + + + + 1 + + + + 0 + + + + 1 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + + + clear + + + + 0 + + + + 1 + + + + 240 + + + + 1 + + + + 0 + + + + 10 + + + + 10 + + + + 0 + + + + 7 + + + + 0x0 + + + + 1 + + + + 2 + + + + 0 + + + + ISR + + + + 1 + + + + 1.0 us + + + + 4 + + + + -1 + + + + OFF + + + + clear + + + + disabled + + + + 0 + + + + 2 + + + + 1 + + + + 0 + + + + disabled + + + + ST_input + + + + 1 + + + + disabled + + + + 0 + + + + 1 + + + + 0 + + + + 3 + + + + 0 + + + + 144 + + + + 0 + + + + 1 + + + + 512 + + + + clear + + + + 1 + + + + 1 + + + + 1 + + + + 0 + + + + disabled + + + + 0 + + + + 29 + + + + 80 + + + + 240 + + + + 240 + + + + 0 + + + + 1 + + + + 8 + + + + disabled + + + + 1 + + + + 0 + + + + 1 + + + + 3 + + + + 1 + + + + 1 + + + + 0 + + + + ON + + + + ST_input + + + + disabled + + + + 17 + + + + enabled + + + + 8000000 + + + + enabled + + + + 1 + + + + enabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + disabled + + + + 0 + + + + 1 + + + + clear + + + + 2 + + + + 0 + + + + 1 + + + + 0 + + + + ISR + + + + 0 + + + + disabled + + + + 0 + + + + 1 + + + + OFF + + + + disabled + + + + FOSC + + + + FOSC + + + + enabled + + + + ISR + + + + clear + + + + enabled + + + + 0 + + + + enabled + + + + enabled + + + + 0 + + + + enabled + + + + 0 + + + + enabled + + + + enabled + + + + 0 + + + + 0 + + + + 0 + + + + 2 + + + + 31000 + + + + 1 + + + + ISR + + + + 0 + + + + 0 + + + + 4 + + + + 1 + + + + disabled + + + + 0 + + + + 0 + + + + 0 + + + + ST_input + + + + 1 + + + + %DESELECT% + + + + 0 + + + + FOSC + + + + + mcc_generated_files\interrupt_manager.h + df7b349f577edc793f43c0782fdba268b27579f110fe1cadccdd97b42af6d43a + + + mcc_generated_files\eusart.h + d1834f9c01bdae9c96b0e0902935b23602b397f40c702118e5c656252ccaad31 + + + mcc_generated_files\dac.c + bef18e8e01d50c7a3b1c99b9d949cf63585dc6615eff8c241cd6b5c97df81206 + + + mcc_generated_files\dac.h + 08b85669eda28717fcaff4be9d10330390eaedab636629043022319abffac117 + + + mcc_generated_files\mcc.c + c7c71fcd7b7151bbba601785123f629e8e7e79d67f364ce015383bfc5d050e3c + + + mcc_generated_files\mcc.h + 7778bbb2b0a76f590e74c637c41f551b18ada80ebfc4c1b8f10714a9c7798c37 + + + mcc_generated_files\device_config.h + a3bbbe518794342c163e81b38332d8d0933fe8f04b73d05ed1e945487e654509 + + + mcc_generated_files\tmr1.h + eda86eefe7e415430fc8f2c27a9176ff1cb79929a69097e967b07138f9ece152 + + + mcc_generated_files\tmr0.h + 2d0ec741b3e9577d78ace8ec1cc2fe7da4650c40b9c9daf3d94901042683e388 + + + mcc_generated_files\adc1.c + ac434aab1eef7e79087c1289a10694735e0ba4a4ef2e48f6c36cc39de0e6affe + + + main.c + c0e1935f961635c78b69ceb4690d2fc607de9b513076935a73386ba3be9bb825 + + + mcc_generated_files\device_config.c + df3bb865d50b872689fe2dd864bfcbc27474ccdac0171e35f6090dc41c244905 + + + mcc_generated_files\pin_manager.h + 3720e2e4813b8cb84af49eef0b8498b97d213d890fa2eb8732375ede23e03d9a + + + mcc_generated_files\tmr1.c + 9abee52f4a03e936dd23b1f5219a479581f268ebe47ece6856d1af64e9724d6c + + + mcc_generated_files\eusart.c + 35302837e83f71b856408a532f8ef61c12d5b44a9925767c836ea40b7b897886 + + + mcc_generated_files\tmr0.c + 9dc749344fdc49e7bab6f99a9061f65ccb59d5391d575981fcdc864acdceaf2c + + + mcc_generated_files\pin_manager.c + 37607cb9082a56acff1990d96c2c25b8d08ca7b7f026dfcb93d3fb3738f11638 + + + mcc_generated_files\pwm1.c + 2648d104fd8cef2c5e613e926cab131f2c404a3b2a826593d4b6bd85180fa452 + + + mcc_generated_files\cmp1.h + d2265f7299131c65be9f49d0c5f7850ab6242ed557e74b49903fabe897447e34 + + + mcc_generated_files\pwm1.h + 80df2204034660542bc221ceccb8ed4d28461a900a9dd8ef844e88b195eacbab + + + mcc_generated_files\adc1.h + 83683f51c38335711c107d6160645fdd4a63d4e16a8b78ac1e16fb4789b2f22f + + + mcc_generated_files\pwm2.h + 2632cfff30ae094da4184c54eba48043e9940051b08d2ddd9f01d0d71af5b992 + + + mcc_generated_files\pwm3.h + bc726667e9f9d8864daa99023e10c20e31421f3f987b744dbb6df0a01483d2cc + + + mcc_generated_files\interrupt_manager.c + 764e3e9559bde4d0ff8047fd82254e308429b044b20c71f47e84ac95776f9d47 + + + mcc_generated_files\pwm2.c + 5da4df8197a4667531884415f22e269daed893191b4e520d1351335568d8822e + + + mcc_generated_files\pwm3.c + 83e117bc9cbb7810e1347e3134ff589cc8586d9d7ba3eb9162022bbd9e920fe4 + + + mcc_generated_files\cmp1.c + 4110956543f68627d7e4b08e63696fd149a38bfeef58db7a4453258682f0dde2 + + + Index: /RF_BT_Tail/Terminal.c =================================================================== --- /RF_BT_Tail/Terminal.c (revision 244) +++ /RF_BT_Tail/Terminal.c (revision 244) @@ -0,0 +1,353 @@ +// File: Terminal.c +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// Implements the serial interface +//------------------------------------------------------------------------------ + +#include "mcc_generated_files/device_config.h" //For __delay_ms +#include "Terminal.h" +#include "Definitions.h" +#include "Power.h" +#include "Servos.h" +#include "LEDs.h" + +#include "JDY08.h" + +#include + +enum { + ST_IDLE, + ST_USER_MOVE_INIT, + ST_USER_LEDS_INIT, + ST_USER_MOVE, + ST_USER_LEDS, + ST_AUTO +} st; + +#define MAX_USER_PRESETS 4u +#define MAX_AUTO_G 3u //We need 3 groups max for automode +#define LEN_AUTO_T 3u //We need 3 timing parameters for automode +#define MIN_AUTO_T 15u //Min time that can be specified (seconds) +#define MAX_AUTO_T 240u //Max time that can be specified (seconds) + +#define ERR_NOERR 0u +#define ERR_OUTOFRANGE 1u +#define ERR_UNKNOWNTYPE 2u +#define ERR_UNEXPECTED 3u +#define ERR_MISSINGTOKEN 4u + +//Error messages +#define ERR_OUTOFRANGE_STR "OUT OF RANGE" +#define ERR_UNKNOWN_TYPE_STR "UNKNOWN TYPE" +#define ERR_UNEXPECTED_TOKEN_STR "UNEXPECTED TOKEN" +#define ERR_MISSING_TOKEN_STR "MISSING PARAMETER" +#define ERR_ERROR_STR "ERROR" + +#define MAX_PFX_LEN 6u +#define MSG_BEGIN "BEGIN " +#define MSG_END "END " + +//Commands +char const * const CMD_SHUTDN = "SHUTDOWN"; +char const * const CMD_PING = "PING"; +char const * const CMD_BATT = "BATT"; +char const * const CMD_VER = "VER"; +char const * const CMD_ULEDS = "USERLEDS"; +char const * const CMD_UMOVE = "USERMOVE"; +char const * const CMD_AUTO = "AUTOMODE"; +char const * const CMD_ABORT = "STOPAUTO"; + +//Responses +char const * const RES_OK ="OK"; +char const * const RES_ERR="ERR"; + +uint8_t parCycles; //Number of cycles in the parsed move or leds pattern +uint8_t parUserMem; //User mem preset to host the specified move +uint8_t parNum; //Number of positions to expect +uint8_t parPtrA; //Pointer to the servo1 positions (MAX_PATTERNS) +int8_t parStep[MAX_MOVES]; +#else +int8_t parStep[MAX_PATTERNS]; +#endif + +//Send a concatenation of 2 strings to the BT module +//This is used to send a BEGIN/END+CmdName message +void sendCompMex(const char* str1, char* str2) +{ + char str[MAX_PFX_LEN+MAX_CMD_LEN+1]; + uint8_t pd,ps; + pd=0; + for (ps=0; ps<=MAX_PFX_LEN && str1[ps]; ps++) + str[pd++]=str1[ps]; + for (ps=0; ps=MIN_AUTO_T && val<=MAX_AUTO_T) parPos.autm.t[parPtrT++]=(uint8_t)val; + else error = ERR_OUTOFRANGE; + else error = ERR_UNEXPECTED; + break; + + default: + error = ERR_UNKNOWNTYPE; + break; + } + } + if (error==0) + { + if (st==ST_USER_MOVE) + { + setUserMove(parUserMem-1u,parNum,parCycles,parPos.move.pos1,parPos.move.pos2,parStep); + } + else if (st==ST_USER_LEDS) + { + setUserLeds(parUserMem-1u,parNum,parCycles,parPos.leds.pos,parStep); + } + else + { + setAuto(parPos.autm.t[0],parPos.autm.t[1],parPos.autm.t[2],parPos.autm.grps); + } + } + //Check that all the positions and step timings have been received + if (error==0 && st!=ST_AUTO) + { + if (parNum>parPtrA || parNum>parPtrS) error=ERR_MISSINGTOKEN; + //If defining a move then check the pointer for the Servo2 as well + if (st==ST_USER_MOVE && parNum>parPtrS) error=ERR_MISSINGTOKEN; + } + switch (error) + { + case ERR_NOERR: btSendStr(RES_OK,0); break; + case ERR_OUTOFRANGE: btSendStr(ERR_OUTOFRANGE_STR,0); break; + case ERR_UNKNOWNTYPE: btSendStr(ERR_UNKNOWN_TYPE_STR,0); break; + case ERR_UNEXPECTED: btSendStr(ERR_UNEXPECTED_TOKEN_STR,0); break; + case ERR_MISSINGTOKEN:btSendStr(ERR_MISSING_TOKEN_STR,0); break; + default: btSendStr(ERR_ERROR_STR,0); break; + } + } + } + + //If ack for move end then send out END MOVE message + // and clear current move string + if (ack==ACK_END_MOVE) + { + sendCompMex(MSG_END,currMoveStr); + currMoveStr[0]=0; + } + + //If ack for leds end then send out END LEDS message + // and clear current leds string + if (ack==ACK_END_LEDS) + { + sendCompMex(MSG_END,currLedsStr); + currLedsStr[0]=0; + } +} + + + Index: /RF_BT_Tail/RF.h =================================================================== --- /RF_BT_Tail/RF.h (revision 244) +++ /RF_BT_Tail/RF.h (revision 244) @@ -0,0 +1,31 @@ +// File: RF.h +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Sep 2019 +// RF remote decoder +//------------------------------------------------------------------------------ + + +#ifndef RF_H +#define RF_H + +#include + +#define RF_A 0x01u +#define RF_B 0x02u +#define RF_C 0x03u +#define RF_D 0x04u + +#define RF_LONG_MASK 0x80u +#define RF_LONG_A RF_LONG_MASK|RF_A +#define RF_LONG_B RF_LONG_MASK|RF_B +#define RF_LONG_C RF_LONG_MASK|RF_C +#define RF_LONG_D RF_LONG_MASK|RF_D + +void initRF(); +uint8_t rfGetNewCode(); +uint8_t isRFreceiving(); +#endif /* RF_H */ + Index: /RF_BT_Tail/Terminal.h =================================================================== --- /RF_BT_Tail/Terminal.h (revision 244) +++ /RF_BT_Tail/Terminal.h (revision 244) @@ -0,0 +1,18 @@ +// File: Terminal.h +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// Implements the serial interface +//------------------------------------------------------------------------------ + +#ifndef TERMINAL_H +#define TERMINAL_H + +#include "Moves.h" + +void terminal(AckEnum ack); + +#endif /* TERMINAL_H */ + Index: /RF_BT_Tail/Definitions.h =================================================================== --- /RF_BT_Tail/Definitions.h (revision 244) +++ /RF_BT_Tail/Definitions.h (revision 244) @@ -0,0 +1,15 @@ +// File: Definitions.h +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// Global definitions +//------------------------------------------------------------------------------ +#ifndef DEFINITIONS_H +#define DEFINITIONS_H + +#define STR_VER "2.21" + +#endif /* DEFINITIONS_H */ + Index: /RF_BT_Tail/mcc_generated_files/cmp1.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/cmp1.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/cmp1.c (revision 244) @@ -0,0 +1,78 @@ + /** + CMP1 Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + cmp1.c + + @Summary + This is the generated driver implementation file for the CMP1 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This source file provides implementations for driver APIs for CMP1. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.11 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 + */ + + /* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + + /** + Section: Included Files + */ + + +#include +#include "cmp1.h" +#include "pin_manager.h" +/** + Section: CMP1 APIs +*/ + +void CMP1_Initialize(void) +{ + + // C1HYS enabled; C1SP lo_speed; C1ON enabled; C1POL not inverted; C1SYNC asynchronous; + CM1CON0 = 0x82; + + // C1INTN intFlag_neg; C1INTP no_intFlag; C1PCH DAC; C1NCH CIN2-; + CM1CON1 = 0x52; + +} + +bool CMP1_GetOutputStatus(void) +{ + return (CMOUTbits.MC1OUT); +} + + +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/mcc.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/mcc.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/mcc.c (revision 244) @@ -0,0 +1,85 @@ +/** + @Generated PIC10 / PIC12 / PIC16 / PIC18 MCUs Source File + + @Company: + Microchip Technology Inc. + + @File Name: + mcc.c + + @Summary: + This is the mcc.c file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description: + This header file provides implementations for driver APIs for all modules selected in the GUI. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.00 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#include "mcc.h" + + +void SYSTEM_Initialize(void) +{ + + PIN_MANAGER_Initialize(); + OSCILLATOR_Initialize(); + WDT_Initialize(); + DAC_Initialize(); + PWM1_Initialize(); + PWM2_Initialize(); + CMP1_Initialize(); + ADC1_Initialize(); + PWM3_Initialize(); + TMR1_Initialize(); + TMR0_Initialize(); + EUSART_Initialize(); +} + +void OSCILLATOR_Initialize(void) +{ + // SCS FOSC; SPLLEN disabled; IRCF 8MHz_HF; + OSCCON = 0x70; + // TUN 0; + OSCTUNE = 0x00; + // SBOREN disabled; BORFS disabled; + BORCON = 0x00; +} + +void WDT_Initialize(void) +{ + // WDTPS 1:65536; SWDTEN OFF; + WDTCON = 0x16; +} + +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/eusart.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/eusart.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/eusart.c (revision 244) @@ -0,0 +1,220 @@ +/** + EUSART Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + eusart.c + + @Summary + This is the generated driver implementation file for the EUSART driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This source file provides APIs for EUSART. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +/** + Section: Included Files +*/ +#include "eusart.h" + +/** + Section: Macro Declarations +*/ + +#define EUSART_TX_BUFFER_SIZE 16 +#define EUSART_RX_BUFFER_SIZE 64 + +/** + Section: Global Variables +*/ +volatile uint8_t eusartTxHead = 0; +volatile uint8_t eusartTxTail = 0; +volatile uint8_t eusartTxBuffer[EUSART_TX_BUFFER_SIZE]; +volatile uint8_t eusartTxBufferRemaining; + +volatile uint8_t eusartRxHead = 0; +volatile uint8_t eusartRxTail = 0; +volatile uint8_t eusartRxBuffer[EUSART_RX_BUFFER_SIZE]; +volatile uint8_t eusartRxCount; + +/** + Section: EUSART APIs +*/ +void EUSART_Initialize(void) +{ + // disable interrupts before changing states + PIE1bits.RCIE = 0; + EUSART_SetRxInterruptHandler(EUSART_Receive_ISR); + PIE1bits.TXIE = 0; + EUSART_SetTxInterruptHandler(EUSART_Transmit_ISR); + // Set the EUSART module to the options selected in the user interface. + + // ABDOVF no_overflow; SCKP Non-Inverted; BRG16 16bit_generator; WUE disabled; ABDEN disabled; + BAUDCON = 0x08; + + // SPEN enabled; RX9 8-bit; CREN enabled; ADDEN disabled; SREN disabled; + RCSTA = 0x90; + + // TX9 8-bit; TX9D 0; SENDB sync_break_complete; TXEN enabled; SYNC asynchronous; BRGH hi_speed; CSRC slave; + TXSTA = 0x24; + + // SPBRGL 16; + SPBRGL = 0x10; + + // SPBRGH 0; + SPBRGH = 0x00; + + + // initializing the driver state + eusartTxHead = 0; + eusartTxTail = 0; + eusartTxBufferRemaining = sizeof(eusartTxBuffer); + + eusartRxHead = 0; + eusartRxTail = 0; + eusartRxCount = 0; + + // enable receive interrupt + PIE1bits.RCIE = 1; +} + +uint8_t EUSART_is_tx_ready(void) +{ + return eusartTxBufferRemaining; +} + +uint8_t EUSART_is_rx_ready(void) +{ + return eusartRxCount; +} + +bool EUSART_is_tx_done(void) +{ + return TXSTAbits.TRMT; +} + +uint8_t EUSART_Read(void) +{ + uint8_t readValue = 0; + + while(0 == eusartRxCount) + { + } + + readValue = eusartRxBuffer[eusartRxTail++]; + if(sizeof(eusartRxBuffer) <= eusartRxTail) + { + eusartRxTail = 0; + } + PIE1bits.RCIE = 0; + eusartRxCount--; + PIE1bits.RCIE = 1; + + return readValue; +} + +void EUSART_Write(uint8_t txData) +{ + while(0 == eusartTxBufferRemaining) + { + } + + if(0 == PIE1bits.TXIE) + { + TXREG = txData; + } + else + { + PIE1bits.TXIE = 0; + eusartTxBuffer[eusartTxHead++] = txData; + if(sizeof(eusartTxBuffer) <= eusartTxHead) + { + eusartTxHead = 0; + } + eusartTxBufferRemaining--; + } + PIE1bits.TXIE = 1; +} + + +void EUSART_Transmit_ISR(void) +{ + + // add your EUSART interrupt custom code + if(sizeof(eusartTxBuffer) > eusartTxBufferRemaining) + { + TXREG = eusartTxBuffer[eusartTxTail++]; + if(sizeof(eusartTxBuffer) <= eusartTxTail) + { + eusartTxTail = 0; + } + eusartTxBufferRemaining++; + } + else + { + PIE1bits.TXIE = 0; + } +} + +void EUSART_Receive_ISR(void) +{ + + if(1 == RCSTAbits.OERR) + { + // EUSART error - restart + + RCSTAbits.CREN = 0; + RCSTAbits.CREN = 1; + } + + // buffer overruns are ignored + eusartRxBuffer[eusartRxHead++] = RCREG; + if(sizeof(eusartRxBuffer) <= eusartRxHead) + { + eusartRxHead = 0; + } + eusartRxCount++; +} + +void EUSART_SetTxInterruptHandler(void (* interruptHandler)(void)){ + EUSART_TxDefaultInterruptHandler = interruptHandler; +} + +void EUSART_SetRxInterruptHandler(void (* interruptHandler)(void)){ + EUSART_RxDefaultInterruptHandler = interruptHandler; +} +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/cmp1.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/cmp1.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/cmp1.h (revision 244) @@ -0,0 +1,146 @@ + /** + CMP1 Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + cmp1.h + + @Summary + This is the generated header file for the CMP1 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for driver for CMP1. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.11 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 + */ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef CMP1_H +#define CMP1_H + + /** + Section: Included Files + */ + +#include +#include + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + +/** + Section: CMP1 APIs +*/ + +/** + @Summary + Initializes the CMP1 + + @Description + This routine initializes the CMP1. + This routine must be called before any other CMP1 routine is called. + This routine should only be called once during system initialization. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Comment + + @Example + + CMP1_Initialize(); + +*/ +void CMP1_Initialize(void); + +/** + @Summary + Gets the CMP1 output status. + + @Description + This routine gets the CMP1 output status. + + @Preconditions + The CMP1 initializer routine should be called + prior to use this routine. + + @Param + None + + @Returns + high - if the CMP1 output is high. + low - if the CMP1 output is low. + + @Example + + #define LED_On LATAbits.LATA0=1 + #define LED_Off LATAbits.LATA0=0 + + CMP1_Initialize(); + + while(1) + { + if(CMP1_GetOutputStatus()) + { + LED_On; + } + else + { + LED_Off; + } + } + +*/ +bool CMP1_GetOutputStatus(void); + + + +#ifdef __cplusplus // Provide C++ Compatibility + + } + +#endif + +#endif // CMP1_H +/** + End of File +*/ + Index: /RF_BT_Tail/mcc_generated_files/mcc.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/mcc.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/mcc.h (revision 244) @@ -0,0 +1,108 @@ +/** + @Generated PIC10 / PIC12 / PIC16 / PIC18 MCUs Header File + + @Company: + Microchip Technology Inc. + + @File Name: + mcc.h + + @Summary: + This is the mcc.h file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description: + This header file provides implementations for driver APIs for all modules selected in the GUI. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.00 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef MCC_H +#define MCC_H +#include +#include "device_config.h" +#include "pin_manager.h" +#include +#include +#include "interrupt_manager.h" +#include "tmr1.h" +#include "cmp1.h" +#include "tmr0.h" +#include "pwm1.h" +#include "pwm2.h" +#include "pwm3.h" +#include "adc1.h" +#include "dac.h" +#include "eusart.h" + + + +/** + * @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 + Initializes the WDT module to the default states configured in the + * MCC GUI + * @Example + WDT_Initialize(void); + */ +void WDT_Initialize(void); + +#endif /* MCC_H */ +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/adc1.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/adc1.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/adc1.c (revision 244) @@ -0,0 +1,145 @@ +/** + ADC1 Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + adc1.c + + @Summary + This is the generated driver implementation file for the ADC1 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This source file provides implementations for driver APIs for ADC1. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +/** + Section: Included Files +*/ + +#include +#include "adc1.h" +#include "device_config.h" + +/** + Section: Macro Declarations +*/ + +#define ACQ_US_DELAY 5 + +/** + Section: ADC Module APIs +*/ + +void ADC1_Initialize(void) +{ + // set the ADC1 to the options selected in the User Interface + + // GO_nDONE stop; ADON enabled; CHS AN0; + ADCON0 = 0x01; + + // ADFM right; ADPREF VDD; ADCS FOSC/8; + ADCON1 = 0x90; + + // TRIGSEL no_auto_trigger; + ADCON2 = 0x00; + + // ADRESL 0; + ADRESL = 0x00; + + // ADRESH 0; + ADRESH = 0x00; + +} + +void ADC1_SelectChannel(adc_channel_t channel) +{ + // select the A/D channel + ADCON0bits.CHS = channel; + // Turn on the ADC module + ADCON0bits.ADON = 1; +} + +void ADC1_StartConversion() +{ + // Start the conversion + ADCON0bits.GO_nDONE = 1; +} + + +bool ADC1_IsConversionDone() +{ + // Start the conversion + return ((bool)(!ADCON0bits.GO_nDONE)); +} + +adc_result_t ADC1_GetConversionResult(void) +{ + // Conversion finished, return the result + return ((adc_result_t)((ADRESH << 8) + ADRESL)); +} + +adc_result_t ADC1_GetConversion(adc_channel_t channel) +{ + // select the A/D channel + ADCON0bits.CHS = channel; + + // Turn on the ADC module + ADCON0bits.ADON = 1; + + // Acquisition time delay + __delay_us(ACQ_US_DELAY); + + // Start the conversion + ADCON0bits.GO_nDONE = 1; + + // Wait for the conversion to finish + while (ADCON0bits.GO_nDONE) + { + } + + //GdS: turn ADC off + ADCON0bits.ADON = 0; + + // Conversion finished, return the result + return ((adc_result_t)((ADRESH << 8) + ADRESL)); +} + +void ADC1_TemperatureAcquisitionDelay(void) +{ + __delay_us(200); +} +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/eusart.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/eusart.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/eusart.h (revision 244) @@ -0,0 +1,393 @@ +/** + EUSART Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + eusart.h + + @Summary + This is the generated header file for the EUSART driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for driver for EUSART. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef EUSART_H +#define EUSART_H + +/** + Section: Included Files +*/ + +#include +#include +#include + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + + +/** + Section: Macro Declarations +*/ + +#define EUSART_DataReady (EUSART_is_rx_ready()) + +/** + Section: Data Type Definitions +*/ + +/** + Section: Global variables + */ +extern volatile uint8_t eusartTxBufferRemaining; +extern volatile uint8_t eusartRxCount; + +/** + Section: EUSART APIs +*/ + +void (*EUSART_TxDefaultInterruptHandler)(void); +void (*EUSART_RxDefaultInterruptHandler)(void); + +/** + @Summary + Initialization routine that takes inputs from the EUSART GUI. + + @Description + This routine initializes the EUSART driver. + This routine must be called before any other EUSART routine is called. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Comment + +*/ +void EUSART_Initialize(void); + +/** + @Summary + Checks if the EUSART transmitter is ready + + @Description + This routine checks if EUSART transmitter is empty and ready + for next transmission + + @Preconditions + EUSART_Initialize() function should have been called + before calling this function. + EUSART transmitter should be enabled before calling + this function + + @Param + None + + @Returns + The number of available bytes that EUSART has remaining in + its transmit buffer + + @Example + + void main(void) + { + volatile uint8_t rxData; + + // Initialize the device + SYSTEM_Initialize(); + + // Enable the Global Interrupts + INTERRUPT_GlobalInterruptEnable(); + + // Enable the Peripheral Interrupts + INTERRUPT_PeripheralInterruptEnable(); + + while(1) + { + // Logic to echo received data + if(EUSART_is_rx_ready()) + { + rxData = UART1_Read(); + if(EUSART_is_tx_ready()) + { + EUSART_Write(rxData); + } + } + } + } + +*/ +uint8_t EUSART_is_tx_ready(void); + +/** + @Summary + Checks if EUSART receiver is empty + + @Description + This routine returns the available number of bytes to be read + from EUSART receiver + + @Preconditions + EUSART_Initialize() function should be called + before calling this function + EUSART receiver should be enabled before calling this + function + + @Param + None + + @Returns + The number of bytes EUSART has available for reading + + @Example + + void main(void) + { + volatile uint8_t rxData; + + // Initialize the device + SYSTEM_Initialize(); + + // Enable the Global Interrupts + INTERRUPT_GlobalInterruptEnable(); + + // Enable the Peripheral Interrupts + INTERRUPT_PeripheralInterruptEnable(); + + while(1) + { + // Logic to echo received data + if(EUSART_is_rx_ready()) + { + rxData = UART1_Read(); + if(EUSART_is_tx_ready()) + { + EUSARTT_Write(rxData); + } + } + } + } + +*/ +uint8_t EUSART_is_rx_ready(void); + +/** + @Summary + Checks if EUSART data is transmitted + + @Description + This function return the status of transmit shift register + + @Preconditions + EUSART_Initialize() function should be called + before calling this function + EUSART transmitter should be enabled and EUSART_Write + should be called before calling this function + + @Param + None + + @Returns + Status of EUSART receiver + TRUE: Data completely shifted out if the USART shift register + FALSE: Data is not completely shifted out of the shift register + + @Example + + void main(void) + { + volatile uint8_t rxData; + + // Initialize the device + SYSTEM_Initialize(); + + while(1) + { + if(EUSART_is_tx_ready()) + { + LED_0_SetHigh(); + EUSARTWrite(rxData); + } + if(EUSART_is_tx_done() + { + LED_0_SetLow(); + } + } + } + +*/ +bool EUSART_is_tx_done(void); + +/** + @Summary + Read a byte of data from the EUSART. + + @Description + This routine reads a byte of data from the EUSART. + + @Preconditions + EUSART_Initialize() 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. +*/ +uint8_t EUSART_Read(void); + + /** + @Summary + Writes a byte of data to the EUSART. + + @Description + This routine writes a byte of data to the EUSART. + + @Preconditions + EUSART_Initialize() function should have been called + before calling this function. The transfer status should be checked to see + if transmitter is not busy before calling this function. + + @Param + txData - Data byte to write to the EUSART + + @Returns + None +*/ +void EUSART_Write(uint8_t txData); + +/** + @Summary + Maintains the driver's transmitter state machine and implements its ISR. + + @Description + This routine is used to maintain the driver's internal transmitter state + machine.This interrupt service routine is called when the state of the + transmitter needs to be maintained in a non polled manner. + + @Preconditions + EUSART_Initialize() function should have been called + for the ISR to execute correctly. + + @Param + None + + @Returns + None +*/ +void EUSART_Transmit_ISR(void); + +/** + @Summary + Maintains the driver's receiver state machine and implements its ISR + + @Description + This routine is used to maintain the driver's internal receiver state + machine.This interrupt service routine is called when the state of the + receiver needs to be maintained in a non polled manner. + + @Preconditions + EUSART_Initialize() function should have been called + for the ISR to execute correctly. + + @Param + None + + @Returns + None +*/ +void EUSART_Receive_ISR(void); + +/** + @Summary + Sets the transmit handler function to be called by the interrupt service + + @Description + Calling this function will set a new custom function that will be + called when the transmit interrupt needs servicing. + + @Preconditions + EUSART_Initialize() function should have been called + for the ISR to execute correctly. + + @Param + A pointer to the new function + + @Returns + None +*/ +void EUSART_SetTxInterruptHandler(void (* interruptHandler)(void)); + +/** + @Summary + Sets the receive handler function to be called by the interrupt service + + @Description + Calling this function will set a new custom function that will be + called when the receive interrupt needs servicing. + + @Preconditions + EUSART_Initialize() function should have been called + for the ISR to execute correctly. + + @Param + A pointer to the new function + + @Returns + None +*/ +void EUSART_SetRxInterruptHandler(void (* interruptHandler)(void)); + +#ifdef __cplusplus // Provide C++ Compatibility + + } + +#endif + +#endif // EUSART_H +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/adc1.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/adc1.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/adc1.h (revision 244) @@ -0,0 +1,328 @@ +/** + ADC1 Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + adc1.h + + @Summary + This is the generated header file for the ADC1 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for driver for ADC1. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef ADC1_H +#define ADC1_H + +/** + Section: Included Files +*/ + +#include +#include +#include + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + +/** + Section: Data Types Definitions +*/ + +/** + * result size of an A/D conversion + */ + +typedef uint16_t adc_result_t; + +/** + * result type of a Double ADC conversion + */ +typedef struct +{ + adc_result_t adcResult1; + adc_result_t adcResult2; +} adc_sync_double_result_t; + +/** ADC Channel Definition + + @Summary + Defines the channels available for conversion. + + @Description + This routine defines the channels that are available for the module to use. + + Remarks: + None + */ + +typedef enum +{ + ADC_BATT = 0x5, + channel_Temp = 0x1D, + channel_DAC = 0x1E, + channel_FVR = 0x1F +} adc_channel_t; + +/** + Section: ADC Module APIs +*/ + +/** + @Summary + Initializes the ADC1 + + @Description + This routine initializes the Initializes the ADC1. + This routine must be called before any other ADC1 routine is called. + This routine should only be called once during system initialization. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Comment + + + @Example + + uint16_t convertedValue; + + ADC1_Initialize(); + convertedValue = ADC1_GetConversionResult(); + +*/ +void ADC1_Initialize(void); + +/** + @Summary + Allows selection of a channel for conversion + + @Description + This routine is used to select desired channel for conversion. + available + + @Preconditions + ADC1_Initialize() function should have been called before calling this function. + + @Returns + None + + @Param + Pass in required channel number + "For available channel refer to enum under adc.h file" + + @Example + + uint16_t convertedValue; + + ADC1_Initialize(); + ADC1_SelectChannel(AN1_Channel); + ADC1_StartConversion(); + convertedValue = ADC1_GetConversionResult(); + +*/ +void ADC1_SelectChannel(adc_channel_t channel); + +/** + @Summary + Starts conversion + + @Description + This routine is used to start conversion of desired channel. + + @Preconditions + ADC1_Initialize() function should have been called before calling this function. + + @Returns + None + + @Param + None + + @Example + + uint16_t convertedValue; + + ADC1_Initialize(); + ADC1_StartConversion(); + convertedValue = ADC1_GetConversionResult(); + +*/ +void ADC1_StartConversion(); + +/** + @Summary + Returns true when the conversion is completed otherwise false. + + @Description + This routine is used to determine if conversion is completed. + When conversion is complete routine returns true. It returns false otherwise. + + @Preconditions + ADC1_Initialize() and ADC1_StartConversion(adc_channel_t channel) + function should have been called before calling this function. + + @Returns + true - If conversion is complete + false - If conversion is not completed + + @Param + None + + @Example + + uint16_t convertedValue; + + ADC1_Initialize(); + ADC1_StartConversion(AN1_Channel); + + while(!ADC1_IsConversionDone()); + convertedValue = ADC1_GetConversionResult(); + + */ +bool ADC1_IsConversionDone(); + +/** + @Summary + Returns the ADC1 conversion value. + + @Description + This routine is used to get the analog to digital converted value. This + routine gets converted values from the channel specified. + + @Preconditions + This routine returns the conversion value only after the conversion is complete. + Completion status can be checked using + ADC1_IsConversionDone() routine. + + @Returns + Returns the converted value. + + @Param + None + + @Example + + uint16_t convertedValue; + + ADC1_Initialize(); + ADC1_StartConversion(AN1_Channel); + + while(ADC1_IsConversionDone()); + + convertedValue = ADC1_GetConversionResult(); + + */ +adc_result_t ADC1_GetConversionResult(void); + +/** + @Summary + Returns the ADC1 conversion value + also allows selection of a channel for conversion. + + @Description + This routine is used to select desired channel for conversion + and to get the analog to digital converted value. + + @Preconditions + ADC1_Initialize() function should have been called before calling this function. + + @Returns + Returns the converted value. + + @Param + Pass in required channel number. + "For available channel refer to enum under adc.h file" + + @Example + + uint16_t convertedValue; + + ADC1_Initialize(); + + conversion = ADC1_GetConversion(AN1_Channel); + +*/ +adc_result_t ADC1_GetConversion(adc_channel_t channel); + +/** + @Summary + Acquisition Delay for temperature sensor + + @Description + This routine should be called when temperature sensor is used. + + @Preconditions + ADC1_Initialize() function should have been called before calling this function. + + @Returns + None + + @Param + None + + @Example + + uint16_t convertedValue; + + ADC1_Initialize(); + ADC1_StartConversion(); + ADC1_temperatureAcquisitionDelay(); + convertedValue = ADC1_GetConversionResult(); + +*/ +void ADC1_TemperatureAcquisitionDelay(void); + +#ifdef __cplusplus // Provide C++ Compatibility + + } + +#endif + +#endif //ADC1_H +/** + End of File +*/ + Index: /RF_BT_Tail/mcc_generated_files/pin_manager.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/pin_manager.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/pin_manager.c (revision 244) @@ -0,0 +1,123 @@ +/** + Generated Pin Manager File + + Company: + Microchip Technology Inc. + + File Name: + pin_manager.c + + Summary: + This is the Pin Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + Description: + This header file provides implementations for pin APIs for all pins selected in the GUI. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.11 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 + + Copyright (c) 2013 - 2015 released Microchip Technology Inc. All rights reserved. +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#include +#include "pin_manager.h" +#include "stdbool.h" + + + + + +void PIN_MANAGER_Initialize(void) +{ + /** + LATx registers + */ + LATA = 0x30; + LATB = 0x10; + LATC = 0x00; + + /** + TRISx registers + */ + TRISA = 0x00; + TRISB = 0x00; + TRISC = 0x6E; + + /** + ANSELx registers + */ + ANSELC = 0x06; + ANSELB = 0x00; + ANSELA = 0x00; + + /** + WPUx registers + */ + WPUB = 0x00; + WPUA = 0x00; + WPUC = 0x00; + OPTION_REGbits.nWPUEN = 1; + + /** + ODx registers + */ + ODCONA = 0x00; + ODCONB = 0x00; + ODCONC = 0x00; + + /** + SLRCONx registers + */ + SLRCONA = 0x37; + SLRCONB = 0xF0; + SLRCONC = 0xFF; + + + + + + + + + RXPPS = 0x13; //RC3->EUSART:RX; + T1GPPS = 0x13; //RC3->TMR1:T1G; + RB6PPS = 0x04; //RB6->PWM2:PWM2OUT; + RB7PPS = 0x05; //RB7->PWM3:PWM3OUT; + RB5PPS = 0x03; //RB5->PWM1:PWM1OUT; + RC4PPS = 0x09; //RC4->EUSART:TX; +} + +void PIN_MANAGER_IOC(void) +{ +} + +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/tmr0.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/tmr0.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/tmr0.c (revision 244) @@ -0,0 +1,136 @@ +/** + TMR0 Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + tmr0.c + + @Summary + This is the generated driver implementation file for the TMR0 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This source file provides APIs for TMR0. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +/** + Section: Included Files +*/ + +#include +#include "tmr0.h" + +/** + Section: Global Variables Definitions +*/ + +volatile uint8_t timer0ReloadVal; +void (*TMR0_InterruptHandler)(void); +/** + Section: TMR0 APIs +*/ + +void TMR0_Initialize(void) +{ + // Set TMR0 to the options selected in the User Interface + + // PSA assigned; PS 1:8; TMRSE Increment_hi_lo; mask the nWPUEN and INTEDG bits + OPTION_REG = (uint8_t)((OPTION_REG & 0xC0) | (0xD2 & 0x3F)); + + // TMR0 6; + TMR0 = 0x06; + + // Load the TMR value to reload variable + timer0ReloadVal= 6; + + // Clear Interrupt flag before enabling the interrupt + INTCONbits.TMR0IF = 0; + + // Enabling TMR0 interrupt + INTCONbits.TMR0IE = 1; + + // Set Default Interrupt Handler + TMR0_SetInterruptHandler(TMR0_DefaultInterruptHandler); +} + +uint8_t TMR0_ReadTimer(void) +{ + uint8_t readVal; + + readVal = TMR0; + + return readVal; +} + +void TMR0_WriteTimer(uint8_t timerVal) +{ + // Write to the Timer0 register + TMR0 = timerVal; +} + +void TMR0_Reload(void) +{ + // Write to the Timer0 register + TMR0 = timer0ReloadVal; +} + +void TMR0_ISR(void) +{ + + // Clear the TMR0 interrupt flag + INTCONbits.TMR0IF = 0; + + TMR0 = timer0ReloadVal; + + if(TMR0_InterruptHandler) + { + TMR0_InterruptHandler(); + } + + // add your TMR0 interrupt custom code +} + + +void TMR0_SetInterruptHandler(void (* InterruptHandler)(void)){ + TMR0_InterruptHandler = InterruptHandler; +} + +void TMR0_DefaultInterruptHandler(void){ + // add your TMR0 interrupt custom code + // or set custom function using TMR0_SetInterruptHandler() +} + +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/tmr1.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/tmr1.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/tmr1.c (revision 244) @@ -0,0 +1,216 @@ +/** + TMR1 Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + tmr1.c + + @Summary + This is the generated driver implementation file for the TMR1 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This source file provides APIs for TMR1. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.11 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +/** + Section: Included Files +*/ + +#include +#include "tmr1.h" + +/** + Section: Global Variables Definitions +*/ +volatile uint16_t timer1ReloadVal; +void (*TMR1_InterruptHandler)(void); +void (*TMR1G_InterruptHandler)(void); + +/** + Section: TMR1 APIs +*/ + +void TMR1_Initialize(void) +{ + //Set the Timer to the options selected in the GUI + + //T1GSS T1G_pin; TMR1GE enabled; T1GTM disabled; T1GPOL high; T1GGO done; T1GSPM enabled; + T1GCON = 0xD0; + + //TMR1H 0; + TMR1H = 0x00; + + //TMR1L 0; + TMR1L = 0x00; + + // Load the TMR value to reload variable + timer1ReloadVal=(uint16_t)((TMR1H << 8) | TMR1L); + + // Clearing IF flag before enabling the interrupt. + PIR1bits.TMR1IF = 0; + + // Enabling TMR1 interrupt. + PIE1bits.TMR1IE = 1; + + // Set Default Interrupt Handlers + TMR1_SetInterruptHandler(TMR1_DefaultInterruptHandler); + TMR1G_SetInterruptHandler(TMR1G_DefaultInterruptHandler); + // Clearing IF flag before enabling the interrupt. + PIR1bits.TMR1GIF = 0; + + // Enabling TMR1 interrupt. + PIE1bits.TMR1GIE = 1; + + // T1CKPS 1:1; nT1SYNC synchronize; TMR1CS FOSC/4; TMR1ON enabled; + T1CON = 0x01; +} + +void TMR1_StartTimer(void) +{ + // Start the Timer by writing to TMRxON bit + T1CONbits.TMR1ON = 1; +} + +void TMR1_StopTimer(void) +{ + // Stop the Timer by writing to TMRxON bit + T1CONbits.TMR1ON = 0; +} + +uint16_t TMR1_ReadTimer(void) +{ + uint16_t readVal; + uint8_t readValHigh; + uint8_t readValLow; + + + readValLow = TMR1L; + readValHigh = TMR1H; + + readVal = ((uint16_t)readValHigh << 8) | readValLow; + + return readVal; +} + +void TMR1_WriteTimer(uint16_t timerVal) +{ + if (T1CONbits.nT1SYNC == 1) + { + // Stop the Timer by writing to TMRxON bit + T1CONbits.TMR1ON = 0; + + // Write to the Timer1 register + TMR1H = (timerVal >> 8); + TMR1L = timerVal; + + // Start the Timer after writing to the register + T1CONbits.TMR1ON =1; + } + else + { + // Write to the Timer1 register + TMR1H = (timerVal >> 8); + TMR1L = timerVal; + } +} + +void TMR1_Reload(void) +{ + TMR1_WriteTimer(timer1ReloadVal); +} + +void TMR1_StartSinglePulseAcquisition(void) +{ + T1GCONbits.T1GGO = 1; +} + +uint8_t TMR1_CheckGateValueStatus(void) +{ + return (T1GCONbits.T1GVAL); +} + +void TMR1_ISR(void) +{ + + // Clear the TMR1 interrupt flag + PIR1bits.TMR1IF = 0; + TMR1_WriteTimer(timer1ReloadVal); + + if(TMR1_InterruptHandler) + { + TMR1_InterruptHandler(); + } +} + + +void TMR1_SetInterruptHandler(void (* InterruptHandler)(void)){ + TMR1_InterruptHandler = InterruptHandler; +} + +void TMR1G_SetInterruptHandler(void (* InterruptHandler)(void)){ + TMR1G_InterruptHandler = InterruptHandler; +} + +void TMR1_DefaultInterruptHandler(void){ + // add your TMR1 interrupt custom code + // or set custom function using TMR1_SetInterruptHandler() +} + +void TMR1G_DefaultInterruptHandler(void){ + // add your TMR1G interrupt custom code + // or set custom function using TMR1G_SetInterruptHandler() +} + +void TMR1_GATE_ISR(void) +{ + // clear the TMR1 interrupt flag + PIR1bits.TMR1GIF = 0; + if(TMR1G_InterruptHandler) + { + TMR1G_InterruptHandler(); + } +} + +void TMR1G_Polarity(uint8_t pol) +{ + if (pol) + T1GCONbits.T1GPOL = 1; + else + T1GCONbits.T1GPOL = 0; +} + +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/pwm1.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/pwm1.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/pwm1.c (revision 244) @@ -0,0 +1,186 @@ +/** + PWM1 Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + pwm1.c + + @Summary + This is the generated driver implementation file for the PWM1 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides implementations for driver APIs for PWM1. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +/** + Section: Included Files +*/ + +#include +#include "pwm1.h" + +/** + Section: PWM1 APIs +*/ + +void PWM1_Initialize(void) +{ + // set the PWM1 to the options selected in the User Interface + + //PHIE disabled; DCIE disabled; OFIE disabled; PRIE disabled; + PWM1INTE = 0x00; + + //PHIF cleared; OFIF cleared; DCIF cleared; PRIF cleared; + PWM1INTF = 0x00; + + //PS Divide_clock_src_by_4; CS FOSC; + PWM1CLKCON = 0x20; + + //LDS LD1_trigger; LDT disabled; LDA do_not_load; + PWM1LDCON = 0x00; + + //OFM independent_run; OFS OF1_match; OFO match_incrementing; + PWM1OFCON = 0x00; + + //PWM1PHH 0; + PWM1PHH = 0x00; + + //PWM1PHL 0; + PWM1PHL = 0x00; + + //PWM1DCH 10; + PWM1DCH = 0x0A; + + //PWM1DCL 240; + PWM1DCL = 0xF0; + + //PWM1PRH 156; + PWM1PRH = 0x9C; + + //PWM1PRL 63; + PWM1PRL = 0x3F; + + //PWM1OFH 0; + PWM1OFH = 0x00; + + //PWM1OFL 1; + PWM1OFL = 0x01; + + //PWM1TMRH 0; + PWM1TMRH = 0x00; + + //PWM1TMRL 0; + PWM1TMRL = 0x00; + + //MODE standard_PWM; POL active_hi; EN enabled; + PWM1CON = 0x80; + +} + + +void PWM1_Start(void) +{ + PWM1CONbits.EN = 1; +} + +void PWM1_Stop(void) +{ + PWM1CONbits.EN = 0; +} + +bool PWM1_CheckOutputStatus(void) +{ + return (PWM1CONbits.OUT); +} + +void PWM1_LoadBufferSet(void) +{ + PWM1LDCONbits.LDA = 1; +} + +void PWM1_PhaseSet(uint16_t phaseCount) +{ + PWM1PHH = (phaseCount>>8); //writing 8 MSBs to PWMPHH register + PWM1PHL = (phaseCount); //writing 8 LSBs to PWMPHL register +} + +void PWM1_DutyCycleSet(uint16_t dutyCycleCount) +{ + PWM1DCH = (dutyCycleCount>>8); //writing 8 MSBs to PWMDCH register + PWM1DCL = (dutyCycleCount); //writing 8 LSBs to PWMDCL register +} + +void PWM1_PeriodSet(uint16_t periodCount) +{ + PWM1PRH = (periodCount>>8); //writing 8 MSBs to PWMPRH register + PWM1PRL = (periodCount); //writing 8 LSBs to PWMPRL register +} + +void PWM1_OffsetSet(uint16_t offsetCount) +{ + PWM1OFH = (offsetCount>>8); //writing 8 MSBs to PWMOFH register + PWM1OFL = (offsetCount); //writing 8 LSBs to PWMOFL register +} + +uint16_t PWM1_TimerCountGet(void) +{ + return ((uint16_t)((PWM1TMRH<<8) | PWM1TMRL)); +} + +bool PWM1_IsOffsetMatchOccured(void) +{ + return (PWM1INTFbits.OFIF); +} + +bool PWM1_IsPhaseMatchOccured(void) +{ + return (PWM1INTFbits.PHIF); +} + +bool PWM1_IsDutyCycleMatchOccured(void) +{ + return (PWM1INTFbits.DCIF); +} + +bool PWM1_IsPeriodMatchOccured(void) +{ + return (PWM1INTFbits.PRIF); +} + +/** + End of File +*/ + + Index: /RF_BT_Tail/mcc_generated_files/device_config.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/device_config.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/device_config.c (revision 244) @@ -0,0 +1,65 @@ +/** + @Generated PIC10 / PIC12 / PIC16 / PIC18 MCUs Source File + + @Company: + Microchip Technology Inc. + + @File Name: + mcc.c + + @Summary: + This is the device_config.c file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description: + This header file provides implementations for driver APIs for all modules selected in the GUI. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.00 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +// Configuration bits: selected in the GUI + +// CONFIG1 +#pragma config FOSC = INTOSC // Oscillator Selection Bits->INTOSC oscillator; I/O function on CLKIN pin +#pragma config WDTE = OFF // Watchdog Timer Enable->WDT disabled +#pragma config PWRTE = OFF // Power-up Timer Enable->PWRT disabled +#pragma config MCLRE = OFF // MCLR Pin Function Select->MCLR/VPP pin function is digital input +#pragma config CP = ON // Flash Program Memory Code Protection->Program memory code protection is enabled +#pragma config BOREN = OFF // Brown-out Reset Enable->Brown-out Reset disabled +#pragma config CLKOUTEN = OFF // Clock Out Enable->CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin + +// CONFIG2 +#pragma config WRT = ALL // Flash Memory Self-Write Protection->000h to FFFh write protected, no addresses may be modified by EECON control +#pragma config PPS1WAY = ON // PPSLOCK bit One-Way Set Enable bit->PPSLOCKED Bit Can Be Cleared & Set Once +#pragma config PLLEN = OFF // PLL Enable->4x PLL disabled +#pragma config STVREN = OFF // Stack Overflow/Underflow Reset Enable->Stack Overflow or Underflow will not cause a Reset +#pragma config BORV = LO // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (Vbor), low trip point selected. +#pragma config LPBOREN = OFF // Low Power Brown-out Reset enable bit->LPBOR is disabled +#pragma config LVP = OFF // Low-Voltage Programming Enable->High-voltage on MCLR/VPP must be used for programming Index: /RF_BT_Tail/mcc_generated_files/pwm2.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/pwm2.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/pwm2.c (revision 244) @@ -0,0 +1,186 @@ +/** + PWM2 Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + pwm2.c + + @Summary + This is the generated driver implementation file for the PWM2 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides implementations for driver APIs for PWM2. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +/** + Section: Included Files +*/ + +#include +#include "pwm2.h" + +/** + Section: PWM2 APIs +*/ + +void PWM2_Initialize(void) +{ + // set the PWM2 to the options selected in the User Interface + + //PHIE disabled; DCIE disabled; OFIE disabled; PRIE disabled; + PWM2INTE = 0x00; + + //PHIF cleared; OFIF cleared; DCIF cleared; PRIF cleared; + PWM2INTF = 0x00; + + //PS Divide_clock_src_by_4; CS FOSC; + PWM2CLKCON = 0x20; + + //LDS LD1_trigger; LDT disabled; LDA do_not_load; + PWM2LDCON = 0x00; + + //OFM independent_run; OFS OF1_match; OFO match_incrementing; + PWM2OFCON = 0x00; + + //PWM2PHH 0; + PWM2PHH = 0x00; + + //PWM2PHL 0; + PWM2PHL = 0x00; + + //PWM2DCH 10; + PWM2DCH = 0x0A; + + //PWM2DCL 240; + PWM2DCL = 0xF0; + + //PWM2PRH 156; + PWM2PRH = 0x9C; + + //PWM2PRL 63; + PWM2PRL = 0x3F; + + //PWM2OFH 0; + PWM2OFH = 0x00; + + //PWM2OFL 1; + PWM2OFL = 0x01; + + //PWM2TMRH 0; + PWM2TMRH = 0x00; + + //PWM2TMRL 0; + PWM2TMRL = 0x00; + + //MODE standard_PWM; POL active_hi; EN enabled; + PWM2CON = 0x80; + +} + + +void PWM2_Start(void) +{ + PWM2CONbits.EN = 1; +} + +void PWM2_Stop(void) +{ + PWM2CONbits.EN = 0; +} + +bool PWM2_CheckOutputStatus(void) +{ + return (PWM2CONbits.OUT); +} + +void PWM2_LoadBufferSet(void) +{ + PWM2LDCONbits.LDA = 1; +} + +void PWM2_PhaseSet(uint16_t phaseCount) +{ + PWM2PHH = (phaseCount>>8); //writing 8 MSBs to PWMPHH register + PWM2PHL = (phaseCount); //writing 8 LSBs to PWMPHL register +} + +void PWM2_DutyCycleSet(uint16_t dutyCycleCount) +{ + PWM2DCH = (dutyCycleCount>>8); //writing 8 MSBs to PWMDCH register + PWM2DCL = (dutyCycleCount); //writing 8 LSBs to PWMDCL register +} + +void PWM2_PeriodSet(uint16_t periodCount) +{ + PWM2PRH = (periodCount>>8); //writing 8 MSBs to PWMPRH register + PWM2PRL = (periodCount); //writing 8 LSBs to PWMPRL register +} + +void PWM2_OffsetSet(uint16_t offsetCount) +{ + PWM2OFH = (offsetCount>>8); //writing 8 MSBs to PWMOFH register + PWM2OFL = (offsetCount); //writing 8 LSBs to PWMOFL register +} + +uint16_t PWM2_TimerCountGet(void) +{ + return ((uint16_t)((PWM2TMRH<<8) | PWM2TMRL)); +} + +bool PWM2_IsOffsetMatchOccured(void) +{ + return (PWM2INTFbits.OFIF); +} + +bool PWM2_IsPhaseMatchOccured(void) +{ + return (PWM2INTFbits.PHIF); +} + +bool PWM2_IsDutyCycleMatchOccured(void) +{ + return (PWM2INTFbits.DCIF); +} + +bool PWM2_IsPeriodMatchOccured(void) +{ + return (PWM2INTFbits.PRIF); +} + +/** + End of File +*/ + + Index: /RF_BT_Tail/mcc_generated_files/pin_manager.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/pin_manager.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/pin_manager.h (revision 244) @@ -0,0 +1,403 @@ +/** + @Generated Pin Manager Header File + + @Company: + Microchip Technology Inc. + + @File Name: + pin_manager.h + + @Summary: + This is the Pin Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for driver for . + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.11 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef PIN_MANAGER_H +#define PIN_MANAGER_H + +#define INPUT 1 +#define OUTPUT 0 + +#define HIGH 1 +#define LOW 0 + +#define ANALOG 1 +#define DIGITAL 0 + +#define PULL_UP_ENABLED 1 +#define PULL_UP_DISABLED 0 + +// get/set UNUSED1 aliases +#define UNUSED1_TRIS TRISAbits.TRISA0 +#define UNUSED1_LAT LATAbits.LATA0 +#define UNUSED1_PORT PORTAbits.RA0 +#define UNUSED1_WPU WPUAbits.WPUA0 +#define UNUSED1_OD ODCONAbits.ODA0 +#define UNUSED1_ANS ANSELAbits.ANSA0 +#define UNUSED1_SetHigh() do { LATAbits.LATA0 = 1; } while(0) +#define UNUSED1_SetLow() do { LATAbits.LATA0 = 0; } while(0) +#define UNUSED1_Toggle() do { LATAbits.LATA0 = ~LATAbits.LATA0; } while(0) +#define UNUSED1_GetValue() PORTAbits.RA0 +#define UNUSED1_SetDigitalInput() do { TRISAbits.TRISA0 = 1; } while(0) +#define UNUSED1_SetDigitalOutput() do { TRISAbits.TRISA0 = 0; } while(0) +#define UNUSED1_SetPullup() do { WPUAbits.WPUA0 = 1; } while(0) +#define UNUSED1_ResetPullup() do { WPUAbits.WPUA0 = 0; } while(0) +#define UNUSED1_SetPushPull() do { ODCONAbits.ODA0 = 0; } while(0) +#define UNUSED1_SetOpenDrain() do { ODCONAbits.ODA0 = 1; } while(0) +#define UNUSED1_SetAnalogMode() do { ANSELAbits.ANSA0 = 1; } while(0) +#define UNUSED1_SetDigitalMode() do { ANSELAbits.ANSA0 = 0; } while(0) + +// get/set UNUSED2 aliases +#define UNUSED2_TRIS TRISAbits.TRISA1 +#define UNUSED2_LAT LATAbits.LATA1 +#define UNUSED2_PORT PORTAbits.RA1 +#define UNUSED2_WPU WPUAbits.WPUA1 +#define UNUSED2_OD ODCONAbits.ODA1 +#define UNUSED2_ANS ANSELAbits.ANSA1 +#define UNUSED2_SetHigh() do { LATAbits.LATA1 = 1; } while(0) +#define UNUSED2_SetLow() do { LATAbits.LATA1 = 0; } while(0) +#define UNUSED2_Toggle() do { LATAbits.LATA1 = ~LATAbits.LATA1; } while(0) +#define UNUSED2_GetValue() PORTAbits.RA1 +#define UNUSED2_SetDigitalInput() do { TRISAbits.TRISA1 = 1; } while(0) +#define UNUSED2_SetDigitalOutput() do { TRISAbits.TRISA1 = 0; } while(0) +#define UNUSED2_SetPullup() do { WPUAbits.WPUA1 = 1; } while(0) +#define UNUSED2_ResetPullup() do { WPUAbits.WPUA1 = 0; } while(0) +#define UNUSED2_SetPushPull() do { ODCONAbits.ODA1 = 0; } while(0) +#define UNUSED2_SetOpenDrain() do { ODCONAbits.ODA1 = 1; } while(0) +#define UNUSED2_SetAnalogMode() do { ANSELAbits.ANSA1 = 1; } while(0) +#define UNUSED2_SetDigitalMode() do { ANSELAbits.ANSA1 = 0; } while(0) + +// get/set UNUSED3 aliases +#define UNUSED3_TRIS TRISAbits.TRISA2 +#define UNUSED3_LAT LATAbits.LATA2 +#define UNUSED3_PORT PORTAbits.RA2 +#define UNUSED3_WPU WPUAbits.WPUA2 +#define UNUSED3_OD ODCONAbits.ODA2 +#define UNUSED3_ANS ANSELAbits.ANSA2 +#define UNUSED3_SetHigh() do { LATAbits.LATA2 = 1; } while(0) +#define UNUSED3_SetLow() do { LATAbits.LATA2 = 0; } while(0) +#define UNUSED3_Toggle() do { LATAbits.LATA2 = ~LATAbits.LATA2; } while(0) +#define UNUSED3_GetValue() PORTAbits.RA2 +#define UNUSED3_SetDigitalInput() do { TRISAbits.TRISA2 = 1; } while(0) +#define UNUSED3_SetDigitalOutput() do { TRISAbits.TRISA2 = 0; } while(0) +#define UNUSED3_SetPullup() do { WPUAbits.WPUA2 = 1; } while(0) +#define UNUSED3_ResetPullup() do { WPUAbits.WPUA2 = 0; } while(0) +#define UNUSED3_SetPushPull() do { ODCONAbits.ODA2 = 0; } while(0) +#define UNUSED3_SetOpenDrain() do { ODCONAbits.ODA2 = 1; } while(0) +#define UNUSED3_SetAnalogMode() do { ANSELAbits.ANSA2 = 1; } while(0) +#define UNUSED3_SetDigitalMode() do { ANSELAbits.ANSA2 = 0; } while(0) + +// get/set UNUSED4 aliases +#define UNUSED4_TRIS TRISAbits.TRISA3 +#define UNUSED4_PORT PORTAbits.RA3 +#define UNUSED4_WPU WPUAbits.WPUA3 +#define UNUSED4_GetValue() PORTAbits.RA3 +#define UNUSED4_SetDigitalInput() do { TRISAbits.TRISA3 = 1; } while(0) +#define UNUSED4_SetDigitalOutput() do { TRISAbits.TRISA3 = 0; } while(0) +#define UNUSED4_SetPullup() do { WPUAbits.WPUA3 = 1; } while(0) +#define UNUSED4_ResetPullup() do { WPUAbits.WPUA3 = 0; } while(0) + +// get/set IO_LED_BLUE_N aliases +#define IO_LED_BLUE_N_TRIS TRISAbits.TRISA4 +#define IO_LED_BLUE_N_LAT LATAbits.LATA4 +#define IO_LED_BLUE_N_PORT PORTAbits.RA4 +#define IO_LED_BLUE_N_WPU WPUAbits.WPUA4 +#define IO_LED_BLUE_N_OD ODCONAbits.ODA4 +#define IO_LED_BLUE_N_ANS ANSELAbits.ANSA4 +#define IO_LED_BLUE_N_SetHigh() do { LATAbits.LATA4 = 1; } while(0) +#define IO_LED_BLUE_N_SetLow() do { LATAbits.LATA4 = 0; } while(0) +#define IO_LED_BLUE_N_Toggle() do { LATAbits.LATA4 = ~LATAbits.LATA4; } while(0) +#define IO_LED_BLUE_N_GetValue() PORTAbits.RA4 +#define IO_LED_BLUE_N_SetDigitalInput() do { TRISAbits.TRISA4 = 1; } while(0) +#define IO_LED_BLUE_N_SetDigitalOutput() do { TRISAbits.TRISA4 = 0; } while(0) +#define IO_LED_BLUE_N_SetPullup() do { WPUAbits.WPUA4 = 1; } while(0) +#define IO_LED_BLUE_N_ResetPullup() do { WPUAbits.WPUA4 = 0; } while(0) +#define IO_LED_BLUE_N_SetPushPull() do { ODCONAbits.ODA4 = 0; } while(0) +#define IO_LED_BLUE_N_SetOpenDrain() do { ODCONAbits.ODA4 = 1; } while(0) +#define IO_LED_BLUE_N_SetAnalogMode() do { ANSELAbits.ANSA4 = 1; } while(0) +#define IO_LED_BLUE_N_SetDigitalMode() do { ANSELAbits.ANSA4 = 0; } while(0) + +// get/set IO_LED_RED_N aliases +#define IO_LED_RED_N_TRIS TRISAbits.TRISA5 +#define IO_LED_RED_N_LAT LATAbits.LATA5 +#define IO_LED_RED_N_PORT PORTAbits.RA5 +#define IO_LED_RED_N_WPU WPUAbits.WPUA5 +#define IO_LED_RED_N_OD ODCONAbits.ODA5 +#define IO_LED_RED_N_SetHigh() do { LATAbits.LATA5 = 1; } while(0) +#define IO_LED_RED_N_SetLow() do { LATAbits.LATA5 = 0; } while(0) +#define IO_LED_RED_N_Toggle() do { LATAbits.LATA5 = ~LATAbits.LATA5; } while(0) +#define IO_LED_RED_N_GetValue() PORTAbits.RA5 +#define IO_LED_RED_N_SetDigitalInput() do { TRISAbits.TRISA5 = 1; } while(0) +#define IO_LED_RED_N_SetDigitalOutput() do { TRISAbits.TRISA5 = 0; } while(0) +#define IO_LED_RED_N_SetPullup() do { WPUAbits.WPUA5 = 1; } while(0) +#define IO_LED_RED_N_ResetPullup() do { WPUAbits.WPUA5 = 0; } while(0) +#define IO_LED_RED_N_SetPushPull() do { ODCONAbits.ODA5 = 0; } while(0) +#define IO_LED_RED_N_SetOpenDrain() do { ODCONAbits.ODA5 = 1; } while(0) + +// get/set IO_POW aliases +#define IO_POW_TRIS TRISBbits.TRISB4 +#define IO_POW_LAT LATBbits.LATB4 +#define IO_POW_PORT PORTBbits.RB4 +#define IO_POW_WPU WPUBbits.WPUB4 +#define IO_POW_OD ODCONBbits.ODB4 +#define IO_POW_ANS ANSELBbits.ANSB4 +#define IO_POW_SetHigh() do { LATBbits.LATB4 = 1; } while(0) +#define IO_POW_SetLow() do { LATBbits.LATB4 = 0; } while(0) +#define IO_POW_Toggle() do { LATBbits.LATB4 = ~LATBbits.LATB4; } while(0) +#define IO_POW_GetValue() PORTBbits.RB4 +#define IO_POW_SetDigitalInput() do { TRISBbits.TRISB4 = 1; } while(0) +#define IO_POW_SetDigitalOutput() do { TRISBbits.TRISB4 = 0; } while(0) +#define IO_POW_SetPullup() do { WPUBbits.WPUB4 = 1; } while(0) +#define IO_POW_ResetPullup() do { WPUBbits.WPUB4 = 0; } while(0) +#define IO_POW_SetPushPull() do { ODCONBbits.ODB4 = 0; } while(0) +#define IO_POW_SetOpenDrain() do { ODCONBbits.ODB4 = 1; } while(0) +#define IO_POW_SetAnalogMode() do { ANSELBbits.ANSB4 = 1; } while(0) +#define IO_POW_SetDigitalMode() do { ANSELBbits.ANSB4 = 0; } while(0) + +// get/set IO_PWM1 aliases +#define IO_PWM1_TRIS TRISBbits.TRISB5 +#define IO_PWM1_LAT LATBbits.LATB5 +#define IO_PWM1_PORT PORTBbits.RB5 +#define IO_PWM1_WPU WPUBbits.WPUB5 +#define IO_PWM1_OD ODCONBbits.ODB5 +#define IO_PWM1_ANS ANSELBbits.ANSB5 +#define IO_PWM1_SetHigh() do { LATBbits.LATB5 = 1; } while(0) +#define IO_PWM1_SetLow() do { LATBbits.LATB5 = 0; } while(0) +#define IO_PWM1_Toggle() do { LATBbits.LATB5 = ~LATBbits.LATB5; } while(0) +#define IO_PWM1_GetValue() PORTBbits.RB5 +#define IO_PWM1_SetDigitalInput() do { TRISBbits.TRISB5 = 1; } while(0) +#define IO_PWM1_SetDigitalOutput() do { TRISBbits.TRISB5 = 0; } while(0) +#define IO_PWM1_SetPullup() do { WPUBbits.WPUB5 = 1; } while(0) +#define IO_PWM1_ResetPullup() do { WPUBbits.WPUB5 = 0; } while(0) +#define IO_PWM1_SetPushPull() do { ODCONBbits.ODB5 = 0; } while(0) +#define IO_PWM1_SetOpenDrain() do { ODCONBbits.ODB5 = 1; } while(0) +#define IO_PWM1_SetAnalogMode() do { ANSELBbits.ANSB5 = 1; } while(0) +#define IO_PWM1_SetDigitalMode() do { ANSELBbits.ANSB5 = 0; } while(0) + +// get/set IO_PWM2 aliases +#define IO_PWM2_TRIS TRISBbits.TRISB6 +#define IO_PWM2_LAT LATBbits.LATB6 +#define IO_PWM2_PORT PORTBbits.RB6 +#define IO_PWM2_WPU WPUBbits.WPUB6 +#define IO_PWM2_OD ODCONBbits.ODB6 +#define IO_PWM2_SetHigh() do { LATBbits.LATB6 = 1; } while(0) +#define IO_PWM2_SetLow() do { LATBbits.LATB6 = 0; } while(0) +#define IO_PWM2_Toggle() do { LATBbits.LATB6 = ~LATBbits.LATB6; } while(0) +#define IO_PWM2_GetValue() PORTBbits.RB6 +#define IO_PWM2_SetDigitalInput() do { TRISBbits.TRISB6 = 1; } while(0) +#define IO_PWM2_SetDigitalOutput() do { TRISBbits.TRISB6 = 0; } while(0) +#define IO_PWM2_SetPullup() do { WPUBbits.WPUB6 = 1; } while(0) +#define IO_PWM2_ResetPullup() do { WPUBbits.WPUB6 = 0; } while(0) +#define IO_PWM2_SetPushPull() do { ODCONBbits.ODB6 = 0; } while(0) +#define IO_PWM2_SetOpenDrain() do { ODCONBbits.ODB6 = 1; } while(0) + +// get/set IO_PWM_LEDS aliases +#define IO_PWM_LEDS_TRIS TRISBbits.TRISB7 +#define IO_PWM_LEDS_LAT LATBbits.LATB7 +#define IO_PWM_LEDS_PORT PORTBbits.RB7 +#define IO_PWM_LEDS_WPU WPUBbits.WPUB7 +#define IO_PWM_LEDS_OD ODCONBbits.ODB7 +#define IO_PWM_LEDS_SetHigh() do { LATBbits.LATB7 = 1; } while(0) +#define IO_PWM_LEDS_SetLow() do { LATBbits.LATB7 = 0; } while(0) +#define IO_PWM_LEDS_Toggle() do { LATBbits.LATB7 = ~LATBbits.LATB7; } while(0) +#define IO_PWM_LEDS_GetValue() PORTBbits.RB7 +#define IO_PWM_LEDS_SetDigitalInput() do { TRISBbits.TRISB7 = 1; } while(0) +#define IO_PWM_LEDS_SetDigitalOutput() do { TRISBbits.TRISB7 = 0; } while(0) +#define IO_PWM_LEDS_SetPullup() do { WPUBbits.WPUB7 = 1; } while(0) +#define IO_PWM_LEDS_ResetPullup() do { WPUBbits.WPUB7 = 0; } while(0) +#define IO_PWM_LEDS_SetPushPull() do { ODCONBbits.ODB7 = 0; } while(0) +#define IO_PWM_LEDS_SetOpenDrain() do { ODCONBbits.ODB7 = 1; } while(0) + +// get/set IO_RC0 aliases +#define IO_RC0_TRIS TRISCbits.TRISC0 +#define IO_RC0_LAT LATCbits.LATC0 +#define IO_RC0_PORT PORTCbits.RC0 +#define IO_RC0_WPU WPUCbits.WPUC0 +#define IO_RC0_OD ODCONCbits.ODC0 +#define IO_RC0_ANS ANSELCbits.ANSC0 +#define IO_RC0_SetHigh() do { LATCbits.LATC0 = 1; } while(0) +#define IO_RC0_SetLow() do { LATCbits.LATC0 = 0; } while(0) +#define IO_RC0_Toggle() do { LATCbits.LATC0 = ~LATCbits.LATC0; } while(0) +#define IO_RC0_GetValue() PORTCbits.RC0 +#define IO_RC0_SetDigitalInput() do { TRISCbits.TRISC0 = 1; } while(0) +#define IO_RC0_SetDigitalOutput() do { TRISCbits.TRISC0 = 0; } while(0) +#define IO_RC0_SetPullup() do { WPUCbits.WPUC0 = 1; } while(0) +#define IO_RC0_ResetPullup() do { WPUCbits.WPUC0 = 0; } while(0) +#define IO_RC0_SetPushPull() do { ODCONCbits.ODC0 = 0; } while(0) +#define IO_RC0_SetOpenDrain() do { ODCONCbits.ODC0 = 1; } while(0) +#define IO_RC0_SetAnalogMode() do { ANSELCbits.ANSC0 = 1; } while(0) +#define IO_RC0_SetDigitalMode() do { ANSELCbits.ANSC0 = 0; } while(0) + +// get/set ADC_BATT aliases +#define ADC_BATT_TRIS TRISCbits.TRISC1 +#define ADC_BATT_LAT LATCbits.LATC1 +#define ADC_BATT_PORT PORTCbits.RC1 +#define ADC_BATT_WPU WPUCbits.WPUC1 +#define ADC_BATT_OD ODCONCbits.ODC1 +#define ADC_BATT_ANS ANSELCbits.ANSC1 +#define ADC_BATT_SetHigh() do { LATCbits.LATC1 = 1; } while(0) +#define ADC_BATT_SetLow() do { LATCbits.LATC1 = 0; } while(0) +#define ADC_BATT_Toggle() do { LATCbits.LATC1 = ~LATCbits.LATC1; } while(0) +#define ADC_BATT_GetValue() PORTCbits.RC1 +#define ADC_BATT_SetDigitalInput() do { TRISCbits.TRISC1 = 1; } while(0) +#define ADC_BATT_SetDigitalOutput() do { TRISCbits.TRISC1 = 0; } while(0) +#define ADC_BATT_SetPullup() do { WPUCbits.WPUC1 = 1; } while(0) +#define ADC_BATT_ResetPullup() do { WPUCbits.WPUC1 = 0; } while(0) +#define ADC_BATT_SetPushPull() do { ODCONCbits.ODC1 = 0; } while(0) +#define ADC_BATT_SetOpenDrain() do { ODCONCbits.ODC1 = 1; } while(0) +#define ADC_BATT_SetAnalogMode() do { ANSELCbits.ANSC1 = 1; } while(0) +#define ADC_BATT_SetDigitalMode() do { ANSELCbits.ANSC1 = 0; } while(0) + +// get/set RC2 procedures +#define RC2_SetHigh() do { LATCbits.LATC2 = 1; } while(0) +#define RC2_SetLow() do { LATCbits.LATC2 = 0; } while(0) +#define RC2_Toggle() do { LATCbits.LATC2 = ~LATCbits.LATC2; } while(0) +#define RC2_GetValue() PORTCbits.RC2 +#define RC2_SetDigitalInput() do { TRISCbits.TRISC2 = 1; } while(0) +#define RC2_SetDigitalOutput() do { TRISCbits.TRISC2 = 0; } while(0) +#define RC2_SetPullup() do { WPUCbits.WPUC2 = 1; } while(0) +#define RC2_ResetPullup() do { WPUCbits.WPUC2 = 0; } while(0) +#define RC2_SetAnalogMode() do { ANSELCbits.ANSC2 = 1; } while(0) +#define RC2_SetDigitalMode() do { ANSELCbits.ANSC2 = 0; } while(0) + +// get/set RC3 procedures +#define RC3_SetHigh() do { LATCbits.LATC3 = 1; } while(0) +#define RC3_SetLow() do { LATCbits.LATC3 = 0; } while(0) +#define RC3_Toggle() do { LATCbits.LATC3 = ~LATCbits.LATC3; } while(0) +#define RC3_GetValue() PORTCbits.RC3 +#define RC3_SetDigitalInput() do { TRISCbits.TRISC3 = 1; } while(0) +#define RC3_SetDigitalOutput() do { TRISCbits.TRISC3 = 0; } while(0) +#define RC3_SetPullup() do { WPUCbits.WPUC3 = 1; } while(0) +#define RC3_ResetPullup() do { WPUCbits.WPUC3 = 0; } while(0) +#define RC3_SetAnalogMode() do { ANSELCbits.ANSC3 = 1; } while(0) +#define RC3_SetDigitalMode() do { ANSELCbits.ANSC3 = 0; } while(0) + +// get/set RC4 procedures +#define RC4_SetHigh() do { LATCbits.LATC4 = 1; } while(0) +#define RC4_SetLow() do { LATCbits.LATC4 = 0; } while(0) +#define RC4_Toggle() do { LATCbits.LATC4 = ~LATCbits.LATC4; } while(0) +#define RC4_GetValue() PORTCbits.RC4 +#define RC4_SetDigitalInput() do { TRISCbits.TRISC4 = 1; } while(0) +#define RC4_SetDigitalOutput() do { TRISCbits.TRISC4 = 0; } while(0) +#define RC4_SetPullup() do { WPUCbits.WPUC4 = 1; } while(0) +#define RC4_ResetPullup() do { WPUCbits.WPUC4 = 0; } while(0) + +// get/set IO_PWRC aliases +#define IO_PWRC_TRIS TRISCbits.TRISC5 +#define IO_PWRC_LAT LATCbits.LATC5 +#define IO_PWRC_PORT PORTCbits.RC5 +#define IO_PWRC_WPU WPUCbits.WPUC5 +#define IO_PWRC_OD ODCONCbits.ODC5 +#define IO_PWRC_SetHigh() do { LATCbits.LATC5 = 1; } while(0) +#define IO_PWRC_SetLow() do { LATCbits.LATC5 = 0; } while(0) +#define IO_PWRC_Toggle() do { LATCbits.LATC5 = ~LATCbits.LATC5; } while(0) +#define IO_PWRC_GetValue() PORTCbits.RC5 +#define IO_PWRC_SetDigitalInput() do { TRISCbits.TRISC5 = 1; } while(0) +#define IO_PWRC_SetDigitalOutput() do { TRISCbits.TRISC5 = 0; } while(0) +#define IO_PWRC_SetPullup() do { WPUCbits.WPUC5 = 1; } while(0) +#define IO_PWRC_ResetPullup() do { WPUCbits.WPUC5 = 0; } while(0) +#define IO_PWRC_SetPushPull() do { ODCONCbits.ODC5 = 0; } while(0) +#define IO_PWRC_SetOpenDrain() do { ODCONCbits.ODC5 = 1; } while(0) + +// get/set IO_STA aliases +#define IO_STA_TRIS TRISCbits.TRISC6 +#define IO_STA_LAT LATCbits.LATC6 +#define IO_STA_PORT PORTCbits.RC6 +#define IO_STA_WPU WPUCbits.WPUC6 +#define IO_STA_OD ODCONCbits.ODC6 +#define IO_STA_ANS ANSELCbits.ANSC6 +#define IO_STA_SetHigh() do { LATCbits.LATC6 = 1; } while(0) +#define IO_STA_SetLow() do { LATCbits.LATC6 = 0; } while(0) +#define IO_STA_Toggle() do { LATCbits.LATC6 = ~LATCbits.LATC6; } while(0) +#define IO_STA_GetValue() PORTCbits.RC6 +#define IO_STA_SetDigitalInput() do { TRISCbits.TRISC6 = 1; } while(0) +#define IO_STA_SetDigitalOutput() do { TRISCbits.TRISC6 = 0; } while(0) +#define IO_STA_SetPullup() do { WPUCbits.WPUC6 = 1; } while(0) +#define IO_STA_ResetPullup() do { WPUCbits.WPUC6 = 0; } while(0) +#define IO_STA_SetPushPull() do { ODCONCbits.ODC6 = 0; } while(0) +#define IO_STA_SetOpenDrain() do { ODCONCbits.ODC6 = 1; } while(0) +#define IO_STA_SetAnalogMode() do { ANSELCbits.ANSC6 = 1; } while(0) +#define IO_STA_SetDigitalMode() do { ANSELCbits.ANSC6 = 0; } while(0) + +// get/set IO_SERVOS aliases +#define IO_SERVOS_TRIS TRISCbits.TRISC7 +#define IO_SERVOS_LAT LATCbits.LATC7 +#define IO_SERVOS_PORT PORTCbits.RC7 +#define IO_SERVOS_WPU WPUCbits.WPUC7 +#define IO_SERVOS_OD ODCONCbits.ODC7 +#define IO_SERVOS_ANS ANSELCbits.ANSC7 +#define IO_SERVOS_SetHigh() do { LATCbits.LATC7 = 1; } while(0) +#define IO_SERVOS_SetLow() do { LATCbits.LATC7 = 0; } while(0) +#define IO_SERVOS_Toggle() do { LATCbits.LATC7 = ~LATCbits.LATC7; } while(0) +#define IO_SERVOS_GetValue() PORTCbits.RC7 +#define IO_SERVOS_SetDigitalInput() do { TRISCbits.TRISC7 = 1; } while(0) +#define IO_SERVOS_SetDigitalOutput() do { TRISCbits.TRISC7 = 0; } while(0) +#define IO_SERVOS_SetPullup() do { WPUCbits.WPUC7 = 1; } while(0) +#define IO_SERVOS_ResetPullup() do { WPUCbits.WPUC7 = 0; } while(0) +#define IO_SERVOS_SetPushPull() do { ODCONCbits.ODC7 = 0; } while(0) +#define IO_SERVOS_SetOpenDrain() do { ODCONCbits.ODC7 = 1; } while(0) +#define IO_SERVOS_SetAnalogMode() do { ANSELCbits.ANSC7 = 1; } while(0) +#define IO_SERVOS_SetDigitalMode() do { ANSELCbits.ANSC7 = 0; } while(0) + +/** + @Param + none + @Returns + none + @Description + GPIO and peripheral I/O initialization + @Example + PIN_MANAGER_Initialize(); + */ +void PIN_MANAGER_Initialize (void); + +/** + * @Param + none + * @Returns + none + * @Description + Interrupt on Change Handling routine + * @Example + PIN_MANAGER_IOC(); + */ +void PIN_MANAGER_IOC(void); + + + +#endif // PIN_MANAGER_H +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/interrupt_manager.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/interrupt_manager.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/interrupt_manager.c (revision 244) @@ -0,0 +1,89 @@ +/** + Generated Interrupt Manager Source File + + @Company: + Microchip Technology Inc. + + @File Name: + interrupt_manager.c + + @Summary: + This is the Interrupt Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description: + This header file provides implementations for global interrupt handling. + For individual peripheral handlers please see the peripheral driver for + all modules selected in the GUI. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.03 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#include "interrupt_manager.h" +#include "mcc.h" + +void __interrupt() INTERRUPT_InterruptManager (void) +{ + // interrupt handler + if(INTCONbits.TMR0IE == 1 && INTCONbits.TMR0IF == 1) + { + TMR0_ISR(); + } + else if(INTCONbits.PEIE == 1) + { + if(PIE1bits.TXIE == 1 && PIR1bits.TXIF == 1) + { + EUSART_TxDefaultInterruptHandler(); + } + else if(PIE1bits.RCIE == 1 && PIR1bits.RCIF == 1) + { + EUSART_RxDefaultInterruptHandler(); + } + else if(PIE1bits.TMR1IE == 1 && PIR1bits.TMR1IF == 1) + { + TMR1_ISR(); + } + else if(PIE1bits.TMR1GIE == 1 && PIR1bits.TMR1GIF == 1) + { + TMR1_GATE_ISR(); + } + else + { + //Unhandled Interrupt + } + } + else + { + //Unhandled Interrupt + } +} +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/pwm3.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/pwm3.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/pwm3.c (revision 244) @@ -0,0 +1,186 @@ +/** + PWM3 Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + pwm3.c + + @Summary + This is the generated driver implementation file for the PWM3 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides implementations for driver APIs for PWM3. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +/** + Section: Included Files +*/ + +#include +#include "pwm3.h" + +/** + Section: PWM3 APIs +*/ + +void PWM3_Initialize(void) +{ + // set the PWM3 to the options selected in the User Interface + + //PHIE disabled; DCIE disabled; OFIE disabled; PRIE disabled; + PWM3INTE = 0x00; + + //PHIF cleared; OFIF cleared; DCIF cleared; PRIF cleared; + PWM3INTF = 0x00; + + //PS No_Prescalar; CS FOSC; + PWM3CLKCON = 0x00; + + //LDS LD1_trigger; LDT disabled; LDA do_not_load; + PWM3LDCON = 0x00; + + //OFM independent_run; OFS OF1_match; OFO match_incrementing; + PWM3OFCON = 0x00; + + //PWM3PHH 0; + PWM3PHH = 0x00; + + //PWM3PHL 0; + PWM3PHL = 0x00; + + //PWM3DCH 0; + PWM3DCH = 0x00; + + //PWM3DCL 80; + PWM3DCL = 0x50; + + //PWM3PRH 31; + PWM3PRH = 0x1F; + + //PWM3PRL 64; + PWM3PRL = 0x40; + + //PWM3OFH 0; + PWM3OFH = 0x00; + + //PWM3OFL 1; + PWM3OFL = 0x01; + + //PWM3TMRH 0; + PWM3TMRH = 0x00; + + //PWM3TMRL 0; + PWM3TMRL = 0x00; + + //MODE standard_PWM; POL active_hi; EN enabled; + PWM3CON = 0x80; + +} + + +void PWM3_Start(void) +{ + PWM3CONbits.EN = 1; +} + +void PWM3_Stop(void) +{ + PWM3CONbits.EN = 0; +} + +bool PWM3_CheckOutputStatus(void) +{ + return (PWM3CONbits.OUT); +} + +void PWM3_LoadBufferSet(void) +{ + PWM3LDCONbits.LDA = 1; +} + +void PWM3_PhaseSet(uint16_t phaseCount) +{ + PWM3PHH = (phaseCount>>8); //writing 8 MSBs to PWMPHH register + PWM3PHL = (phaseCount); //writing 8 LSBs to PWMPHL register +} + +void PWM3_DutyCycleSet(uint16_t dutyCycleCount) +{ + PWM3DCH = (dutyCycleCount>>8); //writing 8 MSBs to PWMDCH register + PWM3DCL = (dutyCycleCount); //writing 8 LSBs to PWMDCL register +} + +void PWM3_PeriodSet(uint16_t periodCount) +{ + PWM3PRH = (periodCount>>8); //writing 8 MSBs to PWMPRH register + PWM3PRL = (periodCount); //writing 8 LSBs to PWMPRL register +} + +void PWM3_OffsetSet(uint16_t offsetCount) +{ + PWM3OFH = (offsetCount>>8); //writing 8 MSBs to PWMOFH register + PWM3OFL = (offsetCount); //writing 8 LSBs to PWMOFL register +} + +uint16_t PWM3_TimerCountGet(void) +{ + return ((uint16_t)((PWM3TMRH<<8) | PWM3TMRL)); +} + +bool PWM3_IsOffsetMatchOccured(void) +{ + return (PWM3INTFbits.OFIF); +} + +bool PWM3_IsPhaseMatchOccured(void) +{ + return (PWM3INTFbits.PHIF); +} + +bool PWM3_IsDutyCycleMatchOccured(void) +{ + return (PWM3INTFbits.DCIF); +} + +bool PWM3_IsPeriodMatchOccured(void) +{ + return (PWM3INTFbits.PRIF); +} + +/** + End of File +*/ + + Index: /RF_BT_Tail/mcc_generated_files/dac.c =================================================================== --- /RF_BT_Tail/mcc_generated_files/dac.c (revision 244) +++ /RF_BT_Tail/mcc_generated_files/dac.c (revision 244) @@ -0,0 +1,77 @@ +/** + DAC Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + dac.c + + @Summary + This is the generated driver implementation file for the DAC driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This source file provides APIs for DAC. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.10 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +/** + Section: Included Files +*/ + +#include +#include "dac.h" + +/** + Section: DAC APIs +*/ + +void DAC_Initialize(void) +{ + // DACOE disabled; DACEN enabled; DACPSS VDD; + DACCON0 = 0x80; + // DACR 19; + DACCON1 = 0x13; +} + +void DAC_SetOutput(uint8_t inputData) +{ + DACCON1 = inputData; +} + +uint8_t DAC_GetOutput(void) +{ + return DACCON1; +} +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/tmr0.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/tmr0.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/tmr0.h (revision 244) @@ -0,0 +1,285 @@ +/** + TMR0 Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + tmr0.h + + @Summary + This is the generated header file for the TMR0 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for TMR0. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef TMR0_H +#define TMR0_H + +/** + Section: Included Files +*/ + +#include +#include + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + +/** + Section: TMR0 APIs +*/ + +/** + @Summary + Initializes the TMR0 module. + + @Description + This function initializes the TMR0 Registers. + This function must be called before any other TMR0 function is called. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Comment + + + @Example + + main() + { + // Initialize TMR0 module + TMR0_Initialize(); + + // Do something else... + } + +*/ +void TMR0_Initialize(void); + +/** + @Summary + Reads the TMR0 register. + + @Description + This function reads the TMR0 register value and return it. + + @Preconditions + Initialize the TMR0 before calling this function. + + @Param + None + + @Returns + This function returns the current value of TMR0 register. + + @Example + + // Initialize TMR0 module + // Read the current value of TMR0 + if(0 == TMR0_ReadTimer()) + { + // Do something else... + + // Reload the TMR value + TMR0_Reload(); + } + +*/ +uint8_t TMR0_ReadTimer(void); + +/** + @Summary + Writes the TMR0 register. + + @Description + This function writes the TMR0 register. + This function must be called after the initialization of TMR0. + + @Preconditions + Initialize the TMR0 before calling this function. + + @Param + timerVal - Value to write into TMR0 register. + + @Returns + None + + @Example + + #define PERIOD 0x80 + #define ZERO 0x00 + + while(1) + { + // Read the TMR0 register + if(ZERO == TMR0_ReadTimer()) + { + // Do something else... + + // Write the TMR0 register + TMR0_WriteTimer(PERIOD); + } + + // Do something else... + } + +*/ +void TMR0_WriteTimer(uint8_t timerVal); + +/** + @Summary + Reload the TMR0 register. + + @Description + This function reloads the TMR0 register. + This function must be called to write initial value into TMR0 register. + + @Preconditions + Initialize the TMR0 before calling this function. + + @Param + None + + @Returns + None + + @Example + + while(1) + { + if(TMR0IF) + { + // Do something else... + + // clear the TMR0 interrupt flag + TMR0IF = 0; + + // Reload the initial value of TMR0 + TMR0_Reload(); + } + } + +*/ +void TMR0_Reload(void); + +/** + @Summary + Timer Interrupt Service Routine + + @Description + Timer Interrupt Service Routine is called by the Interrupt Manager. + + @Returns + None + + @Param + None +*/ +void TMR0_ISR(void); + + +/** + @Summary + Set Timer Interrupt Handler + + @Description + This sets the function to be called during the ISR + + @Preconditions + Initialize the TMR0 module with interrupt before calling this. + + @Param + Address of function to be set + + @Returns + None +*/ + void TMR0_SetInterruptHandler(void (* InterruptHandler)(void)); + +/** + @Summary + Timer Interrupt Handler + + @Description + This is a function pointer to the function that will be called during the ISR + + @Preconditions + Initialize the TMR0 module with interrupt before calling this isr. + + @Param + None + + @Returns + None +*/ +extern void (*TMR0_InterruptHandler)(void); + +/** + @Summary + Default Timer Interrupt Handler + + @Description + This is the default Interrupt Handler function + + @Preconditions + Initialize the TMR0 module with interrupt before calling this isr. + + @Param + None + + @Returns + None +*/ +void TMR0_DefaultInterruptHandler(void); + +#ifdef __cplusplus // Provide C++ Compatibility + + } + +#endif + +#endif // TMR0_H +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/tmr1.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/tmr1.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/tmr1.h (revision 244) @@ -0,0 +1,458 @@ +/** + TMR1 Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + tmr1.h + + @Summary + This is the generated header file for the TMR1 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for driver for TMR1. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.11 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef TMR1_H +#define TMR1_H + +/** + Section: Included Files +*/ + +#include +#include + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + + +/** + Section: TMR1 APIs +*/ + +/** + @Summary + Initializes the TMR1 + + @Description + This routine initializes the TMR1. + This routine must be called before any other TMR1 routine is called. + This routine should only be called once during system initialization. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Comment + + + @Example + + main() + { + // Initialize TMR1 module + TMR1_Initialize(); + + // Do something else... + } + +*/ +void TMR1_Initialize(void); + +/** + @Summary + This function starts the TMR1. + + @Description + This function starts the TMR1 operation. + This function must be called after the initialization of TMR1. + + @Preconditions + Initialize the TMR1 before calling this function. + + @Param + None + + @Returns + None + + @Example + + // Initialize TMR1 module + + // Start TMR1 + TMR1_StartTimer(); + + // Do something else... + +*/ +void TMR1_StartTimer(void); + +/** + @Summary + This function stops the TMR1. + + @Description + This function stops the TMR1 operation. + This function must be called after the start of TMR1. + + @Preconditions + Initialize the TMR1 before calling this function. + + @Param + None + + @Returns + None + + @Example + + // Initialize TMR1 module + + // Start TMR1 + TMR1_StartTimer(); + + // Do something else... + + // Stop TMR1; + TMR1_StopTimer(); + +*/ +void TMR1_StopTimer(void); + +/** + @Summary + Reads the TMR1 register. + + @Description + This function reads the TMR1 register value and return it. + + @Preconditions + Initialize the TMR1 before calling this function. + + @Param + None + + @Returns + This function returns the current value of TMR1 register. + + @Example + + // Initialize TMR1 module + + // Start TMR1 + TMR1_StartTimer(); + + // Read the current value of TMR1 + if(0 == TMR1_ReadTimer()) + { + // Do something else... + + // Reload the TMR value + TMR1_Reload(); + } + +*/ +uint16_t TMR1_ReadTimer(void); + +/** + @Summary + Writes the TMR1 register. + + @Description + This function writes the TMR1 register. + This function must be called after the initialization of TMR1. + + @Preconditions + Initialize the TMR1 before calling this function. + + @Param + timerVal - Value to write into TMR1 register. + + @Returns + None + + @Example + + #define PERIOD 0x80 + #define ZERO 0x00 + + while(1) + { + // Read the TMR1 register + if(ZERO == TMR1_ReadTimer()) + { + // Do something else... + + // Write the TMR1 register + TMR1_WriteTimer(PERIOD); + } + + // Do something else... + } + +*/ +void TMR1_WriteTimer(uint16_t timerVal); + +/** + @Summary + Reload the TMR1 register. + + @Description + This function reloads the TMR1 register. + This function must be called to write initial value into TMR1 register. + + @Preconditions + Initialize the TMR1 before calling this function. + + @Param + None + + @Returns + None + + @Example + + while(1) + { + if(TMR1IF) + { + // Do something else... + + // clear the TMR1 interrupt flag + TMR1IF = 0; + + // Reload the initial value of TMR1 + TMR1_Reload(); + } + } + +*/ +void TMR1_Reload(void); + +/** + @Summary + Starts the single pulse acquisition in TMR1 gate operation. + + @Description + This function starts the single pulse acquisition in TMR1 gate operation. + This function must be used when the TMR1 gate is enabled. + + @Preconditions + Initialize the TMR1 with gate enable before calling this function. + + @Param + None + + @Returns + None + + @Example + + uint16_t xVal; + uint16_t yVal; + + // enable TMR1 singlepulse mode + TMR1_StartSinglePulseAcquistion(); + + // check TMR1 gate status + if(TMR1_CheckGateValueStatus()== 0) + xVal = TMR1_ReadTimer(); + + // wait untill gate interrupt occured + while(TMR1GIF == 0) + { + } + + yVal = TMR1_ReadTimer(); + +*/ +void TMR1_StartSinglePulseAcquisition(void); + +/** + @Summary + Check the current state of Timer1 gate. + + @Description + This function reads the TMR1 gate value and return it. + This function must be used when the TMR1 gate is enabled. + + @Preconditions + Initialize the TMR1 with gate enable before calling this function. + + @Param + None + + @Returns + None + + @Example + + uint16_t xVal; + uint16_t yVal; + + // enable TMR1 singlepulse mode + TMR1_StartSinglePulseAcquistion(); + + // check TMR1 gate status + if(TMR1_CheckGateValueStatus()== 0) + xVal = TMR1_ReadTimer(); + + // wait untill gate interrupt occured + while(TMR1IF == 0) + { + } + + yVal = TMR1_ReadTimer(); + +*/ +uint8_t TMR1_CheckGateValueStatus(void); + +/** + @Summary + Timer Interrupt Service Routine + + @Description + Timer Interrupt Service Routine is called by the Interrupt Manager. + + @Preconditions + Initialize the TMR1 module with interrupt before calling this ISR. + + @Param + None + + @Returns + None +*/ +void TMR1_ISR(void); + +/** + @Summary + Set Timer Interrupt Handler + + @Description + This sets the function to be called during the ISR + + @Preconditions + Initialize the TMR1 module with interrupt before calling this. + + @Param + Address of function to be set + + @Returns + None +*/ + void TMR1_SetInterruptHandler(void (* InterruptHandler)(void)); + void TMR1G_SetInterruptHandler(void (* InterruptHandler)(void)); + +/** + @Summary + Timer Interrupt Handler + + @Description + This is a function pointer to the function that will be called during the ISR + + @Preconditions + Initialize the TMR1 module with interrupt before calling this isr. + + @Param + None + + @Returns + None +*/ +extern void (*TMR1_InterruptHandler)(void); + +/** + @Summary + Default Timer Interrupt Handler + + @Description + This is the default Interrupt Handler function + + @Preconditions + Initialize the TMR1 module with interrupt before calling this isr. + + @Param + None + + @Returns + None +*/ +void TMR1_DefaultInterruptHandler(void); +void TMR1G_DefaultInterruptHandler(void); +/** + @Summary + Timer Gate Interrupt Service Routine + + @Description + Timer Gate Interrupt Service Routine is called by the Interrupt Manager. + User can write the code in this function. + + @Preconditions + Initialize the TMR1 module with gate interrupt before calling this isr. + + @Param + None + + @Returns + None + + @Example + None +*/ +void TMR1_GATE_ISR(void); + +//Sets polarity of the gate pin +void TMR1G_Polarity(uint8_t pol); + +#ifdef __cplusplus // Provide C++ Compatibility + + } + +#endif + +#endif // TMR1_H +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/device_config.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/device_config.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/device_config.h (revision 244) @@ -0,0 +1,55 @@ +/** + @Generated PIC10 / PIC12 / PIC16 / PIC18 MCUs Header File + + @Company: + Microchip Technology Inc. + + @File Name: + mcc.c + + @Summary: + This is the device_config.h file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description: + This header file provides implementations for driver APIs for all modules selected in the GUI. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.00 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef DEVICE_CONFIG_H +#define DEVICE_CONFIG_H + +#define _XTAL_FREQ 8000000 + +#endif /* DEVICE_CONFIG_H */ +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/pwm1.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/pwm1.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/pwm1.h (revision 244) @@ -0,0 +1,419 @@ +/** + PWM1 Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + pwm1.h + + @Summary + This is the generated header file for the PWM1 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for driver for PWM1. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef PWM1_H +#define PWM1_H + +/** + Section: Included Files +*/ + +#include +#include +#include + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + +/** + Section: PWM Module APIs +*/ + +/** + @Summary + Initializes the PWM1 + + @Description + This routine initializes the Initializes the PWM1. + This routine must be called before any other PWM routine is called. + This routine should only be called once during system initialization. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Comment + + + @Example + + + +*/ +void PWM1_Initialize(void); + +/** + @Summary + This function starts the PWM1. + + @Description + This function starts the PWM1 operation. + This function must be called after the initialization of PWM1. + + @Preconditions + Initialize the PWM1 before calling this function. + + @Param + None + + @Returns + None + + @Example + + // Initialize PWM1 module + + // Start PWM1 + PWM1_Start(); + + // Do something else... + +*/ +void PWM1_Start(void); + +/** + @Summary + This function stops the PWM1. + + @Description + This function stops the PWM1 operation. + This function must be called after the start of PWM1. + + @Preconditions + Initialize the PWM1 before calling this function. + + @Param + None + + @Returns + None + + @Example + + // Initialize PWM1 module + + // Start PWM1 + PWM1_StartTimer(); + + // Do something else... + + // Stop PWM1; + PWM1_Stop(); + +*/ +void PWM1_Stop(void); + + +/** + @Summary + This function used to check output status of PWM1. + + @Description + Check output status of PWM1 as High or Low. + + @Preconditions + Start the PWM1 before calling this function. + + @Param + None + + @Returns + true - Output High. + false - Output Low. + + @Example + + + +*/ +bool PWM1_CheckOutputStatus(void); + +/** + @Summary + This function is used to load buffer of PWM1 at the end of period. + + @Description + load buffer of PWM1 at the end of period. + + @Preconditions + Initialize the PWM1 before calling this function. + + @Param + None + + @Returns + None + + @Example + + + +*/ +void PWM1_LoadBufferSet(void); + +/** + @Summary + Load required 16 bit phase count + + @Description + Set the expected phase count + + @Preconditions + None + + @Param + Pass 16 bit phase count + + @Returns + None + + @Example + + + +*/ +void PWM1_PhaseSet(uint16_t phaseCount); + +/** + @Summary + Load required 16 bit Duty Cycle + + @Description + Set the expected Duty Cycle + + @Preconditions + None + + @Param + Pass 16 bit Duty Cycle + + @Returns + None + + @Example + + + +*/ +void PWM1_DutyCycleSet(uint16_t dutyCycleCount); + +/** + @Summary + Load required 16 bit Period + + @Description + Set the expected Period + + @Preconditions + None + + @Param + Pass 16 bit Period + + @Returns + None + + @Example + + + +*/ +void PWM1_PeriodSet(uint16_t periodCount); + +/** + @Summary + Load required 16 bit Offset + + @Description + Set the expected Offset + + @Preconditions + None + + @Param + Pass 16 bit Offset + + @Returns + None + + @Example + + + +*/ +void PWM1_OffsetSet(uint16_t offsetCount); + +/** + @Summary + Read measured Timer count + + @Description + Read the measured Timer count + * + @Preconditions + None + + @Param + None + + @Returns + Return 16 bit Timer count + + @Example + + + +*/ +uint16_t PWM1_TimerCountGet(void); + +/** + @Summary + Returns status of Offset interrupt flag bit (OFIF ). + + @Description + When PWMTMR = PWMOF value offset flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR >= PWMOF value + false - PWMTMR < PWMOF value + + @Example + + + +*/ +bool PWM1_IsOffsetMatchOccured(void); + +/** + @Summary + Returns status of Phase interrupt flag bit (PHIF ). + + @Description + When PWMTMR = PWMPH value, Phase flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR count is >= PWMPH value + false - PWMTMR count is < PWMPH value + + @Example + + + +*/ +bool PWM1_IsPhaseMatchOccured(void); + +/** + @Summary + Returns status of DutyCycle interrupt flag bit (DCIF ). + + @Description + When PWMTMR = PWMDC value DutyCycle flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR count is >= PWMDC value + false - PWMTMR count is < PWMDC value + + @Example + + + +*/ +bool PWM1_IsDutyCycleMatchOccured(void); + +/** + @Summary + Returns status of Period interrupt flag bit (PRIF ). + + @Description + When PWMTMR = PWMPR value offset flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR count is >= PWMPR value + false - PWMTMR count is < PWMPR value + + @Example + + + +*/ +bool PWM1_IsPeriodMatchOccured(void); + +#endif /* PWM1_H */ +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/pwm2.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/pwm2.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/pwm2.h (revision 244) @@ -0,0 +1,419 @@ +/** + PWM2 Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + pwm2.h + + @Summary + This is the generated header file for the PWM2 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for driver for PWM2. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef PWM2_H +#define PWM2_H + +/** + Section: Included Files +*/ + +#include +#include +#include + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + +/** + Section: PWM Module APIs +*/ + +/** + @Summary + Initializes the PWM2 + + @Description + This routine initializes the Initializes the PWM2. + This routine must be called before any other PWM routine is called. + This routine should only be called once during system initialization. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Comment + + + @Example + + + +*/ +void PWM2_Initialize(void); + +/** + @Summary + This function starts the PWM2. + + @Description + This function starts the PWM2 operation. + This function must be called after the initialization of PWM2. + + @Preconditions + Initialize the PWM2 before calling this function. + + @Param + None + + @Returns + None + + @Example + + // Initialize PWM2 module + + // Start PWM2 + PWM2_Start(); + + // Do something else... + +*/ +void PWM2_Start(void); + +/** + @Summary + This function stops the PWM2. + + @Description + This function stops the PWM2 operation. + This function must be called after the start of PWM2. + + @Preconditions + Initialize the PWM2 before calling this function. + + @Param + None + + @Returns + None + + @Example + + // Initialize PWM2 module + + // Start PWM2 + PWM2_StartTimer(); + + // Do something else... + + // Stop PWM2; + PWM2_Stop(); + +*/ +void PWM2_Stop(void); + + +/** + @Summary + This function used to check output status of PWM2. + + @Description + Check output status of PWM2 as High or Low. + + @Preconditions + Start the PWM2 before calling this function. + + @Param + None + + @Returns + true - Output High. + false - Output Low. + + @Example + + + +*/ +bool PWM2_CheckOutputStatus(void); + +/** + @Summary + This function is used to load buffer of PWM2 at the end of period. + + @Description + load buffer of PWM2 at the end of period. + + @Preconditions + Initialize the PWM2 before calling this function. + + @Param + None + + @Returns + None + + @Example + + + +*/ +void PWM2_LoadBufferSet(void); + +/** + @Summary + Load required 16 bit phase count + + @Description + Set the expected phase count + + @Preconditions + None + + @Param + Pass 16 bit phase count + + @Returns + None + + @Example + + + +*/ +void PWM2_PhaseSet(uint16_t phaseCount); + +/** + @Summary + Load required 16 bit Duty Cycle + + @Description + Set the expected Duty Cycle + + @Preconditions + None + + @Param + Pass 16 bit Duty Cycle + + @Returns + None + + @Example + + + +*/ +void PWM2_DutyCycleSet(uint16_t dutyCycleCount); + +/** + @Summary + Load required 16 bit Period + + @Description + Set the expected Period + + @Preconditions + None + + @Param + Pass 16 bit Period + + @Returns + None + + @Example + + + +*/ +void PWM2_PeriodSet(uint16_t periodCount); + +/** + @Summary + Load required 16 bit Offset + + @Description + Set the expected Offset + + @Preconditions + None + + @Param + Pass 16 bit Offset + + @Returns + None + + @Example + + + +*/ +void PWM2_OffsetSet(uint16_t offsetCount); + +/** + @Summary + Read measured Timer count + + @Description + Read the measured Timer count + * + @Preconditions + None + + @Param + None + + @Returns + Return 16 bit Timer count + + @Example + + + +*/ +uint16_t PWM2_TimerCountGet(void); + +/** + @Summary + Returns status of Offset interrupt flag bit (OFIF ). + + @Description + When PWMTMR = PWMOF value offset flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR >= PWMOF value + false - PWMTMR < PWMOF value + + @Example + + + +*/ +bool PWM2_IsOffsetMatchOccured(void); + +/** + @Summary + Returns status of Phase interrupt flag bit (PHIF ). + + @Description + When PWMTMR = PWMPH value, Phase flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR count is >= PWMPH value + false - PWMTMR count is < PWMPH value + + @Example + + + +*/ +bool PWM2_IsPhaseMatchOccured(void); + +/** + @Summary + Returns status of DutyCycle interrupt flag bit (DCIF ). + + @Description + When PWMTMR = PWMDC value DutyCycle flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR count is >= PWMDC value + false - PWMTMR count is < PWMDC value + + @Example + + + +*/ +bool PWM2_IsDutyCycleMatchOccured(void); + +/** + @Summary + Returns status of Period interrupt flag bit (PRIF ). + + @Description + When PWMTMR = PWMPR value offset flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR count is >= PWMPR value + false - PWMTMR count is < PWMPR value + + @Example + + + +*/ +bool PWM2_IsPeriodMatchOccured(void); + +#endif /* PWM2_H */ +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/interrupt_manager.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/interrupt_manager.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/interrupt_manager.h (revision 244) @@ -0,0 +1,104 @@ +/** + Generated Interrupt Manager Header File + + @Company: + Microchip Technology Inc. + + @File Name: + interrupt_manager.h + + @Summary: + This is the Interrupt Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description: + This header file provides implementations for global interrupt handling. + For individual peripheral handlers please see the peripheral driver for + all modules selected in the GUI. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.03 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef INTERRUPT_MANAGER_H +#define INTERRUPT_MANAGER_H + + +/** + * @Param + none + * @Returns + none + * @Description + This macro will enable global interrupts. + * @Example + INTERRUPT_GlobalInterruptEnable(); + */ +#define INTERRUPT_GlobalInterruptEnable() (INTCONbits.GIE = 1) + +/** + * @Param + none + * @Returns + none + * @Description + This macro will disable global interrupts. + * @Example + INTERRUPT_GlobalInterruptDisable(); + */ +#define INTERRUPT_GlobalInterruptDisable() (INTCONbits.GIE = 0) +/** + * @Param + none + * @Returns + none + * @Description + This macro will enable peripheral interrupts. + * @Example + INTERRUPT_PeripheralInterruptEnable(); + */ +#define INTERRUPT_PeripheralInterruptEnable() (INTCONbits.PEIE = 1) + +/** + * @Param + none + * @Returns + none + * @Description + This macro will disable peripheral interrupts. + * @Example + INTERRUPT_PeripheralInterruptDisable(); + */ +#define INTERRUPT_PeripheralInterruptDisable() (INTCONbits.PEIE = 0) + + +#endif // INTERRUPT_MANAGER_H +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/pwm3.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/pwm3.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/pwm3.h (revision 244) @@ -0,0 +1,428 @@ +/** + PWM3 Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + pwm3.h + + @Summary + This is the generated header file for the PWM3 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for driver for PWM3. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.01 + The generated drivers are tested against the following: + Compiler : XC8 1.45 or later + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef PWM3_H +#define PWM3_H + +/** + Section: Included Files +*/ + +#include +#include +#include + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + +//Added by GdS. Factor to get from a percentage to a duty cycle +const int16_t PWM3_MAX_PERIOD_COUNT=8000; //((PWM3PRH<<8)+PWR3PRL); +const int16_t PWM3_PERC_FACTOR=(PWM3_MAX_PERIOD_COUNT/100); + + +/** + Section: PWM Module APIs +*/ + +/** + @Summary + Initializes the PWM3 + + @Description + This routine initializes the Initializes the PWM3. + This routine must be called before any other PWM routine is called. + This routine should only be called once during system initialization. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Comment + + + @Example + + + +*/ +void PWM3_Initialize(void); + +/** + @Summary + This function starts the PWM3. + + @Description + This function starts the PWM3 operation. + This function must be called after the initialization of PWM3. + + @Preconditions + Initialize the PWM3 before calling this function. + + @Param + None + + @Returns + None + + @Example + + // Initialize PWM3 module + + // Start PWM3 + PWM3_Start(); + + // Do something else... + +*/ +void PWM3_Start(void); + +/** + @Summary + This function stops the PWM3. + + @Description + This function stops the PWM3 operation. + This function must be called after the start of PWM3. + + @Preconditions + Initialize the PWM3 before calling this function. + + @Param + None + + @Returns + None + + @Example + + // Initialize PWM3 module + + // Start PWM3 + PWM3_StartTimer(); + + // Do something else... + + // Stop PWM3; + PWM3_Stop(); + +*/ +void PWM3_Stop(void); + + +/** + @Summary + This function used to check output status of PWM3. + + @Description + Check output status of PWM3 as High or Low. + + @Preconditions + Start the PWM3 before calling this function. + + @Param + None + + @Returns + true - Output High. + false - Output Low. + + @Example + + + +*/ +bool PWM3_CheckOutputStatus(void); + +/** + @Summary + This function is used to load buffer of PWM3 at the end of period. + + @Description + load buffer of PWM3 at the end of period. + + @Preconditions + Initialize the PWM3 before calling this function. + + @Param + None + + @Returns + None + + @Example + + + +*/ +void PWM3_LoadBufferSet(void); + +/** + @Summary + Load required 16 bit phase count + + @Description + Set the expected phase count + + @Preconditions + None + + @Param + Pass 16 bit phase count + + @Returns + None + + @Example + + + +*/ +void PWM3_PhaseSet(uint16_t phaseCount); + +/** + @Summary + Load required 16 bit Duty Cycle + + @Description + Set the expected Duty Cycle + + @Preconditions + None + + @Param + Pass 16 bit Duty Cycle + + @Returns + None + + @Example + + + +*/ +void PWM3_DutyCycleSet(uint16_t dutyCycleCount); + +/** + @Summary + Load required 16 bit Period + + @Description + Set the expected Period + + @Preconditions + None + + @Param + Pass 16 bit Period + + @Returns + None + + @Example + + + +*/ +void PWM3_PeriodSet(uint16_t periodCount); + +/** + @Summary + Load required 16 bit Offset + + @Description + Set the expected Offset + + @Preconditions + None + + @Param + Pass 16 bit Offset + + @Returns + None + + @Example + + + +*/ + +//Added by GdS +uint16_t PWM3_PeriodGet(); + +void PWM3_OffsetSet(uint16_t offsetCount); + +/** + @Summary + Read measured Timer count + + @Description + Read the measured Timer count + * + @Preconditions + None + + @Param + None + + @Returns + Return 16 bit Timer count + + @Example + + + +*/ +uint16_t PWM3_TimerCountGet(void); + +/** + @Summary + Returns status of Offset interrupt flag bit (OFIF ). + + @Description + When PWMTMR = PWMOF value offset flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR >= PWMOF value + false - PWMTMR < PWMOF value + + @Example + + + +*/ +bool PWM3_IsOffsetMatchOccured(void); + +/** + @Summary + Returns status of Phase interrupt flag bit (PHIF ). + + @Description + When PWMTMR = PWMPH value, Phase flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR count is >= PWMPH value + false - PWMTMR count is < PWMPH value + + @Example + + + +*/ +bool PWM3_IsPhaseMatchOccured(void); + +/** + @Summary + Returns status of DutyCycle interrupt flag bit (DCIF ). + + @Description + When PWMTMR = PWMDC value DutyCycle flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR count is >= PWMDC value + false - PWMTMR count is < PWMDC value + + @Example + + + +*/ +bool PWM3_IsDutyCycleMatchOccured(void); + +/** + @Summary + Returns status of Period interrupt flag bit (PRIF ). + + @Description + When PWMTMR = PWMPR value offset flag sets. + + @Preconditions + None + + @Param + None + + @Returns + true - PWMTMR count is >= PWMPR value + false - PWMTMR count is < PWMPR value + + @Example + + + +*/ +bool PWM3_IsPeriodMatchOccured(void); + +#endif /* PWM3_H */ +/** + End of File +*/ Index: /RF_BT_Tail/mcc_generated_files/dac.h =================================================================== --- /RF_BT_Tail/mcc_generated_files/dac.h (revision 244) +++ /RF_BT_Tail/mcc_generated_files/dac.h (revision 244) @@ -0,0 +1,174 @@ +/** + DAC Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + dac.h + + @Summary + This is the generated header file for the DAC driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs + + @Description + This header file provides APIs for driver for DAC. + Generation Information : + Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 + Device : PIC16F1579 + Driver Version : 2.10 + The generated drivers are tested against the following: + Compiler : XC8 1.45 + MPLAB : MPLAB X 4.15 +*/ + +/* + (c) 2018 Microchip Technology Inc. and its subsidiaries. + + Subject to your compliance with these terms, you may use Microchip software and any + derivatives exclusively with Microchip products. It is your responsibility to comply with third party + license terms applicable to your use of third party software (including open source software) that + may accompany Microchip software. + + 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. + + 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. +*/ + +#ifndef DAC_H +#define DAC_H + +/** + Section: Included Files +*/ + +#include +#include + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + +/** + Section: DAC APIs +*/ + +/** + @Summary + Initializes the DAC + + @Description + This routine initializes the DAC. + This routine must be called before any other DAC routine is called. + This routine should only be called once during system initialization. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Comment + + + @Example + + DAC_Initialize(); + +*/ +void DAC_Initialize(void); + +/** + @Summary + Set Input data into DAC. + + @Description + This routine pass the digital input data into + DAC voltage reference control register. + + @Preconditions + The DAC_Initialize() routine should be called + prior to use this routine. + + @Param + inputData - 8bit digital data to DAC. + + @Returns + None + + @Example + + uint8_t count=0; + + DAC_Initialize(); + + for(count=0; count<=30; count++) + { + DAC_SetOutput(count); + } + + while(1) + { + } + +*/ +void DAC_SetOutput(uint8_t inputData); + +/** + @Summary + Read input data fed to DAC. + + @Description + This routine reads the digital input data fed to + DAC voltage reference control register. + + @Preconditions + The DAC_Initialize() routine should be called + prior to use this routine. + + @Param + None + + @Returns + uint8_t inputData - digital data fed to DAC + + @Example + + uint8_t count=0; + uint8_t inputData; + + DAC_Initialize(); + + inputData = DAC_GetOutput(); + + while(1) + { + } + +*/ +uint8_t DAC_GetOutput(void); + +#ifdef __cplusplus // Provide C++ Compatibility + + } + +#endif + +#endif // DAC_H +/** + End of File +*/ Index: /RF_BT_Tail/Servos.c =================================================================== --- /RF_BT_Tail/Servos.c (revision 244) +++ /RF_BT_Tail/Servos.c (revision 244) @@ -0,0 +1,68 @@ +// File: Servos.c +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// Controls the 2 servos +//------------------------------------------------------------------------------ + +#include "Servos.h" +#include "mcc_generated_files/pin_manager.h" +#include "mcc_generated_files/pwm1.h" +#include "mcc_generated_files/pwm2.h" +#include "mcc_generated_files/pwm3.h" +#include "mcc_generated_files/device_config.h" +#include "mcc_generated_files/mcc.h" +#include "Power.h" + + +void initServos() +{ + //Initialisation of PWMs with servo parameters (20ms, 1.5ms) is done in the PWM init +} + +//Turns on power to the servos and starts the PWM peripheral +void startServos() +{ + //Skip if already on + if (IO_SERVOS_GetValue()) return; + + setServo1(0); //POS2SERVO(SERVO1_HOME)); + setServo2(0); //POS2SERVO(SERVO2_HOME)); + IO_SERVOS_SetHigh(); + PWM1_Start(); + PWM2_Start(); +} + +//Turns off power to the servos and stops the PWM peripheral +void stopServos() +{ + //Skip if already off + if (IO_SERVOS_GetValue()==0) return; + + //Put servos in the home position + //homeServos(); + + //Power off the PWM peripherals + PWM1_Stop(); + PWM2_Stop(); + //Power off the servos + IO_SERVOS_SetLow(); +} + +uint8_t isServoOn() +{ + return IO_SERVOS_GetValue(); +} + +void setServo1(int16_t pos) +{ + PWM1_DutyCycleSet((uint16_t)pos); + PWM1_LoadBufferSet(); +} +void setServo2(int16_t pos) +{ + PWM2_DutyCycleSet((uint16_t)pos); + PWM2_LoadBufferSet(); +} Index: /RF_BT_Tail/main.c =================================================================== --- /RF_BT_Tail/main.c (revision 244) +++ /RF_BT_Tail/main.c (revision 244) @@ -0,0 +1,218 @@ +// File: Main.h +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +//------------------------------------------------------------------------------ + +#include "mcc_generated_files/mcc.h" +#include "Power.h" +#include "JDY08.h" +#include "Moves.h" +#include "Terminal.h" +#include "RF.h" + +#define T_PWR (5*60*50) //5 min * 60 sec * 1/20ms +#define N_RND_MOVES 9 //Number of random moves taken from the list + //~30*(9-1) = 4 minutes total duration. + +void main(void) +{ + uint8_t isRFver; + uint8_t movCntA=0; + uint8_t movCntB=0; + uint8_t movCntC=0; + uint8_t movCntD=0; + + uint8_t movCntRnd = 0; + uint8_t movRndPtr = 0; + + uint8_t ledCntA=0; + uint8_t ledCntB=0; + uint8_t ledCntC=0; + + AckEnum lastMoveAck=ACK_WAITING; + AckEnum lastLedsAck=ACK_WAITING; + + uint16_t tPwr = T_PWR; //Power off timeout if no commands received + uint16_t tRnd = 0; //Timeout for random moves + + + //Initialise the device + SYSTEM_Initialize(); + + powerBootstrap(); //Keeps power enable high after button is released + + movesInit(); + + //Check if an RF receiver is connected + RC4_SetDigitalInput(); + //Unlock peripheral select + PPSLOCK=0x55; //Magic sequence + PPSLOCK=0xAA; + PPSLOCK=0x00; //Reset PPSLOCKED bit + + RC4PPS = 0x00; //RC4-> I/O + //Re-lock peripheral select + PPSLOCK=0x55; //Magic sequence + PPSLOCK=0xAA; + PPSLOCK=0x01; //Set PPSLOCKED bit + + uint8_t i0=0; + uint8_t i1=0; + __delay_ms(500); + for (uint8_t i=0; i<250; i++) + { + if (RC3_GetValue()) i1++; + else i0++; + __delay_us(1000); + } + + //If noise was coming from the RF input then RF receiver is connected + isRFver = (uint8_t)((i0>2) && (i1>2)); + + //if (isRFver) +#ifdef IS_RF_VER + { + initRF(); //Inits the RF module + LED_RED_On(); //Blink Red LED twice to inform RF mode is active + __delay_ms(100); + LED_RED_Off(); + __delay_ms(100); + LED_RED_On(); + __delay_ms(100); + LED_RED_Off(); + + setBluePattern(LED_BLUE_CNNCTD); + + // Enable the Global Interrupts + INTERRUPT_GlobalInterruptEnable(); + // Enable the Peripheral Interrupts + INTERRUPT_PeripheralInterruptEnable(); + + + while(1) + { + uint8_t rfCode = rfGetNewCode(); + switch (rfCode) + { + case RF_A: + if (lastMoveAck==ACK_RUNNING) break; + setMove(moveGrpSlow[movCntA++]); + if (movCntA>=MAX_GRP_SLOW) movCntA=0; + break; + case RF_B: + if (lastMoveAck==ACK_RUNNING) break; + setMove(moveGrpFast[movCntB++]); + if (movCntB>=MAX_GRP_FAST) movCntB=0; + break; + case RF_C: + if (lastMoveAck==ACK_RUNNING) break; + setMove(moveGrpTrem[movCntC++]); + if (movCntC>=MAX_GRP_TREM) movCntC=0; + break; + case RF_D: + if (lastMoveAck==ACK_RUNNING) break; + setMove(moveGrpErec[movCntD++]); + if (movCntD>=MAX_GRP_EREC) movCntD=0; + break; + case RF_LONG_A: + //If any other pattern was running then turn off (first pattern of grp A) + //if (ACK_RUNNING == lastLedsAck) + setLEDs(ledsGrpA[ledCntA++]); + if (ledCntA>=MAX_LED_GRPA) ledCntA=0; + break; + case RF_LONG_B: + ledCntA = 1; + setLEDs(ledsGrpB[ledCntB++]); + if (ledCntB>=MAX_LED_GRPB) ledCntB=0; + break; + case RF_LONG_C: + ledCntA = 1; + setLEDs(ledsGrpC[ledCntC++]); + if (ledCntC>=MAX_LED_GRPC) ledCntC=0; + break; + case RF_LONG_D: //Random moves from first 2 groups + if (movCntRnd) movCntRnd = 0; + else movCntRnd = N_RND_MOVES; + tRnd = 0; + break; + } + wait20ms(); + lastMoveAck=updateMove(); + lastLedsAck=updateLEDs(); + + if ((lastMoveAck == ACK_WAITING) && (movCntRnd)) + { + if (tRnd) tRnd--; + else + { + tRnd = (uint16_t)moveRndGrpT[movRndPtr] * 50; + setMove(moveRndGrp[movRndPtr]); + if (movRndPtrEUSART:TX; + + //Re-lock peripheral select + PPSLOCK=0x55; //Magic sequence + PPSLOCK=0xAA; + PPSLOCK=0x01; //Set PPSLOCKED bit + + TMR1_StopTimer(); //Timer 1 not used in BT mode + + // Enable the Global Interrupts + INTERRUPT_GlobalInterruptEnable(); + // Enable the Peripheral Interrupts + INTERRUPT_PeripheralInterruptEnable(); + + initJDY08(); //Inits the bluetooth module + + //setAuto(1,5,240,2); + + while (1) + { + AckEnum ack; + //Update move and leds (if running) and send a message at the end + ack = updateMove(); + ack |= updateLEDs(); + + terminal(ack); + + checkPowerButton(); //Read power button to power down the system + + wait20ms(); + } + } +//} +#endif Index: /RF_BT_Tail/Servos.h =================================================================== --- /RF_BT_Tail/Servos.h (revision 244) +++ /RF_BT_Tail/Servos.h (revision 244) @@ -0,0 +1,58 @@ +// File: Servos.h +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// Controls the 2 servos +//------------------------------------------------------------------------------ + +#ifndef SERVOS_H +#define SERVOS_H + +#include + +#define K 2 +//#define P0 (K*500) +//#define P1 (K*850) +//#define P2 (K*1050) +//#define P3 (K*1350) +//#define P4 (K*1500) +//#define P5 (K*1750) +//#define P6 (K*2050) +//#define P7 (K*2200) +//#define P9 (K*2500) + +#define PL 0x0F //Last position, don't update +#define P0 0 //(K*500) // 0 degrees +#define P1 1 //(K*750) // 22.5 degrees +#define P2 2 //(K*1000) // 45.0 degrees +#define P3 3 //(K*1250) // 67.5 degrees +#define P4 4 //(K*1500) // 90.0 degrees +#define P5 5 //(K*1750) //112.5 degrees +#define P6 6 //(K*2000) //135 0 degrees +#define P7 7 //(K*2250) //157.5 degrees +#define P8 8 //(K*2500) //180.0 degrees + +#define SERVO1_HOME P8 +#define SERVO2_HOME P0 +#define POS2SERVO(x) (int16_t)(((int16_t)K*550)+(int16_t)x*K*240) + +#define T_PWM_SERVO 20 +#define F_SERVO 50u //1/T_PwM_SERVO = 1/20ms = 50 Hz + +//Initialise servos +void initServos(); +//Powers the servos +void startServos(); +//Turns off power to the servos +void stopServos(); +//Return >0 if servo power is on +uint8_t isServoOn(); + +//Set servo to position pos (K*500 to K*2500) +void setServo1(int16_t pos); +void setServo2(int16_t pos); + +#endif /* SERVOS_H */ + Index: /RF_BT_Tail/LEDs.c =================================================================== --- /RF_BT_Tail/LEDs.c (revision 244) +++ /RF_BT_Tail/LEDs.c (revision 244) @@ -0,0 +1,38 @@ +// File: LEDs.c +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// Controls the LED strip +//------------------------------------------------------------------------------ + +#include "LEDs.h" + +void stopLEDs() +{ + PWM3_Stop(); +} + +void startLEDs() +{ + PWM3_Start(); +} + +void setLEDsBrightness(uint8_t level) +{ + uint16_t value; + if (level>95) value=PWM3_MAX_PERIOD_COUNT; + else value=(uint16_t)level*PWM3_PERC_FACTOR; + + PWM3_DutyCycleSet(value); + PWM3_LoadBufferSet(); +} + +void setLEDsBrightness2(int16_t level) +{ + if (level>PWM3_MAX_PERIOD_COUNT) level=PWM3_MAX_PERIOD_COUNT; + + PWM3_DutyCycleSet((uint16_t)level); + PWM3_LoadBufferSet(); +} Index: /RF_BT_Tail/Moves.c =================================================================== --- /RF_BT_Tail/Moves.c (revision 244) +++ /RF_BT_Tail/Moves.c (revision 244) @@ -0,0 +1,403 @@ +// File: Moves.c +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// Manages the tail moves and LED patterns +//------------------------------------------------------------------------------ + + +#include "Moves.h" +#include "Servos.h" +#include "Power.h" +#include "LEDs.h" +#include "mcc_generated_files/device_config.h" + +#include +#include //For memset + +#define N_ATTEMPTS 100 //#attempts to draw a random number in range + +#define DD 15 //Delay for morse dot +#define DL 30 //Delay for morse line +#define DP 60 //Delay for morse pause +#define DF0 10 //Delay for flame +#define DF1 20 //Delay for flame +#define DF2 40 //Delay for flame + +const MoveType TAIL_HOME= { 1,PL,P8, 0, 0, 0, PL,P0, 0, 0, 0, 100, 0, 0, 0, 0}; +const MoveType SLOW_WAG1= { 3,P1,P7, 0, 0, 0, P1,P7, 0, 0, 0, 75, 75, 0, 0, 0}; +const MoveType SLOW_WAG2= { 5,P2,P6, 0, 0, 0, P2,P6, 0, 0, 0, 25, 25, 0, 0, 0}; +const MoveType SLOW_WAG3= { 5,P2,P6, 0, 0, 0, P2,P6, 0, 0, 0, 33, 33, 0, 0, 0}; + +const MoveType FAST_WAG = {20,P0,P8, 0, 0, 0, P0,P8, 0, 0, 0, 10, 10, 0, 0, 0}; +const MoveType SHORT_WAG= {20,P2,P6, 0, 0, 0, P2,P6, 0, 0, 0, 7, 7, 0, 0, 0}; +const MoveType HAPPY_WAG= {10,P8,P4,P8,P8,P8, P0,P0,P0,P2,P0, 10, 10,10,10, 0}; + +const MoveType ERECT = { 1,P0,P0, 0, 0, 0, P8,P8, 0, 0, 0, -100,100, 0, 0, 0}; +const MoveType ERECT_PULSE= {10,P8,P0, 0, 0, 0, P8,P0, 0, 0, 0, 20, 20, 0, 0, 0}; +const MoveType TREMBLE1 = {25,P8,P7,P8,P8,P8, P0,P0,P0,P1,P0, 3, 1, 1, 1, 1}; +const MoveType TREMBLE2 = {10,P8,P8,P3,P3, 0, P0,P0,P1,P1, 0, 10, 1,10, 0, 0}; +const MoveType ERECT_TREM = {30,P3,P3,P7,P7, 0, P5,P5,P2,P2, 0, 3, 3, 0, 0, 0}; + +//Move groups (used in RF mode) +const MoveType* const moveGrpSlow[MAX_GRP_SLOW] = {&SLOW_WAG1,&SLOW_WAG2,&SLOW_WAG3}; +const MoveType* const moveGrpFast[MAX_GRP_FAST] = {&FAST_WAG,&SHORT_WAG,&HAPPY_WAG}; +const MoveType* const moveGrpTrem[MAX_GRP_TREM] = {&TREMBLE1,&TREMBLE2,&ERECT_TREM}; +const MoveType* const moveGrpErec[MAX_GRP_EREC] = {&ERECT}; + +//Move groups for 'auto moves' (used in BT mode) +const MoveType* const moveGrpBT[MAX_GRP_BT][MAX_MOV_BT] = +{ + {&SLOW_WAG1, &SLOW_WAG2, &SLOW_WAG3, &SLOW_WAG2}, //Relaxed + {&FAST_WAG, &SHORT_WAG, &HAPPY_WAG, &ERECT}, //Excited + {&TREMBLE1, &TREMBLE2, &ERECT_TREM,&ERECT_PULSE} //Tense +}; + +//Random moves (used in RF mode) +const MoveType* const moveRndGrp[MAX_GRP_RAND] = +{ + &SLOW_WAG1, &SHORT_WAG, &FAST_WAG, &SLOW_WAG2, + &HAPPY_WAG, &FAST_WAG, &SHORT_WAG, &SLOW_WAG3, + &SLOW_WAG2, &SLOW_WAG3, &HAPPY_WAG, &SHORT_WAG, + &FAST_WAG, &SLOW_WAG3, &SLOW_WAG1, &SLOW_WAG2 +}; + +//Time intervals for random moves +const uint8_t moveRndGrpT[MAX_GRP_RAND]= +{ + 35,17,26,40,18,17,36,32,25,34,28,31,31,42,32,33 +}; + +const LedsType LEDS_OFF = {1, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +const LedsType LEDS_ON = {10, //10 cycles*100*20ms = 20 seconds + 0xF,0xF,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +const LedsType LEDS_RECT= {15, //15 cycles*(50+50)*20ms = 30 seconds + 0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + -50,-50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +const LedsType LEDS_TRI = {15, //15 cycles*(50+50)*20ms = 30 seconds + 0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +const LedsType LEDS_SAW = {15, //15 cycles*(50+50)*20ms = 30 seconds + 0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 100, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +const LedsType LEDS_BEA = {15, + 0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + -5,-95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +const LedsType LEDS_SOS = {3, + 0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + -DD,-DD,-DD,-DD,-DD,-DP,-DL,-DL,-DL,-DL,-DL,-DP,-DD,-DD,-DD,-DD,-DD,-DP,-DP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +const LedsType LEDS_FLA = {2, + 0x7,0x8,0x6,0x5,0x3,0x7,0x8,0x7,0x5,0x2,0x6,0x8,0x6,0x5,0x8,0x5,0x2,0x4,0x8,0x5,0x1,0x7,0x8,0x7,0x4,0x8,0x7,0x8,0x8,0x4,0x5,0x3, + DF1,DF2,DF1,DF2,DF0,DF2,DF0,DF2,DF0,DF0,DF0,DF2,DF2,DF0,DF1,DF1,DF1,DF1,DF2,DF1,DF0,DF2,DF2,DF2,DF0,DF2,DF2,DF2,DF1,DF2,DF0,DF0 +}; + +const LedsType LEDS_STR = {250, + 0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + -3, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +const LedsType* const ledsGrpA[MAX_LED_GRPA] = {&LEDS_ON, &LEDS_OFF}; +const LedsType* const ledsGrpB[MAX_LED_GRPB] = {&LEDS_RECT, &LEDS_TRI, &LEDS_SAW}; +const LedsType* const ledsGrpC[MAX_LED_GRPC] = {&LEDS_BEA, &LEDS_STR}; + + +MoveType userMove[MAX_USER_MOVES]; +LedsType userLeds[MAX_USER_LEDS]; +MoveStruct currMove; +LedsStruct currLeds; + +AutoStruct autoMode; + +const MoveCmd MOVE_CMDS[MAX_MOVE_CMDS]= +{ + "TAILHM",&TAIL_HOME, + "TAILS1",&SLOW_WAG1, + "TAILS2",&SLOW_WAG2, + "TAILS3",&SLOW_WAG3, + "TAILFA",&FAST_WAG, + "TAILSH",&SHORT_WAG, + "TAILHA",&HAPPY_WAG, + "TAILER",&ERECT, + "TAILEP",&ERECT_PULSE, + "TAILT1",&TREMBLE1, + "TAILT2",&TREMBLE2, + "TAILET",&ERECT_TREM, + "TAILU1",&userMove[0], + "TAILU2",&userMove[1], + "TAILU3",&userMove[2], + "TAILU4",&userMove[3], +}; + +const LedsCmd LEDS_CMDS[MAX_LEDS_CMDS]= +{ + "LEDOFF",&LEDS_OFF, + "LEDON",&LEDS_ON, + "LEDREC",&LEDS_RECT, + "LEDTRI",&LEDS_TRI, + "LEDSAW",&LEDS_SAW, + "LEDSOS",&LEDS_SOS, + "LEDFLA",&LEDS_FLA, + "LEDSTR",&LEDS_STR, + "LEDBEA",&LEDS_BEA, + "LEDUS1",&userLeds[0], + "LEDUS2",&userLeds[1], + "LEDUS3",&userLeds[2], + "LEDUS4",&userLeds[3] +}; + +void movesInit() +{ + initServos(); //Inits the PWM peripherals + //setMove(&TAIL_HOME); + startLEDs(); + setLEDsBrightness(0); + stopLEDs(); + autoMode.timeout=0; //Makes sure 'auto mode' is off +} + +uint8_t setUserMove(uint8_t preset,uint8_t len,uint8_t cycles,int8_t *pos1,int8_t *pos2,int8_t *steps) +{ + uint8_t i; + + if (preset>=MAX_USER_MOVES) return 1; + memset(&userMove[preset],0,sizeof(MoveType)); + userMove[preset].cycles=cycles; + if (len>MAX_MOVES) len=MAX_MOVES; + for (i=0; i=MAX_USER_LEDS) return 1; + memset(&userLeds[preset],0,sizeof(LedsType)); + userLeds[preset].cycles=cycles; + if (len>MAX_MOVES) len=MAX_MOVES; + for (i=0; i> 2)&0x03u; + if ((1<=autoMode.t1 && p<=autoMode.t2) break; + } + if (pautoMode.t2) p=autoMode.t1; + + autoMode.pause = p * F_SERVO; +} + +//Sets up automatic mode (random moves for a specified length of time) +void setAuto(uint8_t t1, uint8_t t2, uint8_t dur, uint8_t grps) +{ + autoMode.timeout = (uint16_t)dur * F_SERVO; + autoMode.t1 = t1; + autoMode.t2 = t2; + autoMode.pause = 1; //Will start by setting up a move + autoMode.grps = grps; +} + +void abortAuto() +{ + autoMode.timeout = 0; +} + +//Sets up move variables for the ISR +void setMove(const MoveType* movePtr) +{ + currMove.movePtr = movePtr; + currMove.cycIter=movePtr->cycles; + currMove.moveIter=0; + currMove.stepIter=0; + //if (movePtr!=&TAIL_HOME) + //{ +// currMove.pos1=POS2SERVO(SERVO1_HOME); +// currMove.pos2=POS2SERVO(SERVO2_HOME); +// } + startServos(); +} + +AckEnum updateMove() +{ + if (autoMode.timeout) + { + --autoMode.timeout; + if (autoMode.timeout == 0) return ACK_END_AUTO; + + if (autoMode.pause) + { + --autoMode.pause; + if (autoMode.pause == 0) setRandMove(); + //return ACK_RUNNING; + } + } + + if (currMove.movePtr && currMove.cycIter) + { + if (currMove.stepIter==0) + { + int16_t pos; + //Copy new pos, unless it's a PL (keeps the last position) + pos=currMove.movePtr->pos1[currMove.moveIter]; + if (pos!=PL) currMove.pos1=POS2SERVO(pos); + pos=currMove.movePtr->pos2[currMove.moveIter]; + if (pos!=PL) currMove.pos2=POS2SERVO(pos); + + currMove.steps=(int16_t)currMove.movePtr->steps[currMove.moveIter]; + + if (currMove.steps>0) + { + uint8_t p1=currMove.moveIter+1u; + if (p1>=MAX_MOVES) /*|| currMove.movePtr->steps[p1]==0)*/ p1=0; + currMove.d1=(POS2SERVO(currMove.movePtr->pos1[p1])-currMove.pos1)/currMove.steps; + currMove.d2=(POS2SERVO(currMove.movePtr->pos2[p1])-currMove.pos2)/currMove.steps; + } + else + { + currMove.steps = -currMove.steps; + currMove.d1 = 0; + currMove.d2 = 0; + } + } + + setServo1(currMove.pos1); + setServo2(currMove.pos2); + currMove.pos1+=currMove.d1; + currMove.pos2+=currMove.d2; + currMove.stepIter++; + + + //if (currMove.stepIter>=currMove.movePtr->steps[currMove.moveIter] || currMove.steps==0 || currMove.pos1==0 || currMove.pos2==0) + if (currMove.stepIter>=currMove.steps || currMove.steps==0) + { + currMove.stepIter=0; + currMove.moveIter++; + //if (currMove.moveIter>=MAX_MOVES || currMove.steps==0) + if (currMove.moveIter>=MAX_MOVES || currMove.movePtr->steps[currMove.moveIter]==0) + { + currMove.moveIter=0; + currMove.cycIter--; + if (currMove.cycIter==0) + { + if (currMove.movePtr==&TAIL_HOME) + { + currMove.movePtr=0; + if (autoMode.timeout) setRandPause(); + stopServos(); + return ACK_END_MOVE; + } + else + { + setMove(&TAIL_HOME); + return ACK_RUNNING; + } + } + } + } + return ACK_RUNNING; + } + else stopServos(); + return ACK_WAITING; +} + +//Sets up led pattern variables for updateLeds() +void setLEDs(const LedsType* ledsPtr) +{ + currLeds.ledsPtr = ledsPtr; + currLeds.cycIter=ledsPtr->cycles; + currLeds.moveIter=0; + currLeds.stepIter=0; + startLEDs(); +} + +AckEnum updateLEDs() +{ + if (currLeds.ledsPtr && currLeds.cycIter) + { + if (currLeds.stepIter==0) + { + currLeds.pos=POS2LEDS(currLeds.ledsPtr->pos[currLeds.moveIter]); + currLeds.steps=currLeds.ledsPtr->steps[currLeds.moveIter]; + + if (currLeds.steps>0) + { + uint8_t p1=currLeds.moveIter+1u; + if (p1>=MAX_PATTERNS) /*|| currLeds.ledsPtr->steps[p1]==0)*/ p1=0; + currLeds.d=(POS2LEDS(currLeds.ledsPtr->pos[p1])-currLeds.pos)/currLeds.steps; + } + else + { + currLeds.steps = -currLeds.steps; + currLeds.d = 0; + } + } + setLEDsBrightness2(currLeds.pos); + currLeds.pos+=currLeds.d; + currLeds.stepIter++; + + //if (currLeds.stepIter>=currLeds.steps || currLeds.steps==0) + if (currLeds.stepIter>=currLeds.steps || currLeds.ledsPtr->steps[currLeds.moveIter]==0) + { + currLeds.stepIter=0; + currLeds.moveIter++; + if (currLeds.moveIter>=(MAX_PATTERNS) || currLeds.steps==0) + { + currLeds.moveIter=0; + currLeds.cycIter--; + if (currLeds.cycIter==0) + { + currLeds.ledsPtr=0; + return ACK_END_LEDS; + } + } + } + return ACK_RUNNING; return ACK_RUNNING; + } + else stopLEDs(); + return ACK_WAITING; +} Index: /RF_BT_Tail/Power.c =================================================================== --- /RF_BT_Tail/Power.c (revision 244) +++ /RF_BT_Tail/Power.c (revision 244) @@ -0,0 +1,249 @@ +// File: Power.c +//------------------------------------------------------------------------------ +// Author: Giovanni de Sanctis +// Email: info@lateral-technologies.com +//------------------------------------------------------------------------------ +// Date: Dec 2018 +// Pushbutton, onboard LEDs and other power related functions +//------------------------------------------------------------------------------ + +#include "Power.h" +#include "mcc_generated_files/mcc.h" +#include "LEDs.h" +#include "Servos.h" + +#define T_OFF 2 //Power button hold time in 0.5sec +#define T_TICK 20 //20ms +#define T_TIMER_ISR 100 //100ms + +//Battery low threshold assuming 2:1 voltage divider (1023*4.8V/2/3.3) +#define ADC_THR(x) (155u*x/20u) //1023/3.3V*5*v/2 (5cells,v=cell voltage in (volt*100) + +#define THR_BATT_ZERO ADC_THR(80u) //minimum realistic voltage +#define THR_BATT_B0 ADC_THR(124u) //0 bars, critical +#define THR_BATT_B1 ADC_THR(126u) //1 bar > 20% +#define THR_BATT_B2 ADC_THR(128u) //2 bars > 50% +#define THR_BATT_B3 ADC_THR(130u) //3 bars > 80% +#define THR_BATT_B4 ADC_THR(132u) //4 fully charged +#define THR_BATT_MIN THR_BATT_B1 + + +//NOTE:Timed battery reading has now been disabled. +// the variable is updated only if the app requests a battery reading +// so the red LED will start blinking only if the app reads a low battery level + +//Check the battery every 900*0.1s=90s +//#define TIMEOUT_CHECK_BATT 900 +//#define TIMEOUT_CHECK_BATT0 100 //Time out for the first battery read + +//Power down if not connected for 1200*0.1=120s +#define TIMEOUT_CONNECT 1200 + +uint32_t redPattern; //Stores the pattern for the red LED +uint32_t bluePattern; //Stores the pattern for the blue LED +uint32_t patternPtr; //current bit pointer; + +//uint16_t battTimer; //Timer counter to refresh the battery reading +uint16_t connectTimer; //Timer counter to power down if not connected + +uint16_t battery; //Last battery reading +uint8_t battBars; //battery bars, from 0 to 4 + +uint8_t btConnected; //>0 if BT module is connected +uint8_t tick; //enabled every 20ms; +uint8_t countTick; //decremented every timer interrupt. +uint8_t countTimerISR; //decremented every timer interrupt. +uint8_t poweringOff; //1 to request shut down + +void ioISR(); + +//Called after reset to hold the LDO's enable pin high +void powerBootstrap() +{ + IO_POW_SetDigitalOutput(); + IO_POW_SetHigh(); + + btConnected=0; //Assume not connected + battery=0x3FF; //Safe value for battery level + battBars=4; + + //battTimer=TIMEOUT_CHECK_BATT0;//Reset battery timer to enable 1st ADC reading + //connectTimer=TIMEOUT_CONNECT; //Reset connect timer + + poweringOff = 0; //We're not shutting down yet + + //Light up the LED while the power button is pressed + while(CMP1_GetOutputStatus()==0) + { + IO_LED_RED_N_SetLow(); + __delay_ms(500); + } + IO_LED_RED_N_SetHigh(); + + TMR0_SetInterruptHandler(ioISR); +} + +void shutDown() +{ + poweringOff=1; +} + +uint8_t checkPowerButton() +{ + uint8_t count=0; + + if (CMP1_GetOutputStatus()==0 || poweringOff) + { + // Disable the Global Interrupts to stop blinking + INTERRUPT_GlobalInterruptDisable(); + IO_LED_BLUE_N_SetHigh(); //Turns Off blue LED + + while(CMP1_GetOutputStatus()==0) + { + if (count<=T_OFF) + { + IO_LED_RED_N_SetLow(); + } + else + { + stopLEDs(); + stopServos(); + } + __delay_ms(250); + IO_LED_RED_N_SetHigh(); + __delay_ms(250); + ++count; + } + + //If power button was pressed for more than T_OFF/2 seconds + // then turn power off + if (count>T_OFF || poweringOff) IO_POW_SetLow(); + // Re-Enable the Global Interrupts + INTERRUPT_GlobalInterruptEnable(); + } + return 0; +} + +void setBluePattern(uint32_t pattern) +{ + //patternPtr=0x00000001; + if (!pattern) LED_BLUE_Off(); + bluePattern=pattern; +} + +//Updates the LED patterns; called in Timer1 every 0.1s +void ioISR() +{ + countTick--; + if (countTick==0) + { + countTick=T_TICK; + tick=1; + } + countTimerISR--; + if (countTimerISR) return; + countTimerISR=T_TIMER_ISR; + uint8_t status=IO_STA_GetValue(); + + + if (status^btConnected) + { + btConnected = status; + if (status) bluePattern=LED_BLUE_CNNCTD; + else bluePattern=LED_BLUE_ADVERT; + } + else + { + if (!btConnected) + { + connectTimer--; + //Timeout connection to BT + if (connectTimer==0) poweringOff=1; + } + else connectTimer=TIMEOUT_CONNECT; + } + + if (isBattLow()) redPattern=LED_RED_BATT; + else redPattern=LED_RED_OFF; + + patternPtr<<=1; + if (patternPtr==0) patternPtr=0x00000001; + if (redPattern) + { + if (redPattern & patternPtr) LED_RED_On(); + else LED_RED_Off(); + } + if (bluePattern) + { + if (bluePattern & patternPtr) LED_BLUE_On(); + else LED_BLUE_Off(); + } + //if (battTimer) --battTimer; +} + +//Waits 20mS (for servo timing) +void wait20ms() +{ + tick=0; + while(tick==0); +} + + +//Returns the battery voltage in fractions of 2.048V, i.e. 0x00=0V, 0xFF=2V +//the lsb indicates wheather the voltage is above a set threshold THR_BATT +//if lsb=0 then the voltage is below the threshold. +//The battery voltage depends on the voltage divider between battery and ADC in. +uint16_t getBatt() +{ + uint16_t reading; + + if (poweringOff) return battery; //If shutting down then exit + //If servos are running then don't read new value (it would be skewed) + if (isServoOn()) return battery; + + IO_PWM_LEDS_SetHigh(); + IO_PWM_LEDS_SetDigitalOutput(); + + //Unlock peripheral select + PPSLOCK=0x55; //Magic sequence + PPSLOCK=0xAA; + PPSLOCK=0x00; //Reset PPSLOCKED bit + + RB7PPS = 0x00; //RB7->LATB7 (detaches the out from the PWM3 preripheral) + __delay_us(160); //Allow parasitic caps to charge + reading=ADC1_GetConversion(ADC_BATT); //Get ADC value + RB7PPS = 0x05; //RB7->PWM3:PWM3OUT (reattaches PWM3) + //Re-lock peripheral select + PPSLOCK=0x55; //Magic sequence + PPSLOCK=0xAA; + PPSLOCK=0x01; //Set PPSLOCKED bit + + //Make sure we read a meaningful voltage before updating + if (reading>THR_BATT_ZERO) battery=reading; + + if (battery>=THR_BATT_B4) battBars=4; + else if (battery>=THR_BATT_B3) battBars=3; + else if (battery>=THR_BATT_B2) battBars=2; + else if (battery>=THR_BATT_B1) battBars=1; + else + { + battBars=0; + //shutDown(); //Battery critical, shut down to prevent damage + } + return battery; +} + +//Returns the battery charge remaining, expressed in 'bars', from 0 to 4 +uint8_t getBattBars() +{ + getBatt(); + return battBars; +} + + +//Returns 1 if battery voltage is below threshold +uint8_t isBattLow() +{ + //getBatt(); + return (uint8_t)(battery +#include "mcc_generated_files/pwm3.h" + +#define PWM3_PERIOD 8000u + +#define POS2LEDS(x) ((int16_t)x*1000) + +void stopLEDs(); +void startLEDs(); +//Brightness in % +void setLEDsBrightness(uint8_t level); +//Brightness in period counts +void setLEDsBrightness2(int16_t level); + + +#endif /* LEDS_H */ +