示例#1
0
int main(void)
{

	//! [setup_init]
	struct tc_module       tc_instance;
	struct events_resource example_event;
	struct events_hook     hook;

	system_init();
	system_interrupt_enable_global();

	configure_event_channel(&example_event);
	configure_event_user(&example_event);
	configure_event_interrupt(&example_event, &hook);
	configure_tc(&tc_instance);
	//! [setup_init]

	//! [main]

	//! [main_1]
	while (events_is_busy(&example_event)) {
		/* Wait for channel */
	};
	//! [main_1]

	//! [main_2]
	tc_start_counter(&tc_instance);
	//! [main_2]

	while (true) {
		/* Nothing to do */
	}

	//! [main]
}
int main(void)
{
//! [events_resource_struct]
	struct events_resource example_event;
//! [events_resource_struct]

	system_init();

//! [setup_init]
	configure_event_channel(&example_event);
	configure_event_user(&example_event);
//! [setup_init]

	//! [main]

	//! [main_1]
	while (events_is_busy(&example_event)) {
		/* Wait for channel */
	};
	//! [main_1]

	//! [main_2]
	events_trigger(&example_event);
	//! [main_2]

	while (true) {
		/* Nothing to do */
	}

	//! [main]
}