机器人制作开源方案 | 智能家庭防护机器人

作者: 李尚堰 陈庆达 王立宽 尹婕 张永俊
单位: 哈尔滨剑桥学院
**指导老师:**马文龙 韩轶男

一、设计背景

随着计算机技术、信息通讯、大数据、智能传感等科学技术的不断发展、融合以及在机器人领域的不断应用,服务机器人产业将呈现出快速发展趋势。为推进我国服务机器人产业快速发展,政府及有关部门相继发布一系列政策,开展下一代机器人技术、智能机器人学习与认知、智能家庭服务机器人、智能公共服务机器人实现批量生产及应用,在很大程度上促进了服务机器人产业的发展。

智能家居机器人是通过计算机、通信、控制,也就是4C技术建立家庭综合服务于管理集成系统,机器人是IT技术、网络技术与控制技术向居家生活渗透发展的必然结果。

二、市场调研

随着人们收入水平的提高以及消费偏好的转变,家庭服务机器人慢慢演变成大众需求,以扫地机器人为代表的家庭服务机器人驶入了发展的快车道。2017年中国家庭服务机器人销售额55.7亿元,2021年增至142.9亿元,复合增长率26.6%。预计2023年家庭服务机器人零售额将达187亿元。

三、主要技术

3.1 方案设计

针对现有技术中存在的问题,本作品的目的在于提供一种家庭守护机器人,它可以通过四足-履带的切换结构,配合超声波传感器对障碍物进行避障,搭配温湿度、气体传感器、火焰传感器,对家庭火源,以及可燃气体的泄露进行实时检测,同时配备树莓派3B进行人机语音交互,对家庭智能化进行一系列的智能化操作以及方便性,为守护家庭保驾护航。

具体功能:采用四足-履带的驱动结构对障碍物进行避障,采用温湿度传感器将室内温度以及湿度实时显示在led屏幕中,采用火焰传感器、气体传感器对室内火源以及可燃气体进行实时检测,并配合树莓派3B进行语音播报提醒。利用树莓派接入AI百度云人工智能,以及科大讯飞进行人机语言交互,方便获取想要得到的信息,以及智能家居的控制更加的快捷方便。

3.2 控制系统

采用arduino控制器控制全车的运动系统以及实现各种功能的传感器,并且通过串口连接的方式接入人机交互模块对家庭守护更加快捷、方便。

3.3 主体结构

作品整体结构图

小车主要由驱动机构、传感器模块以及人机交互模块构成。

① 驱动机构
驱动结构图

全自动家庭守护机器人采用四足-履带的行进机构,配合超声波完成自主避障,对于较高的障碍物切换为履带模式进行避障,对于较低的障碍物切换为四足进行跨越障。

② 传感器模块
火焰传感器图片

通过火焰传感器对室内火源进行检测,确定火焰的方位,同时进行语音提示,从而为灭火机构提供灭火方位,实现在发生火灾时能够及时自动灭火,从根源避免火灾的蔓延,减少火灾造成的生命财产损失。
气体传感器图片

气体传感器,可以对室内可燃气体进行检测,并及时进行语音播报提醒,并可以通过树莓派进行人机交互,及其打开窗户进行通风换气, 实时保护了家庭人员的安全。
温湿度传感器图片

温湿度传感器,可将室内温度以及湿度进行检测,并将温度以及湿度显示在屏幕中,以方便提醒室内人员对室内舒适环境的温度以及湿度做出相应的操作。
led显示屏图片

可通过led屏显示当前小车状态和传感器相关数据。

③ 人机交互模块
树莓派3B图片

人机交互模块,是通过树莓派3B、麦克风以及扩音器构成。可通过人工智能语音进行人机语言交互,可以在室内出现事故时,通过唤醒机器人做出相应的动作,极大的为家庭守护提供了便捷性,同时也为室内活动增加了一份色彩。

四、创新亮点

本设计全自动家庭守护机器人,充分考虑到在家庭守护的稳定性,采用多种解决办法,能在较为复杂的地形中可靠的工作,具有良好的适应性。综合分析本次设计具有以下亮点:

① 四足-履带行进机构

机器人通过四足-履带的行进机构,为适应不同场地进行避障以及跨越障碍,让小车在复杂的环境中能更加稳定的工作。履带车形态在平坦或稍崎岖的地貌上能够保持较高的行进速度,降低了四足爬行的功率消耗;四足形态用于跨越障碍,灵活应对各类复杂地形环境,解决了履带结构应对高度落差较大地形难以翻越的痛点,即实现了仿生四足与履带式结构双优势结合的腿履协同。

② 传感器模块

通过不同的传感器模块对室内环境进行检测,为室内守护进行实时的数据传达以及提醒。

③ 人机交互模块

机器人搭配人工交互模块,可方便迅速的对室内守护进行语音提示,并方便的做出应对措施**。**

五、应用前景

随着时代的发展,我国消费者的消费观念对包括服务机器人在内的智能化产品需求也逐步增强。由于城市化带来的快节奏生活导致消费者家务时间明显减少,导致消费者对家务机器人购买需求呈现刚性化特征。

随着工业4.0和物联网技术的发展,技术进步带动力服务机器人智能化程度的迅速提升,同时国内智能手机渗透率较高,消费者使用智能手机作为移动终端远程遥控家庭服务机器人,提升了消费者的用户体验。综上,居民可支配收入、消费观念、城市化进程、技术等多方面因素使得我国家庭服务机器人市场需求呈现迅猛增长的态势。

更多详细资料请参考 【S023】智能家庭防护机器人

附录:示例程序

java 复制代码
#define t_bit unsigned char

#define t_bool unsigned char

#define t_uint8 unsigned char

#define t_int8 signed char

#define t_uint16 unsigned short

#define t_int16 signed short

#define t_uint32 unsigned int

#define t_int32 signed int

#define t_fix signed int

void cx_NULL_E(void);

void cx_SYS_NullFunc(void);

t_uint8 cx___sysbox__0_sys_iointerface_get_uint8( t_uint32 tmp_addr );

void cx___sysbox__0_sys_iointerface_set_uint8( t_uint32 tmp_addr, t_uint8 tmp_d );

t_uint16 cx___sysbox__0_sys_iointerface_get_uint16( t_uint32 tmp_addr );

void cx___sysbox__0_sys_iointerface_set_uint16( t_uint32 tmp_addr, t_uint16 tmp_d );

t_uint32 cx___sysbox__0_sys_iointerface_get_uint32( t_uint32 tmp_addr );

void cx___sysbox__0_sys_iointerface_set_uint32( t_uint32 tmp_addr, t_uint32 tmp_d );

void cx_youqian_driver_OS_init(void);

void cx_youqian_driver_OS_run(void);

void cx_youqian_driver_SetSpeed( t_int32 tmp_t );

void cx_youqian_driver_dev_init(void);

void cx_youqian_driver_SetValue( t_int32 tmp_d );

void cx_youqian_driver_sim_SetSpeed( t_int32 tmp_t );

void cx_kongzhiqi1_driver_OS_init(void);

void cx_kongzhiqi1_driver_OS_thread(void);

void cx_kongzhiqi1_driver_OS_run(void);

void cx_kongzhiqi1_driver_LightOpen(void);

void cx_kongzhiqi1_driver_LightClose(void);

void cx_kongzhiqi1_driver_LightSwap(void);

void cx_kongzhiqi1_driver_LightFlashTimes( t_int32 tmp_n );

void cx_kongzhiqi1_driver_LightFlash(void);

void cx_kongzhiqi1_driver_delay(void);

void cx_kongzhiqi1_pinMode( t_int32 tmp_p, t_int32 tmp_m );

void cx_kongzhiqi1_digitalWrite( t_int32 tmp_p, t_int32 tmp_d );

t_int32 cx_kongzhiqi1_digitalRead( t_int32 tmp_p );

void cx_youhou_driver_OS_init(void);

void cx_youhou_driver_OS_run(void);

void cx_youhou_driver_SetSpeed( t_int32 tmp_t );

void cx_youhou_driver_dev_init(void);

void cx_youhou_driver_SetValue( t_int32 tmp_d );

void cx_youhou_driver_sim_SetSpeed( t_int32 tmp_t );

void cx_zuohou_driver_OS_init(void);

void cx_zuohou_driver_OS_run(void);

void cx_zuohou_driver_SetSpeed( t_int32 tmp_t );

void cx_zuohou_driver_dev_init(void);

void cx_zuohou_driver_SetValue( t_int32 tmp_d );

void cx_zuohou_driver_sim_SetSpeed( t_int32 tmp_t );

void cx_zuoqian_driver_OS_init(void);

void cx_zuoqian_driver_OS_run(void);

void cx_zuoqian_driver_SetSpeed( t_int32 tmp_t );

void cx_zuoqian_driver_dev_init(void);

void cx_zuoqian_driver_SetValue( t_int32 tmp_d );

void cx_zuoqian_driver_sim_SetSpeed( t_int32 tmp_t );

void cx_madaqudongqi_driver_OS_init(void);

void cx_madaqudongqi_driver_set_t( t_int32 tmp_t );

void cx_madaqudongqi_driver_vex_init(void);

void cx_madaqudongqi_driver_OS_run100us(void);

void cx_youludai_driver_init(void);

void cx_youludai_driver_set_power( t_int32 tmp_p );

void cx_youludai_driver_run_right(void);

void cx_youludai_driver_run_left(void);

void cx_youludai_driver_stop(void);

void cx_youludai_driver_short_stop(void);

void cx_youludai_driver_OS_init(void);

void cx_zuoludai_driver_init(void);

void cx_zuoludai_driver_set_power( t_int32 tmp_p );

void cx_zuoludai_driver_run_right(void);

void cx_zuoludai_driver_run_left(void);

void cx_zuoludai_driver_stop(void);

void cx_zuoludai_driver_short_stop(void);

void cx_zuoludai_driver_OS_init(void);

t_int32 cx_chaoshengbocejuqi_driver_get_value(void);

t_int32 cx_chaoshengbocejuqi_driver_get_good_value(void);

void cx_chaoshengbocejuqi_driver_OS_init(void);

void cx_huoyanchuanganqi_driver_OS_init(void);

void cx_huoyanchuanganqi_driver_OS_run(void);

void cx_wenshiduchuanganqi_driver_OS_init(void);

void cx_wenshiduchuanganqi_driver_OS_run(void);

t_int32 cx_wenshiduchuanganqi_driver_wendu(void);

t_int32 cx_wenshiduchuanganqi_driver_shidu(void);

t_uint32 cx_wenshiduchuanganqi_driver_read(void);

t_uint8 cx_wenshiduchuanganqi_driver_get_byte(void);

void cx_yanshiqi_driver_OS_init(void);

void cx_yanshiqi_driver_OS_thread(void);

void cx_yanshiqi_driver_DelayMillisecond( t_int32 tmp_t );

void cx_yanshiqi_driver_DelaySecond( t_fix tmp_t );

void cx_yanshiqi_driver_DelayMinute( t_int32 tmp_t );

void cx_yanshiqi_driver_DelayHour( t_int32 tmp_t );

void cx_yanshiqi_driver_DelayDay( t_int32 tmp_t );

void cx_yanshiqi_driver_Stop(void);

void cx_yanshiqi_driver_StopCurrent(void);

void cx_yanshiqi_driver_StopAll(void);

void cx_yanwuchuanganqi_driver_OS_init(void);

t_int32 cx_yanwuchuanganqi_driver_get_data(void);

void cx_pingmu1_driver_Refresh(void);

void cx_pingmu1_driver_command_I2C_Init(void);

void cx_pingmu1_driver_command_I2C_A2_set_uint8( t_uint8 tmp_DeviceAddr, t_uint16 tmp_addr, t_uint8 tmp_data );

t_uint8 cx_pingmu1_driver_command_I2C_A2_get_uint8( t_uint8 tmp_DeviceAddr, t_uint16 tmp_addr );

void cx_pingmu1_driver_command_I2C_A1_set_uint8( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr, t_uint8 tmp_data );

t_uint8 cx_pingmu1_driver_command_I2C_A1_get_uint8( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr );

void cx_pingmu1_driver_command_I2C_A1_get_byte2( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr );

void cx_pingmu1_driver_command_I2C_A1_get_byte4( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr );

void cx_pingmu1_driver_command_I2C_A1_get_byte6( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr );

void cx_pingmu1_driver_command_I2C_start_iic(void);

void cx_pingmu1_driver_command_I2C_end_iic(void);

void cx_pingmu1_driver_command_I2C_wait(void);

void cx_pingmu1_driver_command_I2C_write_byte( t_uint8 tmp_data );

t_uint8 cx_pingmu1_driver_command_I2C_read_byte(void);

void cx_pingmu1_driver_command_I2C_Ack(void);

void cx_pingmu1_driver_command_I2C_NoAck(void);

void cx_pingmu1_driver_command_I2C_delay_1us(void);

void cx_pingmu1_driver_command_OS_init(void);

void cx_pingmu1_driver_command_write_command( t_uint8 tmp_C );

void cx_pingmu1_driver_command_write_data( t_uint8 tmp_D );

void cx_pingmu1_driver_OS_thread(void);

void cx_pingmu1_driver_Init(void);

void cx_pingmu1_driver_Clear(void);

void cx_pingmu1_driver_set_refresh(void);

void cx_pingmu1_driver_pixel( t_int32 tmp_x, t_int32 tmp_y );

void cx_pingmu1_driver_clear_pixel( t_int32 tmp_x, t_int32 tmp_y );

void cx_pingmu1_driver_pixel1( t_int32 tmp_x, t_int32 tmp_y );

void cx_pingmu1_driver_pixel0( t_int32 tmp_x, t_int32 tmp_y );

t_int32 cx_pingmu1_driver_get_pixel( t_int32 tmp_x, t_int32 tmp_y );

void cx_pingmu1_driver_Move( t_int32 tmp_v, t_int32 tmp_vy );

void cx_pingmu1_driver_OS_init(void);

void cx_chaoshengduoji_driver_OS_init(void);

void cx_chaoshengduoji_driver_OS_run(void);

void cx_chaoshengduoji_driver_SetSpeed( t_int32 tmp_t );

void cx_chaoshengduoji_driver_dev_init(void);

void cx_chaoshengduoji_driver_SetValue( t_int32 tmp_d );

void cx_chaoshengduoji_driver_sim_SetSpeed( t_int32 tmp_t );

void cx_xinxixianshiqi_driver_OS_init(void);

void cx_xinxixianshiqi_driver_clear(void);

void cx_xinxixianshiqi_driver_clear_line( t_int32 tmp_line );

void cx_xinxixianshiqi_driver_show_text( t_int32 tmp_line, t_int32 tmp_column, t_int8 tmp_string[] );

void cx_xinxixianshiqi_driver_show_text_f( t_int32 tmp_line, t_int32 tmp_column, t_int8 tmp_string[] );

void cx_xinxixianshiqi_driver_show_number_f( t_int32 tmp_line, t_int32 tmp_column, t_int32 tmp_data0 );

void cx_xinxixianshiqi_driver_show_number_ff( t_int32 tmp_line, t_int32 tmp_column, t_int32 tmp_data0 );

void cx_xinxixianshiqi_driver_show_number( t_int32 tmp_line, t_int32 tmp_column, t_int32 tmp_data0 );

void cx_xinxixianshiqi_driver_set_format( t_int32 tmp_c, t_int32 tmp_n );

void cx_xinxixianshiqi_driver_clear_format(void);

void cx_dianzhenzifuxianshiqi_driver_OS_init(void);

void cx_dianzhenzifuxianshiqi_driver_clear(void);

void cx_dianzhenzifuxianshiqi_driver_clear_line( t_int32 tmp_line );

void cx_dianzhenzifuxianshiqi_driver_print_line1( t_int32 tmp_x, t_int32 tmp_y, t_int32 tmp_c );

void cx_dianzhenzifuxianshiqi_driver_print_line( t_int32 tmp_YY, t_int32 tmp_XX, t_int32 tmp_c );

void cx_dianzhenzifuxianshiqi_driver_DrawChar( t_int8 tmp_PerWidth, t_#.点阵字符显示器.driver.icon *tmp_tfont, t_uint16 tmp_BufferIndex, t_int16 tmp_X, t_int16 tmp_Y );

void cx_dianzhenzifuxianshiqi_driver_SetEnglishFont( t_#.点阵字符显示器.driver.icon *tmp_icon );

void cx_dianzhenzifuxianshiqi_driver_SetChinesFont( t_#.点阵字符显示器.driver.icon *tmp_icon );

void cx_dianzhenzifuxianshiqi_driver_SetEnglishFontDefault(void);

void cx_yuyinlangduqi_driver_OS_init(void);

void cx_yuyinlangduqi_driver_set_baud( t_int32 tmp_b );

void cx_yuyinlangduqi_driver_print_string( t_int8 tmp_s[] );

void cx_yuyinlangduqi_driver_print_number( t_int32 tmp_data0 );

void cx_yuyinlangduqi_driver_print_char( t_int32 tmp_d );

t_int32 cx_yuyinlangduqi_driver_get_byte(void);

void cx_SYS_Servo_OS_init(void);

void cx_SYS_Servo_SetValue( t_int32 tmp_d );

void cx_SYS_Servo_timer2_compA(void);

void cx_SYS_Servo_Clear(void);

void cx_SYS_Servo_SetPin(void);

void cx_OS0_REMO_ModuleWrite( t_int32 tmp_d, t_int32 tmp_d1 );

t_int32 cx_OS0_REMO_ModuleRead( t_int32 tmp_d );

void cx_OS0_Delayer_Init(void);

void cx_OS0_Delayer_Run(void);

t_bool cx_OS0_Delayer_Running(void);

void cx_OS0_Delayer_Stop( t_uint16 tmp_cid );

void cx_OS0_Delayer_StopAll(void);

void cx_OS0_Delayer_Wait( t_int32 tmp_t );

t_int32 cx_OS0_GetSysTick(void);

t_uint32 cx_OS0_GetSysTickU(void);

void cx_OS0_OS_init(void);

void cx_OS0_CloseWatchdog(void);

void cx_OS0_MACRO_TIMER_ON(void);

void cx_OS0_MACRO_TIMER_OFF(void);

void cx_OS0_TimerInit(void);

void cx_OS0_OS_run(void);

void cx_OS0_DriverInit(void);

void cx_OS0_CreateDriver( void (*tmp_Handle)(void), t_uint8 tmp_MaxTick );

void cx_OS0_CreateDriver100us( void (*tmp_Handle)(void) );

void cx_OS0_RunDriverList(void);

void cx_OS0_RunDriver100usList(void);

void cx_OS0_D_CALL( void (*tmp_Handle)(void) );

void cx_OS0_Start(void);

void cx_sys_delayer_delay_n_10us( t_uint8 tmp_t );

void cx_sys_delayer_delay_n_1us( t_uint8 tmp_t );

void cx_sys_delayer_delay_ms( t_int32 tmp_t );

void cx_Sim_onInitDefault(void);

void cx_Sim_onDrawDefault(void);

void cx_Sim_onKeyEventDefault( t_bool tmp_down, t_int32 tmp_key );

t_int32 cx_Sim_crux_AddVar( t_int32 tmp_v );

t_int32 cx_Sim_crux_Run( t_int32 tmp_v );

void cx_Sim_OS_init(void);

void cx_Sim_OS_thread(void);

void cx_Sim_Clear(void);

void cx_Sim_DrawCircle( t_int32 tmp_x, t_int32 tmp_y, t_int32 tmp_r );

void cx_Sim_FillCircle( t_int32 tmp_x, t_int32 tmp_y, t_int32 tmp_r );

void cx_main0(void);

void cx_Setup(void);

void cx_Loop(void);

void cx_xiaocheqianjin(void);

void cx_xiaochetingzhi(void);

void cx_xiaochezuozhuan(void);

void cx_xiaocheyouzhuan(void);

void cx_xiaochedaoche(void);

void cx_xiaochexingtai(void);

void cx_kongzhiqi1_fanfuzhixing(void);

void cx_sizuxingtai(void);

void cx_xingzou(void);

void cx_huoyanchuanganqi_tancedaohuoyanshi(void);

void cx_kongzhiqi1_chushihua(void);

void cx_pingmu(void);

void cx_OS_VarInit(void);

t_int32 cx_SYS_Tick;

t_uint8 cx_SYS_Loop;

t_int32 cx_CInsIndex;

t_uint8 cx_youqian_driver_OS_time;

t_int32 cx_youqian_driver_tick;

t_int32 cx_youqian_driver_ti;

t_int32 cx_youqian_driver_Angle;

t_int32 cx_youqian_driver_C_Angle;

#define cx_kongzhiqi1_driver_RES_SP_LOW SP_LOW

#define cx_kongzhiqi1_driver_RES_SP_HIGH SP_HIGH

#define cx_kongzhiqi1_driver_RES_SP SP

#define cx_kongzhiqi1_driver_RES_SREG SREG

#define cx_kongzhiqi1_driver_RES_PINB PINB

#define cx_kongzhiqi1_driver_RES_DDRB DDRB

#define cx_kongzhiqi1_driver_RES_PORTB PORTB

#define cx_kongzhiqi1_driver_RES_PINC PINC

#define cx_kongzhiqi1_driver_RES_DDRC DDRC

#define cx_kongzhiqi1_driver_RES_PORTC PORTC

#define cx_kongzhiqi1_driver_RES_PIND PIND

#define cx_kongzhiqi1_driver_RES_DDRD DDRD

#define cx_kongzhiqi1_driver_RES_PORTD PORTD

#define cx_kongzhiqi1_driver_RES_WDTCSR WDTCSR

#define cx_kongzhiqi1_driver_RES_MCUSR MCUSR

#define cx_kongzhiqi1_driver_RES_TCCR0A TCCR0A

#define cx_kongzhiqi1_driver_RES_TCCR0B TCCR0B

#define cx_kongzhiqi1_driver_RES_TCNT0 TCNT0

#define cx_kongzhiqi1_driver_RES_OCR0A OCR0A

#define cx_kongzhiqi1_driver_RES_OCR0B OCR0B

#define cx_kongzhiqi1_driver_RES_TIMSK0 TIMSK0

#define cx_kongzhiqi1_driver_RES_TIFR0 TIFR0

#define cx_kongzhiqi1_driver_RES_ADCL ADCL

#define cx_kongzhiqi1_driver_RES_ADCH ADCH

#define cx_kongzhiqi1_driver_RES_ADCSRA ADCSRA

#define cx_kongzhiqi1_driver_RES_ADCSRB ADCSRB

#define cx_kongzhiqi1_driver_RES_ADMUX ADMUX

#define cx_kongzhiqi1_driver_RES_DIDR0 DIDR0

#define cx_kongzhiqi1_driver_RES_EICRA EICRA

#define cx_kongzhiqi1_driver_RES_EIMSK EIMSK

#define cx_kongzhiqi1_driver_RES_EIFR EIFR

#define cx_kongzhiqi1_driver_RES_OCR1BH OCR1BH

#define cx_kongzhiqi1_driver_RES_OCR1BL OCR1BL

#define cx_kongzhiqi1_driver_RES_OCR1AH OCR1AH

#define cx_kongzhiqi1_driver_RES_OCR1AL OCR1AL

#define cx_kongzhiqi1_driver_RES_TCNT1H TCNT1H

#define cx_kongzhiqi1_driver_RES_TCNT1L TCNT1L

#define cx_kongzhiqi1_driver_RES_TCCR1C TCCR1C

#define cx_kongzhiqi1_driver_RES_TCCR1B TCCR1B

#define cx_kongzhiqi1_driver_RES_TCCR1A TCCR1A

#define cx_kongzhiqi1_driver_RES_TIMSK1 TIMSK1

#define cx_kongzhiqi1_driver_RES_TIFR1 TIFR1

#define cx_kongzhiqi1_driver_RES_OCR2B OCR2B

#define cx_kongzhiqi1_driver_RES_OCR2A OCR2A

#define cx_kongzhiqi1_driver_RES_TCNT2 TCNT2

#define cx_kongzhiqi1_driver_RES_TCCR2B TCCR2B

#define cx_kongzhiqi1_driver_RES_TCCR2A TCCR2A

#define cx_kongzhiqi1_driver_RES_TIMSK2 TIMSK2

#define cx_kongzhiqi1_driver_RES_TIFR2 TIFR2

#define cx_kongzhiqi1_driver_RES_UCSR0A UCSR0A

#define cx_kongzhiqi1_driver_RES_UCSR0B UCSR0B

#define cx_kongzhiqi1_driver_RES_UCSR0C UCSR0C

#define cx_kongzhiqi1_driver_RES_UBRR0L UBRR0L

#define cx_kongzhiqi1_driver_RES_UBRR0H UBRR0H

#define cx_kongzhiqi1_driver_RES_UDR0 UDR0

#define cx_kongzhiqi1_driver_RES_EECR EECR

#define cx_kongzhiqi1_driver_RES_EEDR EEDR

#define cx_kongzhiqi1_driver_RES_EEARL EEARL

#define cx_kongzhiqi1_driver_RES_EEARH EEARH

#define cx_kongzhiqi1_driver_RES_SPCR SPCR

#define cx_kongzhiqi1_driver_RES_SPSR SPSR

#define cx_kongzhiqi1_driver_RES_SPDR SPDR

#define cx_kongzhiqi1_driver_RES_SMCR SMCR

#define cx_kongzhiqi1_driver_RES_MCUCSR MCUCSR

#define cx_kongzhiqi1_driver_RES_MCUCR MCUCR

t_uint8 cx_kongzhiqi1_driver_OS_time;

t_uint8 cx_kongzhiqi1_driver_OS_EventFlag;

t_uint8 cx_kongzhiqi1_driver_swap;

t_int32 cx_kongzhiqi1_driver_FlashNumber;

t_bool cx_kongzhiqi1_driver_FlashOpen;

t_bool cx_kongzhiqi1_driver_FlashForever;

t_bit cx_kongzhiqi1_GND_D0_DIR;

t_bit cx_kongzhiqi1_GND_D0_IN;

t_bit cx_kongzhiqi1_GND_D0_OUT;

t_bit cx_kongzhiqi1_GND_D0_PUL;

t_bit cx_kongzhiqi1_GND1_D0_DIR;

t_bit cx_kongzhiqi1_GND1_D0_IN;

t_bit cx_kongzhiqi1_GND1_D0_OUT;

t_bit cx_kongzhiqi1_GND1_D0_PUL;

t_bit cx_kongzhiqi1_GND2_D0_DIR;

t_bit cx_kongzhiqi1_GND2_D0_IN;

t_bit cx_kongzhiqi1_GND2_D0_OUT;

t_bit cx_kongzhiqi1_GND2_D0_PUL;

t_bit cx_kongzhiqi1_VCC1_D0_DIR;

t_bit cx_kongzhiqi1_VCC1_D0_IN;

t_bit cx_kongzhiqi1_VCC1_D0_OUT;

t_bit cx_kongzhiqi1_VCC1_D0_PUL;

t_bit cx_kongzhiqi1_VCC2_D0_DIR;

t_bit cx_kongzhiqi1_VCC2_D0_IN;

t_bit cx_kongzhiqi1_VCC2_D0_OUT;

t_bit cx_kongzhiqi1_VCC2_D0_PUL;

t_uint8 cx_youhou_driver_OS_time;

t_int32 cx_youhou_driver_tick;

t_int32 cx_youhou_driver_ti;

t_int32 cx_youhou_driver_Angle;

t_int32 cx_youhou_driver_C_Angle;

t_uint8 cx_zuohou_driver_OS_time;

t_int32 cx_zuohou_driver_tick;

t_int32 cx_zuohou_driver_ti;

t_int32 cx_zuohou_driver_Angle;

t_int32 cx_zuohou_driver_C_Angle;

t_uint8 cx_zuoqian_driver_OS_time;

t_int32 cx_zuoqian_driver_tick;

t_int32 cx_zuoqian_driver_ti;

t_int32 cx_zuoqian_driver_Angle;

t_int32 cx_zuoqian_driver_C_Angle;

t_int8 cx_madaqudongqi_driver_valueA;

t_int8 cx_madaqudongqi_driver_valueB;

t_bit cx_madaqudongqi_driver_DTA1;

t_bit cx_madaqudongqi_driver_DTA2;

t_bit cx_madaqudongqi_driver_DTB1;

t_bit cx_madaqudongqi_driver_DTB2;

t_int8 cx_madaqudongqi_driver_tick;

t_int8 cx_madaqudongqi_driver_T;

t_int8 cx_madaqudongqi_driver_tt;

t_uint8 cx_huoyanchuanganqi_driver_OS_EventFlag;

t_bool cx_huoyanchuanganqi_driver_key0_press;

t_uint8 cx_huoyanchuanganqi_driver_OS_time;

t_bit cx_huoyanchuanganqi_driver_last_key0_press;

t_uint8 cx_wenshiduchuanganqi_driver_OS_time;

t_int32 cx_wenshiduchuanganqi_driver_v_wendu;

t_int32 cx_wenshiduchuanganqi_driver_v_shidu;

t_bool cx_wenshiduchuanganqi_driver_NeedRefresh;

t_uint8 cx_wenshiduchuanganqi_driver_tick;

t_uint16 cx_wenshiduchuanganqi_driver_tickout;

t_uint8 cx_pingmu1_driver_command_I2C_byte0;

t_uint8 cx_pingmu1_driver_command_I2C_byte1;

t_uint8 cx_pingmu1_driver_command_I2C_byte2;

t_uint8 cx_pingmu1_driver_command_I2C_byte3;

t_uint8 cx_pingmu1_driver_command_I2C_byte4;

t_uint8 cx_pingmu1_driver_command_I2C_byte5;

t_int8 cx_pingmu1_driver_Offset;

t_int32 cx_pingmu1_driver_PenWidth;

t_int32 cx_pingmu1_driver_ForColor;

t_int32 cx_pingmu1_driver_BackColor;

t_int32 cx_pingmu1_driver_Width;

t_int32 cx_pingmu1_driver_Height;

t_bool cx_pingmu1_driver_NeedRefresh;

t_uint8 cx_pingmu1_driver_buffer[1024];

t_bool cx_pingmu1_driver_dot_set;

t_uint8 cx_chaoshengduoji_driver_OS_time;

t_int32 cx_chaoshengduoji_driver_tick;

t_int32 cx_chaoshengduoji_driver_ti;

t_int32 cx_chaoshengduoji_driver_Angle;

t_int32 cx_chaoshengduoji_driver_C_Angle;

t_int8 cx_xinxixianshiqi_driver_number_buffer[11];

t_int8 cx_xinxixianshiqi_driver_bchar;

t_int8 cx_xinxixianshiqi_driver_number;

t_int8 cx_dianzhenzifuxianshiqi_driver_char_PerWidth;
java 复制代码
const t_uint8 cx_dianzhenzifuxianshiqi_driver_font[] = { 128, 6, 58, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 0, 0, 0, 0, 3, 0, 3, 0, 0, 36, 244, 47, 244, 47, 36, 198, 137, 255, 145, 99, 0, 112, 142, 185, 78, 184, 128, 2, 197, 50, 76, 163, 64, 0, 3, 0, 0, 0, 0, 0, 0, 0, 126, 129, 0, 0, 0, 129, 126, 0, 0, 36, 24, 126, 24, 36, 0, 8, 8, 127, 8, 8, 0, 0, 128, 192, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 192, 192, 0, 0, 0, 128, 96, 24, 6, 1, 0, 126, 129, 129, 129, 126, 0, 0, 130, 255, 128, 0, 0, 198, 161, 145, 137, 134, 0, 66, 129, 137, 137, 118, 0, 48, 44, 34, 255, 32, 0, 79, 137, 137, 137, 113, 0, 126, 137, 137, 137, 112, 0, 3, 1, 249, 7, 1, 0, 118, 137, 137, 137, 118, 0, 14, 145, 145, 145, 126, 0, 0, 0, 132, 0, 0, 0, 0, 128, 200, 0, 0, 0, 0, 8, 20, 34, 65, 0, 36, 36, 36, 36, 36, 0, 0, 0, 65, 34, 20, 8, 6, 1, 177, 9, 6, 0, 126, 129, 185, 165, 190, 0, 252, 34, 33, 34, 252, 0, 129, 255, 137, 137, 118, 0, 126, 129, 129, 129, 67, 0, 129, 255, 129, 129, 126, 0, 129, 255, 137, 157, 195, 0, 129, 255, 137, 29, 3, 0, 60, 66, 129, 145, 115, 0, 255, 8, 8, 8, 255, 0, 0, 129, 255, 129, 0, 0, 193, 129, 255, 1, 1, 0, 129, 255, 137, 52, 195, 0, 129, 255, 129, 128, 192, 0, 255, 15, 240, 15, 255, 0, 255, 7, 28, 112, 255, 0, 126, 129, 129, 129, 126, 0, 129, 255, 137, 9, 6, 0, 126, 129, 177, 193, 126, 0, 255, 17, 17, 113, 206, 0, 198, 137, 137, 145, 99, 0, 3, 129, 255, 129, 3, 0, 127, 128, 128, 128, 127, 0, 7, 56, 224, 56, 7, 0, 7, 248, 15, 248, 7, 0, 129, 231, 24, 231, 129, 0, 1, 135, 248, 135, 1, 0, 131, 225, 153, 135, 193, 0, 0, 255, 129, 129, 0, 0, 1, 6, 24, 96, 128, 0, 0, 129, 129, 255, 0, 0, 4, 2, 1, 2, 4, 0, 128, 128, 128, 128, 128, 0, 1, 2, 0, 0, 0, 0, 64, 168, 168, 248, 128, 0, 1, 255, 136, 136, 112, 0, 112, 136, 136, 152, 0, 0, 112, 136, 137, 255, 128, 0, 112, 168, 168, 168, 176, 0, 8, 254, 9, 9, 0, 0, 16, 168, 168, 168, 248, 0, 129, 255, 136, 8, 240, 0, 0, 0, 249, 0, 0, 0, 0, 192, 136, 249, 0, 0, 129, 255, 32, 80, 136, 0, 0, 1, 255, 128, 128, 0, 248, 8, 248, 8, 240, 0, 8, 248, 8, 8, 240, 0, 112, 136, 136, 112, 0, 0, 252, 36, 36, 56, 0, 0, 56, 36, 36, 252, 0, 0, 136, 248, 144, 8, 8, 0, 0, 152, 168, 168, 200, 0, 0, 8, 126, 136, 128, 0, 120, 128, 136, 248, 128, 0, 24, 96, 128, 96, 24, 0, 24, 224, 56, 224, 24, 0, 136, 216, 32, 216, 136, 0, 136, 184, 192, 96, 24, 0, 0, 136, 232, 152, 136, 0, 0, 24, 231, 129, 0, 0, 0, 0, 0, 255, 0, 0, 0, 129, 231, 24, 0, 0, 8, 4, 4, 8, 4, 0 };

t_bit cx_yuyinlangduqi_driver_TX_IN;

t_uint16 cx_yuyinlangduqi_driver_BitTick;

t_uint16 cx_yuyinlangduqi_driver_BitTick_D32;

t_uint16 cx_yuyinlangduqi_driver_BitTick_C;

t_int8 cx_yuyinlangduqi_driver_number_buffer[11];

t_uint8 cx_SYS_Servo_TickNumber;

t_uint8 cx_SYS_Servo_PWM[8];

t_uint8 cx_SYS_Servo_n;

t_uint8 cx_SYS_Servo_out_put;

t_uint8 cx_SYS_Servo_tick;

t_uint8 cx_SYS_Servo_PWM_A;

t_uint16 cx_OS0_ID_list[12];

t_int32 cx_OS0_time_list[12];

t_bool cx_OS0_enable_list[12];

t_uint16 cx_OS0_Delayer_tempID;

t_bool cx_OS0_EnableSchedule;

t_bool cx_OS0_Delayer_Pause;

t_uint32 cx_OS0_SysTick;

t_uint16 cx_OS0_CurrentTaskIndex;

t_uint8 cx_OS0_TickList[8];

t_uint8 cx_OS0_MaxTickList[8];

void (*cx_OS0_DriverHandleList[8])(void);

t_uint8 cx_OS0_DriverNumber;

void (*cx_OS0_Driver100usHandleList[1])(void);

t_uint8 cx_OS0_Driver100usNumber;

t_uint8 cx_OS0_tick;

t_uint8 cx_OS0_DebugTick;

void (*cx_OS0_s_Handle)(void);

t_bool cx_xiaocheqianjin_en_;

t_uint8 cx_xiaocheqianjin_flg_;

t_bool cx_xiaochetingzhi_en_;

t_uint8 cx_xiaochetingzhi_flg_;

t_bool cx_xiaochezuozhuan_en_;

t_uint8 cx_xiaochezuozhuan_flg_;

t_bool cx_xiaocheyouzhuan_en_;

t_uint8 cx_xiaocheyouzhuan_flg_;

t_bool cx_xiaochedaoche_en_;

t_uint8 cx_xiaochedaoche_flg_;

t_bool cx_xiaochexingtai_en_;

t_uint8 cx_xiaochexingtai_flg_;

t_bool cx_kongzhiqi1_fanfuzhixing_en_;

t_uint8 cx_kongzhiqi1_fanfuzhixing_flg_;

t_bool cx_sizuxingtai_en_;

t_uint8 cx_sizuxingtai_flg_;

t_bool cx_xingzou_en_;

t_uint8 cx_xingzou_flg_;

t_bool cx_huoyanchuanganqi_tancedaohuoyanshi_en_;

t_uint8 cx_huoyanchuanganqi_tancedaohuoyanshi_flg_;

t_bool cx_kongzhiqi1_chushihua_en_;

t_uint8 cx_kongzhiqi1_chushihua_flg_;

t_bool cx_pingmu_en_;

t_uint8 cx_pingmu_flg_;

void cx_NULL_E(void)

{

}

void cx_SYS_NullFunc(void)

{

}

t_uint8 cx___sysbox__0_sys_iointerface_get_uint8( t_uint32 tmp_addr )

{

return 0;

}

void cx___sysbox__0_sys_iointerface_set_uint8( t_uint32 tmp_addr, t_uint8 tmp_d )

{

}

t_uint16 cx___sysbox__0_sys_iointerface_get_uint16( t_uint32 tmp_addr )

{

return 0;

}

void cx___sysbox__0_sys_iointerface_set_uint16( t_uint32 tmp_addr, t_uint16 tmp_d )

{

}

t_uint32 cx___sysbox__0_sys_iointerface_get_uint32( t_uint32 tmp_addr )

{

return 0;

}

void cx___sysbox__0_sys_iointerface_set_uint32( t_uint32 tmp_addr, t_uint32 tmp_d )

{

}

void cx_youqian_driver_OS_init(void)

{

cx_youqian_driver_dev_init();

cx_kongzhiqi1_driver_RES_DDRB |= 8;

cx_kongzhiqi1_driver_RES_PORTB &= 247;

if( cx_SYS_Tick < 10 ) {

cx_youqian_driver_OS_time = 10;

}

else {

cx_youqian_driver_OS_time = (t_uint8)(t_uint16)(t_uint32)cx_SYS_Tick;

}

cx_youqian_driver_tick = 0;

cx_youqian_driver_ti = 0;

cx_youqian_driver_C_Angle = 0;

cx_youqian_driver_SetValue( cx_youqian_driver_C_Angle );

cx_youqian_driver_SetSpeed( 1000 );

}

void cx_youqian_driver_OS_run(void)

{

if( cx_youqian_driver_C_Angle == cx_youqian_driver_Angle ) {

cx_youqian_driver_ti = 0;

return;

}

cx_youqian_driver_ti = cx_youqian_driver_ti + (cx_youqian_driver_tick);

if( cx_youqian_driver_ti >= 1000 ) {

t_int32 tmp_dv = cx_youqian_driver_ti / 1000;

cx_youqian_driver_ti = cx_youqian_driver_ti % 1000;

if( cx_youqian_driver_C_Angle > cx_youqian_driver_Angle ) {

cx_youqian_driver_C_Angle = cx_youqian_driver_C_Angle - (tmp_dv);

if( cx_youqian_driver_C_Angle < cx_youqian_driver_Angle ) {

cx_youqian_driver_C_Angle = cx_youqian_driver_Angle;

}

cx_youqian_driver_SetValue( cx_youqian_driver_C_Angle );

}

else {

cx_youqian_driver_C_Angle = cx_youqian_driver_C_Angle + (tmp_dv);

if( cx_youqian_driver_C_Angle > cx_youqian_driver_Angle ) {

cx_youqian_driver_C_Angle = cx_youqian_driver_Angle;

}

cx_youqian_driver_SetValue( cx_youqian_driver_C_Angle );

}

}

}

void cx_youqian_driver_SetSpeed( t_int32 tmp_t )

{

if( tmp_t < 0 ) {

tmp_t = 0;

}

if( tmp_t > 1000 ) {

tmp_t = 1000;

}

cx_youqian_driver_tick = tmp_t * (t_int8)cx_youqian_driver_OS_time;

cx_youqian_driver_sim_SetSpeed( tmp_t );

}

void cx_youqian_driver_dev_init(void)

{

}

void cx_youqian_driver_SetValue( t_int32 tmp_d )

{

tmp_d = -tmp_d * 55 / 90 + 90;

if( tmp_d < 0 ) {

tmp_d = 0;

}

if( tmp_d > 180 ) {

tmp_d = 180;

}

cx_SYS_Servo_PWM[0] = (t_uint8)(t_uint16)(t_uint32)tmp_d;

}

void cx_youqian_driver_sim_SetSpeed( t_int32 tmp_t )

{

}

void cx_kongzhiqi1_driver_OS_init(void)

{

cx_kongzhiqi1_driver_FlashOpen = 0;

cx_kongzhiqi1_driver_FlashForever = 0;

cx_kongzhiqi1_driver_FlashNumber = 0;

cx_kongzhiqi1_driver_swap = 0;

cx_kongzhiqi1_driver_OS_time = 50;

cx_kongzhiqi1_driver_OS_EventFlag = 0;

cx_kongzhiqi1_driver_OS_EventFlag |= 1;

t_uint16 _cx_lc_1 = 10;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

cx_kongzhiqi1_driver_delay();

}

cx_kongzhiqi1_driver_RES_DDRB |= 32;

cx_kongzhiqi1_driver_RES_PORTB &= 223;

}

void cx_kongzhiqi1_driver_OS_thread(void)

{

cx_kongzhiqi1_driver_OS_EventFlag |= 2;

}

void cx_kongzhiqi1_driver_OS_run(void)

{

if( !cx_kongzhiqi1_driver_FlashOpen ) {

return;

}

cx_kongzhiqi1_driver_swap = cx_kongzhiqi1_driver_swap % (10);

t_bit tmp_OUT;

if( cx_kongzhiqi1_driver_swap < 1 ) {
tmp_OUT = 1;

}

else {

tmp_OUT = 0;

}

cx_kongzhiqi1_driver_swap = cx_kongzhiqi1_driver_swap + (1);

if( cx_kongzhiqi1_driver_FlashForever ) {

(tmp_OUT) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 32): (cx_kongzhiqi1_driver_RES_PORTB &= 223);

return;

}

if( cx_kongzhiqi1_driver_FlashNumber == 0 ) {

cx_kongzhiqi1_driver_FlashOpen = 0;

return;

}

if( ((cx_kongzhiqi1_driver_RES_PORTB >> 5) & 1) == 1 && tmp_OUT == 0 ) {

cx_kongzhiqi1_driver_FlashNumber = cx_kongzhiqi1_driver_FlashNumber - (1);

}

(tmp_OUT) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 32): (cx_kongzhiqi1_driver_RES_PORTB &= 223);

}

void cx_kongzhiqi1_driver_LightOpen(void)

{

cx_kongzhiqi1_driver_FlashOpen = 0;

cx_kongzhiqi1_driver_RES_PORTB |= 32;

}

void cx_kongzhiqi1_driver_LightClose(void)

{

cx_kongzhiqi1_driver_FlashOpen = 0;

cx_kongzhiqi1_driver_RES_PORTB &= 223;

}

void cx_kongzhiqi1_driver_LightSwap(void)

{

cx_kongzhiqi1_driver_FlashOpen = 0;

((((cx_kongzhiqi1_driver_RES_PORTB >> 5) & 1)^1)) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 32): (cx_kongzhiqi1_driver_RES_PORTB &= 223);

}

void cx_kongzhiqi1_driver_LightFlashTimes( t_int32 tmp_n )

{

cx_kongzhiqi1_driver_FlashNumber = tmp_n;

cx_kongzhiqi1_driver_swap = 0;

cx_kongzhiqi1_driver_FlashForever = 0;

cx_kongzhiqi1_driver_FlashOpen = 1;

}

void cx_kongzhiqi1_driver_LightFlash(void)

{

cx_kongzhiqi1_driver_FlashNumber = 0;

cx_kongzhiqi1_driver_FlashForever = 1;

cx_kongzhiqi1_driver_FlashOpen = 1;

}

void cx_kongzhiqi1_driver_delay(void)

{

t_uint16 _cx_lc_1 = 250;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

t_uint16 _cx_lc_3 = 250;

for( t_uint16 _cx_lc_2 = 0; _cx_lc_2 < _cx_lc_3; _cx_lc_2++ ) {

}

}

}

void cx_kongzhiqi1_pinMode( t_int32 tmp_p, t_int32 tmp_m )

{

if( tmp_p > 19 || tmp_p < 0 ) {

return;

}

t_bit tmp_b;

if( tmp_m != 0 ) {

tmp_b = 1;

}

else {

tmp_b = 0;

}

switch( (t_uint8)(t_uint16)(t_uint32)tmp_p ) {

case 0:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRD |= 1): (cx_kongzhiqi1_driver_RES_DDRD &= 254);

break;

case 1:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRD |= 2): (cx_kongzhiqi1_driver_RES_DDRD &= 253);

break;

case 2:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRD |= 4): (cx_kongzhiqi1_driver_RES_DDRD &= 251);

break;

case 3:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRD |= 8): (cx_kongzhiqi1_driver_RES_DDRD &= 247);

break;

case 4:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRD |= 16): (cx_kongzhiqi1_driver_RES_DDRD &= 239);

break;

case 5:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRD |= 32): (cx_kongzhiqi1_driver_RES_DDRD &= 223);

break;

case 6:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRD |= 64): (cx_kongzhiqi1_driver_RES_DDRD &= 191);

break;

case 7:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRD |= 128): (cx_kongzhiqi1_driver_RES_DDRD &= 127);

break;

case 8:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRB |= 1): (cx_kongzhiqi1_driver_RES_DDRB &= 254);

break;

case 9:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRB |= 2): (cx_kongzhiqi1_driver_RES_DDRB &= 253);

break;

case 10:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRB |= 4): (cx_kongzhiqi1_driver_RES_DDRB &= 251);

break;

case 11:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRB |= 8): (cx_kongzhiqi1_driver_RES_DDRB &= 247);

break;

case 12:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRB |= 16): (cx_kongzhiqi1_driver_RES_DDRB &= 239);

break;

case 13:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRB |= 32): (cx_kongzhiqi1_driver_RES_DDRB &= 223);

break;

case 14:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRC |= 1): (cx_kongzhiqi1_driver_RES_DDRC &= 254);

break;

case 15:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRC |= 2): (cx_kongzhiqi1_driver_RES_DDRC &= 253);

break;

case 16:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRC |= 4): (cx_kongzhiqi1_driver_RES_DDRC &= 251);

break;

case 17:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRC |= 8): (cx_kongzhiqi1_driver_RES_DDRC &= 247);

break;

case 18:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRC |= 16): (cx_kongzhiqi1_driver_RES_DDRC &= 239);

break;

case 19:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_DDRC |= 32): (cx_kongzhiqi1_driver_RES_DDRC &= 223);

break;

default:

break;

}

}

void cx_kongzhiqi1_digitalWrite( t_int32 tmp_p, t_int32 tmp_d )

{

if( tmp_p > 19 || tmp_p < 0 ) {

return;

}

t_bit tmp_b;

if( tmp_d != 0 ) {

tmp_b = 1;

}

else {

tmp_b = 0;

}

switch( (t_uint8)(t_uint16)(t_uint32)tmp_p ) {

case 0:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 1): (cx_kongzhiqi1_driver_RES_PORTD &= 254);

break;

case 1:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 2): (cx_kongzhiqi1_driver_RES_PORTD &= 253);

break;

case 2:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 4): (cx_kongzhiqi1_driver_RES_PORTD &= 251);

break;

case 3:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 8): (cx_kongzhiqi1_driver_RES_PORTD &= 247);

break;

case 4:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 16): (cx_kongzhiqi1_driver_RES_PORTD &= 239);

break;

case 5:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 32): (cx_kongzhiqi1_driver_RES_PORTD &= 223);

break;

case 6:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 64): (cx_kongzhiqi1_driver_RES_PORTD &= 191);

break;

case 7:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 128): (cx_kongzhiqi1_driver_RES_PORTD &= 127);

break;

case 8:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 1): (cx_kongzhiqi1_driver_RES_PORTB &= 254);

break;

case 9:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 2): (cx_kongzhiqi1_driver_RES_PORTB &= 253);

break;

case 10:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 4): (cx_kongzhiqi1_driver_RES_PORTB &= 251);

break;

case 11:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 8): (cx_kongzhiqi1_driver_RES_PORTB &= 247);

break;

case 12:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 16): (cx_kongzhiqi1_driver_RES_PORTB &= 239);
java 复制代码
break;

case 13:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 32): (cx_kongzhiqi1_driver_RES_PORTB &= 223);

break;

case 14:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTC |= 1): (cx_kongzhiqi1_driver_RES_PORTC &= 254);

break;

case 15:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTC |= 2): (cx_kongzhiqi1_driver_RES_PORTC &= 253);

break;

case 16:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTC |= 4): (cx_kongzhiqi1_driver_RES_PORTC &= 251);

break;

case 17:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTC |= 8): (cx_kongzhiqi1_driver_RES_PORTC &= 247);

break;

case 18:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTC |= 16): (cx_kongzhiqi1_driver_RES_PORTC &= 239);

break;

case 19:

(tmp_b) != 0 ? (cx_kongzhiqi1_driver_RES_PORTC |= 32): (cx_kongzhiqi1_driver_RES_PORTC &= 223);

break;

default:

break;

}

}

t_int32 cx_kongzhiqi1_digitalRead( t_int32 tmp_p )

{

if( tmp_p > 19 || tmp_p < 0 ) {

return 0;

}

t_bit tmp_b;

switch( (t_uint8)(t_uint16)(t_uint32)tmp_p ) {

case 0:

tmp_b = ((cx_kongzhiqi1_driver_RES_PIND >> 0) & 1);

break;

case 1:

tmp_b = ((cx_kongzhiqi1_driver_RES_PIND >> 1) & 1);

break;

case 2:

tmp_b = ((cx_kongzhiqi1_driver_RES_PIND >> 2) & 1);

break;

case 3:

tmp_b = ((cx_kongzhiqi1_driver_RES_PIND >> 3) & 1);

break;

case 4:

tmp_b = ((cx_kongzhiqi1_driver_RES_PIND >> 4) & 1);

break;

case 5:

tmp_b = ((cx_kongzhiqi1_driver_RES_PIND >> 5) & 1);

break;

case 6:

tmp_b = ((cx_kongzhiqi1_driver_RES_PIND >> 6) & 1);

break;

case 7:

tmp_b = ((cx_kongzhiqi1_driver_RES_PIND >> 7) & 1);

break;

case 8:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINB >> 0) & 1);

break;

case 9:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINB >> 1) & 1);

break;

case 10:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINB >> 2) & 1);

break;

case 11:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINB >> 3) & 1);

break;

case 12:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINB >> 4) & 1);

break;

case 13:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINB >> 5) & 1);

break;

case 14:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINC >> 0) & 1);

break;

case 15:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINC >> 1) & 1);

break;

case 16:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINC >> 2) & 1);

break;

case 17:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINC >> 3) & 1);

break;

case 18:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINC >> 4) & 1);

break;

case 19:

tmp_b = ((cx_kongzhiqi1_driver_RES_PINC >> 5) & 1);

break;

default:

break;

}

if( tmp_b == 0 ) {

return 0;

}

else {

return 1;

}

return 0;

}

void cx_youhou_driver_OS_init(void)

{

cx_youhou_driver_dev_init();

cx_kongzhiqi1_driver_RES_DDRD |= 16;

cx_kongzhiqi1_driver_RES_PORTD &= 239;

if( cx_SYS_Tick < 10 ) {

cx_youhou_driver_OS_time = 10;

}

else {

cx_youhou_driver_OS_time = (t_uint8)(t_uint16)(t_uint32)cx_SYS_Tick;

}

cx_youhou_driver_tick = 0;

cx_youhou_driver_ti = 0;

cx_youhou_driver_C_Angle = 0;

cx_youhou_driver_SetValue( cx_youhou_driver_C_Angle );

cx_youhou_driver_SetSpeed( 1000 );

}

void cx_youhou_driver_OS_run(void)

{

if( cx_youhou_driver_C_Angle == cx_youhou_driver_Angle ) {

cx_youhou_driver_ti = 0;

return;

}

cx_youhou_driver_ti = cx_youhou_driver_ti + (cx_youhou_driver_tick);

if( cx_youhou_driver_ti >= 1000 ) {

t_int32 tmp_dv = cx_youhou_driver_ti / 1000;

cx_youhou_driver_ti = cx_youhou_driver_ti % 1000;

if( cx_youhou_driver_C_Angle > cx_youhou_driver_Angle ) {

cx_youhou_driver_C_Angle = cx_youhou_driver_C_Angle - (tmp_dv);

if( cx_youhou_driver_C_Angle < cx_youhou_driver_Angle ) {

cx_youhou_driver_C_Angle = cx_youhou_driver_Angle;

}

cx_youhou_driver_SetValue( cx_youhou_driver_C_Angle );

}

else {

cx_youhou_driver_C_Angle = cx_youhou_driver_C_Angle + (tmp_dv);

if( cx_youhou_driver_C_Angle > cx_youhou_driver_Angle ) {

cx_youhou_driver_C_Angle = cx_youhou_driver_Angle;

}

cx_youhou_driver_SetValue( cx_youhou_driver_C_Angle );

}

}

}

void cx_youhou_driver_SetSpeed( t_int32 tmp_t )

{

if( tmp_t < 0 ) {

tmp_t = 0;

}

if( tmp_t > 1000 ) {

tmp_t = 1000;

}

cx_youhou_driver_tick = tmp_t * (t_int8)cx_youhou_driver_OS_time;

cx_youhou_driver_sim_SetSpeed( tmp_t );

}

void cx_youhou_driver_dev_init(void)

{

}

void cx_youhou_driver_SetValue( t_int32 tmp_d )

{

tmp_d = -tmp_d * 55 / 90 + 90;

if( tmp_d < 0 ) {

tmp_d = 0;

}

if( tmp_d > 180 ) {

tmp_d = 180;

}

cx_SYS_Servo_PWM[1] = (t_uint8)(t_uint16)(t_uint32)tmp_d;

}

void cx_youhou_driver_sim_SetSpeed( t_int32 tmp_t )

{

}

void cx_zuohou_driver_OS_init(void)

{

cx_zuohou_driver_dev_init();

cx_kongzhiqi1_driver_RES_DDRB |= 1;

cx_kongzhiqi1_driver_RES_PORTB &= 254;

if( cx_SYS_Tick < 10 ) {

cx_zuohou_driver_OS_time = 10;

}

else {

cx_zuohou_driver_OS_time = (t_uint8)(t_uint16)(t_uint32)cx_SYS_Tick;

}

cx_zuohou_driver_tick = 0;

cx_zuohou_driver_ti = 0;

cx_zuohou_driver_C_Angle = 0;

cx_zuohou_driver_SetValue( cx_zuohou_driver_C_Angle );

cx_zuohou_driver_SetSpeed( 1000 );

}

void cx_zuohou_driver_OS_run(void)

{

if( cx_zuohou_driver_C_Angle == cx_zuohou_driver_Angle ) {

cx_zuohou_driver_ti = 0;

return;

}

cx_zuohou_driver_ti = cx_zuohou_driver_ti + (cx_zuohou_driver_tick);

if( cx_zuohou_driver_ti >= 1000 ) {

t_int32 tmp_dv = cx_zuohou_driver_ti / 1000;

cx_zuohou_driver_ti = cx_zuohou_driver_ti % 1000;

if( cx_zuohou_driver_C_Angle > cx_zuohou_driver_Angle ) {

cx_zuohou_driver_C_Angle = cx_zuohou_driver_C_Angle - (tmp_dv);

if( cx_zuohou_driver_C_Angle < cx_zuohou_driver_Angle ) {

cx_zuohou_driver_C_Angle = cx_zuohou_driver_Angle;

}

cx_zuohou_driver_SetValue( cx_zuohou_driver_C_Angle );

}

else {

cx_zuohou_driver_C_Angle = cx_zuohou_driver_C_Angle + (tmp_dv);

if( cx_zuohou_driver_C_Angle > cx_zuohou_driver_Angle ) {

cx_zuohou_driver_C_Angle = cx_zuohou_driver_Angle;

}

cx_zuohou_driver_SetValue( cx_zuohou_driver_C_Angle );

}

}

}

void cx_zuohou_driver_SetSpeed( t_int32 tmp_t )

{

if( tmp_t < 0 ) {

tmp_t = 0;

}

if( tmp_t > 1000 ) {

tmp_t = 1000;

}

cx_zuohou_driver_tick = tmp_t * (t_int8)cx_zuohou_driver_OS_time;

cx_zuohou_driver_sim_SetSpeed( tmp_t );

}

void cx_zuohou_driver_dev_init(void)

{

}

void cx_zuohou_driver_SetValue( t_int32 tmp_d )

{

tmp_d = -tmp_d * 55 / 90 + 90;

if( tmp_d < 0 ) {

tmp_d = 0;

}

if( tmp_d > 180 ) {

tmp_d = 180;

}

cx_SYS_Servo_PWM[2] = (t_uint8)(t_uint16)(t_uint32)tmp_d;

}

void cx_zuohou_driver_sim_SetSpeed( t_int32 tmp_t )

{

}

void cx_zuoqian_driver_OS_init(void)

{

cx_zuoqian_driver_dev_init();

cx_kongzhiqi1_driver_RES_DDRB |= 16;

cx_kongzhiqi1_driver_RES_PORTB &= 239;

if( cx_SYS_Tick < 10 ) {

cx_zuoqian_driver_OS_time = 10;

}

else {

cx_zuoqian_driver_OS_time = (t_uint8)(t_uint16)(t_uint32)cx_SYS_Tick;

}

cx_zuoqian_driver_tick = 0;

cx_zuoqian_driver_ti = 0;

cx_zuoqian_driver_C_Angle = 0;

cx_zuoqian_driver_SetValue( cx_zuoqian_driver_C_Angle );

cx_zuoqian_driver_SetSpeed( 1000 );

}

void cx_zuoqian_driver_OS_run(void)

{

if( cx_zuoqian_driver_C_Angle == cx_zuoqian_driver_Angle ) {

cx_zuoqian_driver_ti = 0;

return;

}

cx_zuoqian_driver_ti = cx_zuoqian_driver_ti + (cx_zuoqian_driver_tick);

if( cx_zuoqian_driver_ti >= 1000 ) {

t_int32 tmp_dv = cx_zuoqian_driver_ti / 1000;

cx_zuoqian_driver_ti = cx_zuoqian_driver_ti % 1000;

if( cx_zuoqian_driver_C_Angle > cx_zuoqian_driver_Angle ) {

cx_zuoqian_driver_C_Angle = cx_zuoqian_driver_C_Angle - (tmp_dv);

if( cx_zuoqian_driver_C_Angle < cx_zuoqian_driver_Angle ) {

cx_zuoqian_driver_C_Angle = cx_zuoqian_driver_Angle;

}

cx_zuoqian_driver_SetValue( cx_zuoqian_driver_C_Angle );

}

else {

cx_zuoqian_driver_C_Angle = cx_zuoqian_driver_C_Angle + (tmp_dv);

if( cx_zuoqian_driver_C_Angle > cx_zuoqian_driver_Angle ) {

cx_zuoqian_driver_C_Angle = cx_zuoqian_driver_Angle;

}

cx_zuoqian_driver_SetValue( cx_zuoqian_driver_C_Angle );

}

}

}

void cx_zuoqian_driver_SetSpeed( t_int32 tmp_t )

{

if( tmp_t < 0 ) {

tmp_t = 0;

}

if( tmp_t > 1000 ) {

tmp_t = 1000;

}

cx_zuoqian_driver_tick = tmp_t * (t_int8)cx_zuoqian_driver_OS_time;

cx_zuoqian_driver_sim_SetSpeed( tmp_t );

}

void cx_zuoqian_driver_dev_init(void)

{

}

void cx_zuoqian_driver_SetValue( t_int32 tmp_d )

{

tmp_d = -tmp_d * 55 / 90 + 90;

if( tmp_d < 0 ) {

tmp_d = 0;

}

if( tmp_d > 180 ) {

tmp_d = 180;

}

cx_SYS_Servo_PWM[3] = (t_uint8)(t_uint16)(t_uint32)tmp_d;

}

void cx_zuoqian_driver_sim_SetSpeed( t_int32 tmp_t )

{

}

void cx_madaqudongqi_driver_OS_init(void)

{

cx_kongzhiqi1_driver_RES_DDRB |= 4;

cx_kongzhiqi1_driver_RES_PORTB &= 251;

cx_kongzhiqi1_driver_RES_DDRB |= 2;

cx_kongzhiqi1_driver_RES_PORTB &= 253;

cx_kongzhiqi1_driver_RES_DDRD |= 64;

cx_kongzhiqi1_driver_RES_PORTD &= 191;

cx_kongzhiqi1_driver_RES_DDRD |= 32;

cx_kongzhiqi1_driver_RES_PORTD &= 223;

cx_madaqudongqi_driver_valueA = 100;

cx_madaqudongqi_driver_valueB = 100;

cx_madaqudongqi_driver_tick = 0;

cx_madaqudongqi_driver_DTA1 = 0;

cx_madaqudongqi_driver_DTA2 = 0;

cx_madaqudongqi_driver_DTB1 = 0;

cx_madaqudongqi_driver_DTB2 = 0;

cx_madaqudongqi_driver_T = (t_int8)(t_int16)1;

cx_madaqudongqi_driver_tt = 0;

cx_madaqudongqi_driver_vex_init();

}

void cx_madaqudongqi_driver_set_t( t_int32 tmp_t )

{

cx_madaqudongqi_driver_T = (t_int8)(t_int16)tmp_t;

cx_madaqudongqi_driver_tt = 0;

}

void cx_madaqudongqi_driver_vex_init(void)

{

}

void cx_madaqudongqi_driver_OS_run100us(void)

{

cx_madaqudongqi_driver_tt = cx_madaqudongqi_driver_tt + (1);

if( cx_madaqudongqi_driver_tt < cx_madaqudongqi_driver_T ) {

return;

}

cx_madaqudongqi_driver_tt = 0;

cx_madaqudongqi_driver_tick = cx_madaqudongqi_driver_tick % (100);

t_bool tmp_ResetA = cx_madaqudongqi_driver_tick == 0;

t_bool tmp_ResetB = tmp_ResetA;

if( cx_madaqudongqi_driver_tick >= cx_madaqudongqi_driver_valueA ) {

cx_kongzhiqi1_driver_RES_PORTB &= 251;

cx_kongzhiqi1_driver_RES_PORTB &= 253;

tmp_ResetA = 0;

}

if( tmp_ResetA ) {

(cx_madaqudongqi_driver_DTA1) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 4): (cx_kongzhiqi1_driver_RES_PORTB &= 251);

(cx_madaqudongqi_driver_DTA2) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 2): (cx_kongzhiqi1_driver_RES_PORTB &= 253);

}

if( cx_madaqudongqi_driver_tick >= cx_madaqudongqi_driver_valueB ) {

cx_kongzhiqi1_driver_RES_PORTD &= 191;

cx_kongzhiqi1_driver_RES_PORTD &= 223;

tmp_ResetB = 0;

}

if( tmp_ResetB ) {

(cx_madaqudongqi_driver_DTB1) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 64): (cx_kongzhiqi1_driver_RES_PORTD &= 191);

(cx_madaqudongqi_driver_DTB2) != 0 ? (cx_kongzhiqi1_driver_RES_PORTD |= 32): (cx_kongzhiqi1_driver_RES_PORTD &= 223);

}

cx_madaqudongqi_driver_tick = cx_madaqudongqi_driver_tick + (1);

}

void cx_youludai_driver_init(void)

{

}

void cx_youludai_driver_set_power( t_int32 tmp_p )

{

if( tmp_p < 0 ) {

tmp_p = 0;

}

if( tmp_p > 100 ) {
java 复制代码
tmp_p = 100;

}

cx_madaqudongqi_driver_valueB = (t_int8)(t_int16)tmp_p;

}

void cx_youludai_driver_run_right(void)

{

cx_kongzhiqi1_driver_RES_PORTD |= 32;

cx_madaqudongqi_driver_DTB2 = 1;

cx_kongzhiqi1_driver_RES_PORTD &= 191;

cx_madaqudongqi_driver_DTB1 = 0;

}

void cx_youludai_driver_run_left(void)

{

cx_kongzhiqi1_driver_RES_PORTD |= 64;

cx_madaqudongqi_driver_DTB1 = 1;

cx_kongzhiqi1_driver_RES_PORTD &= 223;

cx_madaqudongqi_driver_DTB2 = 0;

}

void cx_youludai_driver_stop(void)

{

cx_kongzhiqi1_driver_RES_PORTD &= 191;

cx_madaqudongqi_driver_DTB1 = 0;

cx_kongzhiqi1_driver_RES_PORTD &= 223;

cx_madaqudongqi_driver_DTB2 = 0;

}

void cx_youludai_driver_short_stop(void)

{

cx_kongzhiqi1_driver_RES_PORTD |= 64;

cx_madaqudongqi_driver_DTB1 = 1;

cx_kongzhiqi1_driver_RES_PORTD |= 32;

cx_madaqudongqi_driver_DTB1 = 1;

}

void cx_youludai_driver_OS_init(void)

{

cx_youludai_driver_init();

cx_youludai_driver_stop();

}

void cx_zuoludai_driver_init(void)

{

}

void cx_zuoludai_driver_set_power( t_int32 tmp_p )

{

if( tmp_p < 0 ) {

tmp_p = 0;

}

if( tmp_p > 100 ) {

tmp_p = 100;

}

cx_madaqudongqi_driver_valueA = (t_int8)(t_int16)tmp_p;

}

void cx_zuoludai_driver_run_right(void)

{

cx_kongzhiqi1_driver_RES_PORTB |= 2;

cx_madaqudongqi_driver_DTA2 = 1;

cx_kongzhiqi1_driver_RES_PORTB &= 251;

cx_madaqudongqi_driver_DTA1 = 0;

}

void cx_zuoludai_driver_run_left(void)

{

cx_kongzhiqi1_driver_RES_PORTB |= 4;

cx_madaqudongqi_driver_DTA1 = 1;

cx_kongzhiqi1_driver_RES_PORTB &= 253;

cx_madaqudongqi_driver_DTA2 = 0;

}

void cx_zuoludai_driver_stop(void)

{

cx_kongzhiqi1_driver_RES_PORTB &= 251;

cx_madaqudongqi_driver_DTA1 = 0;

cx_kongzhiqi1_driver_RES_PORTB &= 253;

cx_madaqudongqi_driver_DTA2 = 0;

}

void cx_zuoludai_driver_short_stop(void)

{

cx_kongzhiqi1_driver_RES_PORTB |= 4;

cx_madaqudongqi_driver_DTA1 = 1;

cx_kongzhiqi1_driver_RES_PORTB |= 2;

cx_madaqudongqi_driver_DTA1 = 1;

}

void cx_zuoludai_driver_OS_init(void)

{

cx_zuoludai_driver_init();

cx_zuoludai_driver_stop();

}

t_int32 cx_chaoshengbocejuqi_driver_get_value(void)

{

cx_kongzhiqi1_driver_RES_PORTC |= 2;

t_uint16 _cx_lc_1 = 10;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

}

cx_kongzhiqi1_driver_RES_PORTC &= 253;

t_int16 tmp_d = 0;

while( tmp_d < 1000 && ((cx_kongzhiqi1_driver_RES_PINC >> 0) & 1) == 0 ) {

tmp_d = tmp_d + (1);

}

tmp_d = 0;

while( tmp_d < 3000 && ((cx_kongzhiqi1_driver_RES_PINC >> 0) & 1) == 1 ) {

tmp_d = tmp_d + (1);

}

t_int32 tmp_dd = tmp_d;

return tmp_dd * 269 / 500 - 10;

}

t_int32 cx_chaoshengbocejuqi_driver_get_good_value(void)

{

return cx_chaoshengbocejuqi_driver_get_value();

}

void cx_chaoshengbocejuqi_driver_OS_init(void)

{

cx_kongzhiqi1_driver_RES_DDRC |= 2;

cx_kongzhiqi1_driver_RES_PORTC &= 253;

cx_kongzhiqi1_driver_RES_DDRC &= 254;

cx_kongzhiqi1_driver_RES_PORTC |= 1;

}

void cx_huoyanchuanganqi_driver_OS_init(void)

{

cx_kongzhiqi1_driver_RES_DDRC &= 251;

cx_kongzhiqi1_driver_RES_PORTC |= 4;

cx_huoyanchuanganqi_driver_OS_time = 1;

cx_huoyanchuanganqi_driver_OS_EventFlag = 0;

cx_huoyanchuanganqi_driver_last_key0_press = 0;

}

void cx_huoyanchuanganqi_driver_OS_run(void)

{

t_bit tmp_KEY0 = (((cx_kongzhiqi1_driver_RES_PINC >> 2) & 1)^1);

t_bit tmp_key0_down = tmp_KEY0 & (cx_huoyanchuanganqi_driver_last_key0_press^1);

t_bit tmp_key0_up = (tmp_KEY0^1) & cx_huoyanchuanganqi_driver_last_key0_press;

if( tmp_key0_down == 1 ) {

cx_huoyanchuanganqi_driver_OS_EventFlag |= 1;

}

if( tmp_key0_up == 1 ) {

cx_huoyanchuanganqi_driver_OS_EventFlag |= 2;

}

cx_huoyanchuanganqi_driver_last_key0_press = tmp_KEY0;

if( tmp_KEY0 == 1 ) {

cx_huoyanchuanganqi_driver_key0_press = 1;

}

else {

cx_huoyanchuanganqi_driver_key0_press = 0;

}

}

void cx_wenshiduchuanganqi_driver_OS_init(void)

{

cx_kongzhiqi1_driver_RES_DDRD |= 8;

cx_kongzhiqi1_driver_RES_PORTD |= 8;

cx_wenshiduchuanganqi_driver_OS_time = 250;

cx_wenshiduchuanganqi_driver_NeedRefresh = 1;

}

void cx_wenshiduchuanganqi_driver_OS_run(void)

{

cx_wenshiduchuanganqi_driver_tick = cx_wenshiduchuanganqi_driver_tick + (1);

if( cx_wenshiduchuanganqi_driver_tick == 10 ) {

cx_wenshiduchuanganqi_driver_tick = 0;

if( cx_wenshiduchuanganqi_driver_NeedRefresh ) {

cx_wenshiduchuanganqi_driver_NeedRefresh = 0;

t_uint32 tmp_d = cx_wenshiduchuanganqi_driver_read();

t_uint32 tmp_u_wendu = ((tmp_d >> 8) & 255);

t_uint32 tmp_u_shidu = ((tmp_d >> 24) & 255);

cx_wenshiduchuanganqi_driver_v_wendu = (t_int32)tmp_u_wendu;

if( ((tmp_d >> 7) & 1) == 1 ) {

cx_wenshiduchuanganqi_driver_v_wendu = -cx_wenshiduchuanganqi_driver_v_wendu;

}

cx_wenshiduchuanganqi_driver_v_shidu = (t_int32)tmp_u_shidu;

}

}

}

t_int32 cx_wenshiduchuanganqi_driver_wendu(void)

{

cx_wenshiduchuanganqi_driver_NeedRefresh = 1;

return cx_wenshiduchuanganqi_driver_v_wendu;

}

t_int32 cx_wenshiduchuanganqi_driver_shidu(void)

{

cx_wenshiduchuanganqi_driver_NeedRefresh = 1;

return cx_wenshiduchuanganqi_driver_v_shidu;

}

t_uint32 cx_wenshiduchuanganqi_driver_read(void)

{

cx_kongzhiqi1_driver_RES_PORTD &= 247;

t_uint16 _cx_lc_1 = 10;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

cx_sys_delayer_delay_n_10us( 180 );

}

cx_kongzhiqi1_driver_RES_PORTD |= 8;

cx_sys_delayer_delay_n_10us( 3 );

cx_kongzhiqi1_driver_RES_DDRD &= 247;

cx_wenshiduchuanganqi_driver_tickout = 0;

while( ((cx_kongzhiqi1_driver_RES_PIND >> 3) & 1) == 1 && cx_wenshiduchuanganqi_driver_tickout < 30000 ) {

cx_wenshiduchuanganqi_driver_tickout = cx_wenshiduchuanganqi_driver_tickout + (1);

}

cx_wenshiduchuanganqi_driver_tickout = 0;

while( ((cx_kongzhiqi1_driver_RES_PIND >> 3) & 1) == 0 && cx_wenshiduchuanganqi_driver_tickout < 30000 ) {

cx_wenshiduchuanganqi_driver_tickout = cx_wenshiduchuanganqi_driver_tickout + (1);

}

cx_wenshiduchuanganqi_driver_tickout = 0;

while( ((cx_kongzhiqi1_driver_RES_PIND >> 3) & 1) == 1 && cx_wenshiduchuanganqi_driver_tickout < 30000 ) {

cx_wenshiduchuanganqi_driver_tickout = cx_wenshiduchuanganqi_driver_tickout + (1);

}

t_uint32 tmp_d;

tmp_d |= (t_uint32)(cx_wenshiduchuanganqi_driver_get_byte()) << 24; tmp_d &= ((t_uint32)(cx_wenshiduchuanganqi_driver_get_byte()) << 24) | 16777215;

tmp_d |= (t_uint32)(cx_wenshiduchuanganqi_driver_get_byte()) << 16; tmp_d &= ((t_uint32)(cx_wenshiduchuanganqi_driver_get_byte()) << 16) | 4278255615;

tmp_d |= (t_uint32)(cx_wenshiduchuanganqi_driver_get_byte()) << 8; tmp_d &= ((t_uint32)(cx_wenshiduchuanganqi_driver_get_byte()) << 8) | 4294902015;

tmp_d |= (t_uint32)(cx_wenshiduchuanganqi_driver_get_byte()) << 0; tmp_d &= ((t_uint32)(cx_wenshiduchuanganqi_driver_get_byte()) << 0) | 4294967040;

t_uint8 tmp_sum = cx_wenshiduchuanganqi_driver_get_byte();

cx_kongzhiqi1_driver_RES_DDRD |= 8;

return tmp_d;

}

t_uint8 cx_wenshiduchuanganqi_driver_get_byte(void)

{

t_uint8 tmp_d;

t_uint16 _cx_lc_1 = 8;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

tmp_d = tmp_d << (1);

cx_wenshiduchuanganqi_driver_tickout = 0;


while( ((cx_kongzhiqi1_driver_RES_PIND >> 3) & 1) == 0 && cx_wenshiduchuanganqi_driver_tickout < 30000 ) {

cx_wenshiduchuanganqi_driver_tickout = cx_wenshiduchuanganqi_driver_tickout + (1);

}

cx_sys_delayer_delay_n_10us( 5 );

(((cx_kongzhiqi1_driver_RES_PIND >> 3) & 1)) != 0 ? (tmp_d |= 1): (tmp_d &= 254);

cx_wenshiduchuanganqi_driver_tickout = 0;

while( ((cx_kongzhiqi1_driver_RES_PIND >> 3) & 1) == 1 && cx_wenshiduchuanganqi_driver_tickout < 30000 ) {

cx_wenshiduchuanganqi_driver_tickout = cx_wenshiduchuanganqi_driver_tickout + (1);

}

}

return tmp_d;

}

void cx_yanshiqi_driver_OS_init(void)

{

}

void cx_yanshiqi_driver_OS_thread(void)

{

}

void cx_yanshiqi_driver_DelayMillisecond( t_int32 tmp_t )

{

t_int32 tmp_tt = tmp_t;

if( tmp_tt != 0 ) {

cx_OS0_Delayer_tempID = 39;

cx_OS0_Delayer_Wait( tmp_tt );

}

}

void cx_yanshiqi_driver_DelaySecond( t_fix tmp_t )

{

t_uint32 tmp_d = (t_uint32)tmp_t;

tmp_d = tmp_d * 1000 / 1024;

cx_yanshiqi_driver_DelayMillisecond( (t_int32)tmp_d );

}

void cx_yanshiqi_driver_DelayMinute( t_int32 tmp_t )

{

cx_yanshiqi_driver_DelayMillisecond( tmp_t * 60000 );

}

void cx_yanshiqi_driver_DelayHour( t_int32 tmp_t )

{

cx_yanshiqi_driver_DelayMillisecond( tmp_t * 3600000 );

}

void cx_yanshiqi_driver_DelayDay( t_int32 tmp_t )

{

cx_yanshiqi_driver_DelayMillisecond( tmp_t * 86400000 );

}

void cx_yanshiqi_driver_Stop(void)

{

cx_OS0_Delayer_Stop( 39 );

}

void cx_yanshiqi_driver_StopCurrent(void)

{

cx_OS0_Delayer_Stop( 39 );

}

void cx_yanshiqi_driver_StopAll(void)

{

cx_OS0_Delayer_StopAll();

}

void cx_yanwuchuanganqi_driver_OS_init(void)

{

}

t_int32 cx_yanwuchuanganqi_driver_get_data(void)

{

t_uint16 tmp_data = analogRead( 4 );

t_uint32 tmp_d = tmp_data;

return 0 + (t_int32)tmp_d * (1023 - 0 + 1) / 1024;

}

void cx_pingmu1_driver_Refresh(void)

{

cx_pingmu1_driver_OS_thread();

}

void cx_pingmu1_driver_command_I2C_Init(void)

{

cx_kongzhiqi1_driver_RES_DDRC |= 8;

cx_kongzhiqi1_driver_RES_PORTC |= 8;

cx_kongzhiqi1_driver_RES_DDRD |= 4;

cx_kongzhiqi1_driver_RES_PORTD |= 4;

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_end_iic();

cx_pingmu1_driver_command_I2C_delay_1us();

}

void cx_pingmu1_driver_command_I2C_A2_set_uint8( t_uint8 tmp_DeviceAddr, t_uint16 tmp_addr, t_uint8 tmp_data )

{

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr );

cx_pingmu1_driver_command_I2C_write_byte( ((tmp_addr >> 8) & 255) );

cx_pingmu1_driver_command_I2C_write_byte( ((tmp_addr >> 0) & 255) );

cx_pingmu1_driver_command_I2C_write_byte( tmp_data );

cx_pingmu1_driver_command_I2C_end_iic();

}

t_uint8 cx_pingmu1_driver_command_I2C_A2_get_uint8( t_uint8 tmp_DeviceAddr, t_uint16 tmp_addr )

{

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr );

cx_pingmu1_driver_command_I2C_write_byte( ((tmp_addr >> 8) & 255) );

cx_pingmu1_driver_command_I2C_write_byte( ((tmp_addr >> 0) & 255) );

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr | 1 );

t_uint8 tmp_data = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_NoAck();

cx_pingmu1_driver_command_I2C_end_iic();

return tmp_data;

}
java 复制代码
void cx_pingmu1_driver_command_I2C_A1_set_uint8( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr, t_uint8 tmp_data )

{

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr );

cx_pingmu1_driver_command_I2C_write_byte( tmp_addr );

cx_pingmu1_driver_command_I2C_write_byte( tmp_data );

cx_pingmu1_driver_command_I2C_end_iic();

}

t_uint8 cx_pingmu1_driver_command_I2C_A1_get_uint8( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr )

{

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr );

cx_pingmu1_driver_command_I2C_write_byte( tmp_addr );

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr | 1 );

t_uint8 tmp_data = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_NoAck();

cx_pingmu1_driver_command_I2C_end_iic();

return tmp_data;

}

void cx_pingmu1_driver_command_I2C_A1_get_byte2( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr )

{

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr );

cx_pingmu1_driver_command_I2C_write_byte( tmp_addr );

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr | 1 );

cx_pingmu1_driver_command_I2C_byte0 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_Ack();

cx_pingmu1_driver_command_I2C_byte1 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_NoAck();

cx_pingmu1_driver_command_I2C_end_iic();

}

void cx_pingmu1_driver_command_I2C_A1_get_byte4( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr )

{

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr );

cx_pingmu1_driver_command_I2C_write_byte( tmp_addr );

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr | 1 );

cx_pingmu1_driver_command_I2C_byte0 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_Ack();

cx_pingmu1_driver_command_I2C_byte1 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_Ack();

cx_pingmu1_driver_command_I2C_byte2 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_Ack();

cx_pingmu1_driver_command_I2C_byte3 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_NoAck();

cx_pingmu1_driver_command_I2C_end_iic();

}

void cx_pingmu1_driver_command_I2C_A1_get_byte6( t_uint8 tmp_DeviceAddr, t_uint8 tmp_addr )

{

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr );

cx_pingmu1_driver_command_I2C_write_byte( tmp_addr );

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( tmp_DeviceAddr | 1 );

cx_pingmu1_driver_command_I2C_byte0 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_Ack();

cx_pingmu1_driver_command_I2C_byte1 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_Ack();

cx_pingmu1_driver_command_I2C_byte2 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_Ack();

cx_pingmu1_driver_command_I2C_byte3 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_Ack();

cx_pingmu1_driver_command_I2C_byte4 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_Ack();

cx_pingmu1_driver_command_I2C_byte5 = cx_pingmu1_driver_command_I2C_read_byte();

cx_pingmu1_driver_command_I2C_NoAck();

cx_pingmu1_driver_command_I2C_end_iic();

}

void cx_pingmu1_driver_command_I2C_start_iic(void)

{

cx_kongzhiqi1_driver_RES_PORTC |= 8;

cx_kongzhiqi1_driver_RES_PORTD |= 4;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTC &= 247;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTD &= 251;

cx_pingmu1_driver_command_I2C_delay_1us();

}

void cx_pingmu1_driver_command_I2C_end_iic(void)

{

cx_kongzhiqi1_driver_RES_PORTC &= 247;

cx_kongzhiqi1_driver_RES_PORTD |= 4;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTC |= 8;

cx_pingmu1_driver_command_I2C_delay_1us();

}

void cx_pingmu1_driver_command_I2C_wait(void)

{

cx_kongzhiqi1_driver_RES_DDRC &= 247;

cx_kongzhiqi1_driver_RES_PORTC |= 8;

cx_kongzhiqi1_driver_RES_PORTD |= 4;

while( ((cx_kongzhiqi1_driver_RES_PINC >> 3) & 1) == 1 ) {

}

cx_kongzhiqi1_driver_RES_PORTD &= 251;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_DDRC |= 8;

cx_pingmu1_driver_command_I2C_delay_1us();

}

void cx_pingmu1_driver_command_I2C_write_byte( t_uint8 tmp_data )

{

t_uint16 _cx_lc_1 = 8;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

(((tmp_data >> 7) & 1)) != 0 ? (cx_kongzhiqi1_driver_RES_PORTC |= 8): (cx_kongzhiqi1_driver_RES_PORTC &= 247);

tmp_data = tmp_data << (1);

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTD |= 4;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTD &= 251;

cx_pingmu1_driver_command_I2C_delay_1us();

}

cx_pingmu1_driver_command_I2C_wait();

}

t_uint8 cx_pingmu1_driver_command_I2C_read_byte(void)

{

t_uint8 tmp_data;

cx_kongzhiqi1_driver_RES_DDRC &= 247;

cx_kongzhiqi1_driver_RES_PORTC |= 8;

cx_pingmu1_driver_command_I2C_delay_1us();

t_uint16 _cx_lc_1 = 8;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

tmp_data = tmp_data << (1);

(((cx_kongzhiqi1_driver_RES_PINC >> 3) & 1)) != 0 ? (tmp_data |= 1): (tmp_data &= 254);

cx_kongzhiqi1_driver_RES_PORTD |= 4;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTD &= 251;

cx_pingmu1_driver_command_I2C_delay_1us();

}

cx_kongzhiqi1_driver_RES_DDRC |= 8;

return tmp_data;

}

void cx_pingmu1_driver_command_I2C_Ack(void)

{

cx_kongzhiqi1_driver_RES_PORTC &= 247;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTD |= 4;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTD &= 251;

cx_pingmu1_driver_command_I2C_delay_1us();

}

void cx_pingmu1_driver_command_I2C_NoAck(void)

{

cx_kongzhiqi1_driver_RES_PORTC |= 8;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTD |= 4;

cx_pingmu1_driver_command_I2C_delay_1us();

cx_kongzhiqi1_driver_RES_PORTD &= 251;

cx_pingmu1_driver_command_I2C_delay_1us();

}

void cx_pingmu1_driver_command_I2C_delay_1us(void)

{

cx_sys_delayer_delay_n_1us( 1 );

}

void cx_pingmu1_driver_command_OS_init(void)

{

cx_pingmu1_driver_command_I2C_Init();

cx_pingmu1_driver_command_write_command( 174 );

cx_pingmu1_driver_command_write_command( 0 );

cx_pingmu1_driver_command_write_command( 16 );

cx_pingmu1_driver_command_write_command( 64 );

cx_pingmu1_driver_command_write_command( 129 );

cx_pingmu1_driver_command_write_command( 207 );

cx_pingmu1_driver_command_write_command( 161 );

cx_pingmu1_driver_command_write_command( 200 );

cx_pingmu1_driver_command_write_command( 166 );

cx_pingmu1_driver_command_write_command( 168 );

cx_pingmu1_driver_command_write_command( 63 );

cx_pingmu1_driver_command_write_command( 211 );

cx_pingmu1_driver_command_write_command( 0 );

cx_pingmu1_driver_command_write_command( 213 );

cx_pingmu1_driver_command_write_command( 128 );

cx_pingmu1_driver_command_write_command( 217 );

cx_pingmu1_driver_command_write_command( 241 );

cx_pingmu1_driver_command_write_command( 218 );

cx_pingmu1_driver_command_write_command( 18 );

cx_pingmu1_driver_command_write_command( 219 );

cx_pingmu1_driver_command_write_command( 64 );

cx_pingmu1_driver_command_write_command( 32 );

cx_pingmu1_driver_command_write_command( 2 );

cx_pingmu1_driver_command_write_command( 141 );

cx_pingmu1_driver_command_write_command( 20 );

cx_pingmu1_driver_command_write_command( 164 );

cx_pingmu1_driver_command_write_command( 166 );

cx_pingmu1_driver_command_write_command( 175 );

}

void cx_pingmu1_driver_command_write_command( t_uint8 tmp_C )

{

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( 120 );

cx_pingmu1_driver_command_I2C_write_byte( 0 );

cx_pingmu1_driver_command_I2C_write_byte( tmp_C );

cx_pingmu1_driver_command_I2C_end_iic();


}

void cx_pingmu1_driver_command_write_data( t_uint8 tmp_D )

{

cx_pingmu1_driver_command_I2C_start_iic();

cx_pingmu1_driver_command_I2C_write_byte( 120 );

cx_pingmu1_driver_command_I2C_write_byte( 64 );

cx_pingmu1_driver_command_I2C_write_byte( tmp_D );

cx_pingmu1_driver_command_I2C_end_iic();

}

void cx_pingmu1_driver_OS_thread(void)

{

if( cx_pingmu1_driver_NeedRefresh ) {

cx_pingmu1_driver_NeedRefresh = 0;

t_uint8 tmp_line = 0;

t_uint16 tmp_index = 0;

t_uint16 _cx_lc_1 = 8;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

cx_pingmu1_driver_command_write_command( 176 + tmp_line );

cx_pingmu1_driver_command_write_command( 0 + (t_uint8)cx_pingmu1_driver_Offset );

cx_pingmu1_driver_command_write_command( 16 );

tmp_line = tmp_line + (1);

t_uint16 _cx_lc_3 = 128;

for( t_uint16 _cx_lc_2 = 0; _cx_lc_2 < _cx_lc_3; _cx_lc_2++ ) {

cx_pingmu1_driver_command_write_data( cx_pingmu1_driver_buffer[tmp_index] );

tmp_index = tmp_index + (1);

}

}

}

}

void cx_pingmu1_driver_Init(void)

{

if( 0 ) {

cx_pingmu1_driver_Height = 128;

cx_pingmu1_driver_Width = 8 * 8;

}

else {

cx_pingmu1_driver_Width = 128;

cx_pingmu1_driver_Height = 8 * 8;

}

cx_pingmu1_driver_PenWidth = 1;

cx_pingmu1_driver_ForColor = 1;

cx_pingmu1_driver_BackColor = 0;

cx_pingmu1_driver_NeedRefresh = 0;

cx_pingmu1_driver_Clear();

}

void cx_pingmu1_driver_Clear(void)

{

t_uint8 tmp_d = 0;

if( cx_pingmu1_driver_BackColor < 0 ) {

return;

}

if( cx_pingmu1_driver_BackColor == 0 ) {

tmp_d = 0;

}

else {

tmp_d = 255;

}

for( t_int16 tmp_i = 0; tmp_i < 1024; ) {

cx_pingmu1_driver_buffer[tmp_i] = tmp_d;

tmp_i = tmp_i + (1);

}

cx_pingmu1_driver_NeedRefresh = 1;

}

void cx_pingmu1_driver_set_refresh(void)

{

cx_pingmu1_driver_NeedRefresh = 1;

}

void cx_pingmu1_driver_pixel( t_int32 tmp_x, t_int32 tmp_y )

{

if( cx_pingmu1_driver_ForColor < 0 ) {

return;

}

if( cx_pingmu1_driver_ForColor == 0 ) {

cx_pingmu1_driver_dot_set = 0;

}

else {

cx_pingmu1_driver_dot_set = 1;

}

cx_pingmu1_driver_pixel1( tmp_x, tmp_y );

}

void cx_pingmu1_driver_clear_pixel( t_int32 tmp_x, t_int32 tmp_y )

{

if( cx_pingmu1_driver_BackColor < 0 ) {

return;

}

if( cx_pingmu1_driver_BackColor == 0 ) {
java 复制代码
cx_pingmu1_driver_dot_set = 0;

}

else {

cx_pingmu1_driver_dot_set = 1;

}

cx_pingmu1_driver_pixel1( tmp_x, tmp_y );

}

void cx_pingmu1_driver_pixel1( t_int32 tmp_x, t_int32 tmp_y )

{

if( tmp_x < 0 || tmp_x >= cx_pingmu1_driver_Width || tmp_y < 0 || tmp_y >= cx_pingmu1_driver_Height ) {

return;

}

if( 0 ) {

tmp_x = cx_pingmu1_driver_Width - 1 - tmp_x;

}

if( 0 ) {

tmp_y = cx_pingmu1_driver_Height - 1 - tmp_y;

}

if( 0 ) {

t_int32 tmp_t = tmp_x;

tmp_x = tmp_y;

tmp_y = tmp_t;

}

if( cx_pingmu1_driver_PenWidth == 1 ) {

cx_pingmu1_driver_pixel0( tmp_x, tmp_y );

}

if( cx_pingmu1_driver_PenWidth < 1 ) {

return;

}

t_int32 tmp_x0 = tmp_x - cx_pingmu1_driver_PenWidth / 2;

tmp_y = tmp_y - cx_pingmu1_driver_PenWidth / 2;

t_uint16 _cx_lc_1 = cx_pingmu1_driver_PenWidth;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

t_int32 tmp_xx0 = tmp_x0;

t_uint16 _cx_lc_3 = cx_pingmu1_driver_PenWidth;

for( t_uint16 _cx_lc_2 = 0; _cx_lc_2 < _cx_lc_3; _cx_lc_2++ ) {

cx_pingmu1_driver_pixel0( tmp_xx0, tmp_y );

tmp_xx0 = tmp_xx0 + (1);

}

tmp_y = tmp_y + (1);

}

}

void cx_pingmu1_driver_pixel0( t_int32 tmp_x, t_int32 tmp_y )

{

t_int8 tmp_m = (t_int8)(t_int16)tmp_y % 8;

t_uint16 tmp_yy = (t_uint16)(t_uint32)tmp_y;

t_uint16 tmp_index = tmp_yy / 8;

tmp_index = tmp_index * (t_uint16)128 + (t_uint16)(t_uint32)tmp_x;

t_uint8 tmp_data = cx_pingmu1_driver_buffer[tmp_index];

if( cx_pingmu1_driver_dot_set ) {

tmp_data = tmp_data | (1 << (t_uint8)tmp_m);

}

else {

tmp_data = tmp_data & (~(1 << (t_uint8)tmp_m));

}

cx_pingmu1_driver_buffer[tmp_index] = tmp_data;

cx_pingmu1_driver_NeedRefresh = 1;

}

t_int32 cx_pingmu1_driver_get_pixel( t_int32 tmp_x, t_int32 tmp_y )

{

if( tmp_x < 0 || tmp_x >= cx_pingmu1_driver_Width || tmp_y < 0 || tmp_y >= cx_pingmu1_driver_Height ) {

return 1;

}

if( 0 ) {

tmp_x = cx_pingmu1_driver_Width - 1 - tmp_x;

}

if( 0 ) {

tmp_y = cx_pingmu1_driver_Height - 1 - tmp_y;

}

if( 0 ) {

t_int32 tmp_t = tmp_x;

tmp_x = tmp_y;

tmp_y = tmp_t;

}

t_int8 tmp_m = (t_int8)(t_int16)tmp_y % 8;

t_uint16 tmp_yy = (t_uint16)(t_uint32)tmp_y;

t_uint16 tmp_index = tmp_yy / 8;

tmp_index = tmp_index * (t_uint16)128 + (t_uint16)(t_uint32)tmp_x;

t_uint8 tmp_data = cx_pingmu1_driver_buffer[tmp_index];

tmp_data = tmp_data >> ((t_uint8)tmp_m);

if( ((tmp_data >> 0) & 1) == 1 ) {

return 1;

}

else {

return 0;

}

return 0;

}

void cx_pingmu1_driver_Move( t_int32 tmp_v, t_int32 tmp_vy )

{

t_uint8 tmp_yy = (t_uint8)(t_uint16)(t_uint32)tmp_vy;

t_uint8 tmp_off = tmp_yy % 8;

tmp_yy = tmp_yy / (8);

t_uint8 tmp_sft = (t_uint8)(t_uint16)(t_uint32)tmp_v;

for( t_uint8 tmp_x = 4; tmp_x < 92; ) {

t_uint8 tmp_lastData = 0;

t_uint8 tmp_y;

for( tmp_y = 0; tmp_y <= tmp_yy; ) {

t_uint16 tmp_index = tmp_y;

tmp_index = tmp_index * (t_uint16)128 + tmp_x;

t_uint16 tmp_data = cx_pingmu1_driver_buffer[tmp_index];

if( tmp_y == tmp_yy ) {

if( tmp_off == 0 ) {

break;

}

t_uint8 tmp_b = 255 << tmp_off;

tmp_lastData = tmp_lastData | (((tmp_data >> 0) & 255) << tmp_sft);

tmp_lastData = tmp_lastData & (~tmp_b);

tmp_data = tmp_data & (tmp_b);

}

else {

tmp_data = tmp_data << (tmp_sft);

}

tmp_data |= (t_uint16)(((tmp_data >> 0) & 255) | tmp_lastData) << 0; tmp_data &= ((t_uint16)(((tmp_data >> 0) & 255) | tmp_lastData) << 0) | 65280;

cx_pingmu1_driver_buffer[tmp_index] = ((tmp_data >> 0) & 255);

t_uint32 tmp_dd = ((tmp_data >> 0) & 255);

tmp_lastData = ((tmp_data >> 8) & 255);

tmp_y = tmp_y + (1);

}

tmp_x = tmp_x + (1);

}

cx_pingmu1_driver_NeedRefresh = 1;

}

void cx_pingmu1_driver_OS_init(void)

{

cx_pingmu1_driver_Offset = 2;

cx_pingmu1_driver_command_OS_init();

cx_pingmu1_driver_Init();

}

void cx_chaoshengduoji_driver_OS_init(void)

{

cx_chaoshengduoji_driver_dev_init();

cx_kongzhiqi1_driver_RES_DDRD |= 128;

cx_kongzhiqi1_driver_RES_PORTD &= 127;

if( cx_SYS_Tick < 10 ) {

cx_chaoshengduoji_driver_OS_time = 10;

}

else {

cx_chaoshengduoji_driver_OS_time = (t_uint8)(t_uint16)(t_uint32)cx_SYS_Tick;

}

cx_chaoshengduoji_driver_tick = 0;

cx_chaoshengduoji_driver_ti = 0;

cx_chaoshengduoji_driver_C_Angle = 0;

cx_chaoshengduoji_driver_SetValue( cx_chaoshengduoji_driver_C_Angle );

cx_chaoshengduoji_driver_SetSpeed( 1000 );

}

void cx_chaoshengduoji_driver_OS_run(void)

{

if( cx_chaoshengduoji_driver_C_Angle == cx_chaoshengduoji_driver_Angle ) {

cx_chaoshengduoji_driver_ti = 0;

return;

}

cx_chaoshengduoji_driver_ti = cx_chaoshengduoji_driver_ti + (cx_chaoshengduoji_driver_tick);

if( cx_chaoshengduoji_driver_ti >= 1000 ) {

t_int32 tmp_dv = cx_chaoshengduoji_driver_ti / 1000;

cx_chaoshengduoji_driver_ti = cx_chaoshengduoji_driver_ti % 1000;

if( cx_chaoshengduoji_driver_C_Angle > cx_chaoshengduoji_driver_Angle ) {

cx_chaoshengduoji_driver_C_Angle = cx_chaoshengduoji_driver_C_Angle - (tmp_dv);

if( cx_chaoshengduoji_driver_C_Angle < cx_chaoshengduoji_driver_Angle ) {

cx_chaoshengduoji_driver_C_Angle = cx_chaoshengduoji_driver_Angle;

}

cx_chaoshengduoji_driver_SetValue( cx_chaoshengduoji_driver_C_Angle );

}

else {

cx_chaoshengduoji_driver_C_Angle = cx_chaoshengduoji_driver_C_Angle + (tmp_dv);

if( cx_chaoshengduoji_driver_C_Angle > cx_chaoshengduoji_driver_Angle ) {

cx_chaoshengduoji_driver_C_Angle = cx_chaoshengduoji_driver_Angle;

}

cx_chaoshengduoji_driver_SetValue( cx_chaoshengduoji_driver_C_Angle );

}

}

}

void cx_chaoshengduoji_driver_SetSpeed( t_int32 tmp_t )

{

if( tmp_t < 0 ) {

tmp_t = 0;

}

if( tmp_t > 1000 ) {

tmp_t = 1000;

}

cx_chaoshengduoji_driver_tick = tmp_t * (t_int8)cx_chaoshengduoji_driver_OS_time;

cx_chaoshengduoji_driver_sim_SetSpeed( tmp_t );

}

void cx_chaoshengduoji_driver_dev_init(void)

{

}

void cx_chaoshengduoji_driver_SetValue( t_int32 tmp_d )

{

tmp_d = -tmp_d * 55 / 90 + 90;

if( tmp_d < 0 ) {

tmp_d = 0;

}

if( tmp_d > 180 ) {

tmp_d = 180;

}

cx_SYS_Servo_PWM[4] = (t_uint8)(t_uint16)(t_uint32)tmp_d;

}

void cx_chaoshengduoji_driver_sim_SetSpeed( t_int32 tmp_t )

{

}

void cx_xinxixianshiqi_driver_OS_init(void)

{

cx_xinxixianshiqi_driver_bchar = 32;

cx_xinxixianshiqi_driver_number = 0;

}

void cx_xinxixianshiqi_driver_clear(void)

{

cx_dianzhenzifuxianshiqi_driver_clear();

}

void cx_xinxixianshiqi_driver_clear_line( t_int32 tmp_line )

{

cx_dianzhenzifuxianshiqi_driver_clear_line( tmp_line );

}

void cx_xinxixianshiqi_driver_show_text( t_int32 tmp_line, t_int32 tmp_column, t_int8 tmp_string[] )

{

t_int16 tmp_i = 0;

while( true ) {

t_uint8 tmp_ch = (t_uint8)tmp_string[tmp_i];

if( tmp_ch == 0 ) {

return;

}

t_uint32 tmp_cc = tmp_ch;

if( tmp_ch > 127 ) {

tmp_i = tmp_i + (1);

tmp_cc |= (t_uint32)(tmp_ch) << 0; tmp_cc &= ((t_uint32)(tmp_ch) << 0) | 4294967040;

tmp_cc |= (t_uint32)((t_uint8)tmp_string[tmp_i]) << 8; tmp_cc &= ((t_uint32)((t_uint8)tmp_string[tmp_i]) << 8) | 4294902015;

}

cx_dianzhenzifuxianshiqi_driver_print_line( tmp_line, tmp_column, (t_int32)tmp_cc );

tmp_column = tmp_column + (cx_dianzhenzifuxianshiqi_driver_char_PerWidth);

tmp_i = tmp_i + (1);

}

}

void cx_xinxixianshiqi_driver_show_text_f( t_int32 tmp_line, t_int32 tmp_column, t_int8 tmp_string[] )

{

t_int16 tmp_i = 0;

t_uint8 tmp_ch;

while( true ) {

tmp_ch = (t_uint8)tmp_string[tmp_i];

if( tmp_ch == 0 ) {

break;

}

tmp_i = tmp_i + (1);

}

t_uint16 _cx_lc_1 = tmp_i;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

tmp_i = tmp_i - (1);

tmp_ch = (t_uint8)tmp_string[tmp_i];

t_uint32 tmp_cc = tmp_ch;

if( tmp_ch > 127 ) {

tmp_i = tmp_i + (1);

tmp_cc |= (t_uint32)(tmp_ch) << 0; tmp_cc &= ((t_uint32)(tmp_ch) << 0) | 4294967040;

tmp_cc |= (t_uint32)((t_uint8)tmp_string[tmp_i]) << 8; tmp_cc &= ((t_uint32)((t_uint8)tmp_string[tmp_i]) << 8) | 4294902015;

}

cx_dianzhenzifuxianshiqi_driver_print_line( tmp_line, tmp_column, (t_int32)tmp_cc );

tmp_column = tmp_column - (cx_dianzhenzifuxianshiqi_driver_char_PerWidth);

}

}

void cx_xinxixianshiqi_driver_show_number_f( t_int32 tmp_line, t_int32 tmp_column, t_int32 tmp_data0 )

{

cx_xinxixianshiqi_driver_show_number_ff( tmp_line, tmp_column, tmp_data0 );

}

void cx_xinxixianshiqi_driver_show_number_ff( t_int32 tmp_line, t_int32 tmp_column, t_int32 tmp_data0 )

{

t_bool tmp_isNeg;

t_uint32 tmp_data;

if( tmp_data0 >= 0 ) {

tmp_data = (t_uint32)tmp_data0;

tmp_isNeg = 0;

}

else {

tmp_data = (t_uint32)-tmp_data0;

tmp_isNeg = 1;

}

t_int8 tmp_i = 0;

t_int8 tmp_ch = 0;

while( true ) {

tmp_ch = 48 + (t_int8)(t_uint8)(t_uint16)(tmp_data % 10);

cx_xinxixianshiqi_driver_number_buffer[tmp_i] = tmp_ch;

tmp_i = tmp_i + (1);

tmp_data = tmp_data / (10);

if( tmp_data == 0 ) {

break;

}

}

if( tmp_isNeg ) {

cx_xinxixianshiqi_driver_number_buffer[tmp_i] = 45;

tmp_i = tmp_i + (1);

}

if( cx_xinxixianshiqi_driver_number != 0 && tmp_i < cx_xinxixianshiqi_driver_number ) {

t_int8 tmp_x = cx_xinxixianshiqi_driver_number - tmp_i;

t_int8 tmp_y = tmp_i;

t_uint16 _cx_lc_1 = tmp_x;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

cx_xinxixianshiqi_driver_number_buffer[tmp_y] = cx_xinxixianshiqi_driver_bchar;

tmp_y = tmp_y + (1);

}

tmp_i = cx_xinxixianshiqi_driver_number;

}

t_int8 tmp_j = 0;

t_uint16 _cx_lc_3 = tmp_i;

for( t_uint16 _cx_lc_2 = 0; _cx_lc_2 < _cx_lc_3; _cx_lc_2++ ) {

tmp_ch = cx_xinxixianshiqi_driver_number_buffer[tmp_j];

cx_dianzhenzifuxianshiqi_driver_print_line( tmp_line, tmp_column, tmp_ch );

tmp_j = tmp_j + (1);

tmp_column = tmp_column - (cx_dianzhenzifuxianshiqi_driver_char_PerWidth);

}

}

void cx_xinxixianshiqi_driver_show_number( t_int32 tmp_line, t_int32 tmp_column, t_int32 tmp_data0 )

{

t_bool tmp_isNeg;

t_uint32 tmp_data;

if( tmp_data0 >= 0 ) {

tmp_data = (t_uint32)tmp_data0;

tmp_isNeg = 0;

}

else {

tmp_data = (t_uint32)-tmp_data0;

tmp_isNeg = 1;

}

t_int8 tmp_i = 0;

t_int8 tmp_ch = 0;

while( true ) {

tmp_ch = 48 + (t_int8)(t_uint8)(t_uint16)(tmp_data % 10);

cx_xinxixianshiqi_driver_number_buffer[tmp_i] = tmp_ch;

tmp_i = tmp_i + (1);

tmp_data = tmp_data / (10);

if( tmp_data == 0 ) {

break;

}

}

if( tmp_isNeg ) {

cx_xinxixianshiqi_driver_number_buffer[tmp_i] = 45;

tmp_i = tmp_i + (1);

}

if( cx_xinxixianshiqi_driver_number != 0 && tmp_i < cx_xinxixianshiqi_driver_number ) {

t_int8 tmp_x = cx_xinxixianshiqi_driver_number - tmp_i;

t_int8 tmp_y = tmp_i;
t_uint16 _cx_lc_1 = tmp_x;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

cx_xinxixianshiqi_driver_number_buffer[tmp_y] = cx_xinxixianshiqi_driver_bchar;

tmp_y = tmp_y + (1);

}

tmp_i = cx_xinxixianshiqi_driver_number;

}

t_uint16 _cx_lc_3 = tmp_i;

for( t_uint16 _cx_lc_2 = 0; _cx_lc_2 < _cx_lc_3; _cx_lc_2++ ) {

tmp_i = tmp_i - (1);

tmp_ch = cx_xinxixianshiqi_driver_number_buffer[tmp_i];

cx_dianzhenzifuxianshiqi_driver_print_line( tmp_line, tmp_column, tmp_ch );

tmp_column = tmp_column + (cx_dianzhenzifuxianshiqi_driver_char_PerWidth);

}

}

void cx_xinxixianshiqi_driver_set_format( t_int32 tmp_c, t_int32 tmp_n )

{

cx_xinxixianshiqi_driver_bchar = (t_int8)(t_int16)tmp_c;

if( cx_xinxixianshiqi_driver_bchar < 32 ) {

cx_xinxixianshiqi_driver_bchar = cx_xinxixianshiqi_driver_bchar + (48);

}

cx_xinxixianshiqi_driver_number = (t_int8)(t_int16)tmp_n;

if( cx_xinxixianshiqi_driver_number > 11 ) {

cx_xinxixianshiqi_driver_number = 11;

}

}

void cx_xinxixianshiqi_driver_clear_format(void)

{

cx_xinxixianshiqi_driver_number = 0;

}

void cx_dianzhenzifuxianshiqi_driver_OS_init(void)

{

cx_dianzhenzifuxianshiqi_driver_SetEnglishFontDefault();

}

void cx_dianzhenzifuxianshiqi_driver_clear(void)

{

cx_pingmu1_driver_Clear();

}

void cx_dianzhenzifuxianshiqi_driver_clear_line( t_int32 tmp_line )

{

}

void cx_dianzhenzifuxianshiqi_driver_print_line1( t_int32 tmp_x, t_int32 tmp_y, t_int32 tmp_c )

{

cx_dianzhenzifuxianshiqi_driver_print_line( tmp_y, tmp_x, tmp_c );

}

void cx_dianzhenzifuxianshiqi_driver_print_line( t_int32 tmp_YY, t_int32 tmp_XX, t_int32 tmp_c )

{

if( tmp_c < 32 ) {

tmp_c = tmp_c + (48);

}

tmp_c = tmp_c - (32);

t_int16 tmp_X = (t_int16)tmp_XX;

t_int16 tmp_Y = (t_int16)tmp_YY;

t_uint16 tmp_BufferIndex = 0;

t_uint8 tmp_length = 0;

t_uint8 tmp_t = (*cx_dianzhenzifuxianshiqi_driver_EnglishFont);

if( tmp_t == 129 && tmp_c <= 127 ) {

t_uint8 tmp_cc = (t_uint8)(t_uint16)(t_uint32)tmp_c;

tmp_length = (*cx_dianzhenzifuxianshiqi_driver_EnglishFont)[0];

tmp_BufferIndex = (tmp_length + 1);

for( t_uint8 tmp_i = 0; tmp_i < tmp_length; ) {

if( (*cx_dianzhenzifuxianshiqi_driver_EnglishFont)[1 + tmp_i] == tmp_cc + 32 ) {

tmp_c = (t_int8)tmp_i;

break;

}

tmp_i = tmp_i + (1);

}

}

if( tmp_c > 127 ) {

t_uint16 tmp_cc1 = (t_uint16)(t_uint32)tmp_c;

tmp_length = (*cx_dianzhenzifuxianshiqi_driver_ChineseFont)[0];

for( t_uint8 tmp_i1 = 0; tmp_i1 < tmp_length; ) {

t_uint16 tmp_gb2312 = 0;

tmp_gb2312 |= (t_uint16)((*cx_dianzhenzifuxianshiqi_driver_ChineseFont)[1 + tmp_i1]) << 0; tmp_gb2312 &= ((t_uint16)((*cx_dianzhenzifuxianshiqi_driver_ChineseFont)[1 + tmp_i1]) << 0) | 65280;

tmp_gb2312 |= (t_uint16)((*cx_dianzhenzifuxianshiqi_driver_ChineseFont)[2 + tmp_i1]) << 8; tmp_gb2312 &= ((t_uint16)((*cx_dianzhenzifuxianshiqi_driver_ChineseFont)[2 + tmp_i1]) << 8) | 255;

if( tmp_gb2312 == tmp_cc1 + 32 ) {

tmp_c = (t_int8)tmp_i1 / 2;

break;

}

tmp_i1 = tmp_i1 + (2);

}

cx_dianzhenzifuxianshiqi_driver_char_PerWidth = (*cx_dianzhenzifuxianshiqi_driver_ChineseFont);

tmp_BufferIndex = (tmp_length + 1);

tmp_BufferIndex = tmp_BufferIndex + (((t_uint16)(t_uint32)tmp_c * (t_uint8)cx_dianzhenzifuxianshiqi_driver_char_PerWidth));

cx_dianzhenzifuxianshiqi_driver_DrawChar( cx_dianzhenzifuxianshiqi_driver_char_PerWidth, (*cx_dianzhenzifuxianshiqi_driver_ChineseFont), tmp_BufferIndex, tmp_X, tmp_Y );

}

else {

cx_dianzhenzifuxianshiqi_driver_char_PerWidth = (*cx_dianzhenzifuxianshiqi_driver_EnglishFont);

tmp_BufferIndex = tmp_BufferIndex + (((t_uint16)(t_uint32)tmp_c * (t_uint8)cx_dianzhenzifuxianshiqi_driver_char_PerWidth));

cx_dianzhenzifuxianshiqi_driver_DrawChar( cx_dianzhenzifuxianshiqi_driver_char_PerWidth, (*cx_dianzhenzifuxianshiqi_driver_EnglishFont), tmp_BufferIndex, tmp_X, tmp_Y );

}

cx_pingmu1_driver_set_refresh();

}

void cx_dianzhenzifuxianshiqi_driver_DrawChar( t_int8 tmp_PerWidth, t_#.点阵字符显示器.driver.icon *tmp_tfont, t_uint16 tmp_BufferIndex, t_int16 tmp_X, t_int16 tmp_Y )

{

t_uint16 tmp_ColumnE = (*tmp_tfont) * 256 + (*tmp_tfont);

t_uint8 tmp_lineNE = (*tmp_tfont);

t_uint16 tmp_line = tmp_lineNE;

if( tmp_lineNE % 8 == 0 && tmp_lineNE != 0 ) {

tmp_lineNE = tmp_lineNE / 8;

}

else {

tmp_lineNE = tmp_lineNE / 8 + 1;

}

for( t_uint8 tmp_i = 0; tmp_i < (t_uint8)tmp_PerWidth; ) {

t_uint16 tmp_bindex = tmp_BufferIndex + tmp_i;

t_int16 tmp_yy = tmp_Y;

for( t_uint8 tmp_j = 0; tmp_j < tmp_lineNE; ) {

t_uint8 tmp_data = (*tmp_tfont)[tmp_bindex];

t_uint16 _cx_lc_1 = 8;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

if( ((tmp_data >> 0) & 1) == 1 ) {

cx_pingmu1_driver_pixel( tmp_X, tmp_yy );

}

else {

cx_pingmu1_driver_clear_pixel( tmp_X, tmp_yy );

}

tmp_data = tmp_data >> (1);

tmp_yy = tmp_yy + (1);

if( tmp_Y + (t_int16)tmp_line <= tmp_yy ) {

break;

}

}

tmp_bindex = tmp_bindex + (tmp_ColumnE);

tmp_j = tmp_j + (1);

}

tmp_X = tmp_X + (1);

tmp_i = tmp_i + (1);

}

}

void cx_dianzhenzifuxianshiqi_driver_SetEnglishFont( t_#.点阵字符显示器.driver.icon *tmp_icon )

{

(*cx_dianzhenzifuxianshiqi_driver_EnglishFont) = &((*tmp_icon));

}

void cx_dianzhenzifuxianshiqi_driver_SetChinesFont( t_#.点阵字符显示器.driver.icon *tmp_icon )

{

(*cx_dianzhenzifuxianshiqi_driver_ChineseFont) = &((*tmp_icon));

}

void cx_dianzhenzifuxianshiqi_driver_SetEnglishFontDefault(void)

{

(*cx_dianzhenzifuxianshiqi_driver_EnglishFont) = &(cx_dianzhenzifuxianshiqi_driver_font);

}

void cx_yuyinlangduqi_driver_OS_init(void)

{

cx_kongzhiqi1_driver_RES_DDRB |= 32;

cx_kongzhiqi1_driver_RES_PORTB |= 32;

cx_yuyinlangduqi_driver_set_baud( 9600 );

}

void cx_yuyinlangduqi_driver_set_baud( t_int32 tmp_b )

{

cx_yuyinlangduqi_driver_BitTick = (t_uint16)(t_int16)(16000000 / tmp_b / 24);

cx_yuyinlangduqi_driver_BitTick_C = cx_yuyinlangduqi_driver_BitTick - 3;

cx_yuyinlangduqi_driver_BitTick_D32 = cx_yuyinlangduqi_driver_BitTick * 3 / 2;

}

void cx_yuyinlangduqi_driver_print_string( t_int8 tmp_s[] )

{

t_uint16 tmp_i = 0;

while( tmp_s[tmp_i] != 0 ) {

tmp_i = tmp_i + (1);

}

t_uint8 tmp_CSUM = 0;

cx_yuyinlangduqi_driver_print_char( 253 );

tmp_CSUM = tmp_CSUM ^ (253);

cx_yuyinlangduqi_driver_print_char( 0 );

tmp_CSUM = tmp_CSUM ^ (0);

cx_yuyinlangduqi_driver_print_char( (t_int16)tmp_i + 3 );

tmp_CSUM = tmp_CSUM ^ ((((tmp_i >> 0) & 255) + 3));

cx_yuyinlangduqi_driver_print_char( 1 );

tmp_CSUM = tmp_CSUM ^ (1);

cx_yuyinlangduqi_driver_print_char( 0 );

tmp_CSUM = tmp_CSUM ^ (0);

tmp_i = 0;

while( tmp_s[tmp_i] != 0 ) {

cx_yuyinlangduqi_driver_print_char( tmp_s[tmp_i] );

tmp_CSUM = tmp_CSUM ^ ((t_uint8)tmp_s[tmp_i]);

tmp_i = tmp_i + (1);

}

t_uint32 tmp_d = tmp_CSUM;

cx_yuyinlangduqi_driver_print_char( (t_int32)tmp_d );

}

void cx_yuyinlangduqi_driver_print_number( t_int32 tmp_data0 )

{

t_bool tmp_isNeg;

t_uint32 tmp_data;

if( tmp_data0 >= 0 ) {

tmp_data = (t_uint32)tmp_data0;

tmp_isNeg = 0;

}

else {

tmp_data = (t_uint32)-tmp_data0;

tmp_isNeg = 1;

}

t_int16 tmp_i = 0;

while( true ) {

t_int8 tmp_ch = 48 + (t_int8)(t_uint8)(t_uint16)(tmp_data % 10);

cx_yuyinlangduqi_driver_number_buffer[tmp_i] = tmp_ch;

tmp_i = tmp_i + (1);

tmp_data = tmp_data / (10);

if( tmp_data == 0 ) {

if( tmp_isNeg ) {

cx_yuyinlangduqi_driver_number_buffer[tmp_i] = 45;

tmp_i = tmp_i + (1);

}

break;

}

}

do {

tmp_i = tmp_i - (1);

cx_yuyinlangduqi_driver_print_char( cx_yuyinlangduqi_driver_number_buffer[tmp_i] );

}

while( tmp_i != 0 );

}

void cx_yuyinlangduqi_driver_print_char( t_int32 tmp_d )

{

t_uint8 tmp_data = (t_uint8)(t_int8)(t_int16)tmp_d;

cx_kongzhiqi1_driver_RES_PORTB &= 223;

t_uint16 _cx_lc_1 = cx_yuyinlangduqi_driver_BitTick;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

}

t_uint16 _cx_lc_3 = 8;

for( t_uint16 _cx_lc_2 = 0; _cx_lc_2 < _cx_lc_3; _cx_lc_2++ ) {

(((tmp_data >> 0) & 1)) != 0 ? (cx_kongzhiqi1_driver_RES_PORTB |= 32): (cx_kongzhiqi1_driver_RES_PORTB &= 223);

tmp_data = tmp_data >> (1);

t_uint16 _cx_lc_5 = cx_yuyinlangduqi_driver_BitTick_C;

for( t_uint16 _cx_lc_4 = 0; _cx_lc_4 < _cx_lc_5; _cx_lc_4++ ) {

}

}

cx_kongzhiqi1_driver_RES_PORTB |= 32;

t_uint16 _cx_lc_7 = cx_yuyinlangduqi_driver_BitTick;

for( t_uint16 _cx_lc_6 = 0; _cx_lc_6 < _cx_lc_7; _cx_lc_6++ ) {

}

t_uint16 _cx_lc_9 = 500;

for( t_uint16 _cx_lc_8 = 0; _cx_lc_8 < _cx_lc_9; _cx_lc_8++ ) {

}

}

t_int32 cx_yuyinlangduqi_driver_get_byte(void)

{

t_uint8 tmp_data;

while( cx_yuyinlangduqi_driver_TX_IN == 1 ) {

}

t_uint16 _cx_lc_1 = cx_yuyinlangduqi_driver_BitTick_D32;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

}

t_uint16 _cx_lc_3 = 8;

for( t_uint16 _cx_lc_2 = 0; _cx_lc_2 < _cx_lc_3; _cx_lc_2++ ) {

tmp_data = tmp_data >> (1);

(cx_yuyinlangduqi_driver_TX_IN) != 0 ? (tmp_data |= 128): (tmp_data &= 127);

t_uint16 _cx_lc_5 = cx_yuyinlangduqi_driver_BitTick_C;

for( t_uint16 _cx_lc_4 = 0; _cx_lc_4 < _cx_lc_5; _cx_lc_4++ ) {

}

}

t_uint16 _cx_lc_7 = cx_yuyinlangduqi_driver_BitTick;

for( t_uint16 _cx_lc_6 = 0; _cx_lc_6 < _cx_lc_7; _cx_lc_6++ ) {

}

t_uint32 tmp_d = tmp_data;

return (t_int32)tmp_d;

}

void cx_SYS_Servo_OS_init(void)

{

cx_kongzhiqi1_driver_RES_TCCR2A = 0;

cx_kongzhiqi1_driver_RES_TCCR2B = 9;

t_uint32 tmp_f = 16000000;

cx_kongzhiqi1_driver_RES_OCR2A = (t_uint8)(t_uint16)(tmp_f / 100000);

cx_kongzhiqi1_driver_RES_TIMSK2 = 2;

cx_SYS_Servo_n = 0;

cx_SYS_Servo_tick = 0;

cx_SYS_Servo_out_put = 1;

cx_SYS_Servo_PWM_A = 60;

cx_SYS_Servo_TickNumber = 250;

}

void cx_SYS_Servo_SetValue( t_int32 tmp_d )

{

cx_SYS_Servo_PWM[0] = (t_uint8)(t_uint16)(t_uint32)tmp_d;

}

void cx_SYS_Servo_timer2_compA(void)

{

}

void cx_SYS_Servo_Clear(void)

{

cx_kongzhiqi1_driver_RES_PORTB &= 247;

cx_kongzhiqi1_driver_RES_PORTD &= 239;

cx_kongzhiqi1_driver_RES_PORTB &= 254;

cx_kongzhiqi1_driver_RES_PORTB &= 239;

cx_kongzhiqi1_driver_RES_PORTD &= 127;

}

void cx_SYS_Servo_SetPin(void)

{

cx_kongzhiqi1_driver_RES_PORTB |= 8;

cx_kongzhiqi1_driver_RES_PORTB &= 247;

cx_kongzhiqi1_driver_RES_PORTD |= 16;

cx_kongzhiqi1_driver_RES_PORTD &= 239;

cx_kongzhiqi1_driver_RES_PORTB |= 1;

cx_kongzhiqi1_driver_RES_PORTB &= 254;

cx_kongzhiqi1_driver_RES_PORTB |= 16;
cx_kongzhiqi1_driver_RES_PORTB &= 239;

cx_kongzhiqi1_driver_RES_PORTD |= 128;

cx_kongzhiqi1_driver_RES_PORTD &= 127;

}

void cx_OS0_REMO_ModuleWrite( t_int32 tmp_d, t_int32 tmp_d1 )

{

}

t_int32 cx_OS0_REMO_ModuleRead( t_int32 tmp_d )

{

return 0;

}

void cx_OS0_Delayer_Init(void)

{

cx_OS0_EnableSchedule = 1;

cx_OS0_Delayer_Pause = 0;

}

void cx_OS0_Delayer_Run(void)

{

if( cx_OS0_Delayer_Pause ) {

return;

}

for( t_uint8 tmp_i = 0; tmp_i < 12; ) {

if( cx_OS0_enable_list[tmp_i] ) {

cx_OS0_time_list[tmp_i] = cx_OS0_time_list[tmp_i] - (cx_SYS_Tick);

if( cx_OS0_time_list[tmp_i] <= 0 ) {

cx_OS0_enable_list[tmp_i] = 0;

}

}

tmp_i = tmp_i + (1);

}

}

t_bool cx_OS0_Delayer_Running(void)

{

return cx_OS0_enable_list[cx_OS0_CurrentTaskIndex];

}

void cx_OS0_Delayer_Stop( t_uint16 tmp_cid )

{

for( t_uint8 tmp_i = 0; tmp_i < 12; ) {

if( cx_OS0_ID_list[tmp_i] == tmp_cid ) {

cx_OS0_time_list[tmp_i] = 0;

cx_OS0_enable_list[tmp_i] = 0;

}

tmp_i = tmp_i + (1);

}

}

void cx_OS0_Delayer_StopAll(void)

{

for( t_uint8 tmp_i = 0; tmp_i < 12; ) {

cx_OS0_time_list[tmp_i] = 0;

cx_OS0_enable_list[tmp_i] = 0;

tmp_i = tmp_i + (1);

}

}

void cx_OS0_Delayer_Wait( t_int32 tmp_t )

{

cx_OS0_ID_list[cx_OS0_CurrentTaskIndex] = cx_OS0_Delayer_tempID;

cx_OS0_time_list[cx_OS0_CurrentTaskIndex] = tmp_t;

cx_OS0_enable_list[cx_OS0_CurrentTaskIndex] = 1;

}

t_int32 cx_OS0_GetSysTick(void)

{

return (t_int32)(cx_OS0_SysTick & 2147483647);

}

t_uint32 cx_OS0_GetSysTickU(void)

{

return cx_OS0_SysTick;

}

void cx_OS0_OS_init(void)

{

cx_OS0_CloseWatchdog();

cx_OS0_TimerInit();

cx_OS0_DriverInit();

cx_OS0_Delayer_Init();

cx_OS0_tick = 0;

cx_OS0_CurrentTaskIndex = 0;

}

void cx_OS0_CloseWatchdog(void)

{

}

void cx_OS0_MACRO_TIMER_ON(void)

{

}

void cx_OS0_MACRO_TIMER_OFF(void)

{

}

void cx_OS0_TimerInit(void)

{

}

void cx_OS0_OS_run(void)

{

cx_OS0_MACRO_TIMER_OFF();

cx_OS0_RunDriver100usList();

cx_OS0_tick = cx_OS0_tick + (1);

if( cx_OS0_tick >= 10 ) {

cx_OS0_RunDriverList();

cx_OS0_tick = 0;

cx_OS0_DebugTick = cx_OS0_DebugTick + (1);

cx_OS0_SysTick = cx_OS0_SysTick + (1);

}

cx_OS0_MACRO_TIMER_ON();

}

void cx_OS0_DriverInit(void)

{

cx_OS0_DriverNumber = 0;

for( t_uint8 tmp_i = 0; tmp_i < 8; ) {

cx_OS0_TickList[tmp_i] = 0;

cx_OS0_MaxTickList[tmp_i] = 0;

cx_OS0_DriverHandleList[tmp_i] = 0;

tmp_i = tmp_i + (1);

}

cx_OS0_Driver100usNumber = 0;

}

void cx_OS0_CreateDriver( void (*tmp_Handle)(void), t_uint8 tmp_MaxTick )

{

cx_OS0_DriverHandleList[cx_OS0_DriverNumber] = tmp_Handle;

cx_OS0_MaxTickList[cx_OS0_DriverNumber] = tmp_MaxTick;

cx_OS0_DriverNumber = cx_OS0_DriverNumber + (1);

}

void cx_OS0_CreateDriver100us( void (*tmp_Handle)(void) )

{

cx_OS0_Driver100usHandleList[cx_OS0_Driver100usNumber] = tmp_Handle;

cx_OS0_Driver100usNumber = cx_OS0_Driver100usNumber + (1);

}

void cx_OS0_RunDriverList(void)

{

for( t_uint8 tmp_i = 0; tmp_i < cx_OS0_DriverNumber; ) {

cx_OS0_TickList[tmp_i] = cx_OS0_TickList[tmp_i] + (1);

if( cx_OS0_TickList[tmp_i] == cx_OS0_MaxTickList[tmp_i] ) {

cx_OS0_TickList[tmp_i] = 0;

cx_OS0_D_CALL( cx_OS0_DriverHandleList[tmp_i] );

}

tmp_i = tmp_i + (1);

}

cx_OS0_Delayer_Run();

}

void cx_OS0_RunDriver100usList(void)

{

for( t_uint8 tmp_i = 0; tmp_i < cx_OS0_Driver100usNumber; ) {

cx_OS0_D_CALL( cx_OS0_Driver100usHandleList[tmp_i] );

tmp_i = tmp_i + (1);

}

}

void cx_OS0_D_CALL( void (*tmp_Handle)(void) )

{

cx_OS0_s_Handle = tmp_Handle;

(*cx_OS0_s_Handle)();

}

void cx_OS0_Start(void)

{

cx_OS0_MACRO_TIMER_ON();

}

void cx_sys_delayer_delay_n_10us( t_uint8 tmp_t )

{

t_uint16 _cx_lc_1 = tmp_t;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

cx_sys_delayer_delay_n_1us( 10 );

}

}

void cx_sys_delayer_delay_n_1us( t_uint8 tmp_t )

{

delayMicroseconds( tmp_t );

}

void cx_sys_delayer_delay_ms( t_int32 tmp_t )

{

t_uint16 _cx_lc_1 = tmp_t;

for( t_uint16 _cx_lc_0 = 0; _cx_lc_0 < _cx_lc_1; _cx_lc_0++ ) {

cx_sys_delayer_delay_n_10us( 100 );

}

}

void cx_Sim_onInitDefault(void)

{

}

void cx_Sim_onDrawDefault(void)

{

}

void cx_Sim_onKeyEventDefault( t_bool tmp_down, t_int32 tmp_key )

{

}

t_int32 cx_Sim_crux_AddVar( t_int32 tmp_v )

{

return 0;

}

t_int32 cx_Sim_crux_Run( t_int32 tmp_v )

{

return 0;

}

void cx_Sim_OS_init(void)

{

cx_Sim_onInitDefault();

}

void cx_Sim_OS_thread(void)

{

t_int32 tmp_d = cx_Sim_crux_Run( 0 );

if( tmp_d != 0 ) {

t_int32 tmp_type = tmp_d / 1000;

tmp_d = tmp_d % 1000;

if( tmp_type == 1 ) {

cx_Sim_onKeyEventDefault( 1, tmp_d );

}

if( tmp_type == 2 ) {

cx_Sim_onKeyEventDefault( 0, tmp_d );

}

}

cx_Sim_Clear();

cx_Sim_onDrawDefault();

}

void cx_Sim_Clear(void)

{

t_int32 tmp_d = cx_Sim_crux_Run( 10 );

}

void cx_Sim_DrawCircle( t_int32 tmp_x, t_int32 tmp_y, t_int32 tmp_r )

{

t_int32 tmp_d;

tmp_d = cx_Sim_crux_AddVar( tmp_x );

tmp_d = cx_Sim_crux_AddVar( tmp_y );

tmp_d = cx_Sim_crux_AddVar( tmp_r );

tmp_d = cx_Sim_crux_Run( 11 );

}

void cx_Sim_FillCircle( t_int32 tmp_x, t_int32 tmp_y, t_int32 tmp_r )

{

t_int32 tmp_d;

tmp_d = cx_Sim_crux_AddVar( tmp_x );

tmp_d = cx_Sim_crux_AddVar( tmp_y );

tmp_d = cx_Sim_crux_AddVar( tmp_r );

tmp_d = cx_Sim_crux_Run( 12 );

}

void cx_main0(void)

{

cx_Setup();

while( 1 ) {

cx_Loop();

}

}

void cx_Setup(void)

{

cx_OS_VarInit();

cx_OS0_OS_init();

cx_kongzhiqi1_driver_OS_init();

cx_youqian_driver_OS_init();

cx_youhou_driver_OS_init();

cx_zuohou_driver_OS_init();

cx_zuoqian_driver_OS_init();

cx_madaqudongqi_driver_OS_init();

cx_youludai_driver_OS_init();

cx_zuoludai_driver_OS_init();

cx_chaoshengbocejuqi_driver_OS_init();

cx_huoyanchuanganqi_driver_OS_init();

cx_wenshiduchuanganqi_driver_OS_init();

cx_yanshiqi_driver_OS_init();

cx_yanwuchuanganqi_driver_OS_init();

cx_pingmu1_driver_OS_init();

cx_chaoshengduoji_driver_OS_init();

cx_xinxixianshiqi_driver_OS_init();

cx_dianzhenzifuxianshiqi_driver_OS_init();

cx_yuyinlangduqi_driver_OS_init();

cx_OS0_CreateDriver( &cx_youqian_driver_OS_run, cx_youqian_driver_OS_time );

cx_OS0_CreateDriver( &cx_kongzhiqi1_driver_OS_run, cx_kongzhiqi1_driver_OS_time );

cx_OS0_CreateDriver( &cx_youhou_driver_OS_run, cx_youhou_driver_OS_time );

cx_OS0_CreateDriver( &cx_zuohou_driver_OS_run, cx_zuohou_driver_OS_time );

cx_OS0_CreateDriver( &cx_zuoqian_driver_OS_run, cx_zuoqian_driver_OS_time );

cx_OS0_CreateDriver100us( &cx_madaqudongqi_driver_OS_run100us );

cx_OS0_CreateDriver( &cx_huoyanchuanganqi_driver_OS_run, cx_huoyanchuanganqi_driver_OS_time );

cx_OS0_CreateDriver( &cx_wenshiduchuanganqi_driver_OS_run,


cx_wenshiduchuanganqi_driver_OS_time );

cx_OS0_CreateDriver( &cx_chaoshengduoji_driver_OS_run, cx_chaoshengduoji_driver_OS_time );

cx_SYS_Servo_OS_init();

cx_OS0_Start();

}

void cx_Loop(void)

{

if( ((cx_kongzhiqi1_driver_OS_EventFlag >> 0) & 1) == 1 ) {

cx_kongzhiqi1_driver_OS_EventFlag &= 254;

if( cx_kongzhiqi1_chushihua_en_ && cx_kongzhiqi1_chushihua_flg_ == 0 ) {

cx_kongzhiqi1_chushihua_flg_ = 1;

cx_kongzhiqi1_chushihua();

}

}

if( ((cx_kongzhiqi1_driver_OS_EventFlag >> 1) & 1) == 1 ) {

cx_kongzhiqi1_driver_OS_EventFlag &= 253;

if( cx_kongzhiqi1_fanfuzhixing_en_ && cx_kongzhiqi1_fanfuzhixing_flg_ == 0 ) {

cx_kongzhiqi1_fanfuzhixing_flg_ = 1;

cx_kongzhiqi1_fanfuzhixing();

}

}

if( ((cx_huoyanchuanganqi_driver_OS_EventFlag >> 0) & 1) == 1 ) {

cx_huoyanchuanganqi_driver_OS_EventFlag &= 254;

if( cx_huoyanchuanganqi_tancedaohuoyanshi_en_ && cx_huoyanchuanganqi_tancedaohuoyanshi_flg_ == 0 ) {

cx_huoyanchuanganqi_tancedaohuoyanshi_flg_ = 1;

cx_huoyanchuanganqi_tancedaohuoyanshi();

}

}

cx_kongzhiqi1_driver_OS_thread();

cx_yanshiqi_driver_OS_thread();

cx_pingmu1_driver_OS_thread();

if( cx_xiaocheqianjin_flg_ != 0 ) {

cx_xiaocheqianjin();

}

if( cx_xiaochetingzhi_flg_ != 0 ) {

cx_xiaochetingzhi();

}

if( cx_xiaochezuozhuan_flg_ != 0 ) {

cx_xiaochezuozhuan();

}

if( cx_xiaocheyouzhuan_flg_ != 0 ) {

cx_xiaocheyouzhuan();

}

if( cx_xiaochedaoche_flg_ != 0 ) {

cx_xiaochedaoche();

}

if( cx_xiaochexingtai_flg_ != 0 ) {

cx_xiaochexingtai();

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ != 0 ) {

cx_kongzhiqi1_fanfuzhixing();

}

if( cx_sizuxingtai_flg_ != 0 ) {

cx_sizuxingtai();

}

if( cx_xingzou_flg_ != 0 ) {

cx_xingzou();

}

if( cx_huoyanchuanganqi_tancedaohuoyanshi_flg_ != 0 ) {

cx_huoyanchuanganqi_tancedaohuoyanshi();

}

if( cx_kongzhiqi1_chushihua_flg_ != 0 ) {

cx_kongzhiqi1_chushihua();

}

if( cx_pingmu_flg_ != 0 ) {

cx_pingmu();

}

cx_SYS_Loop = 1;

}

void cx_xiaocheqianjin(void)

{

goto cx_xiaocheqianjin_end;

cx_xiaocheqianjin_1:;

cx_youludai_driver_run_right();

cx_youludai_driver_set_power( (40) );

cx_zuoludai_driver_run_right();

cx_zuoludai_driver_set_power( (35) );

cx_xiaocheqianjin_flg_ = 0;

return;

cx_xiaocheqianjin_end:;

if( cx_xiaocheqianjin_flg_ == 1 ) {

goto cx_xiaocheqianjin_1;

}

}

void cx_xiaochetingzhi(void)

{

goto cx_xiaochetingzhi_end;

cx_xiaochetingzhi_1:;

cx_youludai_driver_stop();

cx_zuoludai_driver_stop();

cx_xiaochetingzhi_flg_ = 0;

return;

cx_xiaochetingzhi_end:;

if( cx_xiaochetingzhi_flg_ == 1 ) {

goto cx_xiaochetingzhi_1;

}

}

void cx_xiaochezuozhuan(void)

{

goto cx_xiaochezuozhuan_end;

cx_xiaochezuozhuan_1:;

cx_youludai_driver_run_right();

cx_youludai_driver_set_power( (40) );

cx_zuoludai_driver_run_left();

cx_zuoludai_driver_set_power( (35) );

cx_xiaochezuozhuan_flg_ = 0;

return;

cx_xiaochezuozhuan_end:;

if( cx_xiaochezuozhuan_flg_ == 1 ) {

goto cx_xiaochezuozhuan_1;

}

}

void cx_xiaocheyouzhuan(void)

{

goto cx_xiaocheyouzhuan_end;

cx_xiaocheyouzhuan_1:;

cx_youludai_driver_run_left();

cx_youludai_driver_set_power( (40) );

cx_zuoludai_driver_run_right();

cx_zuoludai_driver_set_power( (35) );

cx_xiaocheyouzhuan_flg_ = 0;

return;

cx_xiaocheyouzhuan_end:;

if( cx_xiaocheyouzhuan_flg_ == 1 ) {

goto cx_xiaocheyouzhuan_1;

}

}

void cx_xiaochedaoche(void)

{

goto cx_xiaochedaoche_end;

cx_xiaochedaoche_1:;

cx_youludai_driver_run_left();

cx_youludai_driver_set_power( (40) );

cx_zuoludai_driver_run_left();

cx_zuoludai_driver_set_power( (35) );

cx_xiaochedaoche_flg_ = 0;

return;

cx_xiaochedaoche_end:;

if( cx_xiaochedaoche_flg_ == 1 ) {

goto cx_xiaochedaoche_1;

}

}

void cx_xiaochexingtai(void)

{

goto cx_xiaochexingtai_end;

cx_xiaochexingtai_1:;

(cx_youqian_driver_Angle) = (-180);

(cx_youhou_driver_Angle) = (120);

(cx_zuohou_driver_Angle) = (-130);

(cx_zuoqian_driver_Angle) = (45);

cx_xiaochexingtai_flg_ = 0;

return;

cx_xiaochexingtai_end:;

if( cx_xiaochexingtai_flg_ == 1 ) {

goto cx_xiaochexingtai_1;

}

}

void cx_kongzhiqi1_fanfuzhixing(void)

{

goto cx_kongzhiqi1_fanfuzhixing_end;

cx_kongzhiqi1_fanfuzhixing_1:;

if( (cx_chaoshengbocejuqi_driver_get_value()) <= (10) ) {

cx_kongzhiqi1_fanfuzhixing_flg_ = 2;

cx_xiaochexingtai_flg_ = 1;
cx_xiaochexingtai();

cx_kongzhiqi1_fanfuzhixing_2:;

cx_xiaochexingtai();

if( cx_xiaochexingtai_flg_ != 0 ) {

return;

}

cx_chaoshengduoji_driver_SetSpeed( (180) );

if( (cx_chaoshengbocejuqi_driver_get_value()) <= (10) ) {

cx_kongzhiqi1_fanfuzhixing_flg_ = 3;

cx_xiaochezuozhuan_flg_ = 1;

cx_xiaochezuozhuan();

cx_kongzhiqi1_fanfuzhixing_3:;

cx_xiaochezuozhuan();

if( cx_xiaochezuozhuan_flg_ != 0 ) {

return;

}

cx_OS0_CurrentTaskIndex = 6;

cx_yanshiqi_driver_DelaySecond( ((t_int32)((5)) << 10) );

cx_kongzhiqi1_fanfuzhixing_flg_ = 4;

cx_kongzhiqi1_fanfuzhixing_4:;

if( cx_OS0_enable_list[6] ) {

return;

}

cx_kongzhiqi1_fanfuzhixing_flg_ = 5;

cx_xiaocheyouzhuan_flg_ = 1;

cx_xiaocheyouzhuan();

cx_kongzhiqi1_fanfuzhixing_5:;

cx_xiaocheyouzhuan();

if( cx_xiaocheyouzhuan_flg_ != 0 ) {

return;

}

cx_OS0_CurrentTaskIndex = 6;

cx_yanshiqi_driver_DelaySecond( ((t_int32)((5)) << 10) );

cx_kongzhiqi1_fanfuzhixing_flg_ = 6;

cx_kongzhiqi1_fanfuzhixing_6:;

if( cx_OS0_enable_list[6] ) {

return;

}

cx_kongzhiqi1_fanfuzhixing_flg_ = 7;

cx_xiaocheqianjin_flg_ = 1;

cx_xiaocheqianjin();

cx_kongzhiqi1_fanfuzhixing_7:;

cx_xiaocheqianjin();

if( cx_xiaocheqianjin_flg_ != 0 ) {

return;

}

cx_OS0_CurrentTaskIndex = 6;

cx_yanshiqi_driver_DelaySecond( ((t_int32)((10)) << 10) );

cx_kongzhiqi1_fanfuzhixing_flg_ = 8;

cx_kongzhiqi1_fanfuzhixing_8:;

if( cx_OS0_enable_list[6] ) {

return;

}

}

else {

cx_kongzhiqi1_fanfuzhixing_flg_ = 9;

cx_xiaocheyouzhuan_flg_ = 1;

cx_xiaocheyouzhuan();

cx_kongzhiqi1_fanfuzhixing_9:;

cx_xiaocheyouzhuan();

if( cx_xiaocheyouzhuan_flg_ != 0 ) {

return;

}

cx_OS0_CurrentTaskIndex = 6;

cx_yanshiqi_driver_DelaySecond( ((t_int32)((5)) << 10) );

cx_kongzhiqi1_fanfuzhixing_flg_ = 10;

cx_kongzhiqi1_fanfuzhixing_10:;

if( cx_OS0_enable_list[6] ) {

return;

}

cx_kongzhiqi1_fanfuzhixing_flg_ = 11;

cx_xiaochezuozhuan_flg_ = 1;

cx_xiaochezuozhuan();

cx_kongzhiqi1_fanfuzhixing_11:;

cx_xiaochezuozhuan();

if( cx_xiaochezuozhuan_flg_ != 0 ) {

return;

}

cx_OS0_CurrentTaskIndex = 6;

cx_yanshiqi_driver_DelaySecond( ((t_int32)((5)) << 10) );

cx_kongzhiqi1_fanfuzhixing_flg_ = 12;

cx_kongzhiqi1_fanfuzhixing_12:;

if( cx_OS0_enable_list[6] ) {

return;

}

cx_kongzhiqi1_fanfuzhixing_flg_ = 13;

cx_xiaocheqianjin_flg_ = 1;

cx_xiaocheqianjin();

cx_kongzhiqi1_fanfuzhixing_13:;

cx_xiaocheqianjin();

if( cx_xiaocheqianjin_flg_ != 0 ) {

return;

}

cx_OS0_CurrentTaskIndex = 6;

cx_yanshiqi_driver_DelaySecond( ((t_int32)((10)) << 10) );

cx_kongzhiqi1_fanfuzhixing_flg_ = 14;

cx_kongzhiqi1_fanfuzhixing_14:;

if( cx_OS0_enable_list[6] ) {

return;

}

}

}

else {

cx_kongzhiqi1_fanfuzhixing_flg_ = 15;

cx_xiaochetingzhi_flg_ = 1;

cx_xiaochetingzhi();

cx_kongzhiqi1_fanfuzhixing_15:;

cx_xiaochetingzhi();

if( cx_xiaochetingzhi_flg_ != 0 ) {

return;

}

cx_kongzhiqi1_fanfuzhixing_flg_ = 16;

cx_xingzou_flg_ = 1;

cx_xingzou();

cx_kongzhiqi1_fanfuzhixing_16:;

cx_xingzou();

if( cx_xingzou_flg_ != 0 ) {

return;

}

}

cx_kongzhiqi1_fanfuzhixing_flg_ = 0;

return;

cx_kongzhiqi1_fanfuzhixing_end:;

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 1 ) {

goto cx_kongzhiqi1_fanfuzhixing_1;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 2 ) {

goto cx_kongzhiqi1_fanfuzhixing_2;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 3 ) {

goto cx_kongzhiqi1_fanfuzhixing_3;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 4 ) {

goto cx_kongzhiqi1_fanfuzhixing_4;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 5 ) {

goto cx_kongzhiqi1_fanfuzhixing_5;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 6 ) {

goto cx_kongzhiqi1_fanfuzhixing_6;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 7 ) {

goto cx_kongzhiqi1_fanfuzhixing_7;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 8 ) {

goto cx_kongzhiqi1_fanfuzhixing_8;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 9 ) {

goto cx_kongzhiqi1_fanfuzhixing_9;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 10 ) {

goto cx_kongzhiqi1_fanfuzhixing_10;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 11 ) {

goto cx_kongzhiqi1_fanfuzhixing_11;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 12 ) {

goto cx_kongzhiqi1_fanfuzhixing_12;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 13 ) {

goto cx_kongzhiqi1_fanfuzhixing_13;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 14 ) {

goto cx_kongzhiqi1_fanfuzhixing_14;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 15 ) {

goto cx_kongzhiqi1_fanfuzhixing_15;

}

if( cx_kongzhiqi1_fanfuzhixing_flg_ == 16 ) {

goto cx_kongzhiqi1_fanfuzhixing_16;

}

}

void cx_sizuxingtai(void)

{

goto cx_sizuxingtai_end;

cx_sizuxingtai_1:;

(cx_youqian_driver_Angle) = (20);

(cx_youhou_driver_Angle) = (-100);

(cx_zuohou_driver_Angle) = (110);

(cx_zuoqian_driver_Angle) = (-103);

cx_sizuxingtai_flg_ = 0;

return;

cx_sizuxingtai_end:;

if( cx_sizuxingtai_flg_ == 1 ) {

goto cx_sizuxingtai_1;

}

}

void cx_xingzou(void)

{

goto cx_xingzou_end;

cx_xingzou_1:;

(cx_youqian_driver_Angle) = (10);

(cx_zuohou_driver_Angle) = (100);

cx_OS0_CurrentTaskIndex = 8;

cx_yanshiqi_driver_DelayMillisecond( (500) );

cx_xingzou_flg_ = 2;

cx_xingzou_2:;

if( cx_OS0_enable_list[8] ) {

return;

}

(cx_zuoqian_driver_Angle) = (-93);

(cx_youhou_driver_Angle) = (-90);

cx_OS0_CurrentTaskIndex = 8;

cx_yanshiqi_driver_DelayMillisecond( (500) );

cx_xingzou_flg_ = 3;

cx_xingzou_3:;

if( cx_OS0_enable_list[8] ) {

return;

}

(cx_youqian_driver_Angle) = (40);

(cx_zuohou_driver_Angle) = (130);

cx_OS0_CurrentTaskIndex = 8;

cx_yanshiqi_driver_DelayMillisecond( (500) );

cx_xingzou_flg_ = 4;

cx_xingzou_4:;

if( cx_OS0_enable_list[8] ) {

return;

}

(cx_zuoqian_driver_Angle) = (-123);

(cx_youhou_driver_Angle) = (-120);

cx_OS0_CurrentTaskIndex = 8;

cx_yanshiqi_driver_DelayMillisecond( (500) );

cx_xingzou_flg_ = 5;

cx_xingzou_5:;

if( cx_OS0_enable_list[8] ) {

return;

}

cx_xingzou_flg_ = 0;

return;

cx_xingzou_end:;

if( cx_xingzou_flg_ == 1 ) {

goto cx_xingzou_1;

}

if( cx_xingzou_flg_ == 2 ) {

goto cx_xingzou_2;

}

if( cx_xingzou_flg_ == 3 ) {

goto cx_xingzou_3;

}

if( cx_xingzou_flg_ == 4 ) {

goto cx_xingzou_4;

}

if( cx_xingzou_flg_ == 5 ) {

goto cx_xingzou_5;

}

}

void cx_huoyanchuanganqi_tancedaohuoyanshi(void)

{

goto cx_huoyanchuanganqi_tancedaohuoyanshi_end;

cx_huoyanchuanganqi_tancedaohuoyanshi_1:;

cx_yuyinlangduqi_driver_print_string( ((t_int8*)((t_uint32)""发现火情"" + 0x10000)) );

cx_huoyanchuanganqi_tancedaohuoyanshi_flg_ = 0;

return;

cx_huoyanchuanganqi_tancedaohuoyanshi_end:;

if( cx_huoyanchuanganqi_tancedaohuoyanshi_flg_ == 1 ) {

goto cx_huoyanchuanganqi_tancedaohuoyanshi_1;

}

}

void cx_kongzhiqi1_chushihua(void)

{

goto cx_kongzhiqi1_chushihua_end;

cx_kongzhiqi1_chushihua_1:;

cx_kongzhiqi1_chushihua_flg_ = 2;

cx_sizuxingtai_flg_ = 1;

cx_sizuxingtai();

cx_kongzhiqi1_chushihua_2:;

cx_sizuxingtai();

if( cx_sizuxingtai_flg_ != 0 ) {

return;

}

while( true ) {

cx_pingmu1_driver_Refresh();

cx_kongzhiqi1_chushihua_flg_ = 3;

cx_pingmu_flg_ = 1;


cx_pingmu();

cx_kongzhiqi1_chushihua_3:;

cx_pingmu();

if( cx_pingmu_flg_ != 0 ) {

return;

}

if( cx_huoyanchuanganqi_driver_key0_press ) {

}

if( (cx_yanwuchuanganqi_driver_get_data()) == (200) ) {

cx_yuyinlangduqi_driver_print_string( ((t_int8*)((t_uint32)"危害气体泄露" + 0x10000)) );

}

}

cx_kongzhiqi1_chushihua_flg_ = 0;

return;

cx_kongzhiqi1_chushihua_end:;

if( cx_kongzhiqi1_chushihua_flg_ == 1 ) {

goto cx_kongzhiqi1_chushihua_1;

}

if( cx_kongzhiqi1_chushihua_flg_ == 2 ) {

goto cx_kongzhiqi1_chushihua_2;

}

if( cx_kongzhiqi1_chushihua_flg_ == 3 ) {

goto cx_kongzhiqi1_chushihua_3;

}

}

void cx_pingmu(void)

{

goto cx_pingmu_end;

cx_pingmu_1:;

cx_xinxixianshiqi_driver_show_number_f( (1), (50), (cx_wenshiduchuanganqi_driver_wendu()) );

cx_xinxixianshiqi_driver_show_number_f( (30), (50), (cx_wenshiduchuanganqi_driver_shidu()) );

cx_xinxixianshiqi_driver_show_text_f( (1), (65), ((t_int8*)((t_uint32)"C" + 0x10000)) );

cx_xinxixianshiqi_driver_show_text_f( (30), (65), ((t_int8*)((t_uint32)"%" + 0x10000)) );

cx_pingmu_flg_ = 0;

return;

cx_pingmu_end:;

if( cx_pingmu_flg_ == 1 ) {

goto cx_pingmu_1;

}

}

void cx_OS_VarInit(void)

{

cx_xiaocheqianjin_flg_ = 0;

cx_xiaocheqianjin_en_ = 1;

cx_xiaochetingzhi_flg_ = 0;

cx_xiaochetingzhi_en_ = 1;

cx_xiaochezuozhuan_flg_ = 0;

cx_xiaochezuozhuan_en_ = 1;

cx_xiaocheyouzhuan_flg_ = 0;

cx_xiaocheyouzhuan_en_ = 1;

cx_xiaochedaoche_flg_ = 0;

cx_xiaochedaoche_en_ = 1;

cx_xiaochexingtai_flg_ = 0;

cx_xiaochexingtai_en_ = 1;

cx_kongzhiqi1_fanfuzhixing_flg_ = 0;

cx_kongzhiqi1_fanfuzhixing_en_ = 1;

cx_sizuxingtai_flg_ = 0;

cx_sizuxingtai_en_ = 1;

cx_xingzou_flg_ = 0;

cx_xingzou_en_ = 1;

cx_huoyanchuanganqi_tancedaohuoyanshi_flg_ = 0;

cx_huoyanchuanganqi_tancedaohuoyanshi_en_ = 1;

cx_kongzhiqi1_chushihua_flg_ = 0;

cx_kongzhiqi1_chushihua_en_ = 1;

cx_pingmu_flg_ = 0;

cx_pingmu_en_ = 1;

cx_SYS_Tick = 1;

cx_CInsIndex = 8192;

}

//=====================================================================

void setup(void) {


//这里添加用户的初始化, 如各个外设

//...


//初始化linkboy里的所有模块

cx_Setup();

}

void loop(void) {

//这里应保证调用频率为1000Hz

cx_OS0_RunDriverList();

cx_Loop();

delay( 1 );

}
相关推荐
计算机科研狗@OUC2 分钟前
【TMM2024】Frequency-Guided Spatial Adaptation for Camouflaged Object Detection
人工智能·深度学习·目标检测·计算机视觉
悟兰因w9 分钟前
论文阅读(三十五):Boundary-guided network for camouflaged object detection
论文阅读·人工智能·目标检测
大山同学11 分钟前
多机器人图优化:2024ICARA开源
人工智能·语言模型·机器人·去中心化·slam·感知定位
Topstip18 分钟前
Gemini 对话机器人加入开源盲水印技术来检测 AI 生成的内容
人工智能·ai·机器人
小嗷犬33 分钟前
【论文笔记】VCoder: Versatile Vision Encoders for Multimodal Large Language Models
论文阅读·人工智能·语言模型·大模型·多模态
Struart_R39 分钟前
LVSM: A LARGE VIEW SYNTHESIS MODEL WITH MINIMAL 3D INDUCTIVE BIAS 论文解读
人工智能·3d·transformer·三维重建
lucy1530275107940 分钟前
【青牛科技】GC5931:工业风扇驱动芯片的卓越替代者
人工智能·科技·单片机·嵌入式硬件·算法·机器学习
幻风_huanfeng1 小时前
线性代数中的核心数学知识
人工智能·机器学习
volcanical1 小时前
LangGPT结构化提示词编写实践
人工智能
粤海科技君1 小时前
如何使用腾讯云GPU云服务器自建一个简单的类似ChatGPT、Kimi的会话机器人
服务器·chatgpt·机器人·腾讯云