init
This commit is contained in:
94
научка/code/pwm_motor_control/Interface/interface.h
Normal file
94
научка/code/pwm_motor_control/Interface/interface.h
Normal file
@@ -0,0 +1,94 @@
|
||||
#ifndef __INTERFACE_H_
|
||||
#define __INTERFACE_H_
|
||||
|
||||
#include "periph_general.h"
|
||||
#include "i2c_lcd.h"
|
||||
|
||||
|
||||
extern LCDI2C_HandleTypeDef hlcd1;
|
||||
extern TIM_EncoderTypeDef henc1;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NOTHING_SELECTED,
|
||||
PWM_VALUE_SELECTED,
|
||||
PWM_HZ_SELECTED,
|
||||
PWM_DUTYBRIDGE_SELECTED,
|
||||
|
||||
NOTHING_COIL_SELECTED,
|
||||
PWM_COIL_DC_SELECTED,
|
||||
PWM_COIL_BRIDGE_SELECTED,
|
||||
PWM_COIL_PHASE_SELECTED,
|
||||
PWM_COIL_POLARITY_SELECTED,
|
||||
}CurrentSelection_TypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned PWM_Value:1;
|
||||
unsigned PWM_Hz:1;
|
||||
unsigned PWM_DutyBridge:1;
|
||||
unsigned reserved:1;
|
||||
unsigned PWM_DC:1;
|
||||
unsigned PWM_BRIDGE:1;
|
||||
unsigned PWM_PHASE:1;
|
||||
unsigned PWM_POLARITY:1;
|
||||
}Menu_HandleTypeDef;
|
||||
typedef struct
|
||||
{
|
||||
Menu_HandleTypeDef MenuItems;
|
||||
Menu_HandleTypeDef DisplayingItems;
|
||||
CurrentSelection_TypeDef CurrentSelection;
|
||||
uint8_t MenuNumber;
|
||||
unsigned FineChanging:1;
|
||||
int8_t StartMenuItem;
|
||||
|
||||
uint32_t Encoder_Shdw;
|
||||
uint32_t Switch_Shdw;
|
||||
uint32_t Switch_prevTick;
|
||||
uint32_t DoubleClick_Timeout;
|
||||
}Interface_HandleTypeDef;
|
||||
|
||||
|
||||
#define Menu_Size 3
|
||||
#define Menu_Coil_Size 4
|
||||
|
||||
#define Menu_PWM_Value (1<<0)
|
||||
#define Menu_PWM_Hz (1<<1)
|
||||
#define Menu_PWM_DutyBridge (1<<2)
|
||||
|
||||
#define Menu_PWM_DC (1<<4)
|
||||
#define Menu_PWM_BRIDGE (1<<5)
|
||||
#define Menu_PWM_PHASE (1<<6)
|
||||
#define Menu_PWM_POLARITY (1<<7)
|
||||
|
||||
void UpdateInterfaceStruct(void);
|
||||
void ReadEncoder(TIM_EncoderTypeDef *henc, LCDI2C_HandleTypeDef *hlcd);
|
||||
void UpdateLCDDisplay(LCDI2C_HandleTypeDef *hlcd);
|
||||
void Display_PWM_Value(LCDI2C_HandleTypeDef *hlcd);
|
||||
void Display_PWM_Hz(LCDI2C_HandleTypeDef *hlcd);
|
||||
void Display_PWM_DutyBridge(LCDI2C_HandleTypeDef *hlcd);
|
||||
|
||||
|
||||
void Display_PWM_DC(LCDI2C_HandleTypeDef *hlcd);
|
||||
void Display_PWM_BRIDGE(LCDI2C_HandleTypeDef *hlcd);
|
||||
void Display_PWM_PHASE(LCDI2C_HandleTypeDef *hlcd);
|
||||
void Display_PWM_POLARITY(LCDI2C_HandleTypeDef *hlcd);
|
||||
uint8_t LCD_DisplayMenuCoils(LCDI2C_HandleTypeDef *hlcd, uint8_t *menu, int8_t disp_cnt);
|
||||
uint8_t LCD_DisplayMenuRegisters(LCDI2C_HandleTypeDef *hlcd, uint8_t *menu, int8_t disp_cnt);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief First initialization of LCD.
|
||||
* @note This called from main
|
||||
*/
|
||||
void LCD_FirstInit(void);
|
||||
|
||||
/**
|
||||
* @brief First initialization of Encoder Timer.
|
||||
* @note This called from main
|
||||
*/
|
||||
void EncoderFirstInit(void);
|
||||
|
||||
#endif // __INTERFACE_H_
|
||||
Reference in New Issue
Block a user