controller/Inc/control.h

48 lines
798 B
C

#ifndef CONTROL_H
#define CONTROL_H
#include "stm32f4xx_hal.h"
typedef enum {
CONTROL_STOP = 0,
CONTROL_RESET_BEGIN,
CONTROL_RESET_1,
CONTROL_RESET_2,
CONTROL_RESET_3,
CONTROL_RESET_4,
CONTROL_RESET_5,
CONTROL_RESET_6,
CONTROL_RESET_7,
CONTROL_RESET_END = 9,
CONTROL_CLOCK_LOW,
CONTROL_CLOCK_HIGH
} ControlState;
typedef struct {
uint8_t dirty;
uint8_t action;
uint8_t ready;
uint8_t lba_1;
uint8_t lba_2;
uint8_t lba_3;
uint32_t lba;
uint32_t counter;
uint8_t* buffer;
} Storage;
typedef struct {
ControlState state;
uint8_t memory_config;
Storage storage;
} Control;
uint16_t read_address();
void write_data(uint8_t value);
uint8_t read_data();
void control_program_eeprom(uint8_t* data, uint16_t length);
void control_execute_state();
void control_reset();
#endif