Archived
implement POC for EEPROM
This commit is contained in:
1 parent
5bbc7bc0c3
commit
2b31ef5c06
8 files changed
+61
-12
No files matched your search
@@ -35,6 +35,11 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
|
||||
if(idMsg == 0xF) { // JOY_ALIVE
|
||||
ALIVE_CHECKER_ISALIVE(ACjoy());
|
||||
if(ACjoy()->state == STAC_DEAD){
|
||||
CAR_CST.JOYSTICK_MODE = MEM_read_one_byte(MEMADD_JOYSTICK_MODE);
|
||||
CAR_CST.JOYSTICK_PARAM1 = MEM_read_one_byte(MEMADD_JOYSTICK_PARAM1);
|
||||
CAR_CST.JOYSTICK_PARAM2 = MEM_read_one_byte(MEMADD_JOYSTICK_PARAM2);
|
||||
CAR_CST.JOYSTICK_ALIVE_TIME = MEM_read_one_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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -67,14 +67,19 @@ void Factory_init() {
|
||||
|
||||
// TODO init watchdog with EPROM CST
|
||||
WATCHDOG_init(WDcontroller());
|
||||
CAR_CST.CONTROL_ALIVE_TIME = 100;
|
||||
MEM_write_one_byte(MEMADD_CONTROL_ALIVE_TIME, 10);
|
||||
|
||||
CAR_CST.CONTROL_ALIVE_TIME = MEM_read_one_byte(MEMADD_CONTROL_ALIVE_TIME);
|
||||
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;
|
||||
MEM_write_one_byte(MEMADD_JOYSTICK_MODE, 0);
|
||||
MEM_write_one_byte(MEMADD_JOYSTICK_PARAM1, 100);
|
||||
MEM_write_one_byte(MEMADD_JOYSTICK_PARAM2, 1);
|
||||
MEM_write_one_byte(MEMADD_JOYSTICK_ALIVE_TIME, CAR_CST.CONTROL_ALIVE_TIME);
|
||||
CAR_CST.JOYSTICK_MODE = MEM_read_one_byte(MEMADD_JOYSTICK_MODE);
|
||||
CAR_CST.JOYSTICK_PARAM1 = MEM_read_one_byte(MEMADD_JOYSTICK_PARAM1);
|
||||
CAR_CST.JOYSTICK_PARAM2 = MEM_read_one_byte(MEMADD_JOYSTICK_PARAM2);
|
||||
CAR_CST.JOYSTICK_ALIVE_TIME = MEM_read_one_byte(MEMADD_JOYSTICK_ALIVE_TIME);
|
||||
ALIVE_CHECKER_init(ACjoy());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "../../middleware/alive_checker.h"
|
||||
#include "../../middleware/can_interface.h"
|
||||
#include "../../middleware/watchdog.h"
|
||||
#include "../../middleware/eeprom_interface.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -1,8 +1,36 @@
|
||||
/**
|
||||
* @author Rémi Heredero
|
||||
* @author R�mi Heredero
|
||||
* @version 1.0.0
|
||||
* @date August 2023
|
||||
* @file eeprom_interface.h
|
||||
*/
|
||||
|
||||
#include "eeprom_interface.h"
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t byte0;
|
||||
uint8_t byte1;
|
||||
uint8_t byte2;
|
||||
uint8_t byte3;
|
||||
} separate;
|
||||
struct {
|
||||
uint32_t bytes;
|
||||
} full;
|
||||
} BYTES_4;
|
||||
|
||||
void MEM_write_one_byte(uint8_t addresse, uint8_t data) {
|
||||
DATAEE_WriteByte(addresse, data);
|
||||
}
|
||||
|
||||
void MEM_write_four_byte(uint8_t addresse, uint32_t data) {
|
||||
|
||||
}
|
||||
|
||||
uint8_t MEM_read_one_byte(uint8_t adresse) {
|
||||
return DATAEE_ReadByte(adresse);
|
||||
}
|
||||
|
||||
uint32_t MEM_read_four_byte(uint8_t adresse) {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @author Rémi Heredero
|
||||
* @author R�mi Heredero
|
||||
* @version 1.0.0
|
||||
* @date August 2023
|
||||
* @file eeprom_interface.h
|
||||
@@ -7,8 +7,14 @@
|
||||
#ifndef EEPROM_INTERFACE_H
|
||||
#define EEPROM_INTERFACE_H
|
||||
|
||||
MEM_write_1_byte(uint8_t addresse, uint8_t data);
|
||||
MEM_write_4_byte(uint32_t data);
|
||||
#include <stdint.h> // usage of standard types
|
||||
#include <stdbool.h> // usage of boolean types
|
||||
#include "../mcc_generated_files/mcc.h"
|
||||
|
||||
void MEM_write_one_byte(uint8_t addresse, uint8_t data);
|
||||
void MEM_write_four_byte(uint8_t adresse, uint32_t data);
|
||||
uint8_t MEM_read_one_byte(uint8_t adresse);
|
||||
uint32_t MEM_read_four_byte(uint8_t adresse);
|
||||
// void MEM_write_CONTROL_STEERING_MODE(uint8_t data);
|
||||
|
||||
#endif /* EEPROM_INTERFACE_H */
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<itemPath>app/factory/factory.h</itemPath>
|
||||
<itemPath>app/car.h</itemPath>
|
||||
<itemPath>app/can_message.h</itemPath>
|
||||
<itemPath>middleware/eeprom_interface.h</itemPath>
|
||||
</logicalFolder>
|
||||
<logicalFolder name="board" displayName="board" projectFiles="true">
|
||||
<itemPath>board/led/led.h</itemPath>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<config configName="default" projectName="ss22ep" configVersion="1.1" device="PIC18F25K83" deviceLibraryClass="com.microchip.mcc.mcu8.Mcu8PeripheralLibrary" coreVersion="5.4.14">
|
||||
<config configName="default" projectName="ss22ep" configVersion="1.1" device="PIC18F25K83" deviceLibraryClass="com.microchip.mcc.mcu8.Mcu8PeripheralLibrary" coreVersion="5.5.7">
|
||||
<usedPackages class="java.util.ArrayList"/>
|
||||
<usedClasses class="java.util.TreeMap">
|
||||
<entry>
|
||||
@@ -1948,7 +1948,7 @@
|
||||
</entry>
|
||||
<entry>
|
||||
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="DMA Manager" name="dmaTable"/>
|
||||
<value>{"dataArray":[{"DMA Channels":{"data":{"isDisable":"true","options":"--NONE--","text":"DMA CHANNEL1","value":"false"},"id":"DMA Channels_rowCount_0"},"Src Module":{"data":{"isDisable":"true","options":"--NONE--,ECAN,MEMORY,TMR0","text":"--NONE--","value":"--NONE--"},"id":"Src Module_rowCount_0"},"Src Region":{"data":{"isDisable":"true","options":"SFR#disabled,GPR#enabled,Program Flash#enabled,Data EEPROM#enabled","text":"GPR","value":"GPR"},"id":"Src Region_rowCount_0"},"Src SFR":{"Src SFR":{"isDisable":"true","options":"","text":"","value":""},"data":{"isDisable":"true","options":"","text":"","value":""},"id":"Src SFR_rowCount_0"},"Src VarName":{"data":{"isDisable":"true","options":"","text":"SrcVarName0","value":"SrcVarName0"},"Src VarName":{"isDisable":"true","options":"","text":"SrcVarName0","value":"SrcVarName0"},"id":"Src VarName_rowCount_0"},"Src VarSize":{"data":{"isDisable":"true","options":"","text":"10","value":"10"},"id":"Src VarSize_rowCount_0","Src VarSize":{"isDisable":"true","options":"","text":"10","value":"10"}},"Src Address":{"data":{"isDisable":"true","options":"","text":"Enter Address0","value":"Enter Address0"},"id":"Src Address_rowCount_0","Src Address":{"isDisable":"true","options":"","text":"Enter Address0","value":"Enter Address0"}},"Src Mode":{"Src Mode":{"isDisable":"true","options":"decremented,incremented,unchanged","text":"unchanged","value":"unchanged"},"data":{"isDisable":"true","options":"decremented,incremented,unchanged","text":"unchanged","value":"unchanged"},"id":"Src Mode_rowCount_0"},"Src Message Size":{"data":{"isDisable":"true","options":"","text":"1","value":"1"},"Src Message Size":{"isDisable":"true","options":"","text":"1","value":"1"},"id":"Src Message Size_rowCount_0"},"Dst Module":{"data":{"isDisable":"true","options":"--NONE--,ECAN,MEMORY,TMR0","text":"--NONE--","value":"--NONE--"},"id":"Dst Module_rowCount_0"},"Dst Region":{"data":{"isDisable":"true","options":"SFR,GPR","text":"GPR","value":"GPR"},"id":"Dst Region_rowCount_0"},"Dst SFR":{"Dst SFR":{"isDisable":"true","options":"","text":"","value":""},"data":{"isDisable":"true","options":"","text":"","value":""},"id":"Dst SFR_rowCount_0"},"Dst VarName":{"data":{"isDisable":"true","options":"","text":"DstVarName0","value":"DstVarName0"},"Dst VarName":{"isDisable":"true","options":"","text":"DstVarName0","value":"DstVarName0"},"id":"Dst VarName_rowCount_0"},"Dst VarSize":{"data":{"isDisable":"true","options":"","text":"10","value":"10"},"id":"Dst VarSize_rowCount_0","Dst VarSize":{"isDisable":"true",&Line truncated
|
||||
<value>{"dataArray":[{"DMA Channels":{"data":{"isDisable":"true","options":"--NONE--","text":"DMA CHANNEL1","value":"false"},"id":"DMA Channels_rowCount_0"},"Src Module":{"data":{"isDisable":"true","options":"--NONE--,MEMORY,ECAN,TMR0","text":"--NONE--","value":"--NONE--"},"id":"Src Module_rowCount_0"},"Src Region":{"data":{"isDisable":"true","options":"SFR#disabled,GPR#enabled,Program Flash#enabled,Data EEPROM#enabled","text":"GPR","value":"GPR"},"id":"Src Region_rowCount_0"},"Src SFR":{"Src SFR":{"isDisable":"true","options":"","text":"","value":""},"data":{"isDisable":"true","options":"","text":"","value":""},"id":"Src SFR_rowCount_0"},"Src VarName":{"data":{"isDisable":"true","options":"","text":"SrcVarName0","value":"SrcVarName0"},"Src VarName":{"isDisable":"true","options":"","text":"SrcVarName0","value":"SrcVarName0"},"id":"Src VarName_rowCount_0"},"Src VarSize":{"data":{"isDisable":"true","options":"","text":"10","value":"10"},"id":"Src VarSize_rowCount_0","Src VarSize":{"isDisable":"true","options":"","text":"10","value":"10"}},"Src Address":{"data":{"isDisable":"true","options":"","text":"Enter Address0","value":"Enter Address0"},"id":"Src Address_rowCount_0","Src Address":{"isDisable":"true","options":"","text":"Enter Address0","value":"Enter Address0"}},"Src Mode":{"Src Mode":{"isDisable":"true","options":"decremented,incremented,unchanged","text":"unchanged","value":"unchanged"},"data":{"isDisable":"true","options":"decremented,incremented,unchanged","text":"unchanged","value":"unchanged"},"id":"Src Mode_rowCount_0"},"Src Message Size":{"data":{"isDisable":"true","options":"","text":"1","value":"1"},"Src Message Size":{"isDisable":"true","options":"","text":"1","value":"1"},"id":"Src Message Size_rowCount_0"},"Dst Module":{"data":{"isDisable":"true","options":"--NONE--,MEMORY,ECAN,TMR0","text":"--NONE--","value":"--NONE--"},"id":"Dst Module_rowCount_0"},"Dst Region":{"data":{"isDisable":"true","options":"SFR,GPR","text":"GPR","value":"GPR"},"id":"Dst Region_rowCount_0"},"Dst SFR":{"Dst SFR":{"isDisable":"true","options":"","text":"","value":""},"data":{"isDisable":"true","options":"","text":"","value":""},"id":"Dst SFR_rowCount_0"},"Dst VarName":{"data":{"isDisable":"true","options":"","text":"DstVarName0","value":"DstVarName0"},"Dst VarName":{"isDisable":"true","options":"","text":"DstVarName0","value":"DstVarName0"},"id":"Dst VarName_rowCount_0"},"Dst VarSize":{"data":{"isDisable":"true","options":"","text":"10","value":"10"},"id":"Dst VarSize_rowCount_0","Dst VarSize":{"isDisable":"true",&Line truncated
|
||||
</entry>
|
||||
<entry>
|
||||
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="ECAN" name="ECAN_ERRIISRFunction"/>
|
||||
|
||||
Reference in new issue
Block a user