Files
GbTModuleEV/Core/Inc/lock.h

36 lines
978 B
C
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* lock.h
*
* Created on: Jul 31, 2024
* Author: colorbass
*/
#ifndef INC_LOCK_H_
#define INC_LOCK_H_
#include "main.h"
#include "stdbool.h"
void GBT_Lock(uint8_t state);
void GBT_ManageLockSolenoid();
void GBT_ManageLockMotor();
uint8_t GBT_LockGetState();
void GBT_ForceLock(uint8_t state);
void GBT_ResetErrorTimeout();
typedef struct {
// uint8_t state;
uint8_t demand;
uint8_t error;
uint8_t action_requested; // 0 = unlock, 1 = lock, 255 = no action
uint8_t motor_state; // 0 = idle, 1 = motor_on, 2 = waiting_off
uint32_t last_action_time; // время последнего изменения состояния мотора
uint8_t retry_count; // счетчик попыток
uint32_t error_tick; // время установки ошибки (для таймаута сброса)
} GBT_LockState_t;
extern GBT_LockState_t GBT_LockState;
#endif /* INC_LOCK_H_ */