int total; void on_click(){ send_cmd(); } void on_rep(){ total++; if (total != 8){ take_photo(); send_cmd(); } } int main(){ } --------------------------------------- void on_message(message){ if(message = setPotion){ motor_set_postion(speed, poitions direction); send_receipt(); }else if(message == getDeviceState){ send_receipt(); } } void on_motor_stop(){ send_report(); } void on_motor_exception(){ } void main(){ ble_init(onmessage); motor_init(on_motor_stop); } --------------------------------------- onmessage_t onmessage; void ble_init(onmessage); void ble_send(); --------------------------------------- void motor_init(on_motor_stop,on_motor_exception); void motor_set_postion(speed, poitions direction); void motor_get_positon(); void motor_is_running(); void motor_get_exception(); void motor_processs(){ ticket = getnow } ----------------------------------------- 中断上下文 main上下文