Merge branch 'feature/EEPROM' into develop

This commit is contained in:
Rémi Heredero 2023-08-29 10:30:10 +02:00
commit 38d7936da7
30 changed files with 18734 additions and 218 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

View File

@ -5,9 +5,10 @@
* @file can_message.c
*/
#include "../middleware/can_interface.h"
#include "can_message.h"
#include "car.h"
#include "../app/factory/factory.h"
#include "../middleware/can_interface.h"
typedef union {
struct {
@ -23,36 +24,166 @@ typedef union {
void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
switch(idSender){
case 0: // Broadcast / Debug
/*********************
* BROADCAST / DEBUG *
*********************/
case 0:
if(idMsg == 0x0) { // CONTROL_SETUP
// steeringMode - - controlAliveTime
BYTES_4 tmpData;
tmpData.full.bytes = data;
CAR_CST.CONTROL_STEERING_MODE = tmpData.separate.byte0;
CAR_CST.CONTROL_ALIVE_TIME = tmpData.separate.byte3;
MEM_write_1_byte(MEMADD_CONTROL_STEERING_MODE, CAR_CST.CONTROL_STEERING_MODE);
MEM_write_1_byte(MEMADD_CONTROL_ALIVE_TIME, CAR_CST.CONTROL_ALIVE_TIME);
WATCHDOG_setTime(WDcontroller(), CAR_CST.CONTROL_ALIVE_TIME);
}
if(idMsg == 0x1) { // CONTROL_SPEED_FACTOR
// valHH valH valL valLL
}
if(idMsg == 0x2) { // CONTROL_POWER_FACTOR
// valHH valH valL valLL
}
if(idMsg == 0x3) { // CONTROL_STEERING_FACTOR
// valHH valH valL valLL
}
if(idMsg == 0x4) { // CONTROL_SECURITY_PARAM
// maxSpeedFw maxSpeedBw - -
}
if(idMsg == 0x5) { // CONTROL_SETUP_PARAM
// displayAliveTime steeringAliveTime - -
}
if(idMsg == 0x6) { // CONTROL_SETUP_PARAM_JOY
// joystickMode joystickParam1 joystickParam2 joystickAliveTime
BYTES_4 tmpData;
tmpData.full.bytes = data;
CAR_CST.JOYSTICK_MODE = tmpData.separate.byte0;
CAR_CST.JOYSTICK_PARAM1 = tmpData.separate.byte1;
CAR_CST.JOYSTICK_PARAM2 = tmpData.separate.byte2;
CAR_CST.JOYSTICK_ALIVE_TIME = tmpData.separate.byte3;
MEM_write_1_byte(MEMADD_JOYSTICK_MODE, CAR_CST.JOYSTICK_MODE);
MEM_write_1_byte(MEMADD_JOYSTICK_PARAM1, CAR_CST.JOYSTICK_PARAM1);
MEM_write_1_byte(MEMADD_JOYSTICK_PARAM2, CAR_CST.JOYSTICK_PARAM2);
MEM_write_1_byte(MEMADD_JOYSTICK_ALIVE_TIME, CAR_CST.JOYSTICK_ALIVE_TIME);
ALIVE_CHECKER_setAliveTime(ACjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
CM_JOY_SETUP(NULL);
}
if(idMsg == 0x7) { // CONTROL_SETUP_PARAM_DRIVE
// driveAliveTime driveSpeedTime driveStopTime -
}
if(idMsg == 0x8) { // CONTROL_SETUP_PARAM_BATTERY
// batteryVoltTime batteryCurrentTime batteryEnergyTime batteryAliveTime
}
break;
case 2: // Joystick
/************
* JOYSTICK *
************/
case 2:
if(idMsg == 0x1) { // JOY_MESURE
// posX posY button -
}
if(idMsg == 0xF) { // JOY_ALIVE
// - - - -
ALIVE_CHECKER_ISALIVE(ACjoy());
if(ACjoy()->state == STAC_DEAD){
CAR_CST.JOYSTICK_MODE = MEM_read_1_byte(MEMADD_JOYSTICK_MODE);
CAR_CST.JOYSTICK_PARAM1 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM1);
CAR_CST.JOYSTICK_PARAM2 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM2);
CAR_CST.JOYSTICK_ALIVE_TIME = MEM_read_1_byte(MEMADD_JOYSTICK_ALIVE_TIME);
ALIVE_CHECKER_setAliveTime(ACjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
ALIVE_CHECKER_emitBorn(ACjoy(), 0, 0);
ALIVE_CHECKER_emitReady(ACjoy(), 100, 0);
}
}
break;
case 3: // Display
/***********
* DISPLAY *
***********/
case 3:
if(idMsg == 0xF) { // DISPLAY_ALIVE
// powerMode - - -
}
break;
case 4: // Drive
/*********
* DRIVE *
*********/
case 4:
if(idMsg == 0x0) { // DRIVE_SPEED
// speedHH speedH speedL speedLL
}
if(idMsg == 0xF) { // DRIVE_ALIVE
// statusH statusL - -
}
break;
case 5: // Steering
/************
* STEERING *
************/
case 5:
if(idMsg == 0x1) { // STEERING_GET_CENTER
// valHH valH valL valLL
}
if(idMsg == 0x2) { // STEERING_GET_POSITION
// valHH valH valL valLL
}
if(idMsg == 0xF) { // STEERING_ALIVE
// statusH statusL - -
}
break;
case 6: // Supply
/**********
* SUPPLY *
**********/
case 6:
if(idMsg == 0xF) { // BATTERY_ALIVE
// - - - -
}
break;
case 7: // Undefined
/*************
* UNDEFINED *
*************/
case 7:
break;
}
}

View File

@ -8,6 +8,9 @@
#ifndef CAN_MESSAGE_H
#define CAN_MESSAGE_H
#include <stdint.h> // usage of standard types
#include <stdbool.h> // usage of boolean types
#include "../mcc_generated_files/mcc.h"
/*
S R M

View File

@ -34,12 +34,15 @@
#define MEMADD_JOYSTICK_PARAM1 0x12
#define MEMADD_JOYSTICK_PARAM2 0x13
#define MEMADD_JOYSTICK_ALIVE_TIME 0x14
#define MEMADD_DISPLAY_ALIVE_TIME 0x
#define MEMADD_DRIVE_SPEED_TIME 0x
#define MEMADD_DRIVE_STOP_TIME 0x
#define MEMADD_DRIVE_ALIVE_TIME 0x
#define MEMADD_STEERING_ALIVE_TIME 0x
#define MEMADD_BATTERY_ALIVE_TIME 0x
#define MEMADD_DISPLAY_ALIVE_TIME 0x15
#define MEMADD_DRIVE_SPEED_TIME 0x16
#define MEMADD_DRIVE_STOP_TIME 0x17
#define MEMADD_DRIVE_ALIVE_TIME 0x18
#define MEMADD_STEERING_ALIVE_TIME 0x19
#define MEMADD_BATTERY_VOLT_TIME 0x1A
#define MEMADD_BATTERY_CURRENT_TIME 0x1B
#define MEMADD_BATTERY_ENERGY_TIME 0x1C
#define MEMADD_BATTERY_ALIVE_TIME 0x1D
typedef struct {
uint8_t CONTROL_STEERING_MODE;
@ -49,7 +52,6 @@ typedef struct {
uint32_t CONTROL_STEERING_FACTOR;
uint8_t CONTROL_MAX_SPEED_FW;
uint8_t CONTROL_MAX_SPEED_BW;
uint8_t JOYSTICK_MODE;
uint8_t JOYSTICK_PARAM1;
uint8_t JOYSTICK_PARAM2;
@ -59,6 +61,9 @@ typedef struct {
uint8_t DRIVE_STOP_TIME;
uint8_t DRIVE_ALIVE_TIME;
uint8_t STEERING_ALIVE_TIME;
uint8_t BATTERY_VOLT_TIME;
uint8_t BATTERY_CURRENT_TIME;
uint8_t BATTERY_ENERGY_TIME;
uint8_t BATTERY_ALIVE_TIME;
} CAR_CST_TYPE;
CAR_CST_TYPE CAR_CST;

View File

@ -64,17 +64,12 @@ void Factory_init() {
LED_off(l1());
// TODO init EPROM interface
MEM_init();
// TODO init watchdog with EPROM CST
WATCHDOG_init(WDcontroller());
CAR_CST.CONTROL_ALIVE_TIME = 100;
WATCHDOG_setTime(WDcontroller(), CAR_CST.CONTROL_ALIVE_TIME);
// TODO init ALIVE CHECKER with EPROM CST
CAR_CST.JOYSTICK_MODE = 0;
CAR_CST.JOYSTICK_PARAM1 = 100;
CAR_CST.JOYSTICK_PARAM2 = 1;
CAR_CST.JOYSTICK_ALIVE_TIME = 10;
ALIVE_CHECKER_init(ACjoy());
}

View File

@ -19,6 +19,7 @@
#include "../../middleware/alive_checker.h"
#include "../../middleware/can_interface.h"
#include "../../middleware/watchdog.h"
#include "../../middleware/eeprom.h"
typedef struct {

View File

@ -14,7 +14,7 @@
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.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.00
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above or later

View File

@ -14,7 +14,7 @@
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.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.00
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above or later

View File

@ -130,17 +130,21 @@ void ECAN_Initialize(void)
/*
* ENABLE FILTERS
*
* Filter 0 set on mask 0
* Filter 1 set on mask 0
* Filter 2 set on mask 1
* RXF7EN RXF6EN RXF5EN RXF4EN RXF3EN RXF2EN RXF1EN RXF0EN
* 0b 00000111
*/
RXFCON0 = 0x07;
/**
Assign Filters to Masks
*/
// Filter 0 & 1 assigned to mask 0 and filter 2 assigned to mask 1
/*
* Assign Filters to Masks
*
* Filter 0 set on mask 0
* Filter 1 set on mask 0
* Filter 2 set on mask 1
* 0b F3 F2 F1 F0
* 0b 00 01 00 00
*/
MSEL0 = 0x10;
/**

View File

@ -16,7 +16,7 @@
all modules selected in the GUI.
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.04
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above or later

View File

@ -16,7 +16,7 @@
all modules selected in the GUI.
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.03
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above or later

View File

@ -14,7 +14,7 @@
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.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.00
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above or later

View File

@ -14,7 +14,7 @@
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.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.00
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above or later

View File

@ -14,7 +14,7 @@
This file provides implementations of driver APIs for MEMORY.
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.1.3
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above

View File

@ -14,7 +14,7 @@
This header file provides APIs for driver for MEMORY.
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.1.3
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above
@ -64,9 +64,9 @@
Section: Macro Declarations
*/
#define WRITE_FLASH_BLOCKSIZE 64
#define ERASE_FLASH_BLOCKSIZE 64
#define END_FLASH 0x008000
#define WRITE_FLASH_BLOCKSIZE 128
#define ERASE_FLASH_BLOCKSIZE 128
#define END_FLASH 0x010000
/**
Section: Flash Module APIs

View File

@ -14,7 +14,7 @@
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.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.11
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above

View File

@ -14,7 +14,7 @@
This header file provides APIs for driver for .
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 2.11
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above

View File

@ -14,7 +14,7 @@
This source file provides APIs for TMR0.
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 3.10
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above

View File

@ -14,7 +14,7 @@
This header file provides APIs for TMR0.
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8
Device : PIC18F25K83
Device : PIC18F26K83
Driver Version : 3.10
The generated drivers are tested against the following:
Compiler : XC8 2.36 and above

View File

@ -146,13 +146,13 @@ void CAN_newMsg() {
CAN_receive(&canMsg);
data = canMsg.frame.id;
data = data<<12;
data = data | canMsg.frame.data0;
data = data<<8;
data = data | canMsg.frame.data1;
data = data | canMsg.frame.data3;
data = data<<8;
data = data | canMsg.frame.data2;
data = data<<8;
data = data | canMsg.frame.data3;
data = data | canMsg.frame.data1;
data = data<<8;
data = data | canMsg.frame.data0;
POST(&CAN_myself, &CAN_processEvent, evCAnewMsg, 0, data);
}

View File

@ -0,0 +1,135 @@
/**
* @author R<EFBFBD>mi Heredero
* @version 1.0.0
* @date August 2023
* @file eeprom_interface.h
*/
#include "eeprom.h"
#include "../app/car.h"
typedef union {
struct {
uint8_t byte0;
uint8_t byte1;
uint8_t byte2;
uint8_t byte3;
} separate;
uint32_t full;
uint8_t array[4];
} BYTES_4;
void MEM_init(){
uint8_t check = MEM_read_1_byte(0x0);
if(check != 0x42){
CAR_CST.CONTROL_STEERING_MODE = 0;
CAR_CST.CONTROL_ALIVE_TIME = 50;
CAR_CST.CONTROL_SPEED_FACTOR = 0;
CAR_CST.CONTROL_POWER_FACTOR = 0;
CAR_CST.CONTROL_STEERING_FACTOR = 0;
CAR_CST.CONTROL_MAX_SPEED_FW = 0;
CAR_CST.CONTROL_MAX_SPEED_BW = 0;
CAR_CST.JOYSTICK_MODE = 0;
CAR_CST.JOYSTICK_PARAM1 = 100;
CAR_CST.JOYSTICK_PARAM2 = 1;
CAR_CST.JOYSTICK_ALIVE_TIME = 10;
CAR_CST.DISPLAY_ALIVE_TIME = 50;
CAR_CST.DRIVE_SPEED_TIME = 0;
CAR_CST.DRIVE_STOP_TIME = 0;
CAR_CST.DRIVE_ALIVE_TIME = 10;
CAR_CST.STEERING_ALIVE_TIME = 100;
CAR_CST.BATTERY_VOLT_TIME = 50;
CAR_CST.BATTERY_CURRENT_TIME = 50;
CAR_CST.BATTERY_ENERGY_TIME = 50;
CAR_CST.BATTERY_ALIVE_TIME = 50;
MEM_write_1_byte(MEMADD_CONTROL_STEERING_MODE, CAR_CST.CONTROL_STEERING_MODE);
MEM_write_1_byte(MEMADD_CONTROL_ALIVE_TIME, CAR_CST.CONTROL_ALIVE_TIME);
MEM_write_4_byte(MEMADD_CONTROL_SPEED_FACTOR, CAR_CST.CONTROL_SPEED_FACTOR);
MEM_write_4_byte(MEMADD_CONTROL_POWER_FACTOR, CAR_CST.CONTROL_POWER_FACTOR);
MEM_write_4_byte(MEMADD_CONTROL_STEERING_FACTOR, CAR_CST.CONTROL_STEERING_FACTOR);
MEM_write_1_byte(MEMADD_CONTROL_MAX_SPEED_FW, CAR_CST.CONTROL_MAX_SPEED_FW);
MEM_write_1_byte(MEMADD_CONTROL_MAX_SPEED_BW, CAR_CST.CONTROL_MAX_SPEED_BW);
MEM_write_1_byte(MEMADD_JOYSTICK_MODE, CAR_CST.JOYSTICK_MODE);
MEM_write_1_byte(MEMADD_JOYSTICK_PARAM1, CAR_CST.JOYSTICK_PARAM1);
MEM_write_1_byte(MEMADD_JOYSTICK_PARAM2, CAR_CST.JOYSTICK_PARAM2);
MEM_write_1_byte(MEMADD_JOYSTICK_ALIVE_TIME, CAR_CST.JOYSTICK_ALIVE_TIME);
MEM_write_1_byte(MEMADD_DISPLAY_ALIVE_TIME, CAR_CST.DISPLAY_ALIVE_TIME);
MEM_write_1_byte(MEMADD_DRIVE_SPEED_TIME, CAR_CST.DRIVE_SPEED_TIME);
MEM_write_1_byte(MEMADD_DRIVE_STOP_TIME, CAR_CST.DRIVE_STOP_TIME);
MEM_write_1_byte(MEMADD_DRIVE_ALIVE_TIME, CAR_CST.DRIVE_ALIVE_TIME);
MEM_write_1_byte(MEMADD_STEERING_ALIVE_TIME, CAR_CST.STEERING_ALIVE_TIME);
MEM_write_1_byte(MEMADD_BATTERY_VOLT_TIME, CAR_CST.BATTERY_VOLT_TIME);
MEM_write_1_byte(MEMADD_BATTERY_CURRENT_TIME, CAR_CST.BATTERY_CURRENT_TIME);
MEM_write_1_byte(MEMADD_BATTERY_ENERGY_TIME, CAR_CST.BATTERY_ENERGY_TIME);
MEM_write_1_byte(MEMADD_BATTERY_ALIVE_TIME, CAR_CST.BATTERY_ALIVE_TIME);
MEM_write_1_byte(0x0, 0x42);
} else {
CAR_CST.CONTROL_STEERING_MODE = MEM_read_1_byte(MEMADD_CONTROL_STEERING_MODE);
CAR_CST.CONTROL_ALIVE_TIME = MEM_read_1_byte(MEMADD_CONTROL_ALIVE_TIME);
CAR_CST.CONTROL_SPEED_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_SPEED_FACTOR);
CAR_CST.CONTROL_POWER_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_POWER_FACTOR);
CAR_CST.CONTROL_STEERING_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_STEERING_FACTOR);
CAR_CST.CONTROL_MAX_SPEED_FW = MEM_read_1_byte(MEMADD_CONTROL_MAX_SPEED_FW);
CAR_CST.CONTROL_MAX_SPEED_BW = MEM_read_1_byte(MEMADD_CONTROL_MAX_SPEED_BW);
CAR_CST.JOYSTICK_MODE = MEM_read_1_byte(MEMADD_JOYSTICK_MODE);
CAR_CST.JOYSTICK_PARAM1 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM1);
CAR_CST.JOYSTICK_PARAM2 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM2);
CAR_CST.JOYSTICK_ALIVE_TIME = MEM_read_1_byte(MEMADD_JOYSTICK_ALIVE_TIME);
CAR_CST.DISPLAY_ALIVE_TIME = MEM_read_1_byte(MEMADD_DISPLAY_ALIVE_TIME);
CAR_CST.DRIVE_SPEED_TIME = MEM_read_1_byte(MEMADD_DRIVE_SPEED_TIME);
CAR_CST.DRIVE_STOP_TIME = MEM_read_1_byte(MEMADD_DRIVE_STOP_TIME);
CAR_CST.DRIVE_ALIVE_TIME = MEM_read_1_byte(MEMADD_DRIVE_ALIVE_TIME);
CAR_CST.STEERING_ALIVE_TIME = MEM_read_1_byte(MEMADD_STEERING_ALIVE_TIME);
CAR_CST.BATTERY_VOLT_TIME = MEM_read_1_byte(MEMADD_BATTERY_VOLT_TIME);
CAR_CST.BATTERY_CURRENT_TIME = MEM_read_1_byte(MEMADD_BATTERY_CURRENT_TIME);
CAR_CST.BATTERY_ENERGY_TIME = MEM_read_1_byte(MEMADD_BATTERY_ENERGY_TIME);
CAR_CST.BATTERY_ALIVE_TIME = MEM_read_1_byte(MEMADD_BATTERY_ALIVE_TIME);
}
}
void MEM_write_1_byte(uint8_t address, uint8_t data) {
DATAEE_WriteByte(address, data);
}
void MEM_write_4_byte(uint8_t address, uint32_t data) {
BYTES_4 tmpData;
tmpData.full = data;
for(uint8_t i = 0; i<4;i++) {
uint8_t add = address;
add += i;
MEM_write_1_byte(add, tmpData.array[i]);
}
}
uint8_t MEM_read_1_byte(uint8_t address) {
return DATAEE_ReadByte(address);
}
uint32_t MEM_read_4_byte(uint8_t address) {
BYTES_4 tmpData;
for(uint8_t i = 0; i<4;i++) {
uint8_t add = address;
add += i;
tmpData.array[i] = MEM_read_1_byte(add);
}
return tmpData.full;
}

View File

@ -0,0 +1,21 @@
/**
* @author R<EFBFBD>mi Heredero
* @version 1.0.0
* @date August 2023
* @file eeprom_interface.h
*/
#ifndef EEPROM_INTERFACE_H
#define EEPROM_INTERFACE_H
#include <stdint.h> // usage of standard types
#include <stdbool.h> // usage of boolean types
#include "../mcc_generated_files/mcc.h"
void MEM_init();
void MEM_write_1_byte(uint8_t address, uint8_t data);
void MEM_write_4_byte(uint8_t address, uint32_t data);
uint8_t MEM_read_1_byte(uint8_t address);
uint32_t MEM_read_4_byte(uint8_t address);
#endif /* EEPROM_INTERFACE_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,7 @@ typedef struct Timer_ // timer structure
/* depending on usage, change MAXTIMER and MAXEVENT */
/*----------------------------------------------------------------------------*/
#define MAXTIMER 8 // number of timers in our system
#define MAXEVENT 12 // number of events in our system
#define MAXEVENT 20 // number of events in our system
#define NULLTIMER 0 // no value for time
#define TICKINTERVAL 10 // this is the ticktimers duration

BIN
UML/alive.pdf Normal file

Binary file not shown.

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="15.0.0">
<zoom_level>14</zoom_level>
<zoom_level>15</zoom_level>
<element>
<id>UMLSpecialState</id>
<coordinates>
<x>266</x>
<y>98</y>
<w>28</w>
<h>28</h>
<x>510</x>
<y>30</y>
<w>30</w>
<h>30</h>
</coordinates>
<panel_attributes>type=initial</panel_attributes>
<additional_attributes/>
@ -15,115 +15,112 @@
<element>
<id>Relation</id>
<coordinates>
<x>266</x>
<y>112</y>
<w>112</w>
<h>98</h>
<x>510</x>
<y>45</y>
<w>90</w>
<h>105</h>
</coordinates>
<panel_attributes>lt=-&gt;
evACinit</panel_attributes>
evInit</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>210</x>
<y>182</y>
<w>140</w>
<h>56</h>
<x>390</x>
<y>120</y>
<w>285</w>
<h>90</h>
</coordinates>
<panel_attributes>STAC_SETUP</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLNote</id>
<coordinates>
<x>434</x>
<y>182</y>
<w>140</w>
<h>42</h>
</coordinates>
<panel_attributes>Send params</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>266</x>
<y>224</y>
<w>126</w>
<h>98</h>
</coordinates>
<panel_attributes>lt=-&gt;
evACborn</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>210</x>
<y>294</y>
<w>140</w>
<h>56</h>
</coordinates>
<panel_attributes>STAC_BORN</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>168</x>
<y>406</y>
<w>224</w>
<h>84</h>
</coordinates>
<panel_attributes>STAC_WAIT
<panel_attributes>SETUP
--
/entry: isAlive = false</panel_attributes>
/entry: sendParamsOnCan</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>266</x>
<y>336</y>
<w>140</w>
<h>98</h>
<x>510</x>
<y>195</y>
<w>105</w>
<h>105</h>
</coordinates>
<panel_attributes>lt=-&gt;
evACready</panel_attributes>
evBorn</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>210</x>
<y>658</y>
<w>140</w>
<h>56</h>
<x>390</x>
<y>270</y>
<w>285</w>
<h>90</h>
</coordinates>
<panel_attributes>STAC_DEAD</panel_attributes>
<panel_attributes>BORN
--
/entry: init</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>390</x>
<y>420</y>
<w>285</w>
<h>120</h>
</coordinates>
<panel_attributes>WAIT
--
/entry: start children class
--
isAlive = false</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>266</x>
<y>476</y>
<w>112</w>
<h>98</h>
<x>510</x>
<y>345</y>
<w>120</w>
<h>105</h>
</coordinates>
<panel_attributes>lt=-&gt;
evACpoll</panel_attributes>
evReady</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>390</x>
<y>720</y>
<w>285</w>
<h>90</h>
</coordinates>
<panel_attributes>DEAD
--
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>510</x>
<y>525</y>
<w>105</w>
<h>105</h>
</coordinates>
<panel_attributes>lt=-&gt;
evPoll</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
</element>
<element>
<id>UMLSpecialState</id>
<coordinates>
<x>252</x>
<y>546</y>
<w>56</w>
<h>56</h>
<x>495</x>
<y>600</y>
<w>60</w>
<h>60</h>
</coordinates>
<panel_attributes>type=decision</panel_attributes>
<additional_attributes/>
@ -131,48 +128,71 @@ evACpoll</panel_attributes>
<element>
<id>Relation</id>
<coordinates>
<x>266</x>
<y>588</y>
<w>84</w>
<h>98</h>
<x>510</x>
<y>645</y>
<w>90</w>
<h>105</h>
</coordinates>
<panel_attributes>lt=-&gt;
m1=[else]</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
</element>
<element>
<id>UMLNote</id>
<id>Relation</id>
<coordinates>
<x>434</x>
<y>294</y>
<w>140</w>
<h>42</h>
<x>315</x>
<y>465</y>
<w>210</w>
<h>210</h>
</coordinates>
<panel_attributes>Reset / Init</panel_attributes>
<additional_attributes/>
<panel_attributes>lt=-&gt;
m1=[isAlive]</panel_attributes>
<additional_attributes>120.0;110.0;10.0;110.0;10.0;10.0;50.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>294</x>
<y>420</y>
<w>182</w>
<h>196</h>
<x>660</x>
<y>135</y>
<w>210</w>
<h>405</h>
</coordinates>
<panel_attributes>lt=-&gt;
m1=[alive]</panel_attributes>
<additional_attributes>10.0;110.0;110.0;110.0;110.0;10.0;70.0;10.0</additional_attributes>
evDisable</panel_attributes>
<additional_attributes>10.0;250.0;60.0;250.0;60.0;10.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>140</x>
<y>308</y>
<w>168</w>
<h>490</h>
<x>255</x>
<y>300</y>
<w>300</w>
<h>600</h>
</coordinates>
<panel_attributes>lt=-&gt;
evACborn</panel_attributes>
<additional_attributes>100.0;290.0;100.0;330.0;10.0;330.0;10.0;10.0;50.0;10.0</additional_attributes>
evBorn</panel_attributes>
<additional_attributes>180.0;340.0;180.0;380.0;10.0;380.0;10.0;10.0;90.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>660</x>
<y>495</y>
<w>120</w>
<h>315</h>
</coordinates>
<panel_attributes>lt=-</panel_attributes>
<additional_attributes>10.0;190.0;60.0;190.0;60.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>660</x>
<y>315</y>
<w>120</w>
<h>45</h>
</coordinates>
<panel_attributes>lt=-</panel_attributes>
<additional_attributes>10.0;10.0;60.0;10.0</additional_attributes>
</element>
</diagram>

29
UML/can.puml Normal file
View File

@ -0,0 +1,29 @@
@startuml
actor CAN_BUS as bus
participant interrupt as ISR
queue XF as xf
participant ecan as ecan
participant can_interface as can
control can_message as msg
bus -\\ ISR ++ : can message
ISR -> can : newMsg
can -> ecan : read
ecan --> can : message
can -> xf : POST XF
destroy ISR
group clock xf [every 10ms]
xf o-> can : receiveCan
can -> msg : processIncome
msg -> can : create message
can -> xf : POST XF
end
group clock xf [every 10ms]
xf o-> can : sendCan
can -> ecan : write
ecan -\\ bus : can message
end
@enduml

View File

@ -6,7 +6,7 @@
[BUSMASTER_VERSION] [3.2.2]
[NUMBER_OF_MESSAGES] 25
[NUMBER_OF_MESSAGES] 26
[START_MSG] JOY_MEASURE,529,3,3,1,S
[START_SIGNALS] posX,8,1,0,I,127,-128,1,0.000000,1.000000,%,
@ -150,4 +150,11 @@
[START_MSG] STEERING_GET_POS,1298,4,1,1,S
[START_SIGNALS] POSITION,32,4,0,I,2147483647,-2147483648,0,0.000000,1.000000,qc,
[END_MSG]
[START_MSG] CONTROL_SETUP_PARAM_JOY,22,4,4,1,S
[START_SIGNALS] mode,1,1,0,B,1,0,1,0.000000,1.000000,,
[START_SIGNALS] timeMeasureOrDeltaX,8,2,0,U,255,0,1,0.000000,10.000000,msOrVal,
[START_SIGNALS] DeltaY,8,3,0,U,255,0,1,0.000000,1.000000,val,
[START_SIGNALS] aliveTime,8,4,0,U,255,0,1,0.000000,10.000000,ms,
[END_MSG]