implement POC for EEPROM
This commit is contained in:
parent
5bbc7bc0c3
commit
2b31ef5c06
@ -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<EFBFBD>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<EFBFBD>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>
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user