// 声明全局变量 extern int16_t wheelEncoderValue; // 轮编码器值 extern uint16_t handbrakeValue; // 手刹值 extern int16_t leftTriggerValue_ADC; // 左扳机值(ADC) extern int16_t rightTriggerValue_ADC; // 右扳机值(ADC) extern int16_t xLeftStickValue_ADC; // 左摇杆 x 值(ADC) extern int16_t yLeftStickValue_ADC; // 左摇杆 y 值(ADC) extern int16_t xRightStickValue_ADC; // 右摇杆 x 值(ADC) extern int16_t yRightStickValue_ADC; // 右摇杆 y 值(ADC) extern struct _pin digitalArray[NUM_BUTTONS]; // 数字输入输出数组 extern struct _pin analogArray[NUM_ANALOG]; // 模拟输入输出数组 extern struct _pin encoderPins[2]; // 编码器引脚数组

extern int8_t adcValueReady; // ADC 值是否准备好的标志 extern int16_t leftTriggerValue; // 左扳机值 extern int16_t rightTriggerValue; // 右扳机值 extern int16_t xLeftStickValue; // 左摇杆 x 值 extern int16_t yLeftStickValue; // 左摇杆 y 值 extern int16_t xRightStickValue; // 右摇杆 x 值 extern int16_t yRightStickValue; // 右摇杆 y 值

// 声明函数 void declareButtonPins(void); // 声明数字输入输出引脚 void declareAnalogPins(void); // 声明模拟输入输出引脚 void declareEncoderPins(void); // 声明编码器引脚 uint32_t map(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max); // 映射函数 uint32_t my_restrict(int32_t x, int32_t max, int32_t middle); // 限制函数 void readButtons(void); // 读取数字输入输出引脚的状态 void updateTriggers(void); // 更新扳机的值 void updateSticks(void); // 更新摇杆的值 void readAdcValues(void); // 读取 ADC 的值 uint8_t readTag(uint8_t tag); // 读取标


原文地址: http://www.cveoy.top/t/topic/fe4f 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录