You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Aquatic-Robotic-Courier/software/ASF_Edition_Firmware/ePenguin-Boaty-Testbed/src/main.c

77 lines
1.5 KiB
C

/**
* \file
*
* \brief Empty user application template
*
*/
/**
* \mainpage User Application template doxygen documentation
*
* \par Empty user application template
*
* This is a bare minimum user application template.
*
* For documentation of the board, go \ref group_common_boards "here" for a link
* to the board-specific documentation.
*
* \par Content
*
* -# Include the ASF header files (through asf.h)
* -# Minimal main function that starts with a call to system_init()
* -# Basic usage of on-board LED and button
* -# "Insert application code here" comment
*
*/
/*
* Include header files for all drivers that have been imported from
* Atmel Software Framework (ASF).
*/
/*
* Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
*/
#include <asf.h>
#include "p_usart.h"
#include "p_io.h"
#include "p_adc.h"
#include "motor.h"
int main (void)
{
system_init();
delay_init();
system_interrupt_enable_global();
p_usart_init();
p_adc_init();
p_io_init();
motor_init();
for(;;)
{
if(p_button_pressed())
{
switch(p_button_state())
{
case P_BTN_STATE_STOP:
{
motor_update_state(MS_STOP);
}break;
case P_BTN_STATE_FWD:
{
motor_update_state(MS_FORWARD);
}break;
case P_BTN_STATE_REV:
{
motor_update_state(MS_REVERSE);
}break;
}
}
motor_run();
delay_ms(10);
}
}