RobotHardware-UESTC/Hardware/Firmware/Gebot_Firmware v1.0/STM32/Lib/Board/board_stm32.h

53 lines
1.7 KiB
C
Raw Permalink Normal View History

2024-01-18 02:06:22 +08:00
#ifndef PIBOT_BOARD_MEGA2560_H_
#define PIBOT_BOARD_MEGA2560_H_
#include "board.h"
#include "variable_queue.h"
class Board_STM32 : public Board
{
public:
Board_STM32();
~Board_STM32();
virtual void init();
virtual void enable_irq();
virtual void disable_irq();
virtual void usart_debug_init();
virtual void usart_write(unsigned char num, unsigned char ch);
virtual void usart_init(unsigned char num, unsigned long buad);
virtual Queue* usart_getDataQueue(unsigned char num);
virtual void usart_write(unsigned char num, unsigned char* data, unsigned char len);
virtual void set_config(unsigned char* data, unsigned short len);
virtual void get_config(unsigned char* data, unsigned short len);
virtual void setDOState(unsigned char id, unsigned char operation);
virtual bool getDIState(unsigned char id);
virtual unsigned long get_tick_count();
virtual void motor_init(unsigned char num, unsigned long period);
virtual void motor_pwm(unsigned char num, long pwm_value);
virtual void encoder_init(unsigned char motor_id) ;
virtual long get_encoder_count(unsigned char motor_id);
virtual void i2c_init();
virtual unsigned char i2c_write_byte(unsigned char equipment_address, unsigned char reg_address , unsigned char pt_char);
virtual unsigned char i2c_write_buf(unsigned char equipment_address, unsigned char reg_address , unsigned char* pt_char , unsigned char size);
virtual unsigned char i2c_read_byte(unsigned char equipment_address, unsigned char reg_address , unsigned char* pt_char);
virtual unsigned char i2c_read_buf(unsigned char equipment_address, unsigned char reg_address , unsigned char* pt_char, unsigned char size);
private:
void DOInit(void);
void DIInit(void);
public:
static Board_STM32 board;
VQueue<256> usart3_queue;
};
#endif