finish devleop can interface not yet tested

This commit is contained in:
Rémi Heredero 2023-08-23 13:45:34 +02:00
parent ff9137a026
commit 21f9cb7f62
23 changed files with 927 additions and 1144 deletions

View File

@ -1,25 +0,0 @@
#include "blcontrol.h"
#include "../mcc_generated_files/mcc.h"
#include "../factory/factory.h"
//private methods
void BLControl_init(BLControl* me)
{
//nothing to do yet
}
void BLControl_onButton(void * me, uint8_t buttonId, bool pressed)
{
BLControl* realMe = (BLControl*)me;
if (buttonId == BID)
{
if (pressed)
{
LED_on(l());
}
else
{
LED_off(l());
}
}
}

View File

@ -1,19 +0,0 @@
#ifndef BLCONTROL_DEF
#define BLCONTROL_DEF
#include <stdint.h>
#include <stdbool.h>
#include "../xf/xf.h"
#include "../board/button/buttonsm.h"
struct BLControl_
{
};
typedef struct BLControl_ BLControl;
void BLControl_init(BLControl* me);
void BLControl_onButton(void* me, uint8_t buttonId, bool pressed);
#endif

View File

@ -0,0 +1,70 @@
#include "factory.h"
//the factory object containing all objects of our system
static Factory theFactory;
//all the getters
LED* l1() {
return &theFactory.l1_;
}
LED* l2() {
return &theFactory.l2_;
}
LED* l3() {
return &theFactory.l3_;
}
LED* l4() {
return &theFactory.l4_;
}
LED* l5() {
return &theFactory.l5_;
}
LED* l6() {
return &theFactory.l6_;
}
LED* l7() {
return &theFactory.l7_;
}
LED* l8() {
return &theFactory.l8_;
}
//initialize all objects
void Factory_init() {
LED_init(l1(), 1);
LED_init(l2(), 2);
LED_init(l3(), 3);
LED_init(l4(), 4);
LED_init(l5(), 5);
LED_init(l6(), 6);
LED_init(l7(), 7);
LED_init(l8(), 8);
LED_initHW(l1());
LED_initHW(l2());
LED_initHW(l3());
LED_initHW(l4());
LED_initHW(l5());
LED_initHW(l6());
LED_initHW(l7());
LED_initHW(l8());
CAN_init();
}
void foo(uint8_t a, uint8_t b, uint32_t c){
}
//connect objects if required
void Factory_build() {
ECAN_SetRXBnInterruptHandler(CAN_newMsg);
CAN_onReceiveCan(foo);
}
//start all state machines
void Factory_start() {
CAN_startBehaviour();
}

View File

@ -0,0 +1,48 @@
/**
* @author Rémi Heredero
* @version. 0.0.0
* @date August 2023
* @file factory.h
*/
#ifndef FACTORY_H
#define FACTORY_H
#include <stdint.h>
#include <stdbool.h>
#include "../../board/led/led.h"
#include "../../board/button/button.h"
#include "../../middleware/can_interface.h"
typedef struct {
LED l1_;
LED l2_;
LED l3_;
LED l4_;
LED l5_;
LED l6_;
LED l7_;
LED l8_;
} Factory;
void Factory_init();
void Factory_build();
void Factory_start();
//these are global getters for our objects
LED* l1();
LED* l2();
LED* l3();
LED* l4();
LED* l5();
LED* l6();
LED* l7();
LED* l8();
#endif

View File

@ -1,5 +1,5 @@
#include "mcc_generated_files/mcc.h"
#include "xf/xf.h"
#include "../mcc_generated_files/mcc.h"
#include "../xf/xf.h"
#include "factory/factory.h"
/*

View File

@ -1,66 +1,137 @@
/**
* @author Rémi Heredero (remi@heredero.ch)
* @version. 1.0.0
* @date 2023-06-15
*/
#include "button.h"
#include "../../mcc_generated_files/pin_manager.h"
#include "../../app/factory/factory.h"
void Button_init(Button* me, uint8_t id, bool isPullUp)
{
/**
* @brief Initialize the button
*
* @param me The object to initialize
* @param id The id of the button
*/
void BUTTON_init(BUTTON* me, uint8_t id) {
me->id = id;
me->isPullUp = isPullUp;
me->state = ST_PBINIT;
me->press.fCallBack = NULL;
me->release.fCallBack = NULL;
}
/**
* @brief Initialize the Driver
* @brief Initialize the hardware of the button
*
* @param me The object to initialize
*/
void Button_initHW(Button* me)
{
}
//read the state of the button
//maybe you have to adjust the
//low level calls
uint8_t Button_read(Button* me)
{
uint8_t value = LOW;
switch (me->id)
{
void BUTTON_initHW(BUTTON* me) {
switch (me->id) {
case 1:
value = IO_RA7_GetValue();
INPUT1_SetDigitalInput();
break;
case 2:
INPUT2_SetDigitalInput();
break;
case 3:
INPUT3_SetDigitalInput();
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
default:
break;
}
if (me->isPullUp == true)
{
value=value==LOW?HIGH:LOW;
}
return value;
}
//id getter
uint8_t Button_getId(Button* me)
{
return me->id;
/**
* @brief Check if the button is pressed
* The function returns true if the button is pressed, false otherwise
*
* @param me The object to check
* @return true if the button is pressed
* @return false if the button is not pressed
*/
bool BUTTON_isPressed(BUTTON* me) {
switch (me->id) {
case 1:
return INPUT1_GetValue();
break;
case 2:
return INPUT2_GetValue();
break;
case 3:
return INPUT3_GetValue();
break;
default:
return false;
break;
}
}
//id setter
void Button_setId(Button* me, uint8_t id)
{
me->id = id;
void BUTTON_startBehaviour(BUTTON* me) {
POST(me, &BUTTON_processEvent, evPBInit, 0, 0);
}
bool BUTTON_processEvent(Event * ev) {
bool processed = false;
BUTTON* me = (BUTTON*)Event_getTarget(ev);
BUTTON_STATES oldState = me->state;
evIDT evid = Event_getId(ev);
switch(me->state){
case ST_PBINIT:
if (evid == evPBInit) {
POST(me, &BUTTON_processEvent, evPBPoll, 0, 0);
if(BUTTON_isPressed(me)) {
me->state = ST_PBPRESSED;
} else {
me->state = ST_PBRELEASED;
}
}
break;
case ST_PBRELEASED:
if(evid == evPBPoll) {
POST(me, &BUTTON_processEvent, evPBPoll, PB_POLL_TIME, 0);
if(BUTTON_isPressed(me)) {
me->state = ST_PBPRESSED;
}
}
break;
case ST_PBPRESSED:
if(evid == evPBPoll) {
POST(me, &BUTTON_processEvent, evPBPoll, PB_POLL_TIME, 0);
if(!BUTTON_isPressed(me)){
me->state = ST_PBRELEASED;
}
}
break;
}
if(oldState != me->state) {
switch(me->state){
case ST_PBINIT:
break;
case ST_PBRELEASED:
if(me->release.fCallBack != NULL) me->release.fCallBack(me->release.param);
break;
case ST_PBPRESSED:
if(me->press.fCallBack != NULL) me->press.fCallBack(me->press.param);
break;
}
processed = true;
}
return processed;
}
void BUTTON_setEventFunctions(BUTTON* me, buttonCallBack fPress, buttonCallBack fRelease) {
me->press = fPress;
me->release = fRelease;
}
buttonCallBack BUTTON_defineCallBack(fButtonCallback f, void* param){
buttonCallBack c;
c.fCallBack = f;
c.param = param;
return c;
}

View File

@ -1,25 +1,97 @@
#ifndef Button_ONCE
#define Button_ONCE
/**
* @author Rémi Heredero (remi@heredero.ch)
* @version. 1.0.0
* @date 2023-06-15
*/
#ifndef BUTTON_H
#define BUTTON_H
#include <stdint.h>
#include <stdbool.h>
#include "../../xf/xf.h"
/*
* this is the declaration of the Button class
#define PB_POLL_TIME 20 // Poll time for BUTTON
typedef enum {
ST_PBINIT,
ST_PBRELEASED,
ST_PBPRESSED
} BUTTON_STATES;
typedef enum {
evPBInit=50,
evPBPoll
} BUTTON_EVENTS;
// Calback function
typedef void (*fButtonCallback)(void*);
typedef struct {
fButtonCallback fCallBack;
void* param;
} buttonCallBack;
typedef struct {
uint8_t id; // Id of the button
BUTTON_STATES state; // Actual state
buttonCallBack press; // Callback for the rising edge of the button
buttonCallBack release; // Callback for the falling edge of the button
} BUTTON;
/**
* @brief Initialize the button
*
* @param me button itself
* @param id The id of the button
*/
void BUTTON_init(BUTTON* me, uint8_t id);
struct Button_
{
uint8_t id;
bool isPullUp;
};
/**
* @brief Initialize the hardware of the button
*
* @param me button itself
*/
void BUTTON_initHW(BUTTON* me);
typedef struct Button_ Button;
/**
* @brief Set both callback event functions
*
* @param me button itself
* @param fPress callback function when the button have a rising edge
* @param release callback function whent the have a falling edge
*/
void BUTTON_setEventFunctions(BUTTON* me, buttonCallBack fPress, buttonCallBack release);
void Button_init(Button* me, uint8_t id, bool isPullUp);
void Button_initHW(Button* me);
uint8_t Button_read(Button* me);
void Button_setId(Button* me, uint8_t id);
uint8_t Button_getId(Button* me);
/**
* @brief Check if the button is pressed
* The function returns true if the button is pressed, false otherwise
*
* @param me button itself
* @return true if the button is pressed
* @return false if the button is not pressed
*/
bool BUTTON_isPressed(BUTTON* me);
#endif
/**
* @biref Start state machine of the BUTTON
*
* @param me the button itself
*/
void BUTTON_startBehaviour(BUTTON* me);
/**
* @brief State machine of the BUTTON
*
* @param ev event to process on the state machine
*/
bool BUTTON_processEvent(Event* ev);
/**
* @brief Define a callback for BUTTON
*
* @param f callback function
* @param param callback parameter for the function
* @return the callback struct
*/
buttonCallBack BUTTON_defineCallBack(fButtonCallback f, void* param);
#endif /* BUTTON_H */

View File

@ -1,129 +0,0 @@
#include "buttonsm.h"
/*
* this is the init method of the ButtonSM class
*/
void ButtonSM_init(ButtonSM* me, Button* button)
{
me->state = ST_BSMINIT;
me->button = button;
me->actualState = ST_BSMINIT;
me->observer = NULL;
me->observerCB = NULL;
}
/*
* this is the state machine method of the ButtonSM class
*/
bool ButtonSM_processEvent(Event* ev)
{
ButtonSM* me = (ButtonSM*)ev->target;
bool processed = false;
BSMState oldState = me->state;
switch (me->state)
{
case ST_BSMINIT:
if (Event_getId(ev) == evBSMInit)
{
me->state = ST_BSMWAIT;
}
break;
case ST_BSMWAIT:
if (Event_getId(ev) == evBSMPollTM)
{
me->state = ST_BSMPOLL;
}
break;
case ST_BSMPOLL:
if (Event_getId(ev) == evBSMDefault)
{
if (Button_read(me->button)==HIGH)
{
me->state = ST_BSMPRESSED;
}
else
{
me->state = ST_BSMRELEASED;
}
}
break;
case ST_BSMPRESSED:
if (Event_getId(ev) == evBSMDefault)
{
me->state = ST_BSMWAIT;
}
break;
case ST_BSMRELEASED:
if (Event_getId(ev) == evBSMDefault)
{
me->state = ST_BSMWAIT;
}
break;
}
if (oldState != me->state)
{
processed = true;
switch (me->state)
{
case ST_BSMINIT:
break;
case ST_BSMWAIT:
POST(me, &ButtonSM_processEvent, evBSMPollTM,POLLTM,0);
break;
case ST_BSMPOLL:
POST(me, &ButtonSM_processEvent, evBSMDefault,0,0);
break;
case ST_BSMPRESSED:
POST(me, &ButtonSM_processEvent, evBSMDefault,0,0);
if (me->actualState != ST_BSMPRESSED)
{
if (me->observerCB != NULL)
{
me->observerCB(me->observer,Button_getId(me->button),true);
me->actualState = ST_BSMPRESSED;
}
}
break;
case ST_BSMRELEASED:
POST(me, &ButtonSM_processEvent, evBSMDefault,0,0);
if (me->actualState != ST_BSMRELEASED)
{
if (me->observerCB != NULL)
{
me->observerCB(me->observer,Button_getId(me->button),false);
me->actualState = ST_BSMRELEASED;
}
}
break;
}
}
return processed;
}
/*
* this is the start method for the
* state machine of the ButtonSM class
*/
void ButtonSM_startBehaviour(ButtonSM* me)
{
POST(me, &ButtonSM_processEvent, evBSMInit,0,0);
me->actualState = Button_read(me->button)==HIGH?ST_BSMPRESSED:ST_BSMRELEASED;
}
/*
* this is the method to set the object and the
* call back method of the ButtonSM class
* this method will be called whenever the
* button changes its state
* as parameters to the callback method will be passed
* the object address, the button id and its state
* if the call back method does not belong to a class,
* then the object address must be set to NULL
*/
void ButtonSM_setObserver(ButtonSM* me, void* observer, buttonObserverCBT observerCB)
{
me->observer = observer;
me->observerCB = observerCB;
}

View File

@ -1,69 +0,0 @@
#ifndef BUTTONSM_DEF
#define BUTTONSM_DEF
#include <stdint.h>
#include <stdbool.h>
#include "../../xf/xf.h"
#include "button.h"
/*
* these are the events of the
* button state machine
* be sure to make the first event
* in the enumeration different from 0
*/
typedef enum BSMEvent
{
evBSMInit = 10,
evBSMDefault,
evBSMPollTM
} BSMEvent;
/*
* these are the states of the
* button state machine
*/
typedef enum BSMSTate_
{
ST_BSMINIT,
ST_BSMWAIT,
ST_BSMPOLL,
ST_BSMPRESSED,
ST_BSMRELEASED
} BSMState;
/*
* the associated button will be polled
* each 50 ms. do not make this time
* shorter than TICKINTERVAL
*/
#define POLLTM 50
/*
* this is the prototype type of the callback function
* that will be called when the associated button
* changes from released to pressed or inverse.
*/
typedef void (*buttonObserverCBT)(void*, uint8_t, bool);
/*
* this is the declaration of the ButtonSM class
*/
struct ButtonSM_
{
BSMState state;
Button* button;
BSMState actualState;
buttonObserverCBT observerCB;
void* observer;
};
typedef struct ButtonSM_ ButtonSM;
void ButtonSM_init(ButtonSM* me, Button* button);
void ButtonSM_startBehaviour(ButtonSM* me);
bool ButtonSM_processEvent(Event* ev);
void ButtonSM_setObserver(ButtonSM* me, void* observer, buttonObserverCBT observerCB);
#endif

View File

@ -1,8 +1,13 @@
/**
* @author Rémi Heredero (remi@heredero.ch)
* @version. 1.0.0
* @date 2023-06-15
*/
#include "led.h"
#include "../../mcc_generated_files/pin_manager.h"
void LED_init(LED* me, uint8_t id)
{
void LED_init(LED* me, uint8_t id) {
me->id = id;
}
@ -10,94 +15,68 @@ void LED_init(LED* me, uint8_t id)
* @brief Initialize the Driver
*
*/
void LED_initHW(LED* me)
{
void LED_initHW(LED* me) {
LED_off(me);
}
/*
* for the on and the off methods:
* if the output is push pull, it depends if the
* load is connect to ground or vcc.
* in this case, the load is connected to vcc,
* so on and off are inverted. Change the code as it
* is convenient for your hardware
*/
//switch on the led
//maybe you have to adjust your
//low level calls
void LED_on(LED* me)
{
switch (me->id)
{
void LED_on(void* me) {
LED* l = (LED*) me;
switch (l->id) {
case 1:
IO_RB0_SetLow();
OUTPUT1_SetHigh();
break;
case 2:
OUTPUT2_SetHigh();
break;
case 3:
OUTPUT3_SetHigh();
break;
case 4:
OUTPUT4_SetHigh();
break;
case 5:
OUTPUT5_SetHigh();
break;
case 6:
OUTPUT6_SetHigh();
break;
case 7:
OUTPUT7_SetHigh();
break;
case 8:
break;
case 9:
break;
case 10:
OUTPUT8_SetHigh();
break;
}
}
//switch off the led
//maybe you have to adjust your
//low level calls
void LED_off(LED* me)
{
switch (me->id)
{
void LED_off(void* me) {
LED* l = (LED*) me;
switch (l->id) {
case 1:
IO_RB0_SetHigh();
OUTPUT1_SetLow();
break;
case 2:
OUTPUT2_SetLow();
break;
case 3:
OUTPUT3_SetLow();
break;
case 4:
OUTPUT4_SetLow();
break;
case 5:
OUTPUT5_SetLow();
break;
case 6:
OUTPUT6_SetLow();
break;
case 7:
OUTPUT7_SetLow();
break;
case 8:
break;
case 9:
break;
case 10:
OUTPUT8_SetLow();
break;
}
}
void LED_setState(LED* me, uint8_t state)
{
if (state == HIGH)
{
LED_on(me);
}
if (state == LOW)
{
LED_off(me);
}
}

View File

@ -1,23 +1,43 @@
#ifndef LED_ONCE
#define LED_ONCE
/**
* @author Rémi Heredero (remi@heredero.ch)
* @version. 1.0.0
* @date 2023-06-15
*/
#ifndef LED_H
#define LED_H
#include <stdint.h>
/*
* this is the declaration of the Led class
// LED struct
typedef struct {
uint8_t id; // The id of the LED
}LED;
/**
* Initialize the led
* @param me the led itself
* @param id the id of the led
*/
struct LED_
{
//has a gpo
uint8_t id;
};
typedef struct LED_ LED;
void LED_init(LED* me, uint8_t id);
void LED_initHW(LED* me);
void LED_on(LED* me);
void LED_off(LED* me);
void LED_setState(LED* me,uint8_t state);
#endif
/**
* Initializing the led
* @param me the led itself
*/
void LED_initHW(LED* me);
/**
* Turn On the led
* @param me the led itself
*/
void LED_on(void* me);
/**
* Turn Off the led
* @param me the led itself
*/
void LED_off(void* me);
#endif /* LED_H */

View File

@ -1,62 +0,0 @@
#include "factory.h"
//the factory object containing all objects of our system
static Factory theFactory;
//all the getters
LED* l()
{
return &theFactory.l_;
}
Button* b()
{
return &theFactory.b_;
}
ButtonSM* bsm()
{
return &theFactory.bsm_;
}
BLControl* blc()
{
return &theFactory.blc_;
}
//initialize all objects
void Factory_init()
{
LED_init(l(),LID);
LED_initHW(l());
Button_init(b(),BID, true);
Button_initHW(b());
ButtonSM_init(bsm(),b());
BLControl_init(blc());
CANINTERFACE_init();
;
}
void foo(uint32_t a, uint32_t b){
}
//connect objects if required
void Factory_build() {
ButtonSM_setObserver(bsm(), blc(), &BLControl_onButton);
ECAN_SetRXBnInterruptHandler(CANINTERFACE_newMsg);
//CANINTERFACE_onProcessCan(foo);
}
//start all state machines
void Factory_start()
{
ButtonSM_startBehaviour(bsm());
}

View File

@ -1,42 +0,0 @@
/* this is the Factory class */
#ifndef FACTORY_ONCE
#define FACTORY_ONCE
#include <stdint.h>
#include <stdbool.h>
#include "../board/led/led.h"
#include "../board/button/button.h"
#include "../board/button/buttonsm.h"
#include "../app/blcontrol.h"
#include "../middleware/can/can_interface.h"
#define BID 1
#define LID 1
void bObs(void*, uint8_t,bool);
struct Factory_
{
LED l_;
Button b_;
ButtonSM bsm_;
BLControl blc_;
};
typedef struct Factory_ Factory;
void Factory_init();
void Factory_build();
void Factory_start();
//these are global getters for our objects
LED* l();
Button* b();
ButtonSM* bsm();
BLControl* blc();
#endif

View File

@ -64,16 +64,16 @@ void PIN_MANAGER_Initialize(void)
/**
TRISx registers
*/
TRISA = 0xFF;
TRISB = 0xFE;
TRISA = 0x00;
TRISB = 0xF6;
TRISC = 0xFF;
/**
ANSELx registers
*/
ANSELC = 0xFF;
ANSELB = 0xF6;
ANSELA = 0x7F;
ANSELB = 0xEE;
ANSELA = 0x00;
/**
WPUx registers
@ -112,7 +112,8 @@ void PIN_MANAGER_Initialize(void)
CANRXPPS = 0x0B; //RB3->ECAN:CANRX;
CANRXPPS = 0x0C; //RB4->ECAN:CANRX;
RB3PPS = 0x33; //RB3->ECAN:CANTX0;
}
void PIN_MANAGER_IOC(void)

View File

@ -65,45 +65,165 @@
#define PULL_UP_ENABLED 1
#define PULL_UP_DISABLED 0
// get/set IO_RA7 aliases
#define IO_RA7_TRIS TRISAbits.TRISA7
#define IO_RA7_LAT LATAbits.LATA7
#define IO_RA7_PORT PORTAbits.RA7
#define IO_RA7_WPU WPUAbits.WPUA7
#define IO_RA7_OD ODCONAbits.ODCA7
#define IO_RA7_ANS ANSELAbits.ANSELA7
#define IO_RA7_SetHigh() do { LATAbits.LATA7 = 1; } while(0)
#define IO_RA7_SetLow() do { LATAbits.LATA7 = 0; } while(0)
#define IO_RA7_Toggle() do { LATAbits.LATA7 = ~LATAbits.LATA7; } while(0)
#define IO_RA7_GetValue() PORTAbits.RA7
#define IO_RA7_SetDigitalInput() do { TRISAbits.TRISA7 = 1; } while(0)
#define IO_RA7_SetDigitalOutput() do { TRISAbits.TRISA7 = 0; } while(0)
#define IO_RA7_SetPullup() do { WPUAbits.WPUA7 = 1; } while(0)
#define IO_RA7_ResetPullup() do { WPUAbits.WPUA7 = 0; } while(0)
#define IO_RA7_SetPushPull() do { ODCONAbits.ODCA7 = 0; } while(0)
#define IO_RA7_SetOpenDrain() do { ODCONAbits.ODCA7 = 1; } while(0)
#define IO_RA7_SetAnalogMode() do { ANSELAbits.ANSELA7 = 1; } while(0)
#define IO_RA7_SetDigitalMode() do { ANSELAbits.ANSELA7 = 0; } while(0)
// get/set OUTPUT1 aliases
#define OUTPUT1_TRIS TRISAbits.TRISA0
#define OUTPUT1_LAT LATAbits.LATA0
#define OUTPUT1_PORT PORTAbits.RA0
#define OUTPUT1_WPU WPUAbits.WPUA0
#define OUTPUT1_OD ODCONAbits.ODCA0
#define OUTPUT1_ANS ANSELAbits.ANSELA0
#define OUTPUT1_SetHigh() do { LATAbits.LATA0 = 1; } while(0)
#define OUTPUT1_SetLow() do { LATAbits.LATA0 = 0; } while(0)
#define OUTPUT1_Toggle() do { LATAbits.LATA0 = ~LATAbits.LATA0; } while(0)
#define OUTPUT1_GetValue() PORTAbits.RA0
#define OUTPUT1_SetDigitalInput() do { TRISAbits.TRISA0 = 1; } while(0)
#define OUTPUT1_SetDigitalOutput() do { TRISAbits.TRISA0 = 0; } while(0)
#define OUTPUT1_SetPullup() do { WPUAbits.WPUA0 = 1; } while(0)
#define OUTPUT1_ResetPullup() do { WPUAbits.WPUA0 = 0; } while(0)
#define OUTPUT1_SetPushPull() do { ODCONAbits.ODCA0 = 0; } while(0)
#define OUTPUT1_SetOpenDrain() do { ODCONAbits.ODCA0 = 1; } while(0)
#define OUTPUT1_SetAnalogMode() do { ANSELAbits.ANSELA0 = 1; } while(0)
#define OUTPUT1_SetDigitalMode() do { ANSELAbits.ANSELA0 = 0; } while(0)
// get/set IO_RB0 aliases
#define IO_RB0_TRIS TRISBbits.TRISB0
#define IO_RB0_LAT LATBbits.LATB0
#define IO_RB0_PORT PORTBbits.RB0
#define IO_RB0_WPU WPUBbits.WPUB0
#define IO_RB0_OD ODCONBbits.ODCB0
#define IO_RB0_ANS ANSELBbits.ANSELB0
#define IO_RB0_SetHigh() do { LATBbits.LATB0 = 1; } while(0)
#define IO_RB0_SetLow() do { LATBbits.LATB0 = 0; } while(0)
#define IO_RB0_Toggle() do { LATBbits.LATB0 = ~LATBbits.LATB0; } while(0)
#define IO_RB0_GetValue() PORTBbits.RB0
#define IO_RB0_SetDigitalInput() do { TRISBbits.TRISB0 = 1; } while(0)
#define IO_RB0_SetDigitalOutput() do { TRISBbits.TRISB0 = 0; } while(0)
#define IO_RB0_SetPullup() do { WPUBbits.WPUB0 = 1; } while(0)
#define IO_RB0_ResetPullup() do { WPUBbits.WPUB0 = 0; } while(0)
#define IO_RB0_SetPushPull() do { ODCONBbits.ODCB0 = 0; } while(0)
#define IO_RB0_SetOpenDrain() do { ODCONBbits.ODCB0 = 1; } while(0)
#define IO_RB0_SetAnalogMode() do { ANSELBbits.ANSELB0 = 1; } while(0)
#define IO_RB0_SetDigitalMode() do { ANSELBbits.ANSELB0 = 0; } while(0)
// get/set OUTPUT2 aliases
#define OUTPUT2_TRIS TRISAbits.TRISA1
#define OUTPUT2_LAT LATAbits.LATA1
#define OUTPUT2_PORT PORTAbits.RA1
#define OUTPUT2_WPU WPUAbits.WPUA1
#define OUTPUT2_OD ODCONAbits.ODCA1
#define OUTPUT2_ANS ANSELAbits.ANSELA1
#define OUTPUT2_SetHigh() do { LATAbits.LATA1 = 1; } while(0)
#define OUTPUT2_SetLow() do { LATAbits.LATA1 = 0; } while(0)
#define OUTPUT2_Toggle() do { LATAbits.LATA1 = ~LATAbits.LATA1; } while(0)
#define OUTPUT2_GetValue() PORTAbits.RA1
#define OUTPUT2_SetDigitalInput() do { TRISAbits.TRISA1 = 1; } while(0)
#define OUTPUT2_SetDigitalOutput() do { TRISAbits.TRISA1 = 0; } while(0)
#define OUTPUT2_SetPullup() do { WPUAbits.WPUA1 = 1; } while(0)
#define OUTPUT2_ResetPullup() do { WPUAbits.WPUA1 = 0; } while(0)
#define OUTPUT2_SetPushPull() do { ODCONAbits.ODCA1 = 0; } while(0)
#define OUTPUT2_SetOpenDrain() do { ODCONAbits.ODCA1 = 1; } while(0)
#define OUTPUT2_SetAnalogMode() do { ANSELAbits.ANSELA1 = 1; } while(0)
#define OUTPUT2_SetDigitalMode() do { ANSELAbits.ANSELA1 = 0; } while(0)
// get/set OUTPUT3 aliases
#define OUTPUT3_TRIS TRISAbits.TRISA2
#define OUTPUT3_LAT LATAbits.LATA2
#define OUTPUT3_PORT PORTAbits.RA2
#define OUTPUT3_WPU WPUAbits.WPUA2
#define OUTPUT3_OD ODCONAbits.ODCA2
#define OUTPUT3_ANS ANSELAbits.ANSELA2
#define OUTPUT3_SetHigh() do { LATAbits.LATA2 = 1; } while(0)
#define OUTPUT3_SetLow() do { LATAbits.LATA2 = 0; } while(0)
#define OUTPUT3_Toggle() do { LATAbits.LATA2 = ~LATAbits.LATA2; } while(0)
#define OUTPUT3_GetValue() PORTAbits.RA2
#define OUTPUT3_SetDigitalInput() do { TRISAbits.TRISA2 = 1; } while(0)
#define OUTPUT3_SetDigitalOutput() do { TRISAbits.TRISA2 = 0; } while(0)
#define OUTPUT3_SetPullup() do { WPUAbits.WPUA2 = 1; } while(0)
#define OUTPUT3_ResetPullup() do { WPUAbits.WPUA2 = 0; } while(0)
#define OUTPUT3_SetPushPull() do { ODCONAbits.ODCA2 = 0; } while(0)
#define OUTPUT3_SetOpenDrain() do { ODCONAbits.ODCA2 = 1; } while(0)
#define OUTPUT3_SetAnalogMode() do { ANSELAbits.ANSELA2 = 1; } while(0)
#define OUTPUT3_SetDigitalMode() do { ANSELAbits.ANSELA2 = 0; } while(0)
// get/set OUTPUT4 aliases
#define OUTPUT4_TRIS TRISAbits.TRISA3
#define OUTPUT4_LAT LATAbits.LATA3
#define OUTPUT4_PORT PORTAbits.RA3
#define OUTPUT4_WPU WPUAbits.WPUA3
#define OUTPUT4_OD ODCONAbits.ODCA3
#define OUTPUT4_ANS ANSELAbits.ANSELA3
#define OUTPUT4_SetHigh() do { LATAbits.LATA3 = 1; } while(0)
#define OUTPUT4_SetLow() do { LATAbits.LATA3 = 0; } while(0)
#define OUTPUT4_Toggle() do { LATAbits.LATA3 = ~LATAbits.LATA3; } while(0)
#define OUTPUT4_GetValue() PORTAbits.RA3
#define OUTPUT4_SetDigitalInput() do { TRISAbits.TRISA3 = 1; } while(0)
#define OUTPUT4_SetDigitalOutput() do { TRISAbits.TRISA3 = 0; } while(0)
#define OUTPUT4_SetPullup() do { WPUAbits.WPUA3 = 1; } while(0)
#define OUTPUT4_ResetPullup() do { WPUAbits.WPUA3 = 0; } while(0)
#define OUTPUT4_SetPushPull() do { ODCONAbits.ODCA3 = 0; } while(0)
#define OUTPUT4_SetOpenDrain() do { ODCONAbits.ODCA3 = 1; } while(0)
#define OUTPUT4_SetAnalogMode() do { ANSELAbits.ANSELA3 = 1; } while(0)
#define OUTPUT4_SetDigitalMode() do { ANSELAbits.ANSELA3 = 0; } while(0)
// get/set OUTPUT5 aliases
#define OUTPUT5_TRIS TRISAbits.TRISA4
#define OUTPUT5_LAT LATAbits.LATA4
#define OUTPUT5_PORT PORTAbits.RA4
#define OUTPUT5_WPU WPUAbits.WPUA4
#define OUTPUT5_OD ODCONAbits.ODCA4
#define OUTPUT5_ANS ANSELAbits.ANSELA4
#define OUTPUT5_SetHigh() do { LATAbits.LATA4 = 1; } while(0)
#define OUTPUT5_SetLow() do { LATAbits.LATA4 = 0; } while(0)
#define OUTPUT5_Toggle() do { LATAbits.LATA4 = ~LATAbits.LATA4; } while(0)
#define OUTPUT5_GetValue() PORTAbits.RA4
#define OUTPUT5_SetDigitalInput() do { TRISAbits.TRISA4 = 1; } while(0)
#define OUTPUT5_SetDigitalOutput() do { TRISAbits.TRISA4 = 0; } while(0)
#define OUTPUT5_SetPullup() do { WPUAbits.WPUA4 = 1; } while(0)
#define OUTPUT5_ResetPullup() do { WPUAbits.WPUA4 = 0; } while(0)
#define OUTPUT5_SetPushPull() do { ODCONAbits.ODCA4 = 0; } while(0)
#define OUTPUT5_SetOpenDrain() do { ODCONAbits.ODCA4 = 1; } while(0)
#define OUTPUT5_SetAnalogMode() do { ANSELAbits.ANSELA4 = 1; } while(0)
#define OUTPUT5_SetDigitalMode() do { ANSELAbits.ANSELA4 = 0; } while(0)
// get/set OUTPUT6 aliases
#define OUTPUT6_TRIS TRISAbits.TRISA5
#define OUTPUT6_LAT LATAbits.LATA5
#define OUTPUT6_PORT PORTAbits.RA5
#define OUTPUT6_WPU WPUAbits.WPUA5
#define OUTPUT6_OD ODCONAbits.ODCA5
#define OUTPUT6_ANS ANSELAbits.ANSELA5
#define OUTPUT6_SetHigh() do { LATAbits.LATA5 = 1; } while(0)
#define OUTPUT6_SetLow() do { LATAbits.LATA5 = 0; } while(0)
#define OUTPUT6_Toggle() do { LATAbits.LATA5 = ~LATAbits.LATA5; } while(0)
#define OUTPUT6_GetValue() PORTAbits.RA5
#define OUTPUT6_SetDigitalInput() do { TRISAbits.TRISA5 = 1; } while(0)
#define OUTPUT6_SetDigitalOutput() do { TRISAbits.TRISA5 = 0; } while(0)
#define OUTPUT6_SetPullup() do { WPUAbits.WPUA5 = 1; } while(0)
#define OUTPUT6_ResetPullup() do { WPUAbits.WPUA5 = 0; } while(0)
#define OUTPUT6_SetPushPull() do { ODCONAbits.ODCA5 = 0; } while(0)
#define OUTPUT6_SetOpenDrain() do { ODCONAbits.ODCA5 = 1; } while(0)
#define OUTPUT6_SetAnalogMode() do { ANSELAbits.ANSELA5 = 1; } while(0)
#define OUTPUT6_SetDigitalMode() do { ANSELAbits.ANSELA5 = 0; } while(0)
// get/set OUTPUT7 aliases
#define OUTPUT7_TRIS TRISAbits.TRISA6
#define OUTPUT7_LAT LATAbits.LATA6
#define OUTPUT7_PORT PORTAbits.RA6
#define OUTPUT7_WPU WPUAbits.WPUA6
#define OUTPUT7_OD ODCONAbits.ODCA6
#define OUTPUT7_ANS ANSELAbits.ANSELA6
#define OUTPUT7_SetHigh() do { LATAbits.LATA6 = 1; } while(0)
#define OUTPUT7_SetLow() do { LATAbits.LATA6 = 0; } while(0)
#define OUTPUT7_Toggle() do { LATAbits.LATA6 = ~LATAbits.LATA6; } while(0)
#define OUTPUT7_GetValue() PORTAbits.RA6
#define OUTPUT7_SetDigitalInput() do { TRISAbits.TRISA6 = 1; } while(0)
#define OUTPUT7_SetDigitalOutput() do { TRISAbits.TRISA6 = 0; } while(0)
#define OUTPUT7_SetPullup() do { WPUAbits.WPUA6 = 1; } while(0)
#define OUTPUT7_ResetPullup() do { WPUAbits.WPUA6 = 0; } while(0)
#define OUTPUT7_SetPushPull() do { ODCONAbits.ODCA6 = 0; } while(0)
#define OUTPUT7_SetOpenDrain() do { ODCONAbits.ODCA6 = 1; } while(0)
#define OUTPUT7_SetAnalogMode() do { ANSELAbits.ANSELA6 = 1; } while(0)
#define OUTPUT7_SetDigitalMode() do { ANSELAbits.ANSELA6 = 0; } while(0)
// get/set OUTPUT8 aliases
#define OUTPUT8_TRIS TRISAbits.TRISA7
#define OUTPUT8_LAT LATAbits.LATA7
#define OUTPUT8_PORT PORTAbits.RA7
#define OUTPUT8_WPU WPUAbits.WPUA7
#define OUTPUT8_OD ODCONAbits.ODCA7
#define OUTPUT8_ANS ANSELAbits.ANSELA7
#define OUTPUT8_SetHigh() do { LATAbits.LATA7 = 1; } while(0)
#define OUTPUT8_SetLow() do { LATAbits.LATA7 = 0; } while(0)
#define OUTPUT8_Toggle() do { LATAbits.LATA7 = ~LATAbits.LATA7; } while(0)
#define OUTPUT8_GetValue() PORTAbits.RA7
#define OUTPUT8_SetDigitalInput() do { TRISAbits.TRISA7 = 1; } while(0)
#define OUTPUT8_SetDigitalOutput() do { TRISAbits.TRISA7 = 0; } while(0)
#define OUTPUT8_SetPullup() do { WPUAbits.WPUA7 = 1; } while(0)
#define OUTPUT8_ResetPullup() do { WPUAbits.WPUA7 = 0; } while(0)
#define OUTPUT8_SetPushPull() do { ODCONAbits.ODCA7 = 0; } while(0)
#define OUTPUT8_SetOpenDrain() do { ODCONAbits.ODCA7 = 1; } while(0)
#define OUTPUT8_SetAnalogMode() do { ANSELAbits.ANSELA7 = 1; } while(0)
#define OUTPUT8_SetDigitalMode() do { ANSELAbits.ANSELA7 = 0; } while(0)
// get/set RB3 procedures
#define RB3_SetHigh() do { LATBbits.LATB3 = 1; } while(0)
@ -117,6 +237,18 @@
#define RB3_SetAnalogMode() do { ANSELBbits.ANSELB3 = 1; } while(0)
#define RB3_SetDigitalMode() do { ANSELBbits.ANSELB3 = 0; } while(0)
// get/set RB4 procedures
#define RB4_SetHigh() do { LATBbits.LATB4 = 1; } while(0)
#define RB4_SetLow() do { LATBbits.LATB4 = 0; } while(0)
#define RB4_Toggle() do { LATBbits.LATB4 = ~LATBbits.LATB4; } while(0)
#define RB4_GetValue() PORTBbits.RB4
#define RB4_SetDigitalInput() do { TRISBbits.TRISB4 = 1; } while(0)
#define RB4_SetDigitalOutput() do { TRISBbits.TRISB4 = 0; } while(0)
#define RB4_SetPullup() do { WPUBbits.WPUB4 = 1; } while(0)
#define RB4_ResetPullup() do { WPUBbits.WPUB4 = 0; } while(0)
#define RB4_SetAnalogMode() do { ANSELBbits.ANSELB4 = 1; } while(0)
#define RB4_SetDigitalMode() do { ANSELBbits.ANSELB4 = 0; } while(0)
/**
@Param
none

View File

@ -1,134 +0,0 @@
/**
* @author Rémi Heredero
* @version 1.0.0
* @date August 2023
* @file can_interface.c
*/
#include "can_interface.h"
void CANINTERFACE_init(){
CANINTERFACE_myself.wait.f = NULL;
CANINTERFACE_myself.read.f = NULL;
//CANINTERFACE_myself.processCan = NULL;
}
void CANINTERFACE_startBehaviour(){
POST(&CANINTERFACE_myself, &CANINTERFACE_processEvent, evCAinit, 0, 0);
}
void CANINTERFACE_newMsg() {
uint64_t data;
uCAN_MSG canMsg;
CAN_receive(&canMsg);
data = canMsg.frame.id;
data = data<<32;
data = canMsg.frame.data0;
data = data<<8;
data = canMsg.frame.data1;
data = data<<8;
data = canMsg.frame.data2;
data = data<<8;
data = canMsg.frame.data3;
POST(&CANINTERFACE_myself, &CANINTERFACE_processEvent, evCAnewMsg, 0, data);
}
bool CANINTERFACE_processEvent(Event* ev) {
bool processed = false;
CANINTERFACE* me = (CANINTERFACE*)Event_getTarget(ev);
CANINTERFACE_STATES oldState = me->state;
evIDT evid = Event_getId(ev);
uint64_t data = Event_getData(ev);
uint32_t canData = (uint32_t) data;
data = data>>8;
uint32_t canId = (uint32_t) data;
switch (me->state) { // onState
case STCA_INIT:
if (ev->id == evCAinit) {
me->state = STCA_WAIT;
}
break;
case STCA_WAIT:
if (ev->id == evCAnewMsg) {
me->state = STCA_READ;
CANINTERFACE_emitDone(0);
}
break;
case STCA_READ:
if (ev->id == evCAdone) {
me->state = STCA_WAIT;
}
break;
}
if(oldState != me->state){
switch (oldState) { // onExit
case STCA_INIT:
break;
case STCA_WAIT:
break;
case STCA_READ:
break;
}
switch (me->state) { // onEntry
case STCA_INIT:
break;
case STCA_WAIT:
if (me->wait.f != NULL) {
me->wait.f(me->wait.p);
}
break;
case STCA_READ:
if (me->read.f != NULL) {
me->read.f(me->read.p);
}
if (me->processCan != NULL) {
me->processCan(canId, canData);
}
break;
}
processed = true;
}
return processed;
}
/*************
* Callbacks *
*************/
void CANINTERFACE_onWait(CANINTERFACE_CALLBACK_FUNCTION f, void* p) {
CANINTERFACE_myself.wait.f = f;
CANINTERFACE_myself.wait.p = p;
}
void CANINTERFACE_onRead(CANINTERFACE_CALLBACK_FUNCTION f, void* p) {
CANINTERFACE_myself.read.f = f;
CANINTERFACE_myself.read.p = p;
}
void CANINTERFACE_onProcessCan(CANINTERFACE_CALLBACK_CAN f) {
CANINTERFACE_myself.processCan = f;
}
/************
* EMITTERS *
************/
void CANINTERFACE_emitNewMsg(uint16_t t) {
POST(&CANINTERFACE_myself, &CANINTERFACE_processEvent, evCAnewMsg, t, 0);
}
void CANINTERFACE_emitDone(uint16_t t) {
POST(&CANINTERFACE_myself, &CANINTERFACE_processEvent, evCAdone, t, 0);
}

View File

@ -1,104 +0,0 @@
/**
* @author Rémi Heredero
* @version 1.0.0
* @date August 2023
* @file can_interface.h
*/
#ifndef CANINTERFACE_H
#define CANINTERFACE_H
#include "../../xf/xf.h"
typedef enum {
STCA_INIT,
STCA_WAIT,
STCA_READ
} CANINTERFACE_STATES;
typedef enum {
evCAinit = 10, // TODO change this number (< 256)
evCAnewMsg,
evCAdone
} CANINTERFACE_EVENTS;
typedef void (*CANINTERFACE_CALLBACK_FUNCTION)(void*);
typedef void (*CANINTERFACE_CALLBACK_CAN)(uint32_t, uint32_t);
typedef struct {
CANINTERFACE_CALLBACK_FUNCTION f; // function
void* p; // param(s)
} CANINTERFACE_CALLBACK;
typedef struct {
CANINTERFACE_STATES state;
CANINTERFACE_CALLBACK wait;
CANINTERFACE_CALLBACK read;
CANINTERFACE_CALLBACK_CAN processCan;
} CANINTERFACE;
CANINTERFACE CANINTERFACE_myself;
/**
* Initialize the CANINTERFACE
* @param me the CANINTERFACE itself
*/
void CANINTERFACE_init();
/**
* Start the CANINTERFACE state machine
*/
void CANINTERFACE_startBehaviour();
/**
* Handler for receiving new can message during.
* This function is done during interrupt
*/
void CANINTERFACE_newMsg();
/**
* Process the event
* @param ev the event to process
* @return true if the event is processed
*/
bool CANINTERFACE_processEvent(Event* ev);
/*************
* Callbacks *
*************/
/**
* Set the callback function to call when the CANINTERFACE is entering state wait
* @param f the function to call
* @param p the param(s) to pass to the function
*/
void CANINTERFACE_onWait(CANINTERFACE_CALLBACK_FUNCTION f, void* p);
/**
* Set the callback function to call when the CANINTERFACE is entering state read
* @param f the function to call
* @param p the param(s) to pass to the function
*/
void CANINTERFACE_onRead(CANINTERFACE_CALLBACK_FUNCTION f, void* p);
/**
* Set the callback function to call when the CANINTERFACE is entering state read
* @param f the function to call
*/
void CANINTERFACE_onProcessCan(CANINTERFACE_CALLBACK_CAN f);
/************
* EMITTERS *
************/
/**
* Emit the NewMsg event
* @param t time to wait in ms before triggering event
*/
void CANINTERFACE_emitNewMsg(uint16_t t);
/**
* Emit the Done event
* @param t time to wait in ms before triggering event
*/
void CANINTERFACE_emitDone(uint16_t t);
#endif

View File

@ -1,131 +0,0 @@
/**
* @author Rémi Heredero
* @version 1.0.0
* @date August 2023
* @file can_sender.c
*/
#include "can_sender.h"
void CANSENDER_init(CANSENDER* me){
me->state = STCS_INIT;
me->sendingTime = 1;
me->wait.f = NULL;
me->send.f = NULL;
}
void CANSENDER_startBehaviour(CANSENDER* me){
POST(me, &CANSENDER_processEvent, evCSinit, 0, 0);
}
bool CANSENDER_processEvent(Event* ev) {
bool processed = false;
CANSENDER* me = (CANSENDER*)Event_getTarget(ev);
CANSENDER_STATES oldState = me->state;
evIDT evid = Event_getId(ev);
uint64_t data = Event_getData(ev);
switch (me->state) { // onState
case STCS_INIT:
if (ev->id == evCSinit) {
CANSENDER.state = STCS_WAIT;
}
break;
case STCS_WAIT:
if (ev->id == evCSsend) {
CANSENDER.state = STCS_SEND;
}
break;
case STCS_SEND:
if (ev->id == evCSdone) {
CANSENDER.state = STCS_WAIT;
}
uCAN_MSG canMsg;
canMsg.frame.data0 = (uint8_t) data;
data = data >> 8;
canMsg.frame.data1 = (uint8_t) data;
data = data >> 8;
canMsg.frame.data2 = (uint8_t) data;
data = data >> 8;
canMsg.frame.data3 = (uint8_t) data;
data = data >> 8;
canMsg.frame.id = (uint32_t) data;
CAN_transmit(&canMsg);
CANSENDER_emitDone(me, 0);
break;
}
if(oldState != me->state){
switch (oldState) { // onExit
case STCS_INIT:
break;
case STCS_WAIT:
break;
case STCS_SEND:
break;
}
switch (me->state) { // onEntry
case STCS_INIT:
break;
case STCS_WAIT:
if (me->wait.f != NULL) {
me->wait.f(me->wait.p);
}
break;
case STCS_SEND:
if (me->send.f != NULL) {
me->send.f(me->send.p);
}
break;
}
processed = true;
}
return processed;
}
/*************
* Callbacks *
*************/
void CANSENDER_onWait(CANSENDER* me, CANSENDER_CALLBACK_FUNCTION f, void* p) {
me->wait.f = f;
me->wait.p = p;
}
void CANSENDER_onSend(CANSENDER* me, CANSENDER_CALLBACK_FUNCTION f, void* p) {
me->send.f = f;
me->send.p = p;
}
/************
* EMITTERS *
************/
void CANSENDER_emitSend(CANSENDER* me, uint16_t t) {
POST(me, &CANSENDER_processEvent, evCSsend, t, 0);
}
void CANSENDER_emitDone(CANSENDER* me, uint16_t t) {
POST(me, &CANSENDER_processEvent, evCSdone, t, 0);
}
CANSENDER_sendCanMsg(CANSENDER* me, uint8_t id, uint32_t data)
/***********
* SETTERS *
***********/
void CANSENDER_setSendingTime(CANSENDER* me, uint8_t v) {
me->sendingTime = v;
}

View File

@ -1,112 +0,0 @@
/**
* @author Rémi Heredero
* @version 1.0.0
* @date August 2023
* @file can_sender.h
*/
#ifndef CANSENDER_H
#define CANSENDER_H
#include "../../xf/xf.h"
typedef enum {
STCS_INIT,
STCS_WAIT,
STCS_SEND
} CANSENDER_STATES;
typedef enum {
evCSinit = 15, // TODO change this number (< 256)
evCSsend,
evCSdone
} CANSENDER_EVENTS;
typedef void (*CANSENDER_CALLBACK_FUNCTION)(void*);
typedef struct {
CANSENDER_CALLBACK_FUNCTION f; // function
void* p; // param(s)
} CANSENDER_CALLBACK;
typedef struct {
CANSENDER_STATES state;
uint8_t sendingTime;
CANSENDER_CALLBACK wait;
CANSENDER_CALLBACK send;
} CANSENDER;
/**
* Initialize the CANSENDER
* @param me the CANSENDER itself
*/
void CANSENDER_init(CANSENDER* me);
/**
* Start the CANSENDER state machine
* @param me the CANSENDER itself
*/
void CANSENDER_startBehaviour(CANSENDER* me);
/**
* Process the event
* @param ev the event to process
* @return true if the event is processed
*/
bool CANSENDER_processEvent(Event* ev);
/*************
* Callbacks *
*************/
/**
* Set the callback function to call when the CANSENDER is entering state wait
* @param me the CANSENDER itself
* @param f the function to call
* @param p the param(s) to pass to the function
*/
void CANSENDER_onWait(CANSENDER* me, CANSENDER_CALLBACK_FUNCTION f, void* p);
/**
* Set the callback function to call when the CANSENDER is entering state send
* @param me the CANSENDER itself
* @param f the function to call
* @param p the param(s) to pass to the function
*/
void CANSENDER_onSend(CANSENDER* me, CANSENDER_CALLBACK_FUNCTION f, void* p);
/************
* EMITTERS *
************/
/**
* Emit the send event
* @param me the CANSENDER itself
* @param t time to wait in ms before triggering event
*/
void CANSENDER_emitSend(CANSENDER* me, uint16_t t);
/**
* Emit the done event
* @param me the CANSENDER itself
* @param t time to wait in ms before triggering event
*/
void CANSENDER_emitDone(CANSENDER* me, uint16_t t);
void CANSENDER_sendCanMsg(CANSENDER* me, uint8_t id, uint32_t data);
void sendCanMsg(uint32_t id, uint32_t data);
/***********
* SETTERS *
***********/
/**
*
* @param me
* @param v
*/
void CANSENDER_setSendingTime(CANSENDER* me, uint8_t v);
void CANSENDER_seSender(CANSENDER* me, uint8_t s);
void CANSENDER_setRecipient(CANSENDER* me, uint8_t r);
#endif

View File

@ -0,0 +1,127 @@
/**
* @author Rémi Heredero
* @version 1.0.0
* @date August 2023
* @file can_interface.c
*/
#include "can_interface.h"
void CAN_init(){
CAN_myself.receiveCan = NULL;
CAN_myself.sender = 0;
}
void CAN_startBehaviour(){
POST(&CAN_myself, &CAN_processEvent, evCAinit, 0, 0);
}
bool CAN_processEvent(Event* ev) {
bool processed = false;
CAN* me = (CAN*)Event_getTarget(ev);
CAN_STATES oldState = me->state;
evIDT evid = Event_getId(ev);
uint64_t data = Event_getData(ev);
switch (me->state) { // onState
case STCA_INIT:
if (ev->id == evCAinit) {
me->state = STCA_PROCESS;
}
break;
case STCA_PROCESS:
// New message arrive
if (ev->id == evCAnewMsg) {
if (me->receiveCan != NULL) {
uint32_t canData = (uint32_t) data;
data = data>>32;
uint8_t idMsg = (uint8_t) data;
data = data>>4;
uint8_t idRecipient = (uint8_t) data;
data = data>>4;
uint8_t idSender = (uint8_t) data;
me->receiveCan(idSender, idMsg, canData);
}
}
// Send a message
if (ev->id == evCAsend) {
uCAN_MSG canMsg;
canMsg.frame.idType = 0; // I don't understand what is it
canMsg.frame.dlc = 8; // 8 bytes to send
canMsg.frame.rtr = 0; // no remote frame
canMsg.frame.data0 = (uint8_t) data;
data = data >> 8;
canMsg.frame.data1 = (uint8_t) data;
data = data >> 8;
canMsg.frame.data2 = (uint8_t) data;
data = data >> 8;
canMsg.frame.data3 = (uint8_t) data;
data = data >> 8;
canMsg.frame.id = (uint32_t) data;
CAN_transmit(&canMsg);
}
break;
}
if(oldState != me->state){
switch (oldState) { // onExit
case STCA_INIT:
break;
case STCA_PROCESS:
break;
}
switch (me->state) { // onEntry
case STCA_INIT:
break;
case STCA_PROCESS:
break;
}
processed = true;
}
return processed;
}
/*************
* Callbacks *
*************/
void CAN_onReceiveCan(CAN_CALLBACK f) {
CAN_myself.receiveCan = f;
}
/************
* EMITTERS *
************/
void CAN_newMsg() {
uint64_t data;
uCAN_MSG canMsg;
CAN_receive(&canMsg);
data = canMsg.frame.id;
data = data<<32;
data = canMsg.frame.data0;
data = data<<8;
data = canMsg.frame.data1;
data = data<<8;
data = canMsg.frame.data2;
data = data<<8;
data = canMsg.frame.data3;
POST(&CAN_myself, &CAN_processEvent, evCAnewMsg, 0, data);
}
void CAN_Send(uint8_t idRecipient, uint8_t idMsg, uint32_t data) {
uint64_t tmpData = CAN_myself.sender;
tmpData = (tmpData<<4) | idRecipient;
tmpData = (tmpData<<4) | idMsg;
tmpData = (tmpData<<32) | data;
POST(&CAN_myself, &CAN_processEvent, evCAsend, 0, tmpData);
}

View File

@ -0,0 +1,99 @@
/**
* @author Rémi Heredero
* @version 1.0.0
* @date August 2023
* @file can_interface.h
*/
#ifndef CAN_H
#define CAN_H
#include "../xf/xf.h"
typedef enum {
STCA_INIT,
STCA_PROCESS
} CAN_STATES;
typedef enum {
evCAinit = 10, // TODO change this number (< 256)
evCAnewMsg,
evCAsend
} CAN_EVENTS;
typedef void (*CAN_CALLBACK)(uint8_t, uint8_t, uint32_t);
typedef struct {
CAN_STATES state;
uint8_t sender;
CAN_CALLBACK receiveCan;
} CAN;
CAN CAN_myself;
/**
* Initialize the CAN
* @param me the CAN itself
*/
void CAN_init();
/**
* Start the CAN state machine
*/
void CAN_startBehaviour();
/**
* Process the event
* @param ev the event to process
* @return true if the event is processed
*/
bool CAN_processEvent(Event* ev);
/*************
* Callbacks *
*************/
/**
* Set the callback function to call when the CAN is entering state read
* @param f the function to call
*/
void CAN_onReceiveCan(CAN_CALLBACK f);
/************
* EMITTERS *
************/
/**
* Handler for receiving new can message during.
* This function is done during interrupt
*/
void CAN_newMsg();
/**
* Put a new can message on the queue
* @param idRecipient id for the recipient
* @param idMsg id for the message
* @param data 4 bytes of data to send
*/
void CAN_Send(uint8_t idRecipient, uint8_t idMsg, uint32_t data);
/***********
* SETTERS *
***********/
/**
* Set the sender of this firmware
* @param idSender id of the sender
* 1 CONTROL
* 2 JOYSTICK
* 3 DISPLAY
* 4 DRIVE
* 5 STEERING
* 6 SUPPLY
* 7 UNDEFINED YET
* 0 BROADCAST/DEBUG
*/
void CAN_setSender(uint8_t idSender);
#endif

View File

@ -5,20 +5,11 @@
displayName="Header Files"
projectFiles="true">
<logicalFolder name="app" displayName="app" projectFiles="true">
<itemPath>app/blcontrol.h</itemPath>
<itemPath>app/factory/factory.h</itemPath>
</logicalFolder>
<logicalFolder name="board" displayName="board" projectFiles="true">
<logicalFolder name="button" displayName="button" projectFiles="true">
<itemPath>board/button/buttonsm.h</itemPath>
<itemPath>board/button/button.h</itemPath>
</logicalFolder>
<logicalFolder name="led" displayName="led" projectFiles="true">
<itemPath>board/led/led.h</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="factory" displayName="factory" projectFiles="true">
<itemPath>factory/factory.h</itemPath>
</logicalFolder>
<logicalFolder name="MCC Generated Files"
displayName="MCC Generated Files"
projectFiles="true">
@ -31,10 +22,7 @@
<itemPath>mcc_generated_files/memory.h</itemPath>
</logicalFolder>
<logicalFolder name="middleware" displayName="middleware" projectFiles="true">
<logicalFolder name="f1" displayName="can" projectFiles="true">
<itemPath>middleware/can/can_interface.h</itemPath>
<itemPath>middleware/can/can_sender.h</itemPath>
</logicalFolder>
<itemPath>middleware/can_interface.h</itemPath>
</logicalFolder>
<logicalFolder name="xf" displayName="xf" projectFiles="true">
<itemPath>xf/event.h</itemPath>
@ -50,20 +38,12 @@
displayName="Source Files"
projectFiles="true">
<logicalFolder name="app" displayName="app" projectFiles="true">
<itemPath>app/blcontrol.c</itemPath>
<itemPath>app/factory/factory.c</itemPath>
<itemPath>app/main.c</itemPath>
</logicalFolder>
<logicalFolder name="board" displayName="board" projectFiles="true">
<logicalFolder name="button" displayName="button" projectFiles="true">
<itemPath>board/button/button.c</itemPath>
<itemPath>board/button/buttonsm.c</itemPath>
</logicalFolder>
<logicalFolder name="led" displayName="led" projectFiles="true">
<itemPath>board/led/led.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="factory" displayName="factory" projectFiles="true">
<itemPath>factory/factory.c</itemPath>
</logicalFolder>
<logicalFolder name="MCC Generated Files"
displayName="MCC Generated Files"
projectFiles="true">
@ -76,16 +56,12 @@
<itemPath>mcc_generated_files/memory.c</itemPath>
</logicalFolder>
<logicalFolder name="middleware" displayName="middleware" projectFiles="true">
<logicalFolder name="f1" displayName="can" projectFiles="true">
<itemPath>middleware/can/can_interface.c</itemPath>
<itemPath>middleware/can/can_sender.c</itemPath>
</logicalFolder>
<itemPath>middleware/can_interface.c</itemPath>
</logicalFolder>
<logicalFolder name="xf" displayName="xf" projectFiles="true">
<itemPath>xf/event.c</itemPath>
<itemPath>xf/xf.c</itemPath>
</logicalFolder>
<itemPath>main.c</itemPath>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
@ -319,6 +295,21 @@
<property key="coverage-enable" value=""/>
<property key="stack-guidance" value="false"/>
</XC8-CO>
<XC8-config-global>
<property key="advanced-elf" value="true"/>
<property key="gcc-opt-driver-new" value="true"/>
<property key="gcc-opt-std" value="-std=c99"/>
<property key="gcc-output-file-format" value="dwarf-3"/>
<property key="omit-pack-options" value="false"/>
<property key="omit-pack-options-new" value="1"/>
<property key="output-file-format" value="-mcof,+elf"/>
<property key="stack-size-high" value="auto"/>
<property key="stack-size-low" value="auto"/>
<property key="stack-size-main" value="auto"/>
<property key="stack-type" value="compiled"/>
<property key="user-pack-device-support" value=""/>
<property key="wpo-lto" value="false"/>
</XC8-config-global>
</conf>
</confs>
</configurationDescriptor>

View File

@ -11676,35 +11676,35 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RA0"/>
<value/>
<value>OUTPUT1</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RA1"/>
<value/>
<value>OUTPUT2</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RA2"/>
<value/>
<value>OUTPUT3</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RA3"/>
<value/>
<value>OUTPUT4</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RA4"/>
<value/>
<value>OUTPUT5</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RA5"/>
<value/>
<value>OUTPUT6</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RA6"/>
<value/>
<value>OUTPUT7</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RA7"/>
<value/>
<value>OUTPUT8</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RB0"/>
@ -11780,35 +11780,35 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RA0"/>
<value>disabled</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RA1"/>
<value>disabled</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RA2"/>
<value>disabled</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RA3"/>
<value>disabled</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RA4"/>
<value>disabled</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RA5"/>
<value>disabled</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RA6"/>
<value>disabled</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RA7"/>
<value>disabled</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RB0"/>
@ -11884,35 +11884,35 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="anselUserSetRA0"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="anselUserSetRA1"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="anselUserSetRA2"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="anselUserSetRA3"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="anselUserSetRA4"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="anselUserSetRA5"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="anselUserSetRA6"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="anselUserSetRA7"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="anselUserSetRB0"/>
@ -11980,35 +11980,35 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="customNameUserSet RA0"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="customNameUserSet RA1"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="customNameUserSet RA2"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="customNameUserSet RA3"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="customNameUserSet RA4"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="customNameUserSet RA5"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="customNameUserSet RA6"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="customNameUserSet RA7"/>
<value>disabled</value>
<value>enabled</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="customNameUserSet RB0"/>
@ -14352,11 +14352,11 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="ANSELA"/>
<value>255</value>
<value>0</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="ANSELB"/>
<value>246</value>
<value>238</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="ANSELC"/>
@ -14364,7 +14364,7 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="CANRXPPS"/>
<value>11</value>
<value>12</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="CCP1PPS"/>
@ -14588,11 +14588,11 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="RB3PPS"/>
<value>0</value>
<value>51</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="RB4PPS"/>
<value>51</value>
<value>0</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="RB5PPS"/>
@ -14720,11 +14720,11 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="TRISA"/>
<value>255</value>
<value>0</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="TRISB"/>
<value>238</value>
<value>246</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="TRISC"/>
@ -14768,35 +14768,35 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELA" settingAlias="ANSELA0"/>
<value>analog</value>
<value>digital</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELA" settingAlias="ANSELA1"/>
<value>analog</value>
<value>digital</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELA" settingAlias="ANSELA2"/>
<value>analog</value>
<value>digital</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELA" settingAlias="ANSELA3"/>
<value>analog</value>
<value>digital</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELA" settingAlias="ANSELA4"/>
<value>analog</value>
<value>digital</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELA" settingAlias="ANSELA5"/>
<value>analog</value>
<value>digital</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELA" settingAlias="ANSELA6"/>
<value>analog</value>
<value>digital</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELA" settingAlias="ANSELA7"/>
<value>analog</value>
<value>digital</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELB" settingAlias="ANSELB0"/>
@ -14812,11 +14812,11 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELB" settingAlias="ANSELB3"/>
<value>digital</value>
<value>analog</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELB" settingAlias="ANSELB4"/>
<value>analog</value>
<value>digital</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="ANSELB" settingAlias="ANSELB5"/>
@ -14864,7 +14864,7 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="CANRXPPS" settingAlias="CANRXPPS"/>
<value>11</value>
<value>12</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="CCP1PPS" settingAlias="CCP1PPS"/>
@ -15608,11 +15608,11 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="RB3PPS" settingAlias="RB3PPS"/>
<value>0</value>
<value>51</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="RB4PPS" settingAlias="RB4PPS"/>
<value>51</value>
<value>0</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="RB5PPS" settingAlias="RB5PPS"/>
@ -15824,35 +15824,35 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISA" settingAlias="TRISA0"/>
<value>input</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISA" settingAlias="TRISA1"/>
<value>input</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISA" settingAlias="TRISA2"/>
<value>input</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISA" settingAlias="TRISA3"/>
<value>input</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISA" settingAlias="TRISA4"/>
<value>input</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISA" settingAlias="TRISA5"/>
<value>input</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISA" settingAlias="TRISA6"/>
<value>input</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISA" settingAlias="TRISA7"/>
<value>input</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISB" settingAlias="TRISB0"/>
@ -15868,11 +15868,11 @@
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISB" settingAlias="TRISB3"/>
<value>input</value>
<value>output</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISB" settingAlias="TRISB4"/>
<value>output</value>
<value>input</value>
</entry>
<entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="TRISB" settingAlias="TRISB5"/>
@ -17163,7 +17163,27 @@
<value>Window delay time 87.5%</value>
</entry>
</tokenMap>
<generatedFileHashHistoryMap class="java.util.TreeMap">
<generatedFileHashHistoryMap class="java.util.HashMap">
<entry>
<file>mcc_generated_files\mcc.h</file>
<hash>a2db7e36e878f686c2bf0c2ef586ef1c6570fa2f27119b4be7b52af6403091a4</hash>
</entry>
<entry>
<file>mcc_generated_files\device_config.h</file>
<hash>89c6172ff575ce515b93f2fbc85dcedc2978e58a8e0e1fbdc52e42511ae3bc05</hash>
</entry>
<entry>
<file>mcc_generated_files\interrupt_manager.h</file>
<hash>9c2f1ae45f2ac887bb3e8b3763e1a394a6a22ffe4e9ae1c20c336fe6f12da1aa</hash>
</entry>
<entry>
<file>mcc_generated_files\memory.c</file>
<hash>17fb4759c4719b77287f6c4be48edfbcf117b5b8398b771c434f23aceac256e0</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr0.h</file>
<hash>6661ab783aae9f11e952805f9bca14209ec06551939552123056eefd5524fff8</hash>
</entry>
<entry>
<file>main.c</file>
<hash>cae37ae3b36cf22e97e106633433f5c00a66dd5d38ec353eb67fbbb0d88bde4d</hash>
@ -17172,57 +17192,37 @@
<file>mcc_generated_files\device_config.c</file>
<hash>39a6d1181ef5eab59c7dde2c52a9ea889465d4da43262200f3322abc45e77739</hash>
</entry>
<entry>
<file>mcc_generated_files\device_config.h</file>
<hash>89c6172ff575ce515b93f2fbc85dcedc2978e58a8e0e1fbdc52e42511ae3bc05</hash>
</entry>
<entry>
<file>mcc_generated_files\ecan.c</file>
<hash>ea62f50d319e1e537d7632774728ad6a779f442e896d043dbdea8066d028a6c6</hash>
</entry>
<entry>
<file>mcc_generated_files\ecan.h</file>
<hash>aa9a50aae81bab76b876ea6123777af7d6a6d0a58fe953be27e8b88776395b2e</hash>
</entry>
<entry>
<file>mcc_generated_files\interrupt_manager.c</file>
<hash>df04edcd2c7d85ef90a8dbe4e46f1b1c9487b872153f4f2321249a4ce0d9635f</hash>
</entry>
<entry>
<file>mcc_generated_files\interrupt_manager.h</file>
<hash>9c2f1ae45f2ac887bb3e8b3763e1a394a6a22ffe4e9ae1c20c336fe6f12da1aa</hash>
</entry>
<entry>
<file>mcc_generated_files\mcc.c</file>
<hash>cc9ed44843b509879e6a3f676b561ecde91e1df88d855cf7eca77e1afc8920ca</hash>
</entry>
<entry>
<file>mcc_generated_files\mcc.h</file>
<hash>a2db7e36e878f686c2bf0c2ef586ef1c6570fa2f27119b4be7b52af6403091a4</hash>
</entry>
<entry>
<file>mcc_generated_files\memory.c</file>
<hash>17fb4759c4719b77287f6c4be48edfbcf117b5b8398b771c434f23aceac256e0</hash>
</entry>
<entry>
<file>mcc_generated_files\memory.h</file>
<hash>fbbca4e9d7ce92ddcc637d82b694a1f5cbefa75710a8a18bb1dc9ab5161f0924</hash>
</entry>
<entry>
<file>mcc_generated_files\pin_manager.c</file>
<hash>30d27d3c212d3420d65a30996dd68e9c3ba572d0d2bf50924ad025e552b9dcbf</hash>
</entry>
<entry>
<file>mcc_generated_files\pin_manager.h</file>
<hash>76c9c709283a0d30fc6bf8d663b1394044aa806dbd1282fad68c1ebb0a221d36</hash>
<hash>611a409602fd8fba29be052e06a3ce86ad0a3b723b5e0f4c1a998854de7f9a7b</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr0.c</file>
<hash>e0b4d075e819024ae77ea60a2c01182fdca45b783980cb50358d0a614736339d</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr0.h</file>
<hash>6661ab783aae9f11e952805f9bca14209ec06551939552123056eefd5524fff8</hash>
<file>mcc_generated_files\pin_manager.c</file>
<hash>04b16a3d3fcbbb333ee6fb545a405b76aba47ef3935be548bf2b8165c43c5654</hash>
</entry>
<entry>
<file>mcc_generated_files\ecan.c</file>
<hash>ea62f50d319e1e537d7632774728ad6a779f442e896d043dbdea8066d028a6c6</hash>
</entry>
<entry>
<file>mcc_generated_files\mcc.c</file>
<hash>cc9ed44843b509879e6a3f676b561ecde91e1df88d855cf7eca77e1afc8920ca</hash>
</entry>
<entry>
<file>mcc_generated_files\interrupt_manager.c</file>
<hash>df04edcd2c7d85ef90a8dbe4e46f1b1c9487b872153f4f2321249a4ce0d9635f</hash>
</entry>
<entry>
<file>mcc_generated_files\ecan.h</file>
<hash>aa9a50aae81bab76b876ea6123777af7d6a6d0a58fe953be27e8b88776395b2e</hash>
</entry>
<entry>
<file>mcc_generated_files\memory.h</file>
<hash>fbbca4e9d7ce92ddcc637d82b694a1f5cbefa75710a8a18bb1dc9ab5161f0924</hash>
</entry>
</generatedFileHashHistoryMap>
</config>