Project

General

Profile

Revision 82

Added by Chris Mar over 16 years ago

merged lib_additions

View differences:

trunk/code/projects/libdragonfly/dragonfly_lib.c
78 78
	_delay_ms(1);
79 79
}
80 80

  
81
/**
82
 * Resets the AVR when called.  Sets the watchdog timer and lets it overflow
83
 * to reset the AVR.  The reset clears all memory and resets all registers
84
 * with the exception of the Watchdog Reset Flag (WDRF) in the MCU Control
85
 * and Status Register (MCUCSR).
86
*/
87
void reset(void)
88
{
89
    WDTCR &= 0xF8;
90
    WDTCR |= 0x08;
91
    _delay_ms(15);
92
}
93 81

  
94

  
95 82
/** @} **/ //end defgroup
96 83

  
trunk/code/projects/libdragonfly/dragonfly_lib.h
42 42

  
43 43
/** @brief Initialize the board **/
44 44
void dragonfly_init(int config);
45
/** @brief Reset the robot **/
46
void reset(void);
47 45

  
48 46
/** @} **/ //end addtogroup
49 47

  
......
65 63
#include <buzzer.h>
66 64
#include <rangefinder.h>
67 65
#include <bom.h>
68
#include <move.h>
66
#include <move.h>
67
#include <reset.h>
68
#include <math.h>
69 69

  
70 70
#endif
71 71

  
trunk/code/projects/libdragonfly/math.c
1
#include "math.h"
2

  
3
/**
4
 * @defgroup math Math
5
 * Function(s) for performing math operations
6
 *
7
 * @{
8
 **/
9

  
10
/**
11
 * finds the absolute value of x
12
 * 
13
 * @param x the int of which we want to take its absolute value
14
 * 
15
 * @return the absolute value of x
16
 **/
17
int abs_int (int x) {
18

  
19
  if(x < 0)
20
    return -x;
21
    
22
  return x;
23
}
24

  
25
/**@}**/ //end defgroup
trunk/code/projects/libdragonfly/math.h
1
/**
2
 * 
3
 * @file math.h
4
 * @brief Contains math function(s)
5
 * 
6
 * @author Colony Project, CMU Robotics Club, James Kong
7
*/
8

  
9
#ifndef _MATH_H_
10
#define _MATH_H_
11

  
12
/**
13
 * @addtogroup math
14
 * @{
15
 **/
16
 
17
/** @brief absolute value **/
18
int abs_int(int x);
19

  
20
/**@}**/ //end group
21

  
22
#endif
trunk/code/projects/libdragonfly/reset.c
1
/*
2
reset.h - contains reset() function that resets the AVR
3
author: James Kong
4

  
5
Last Modified:
6

  
7
3.7.2007 - James
8
    created reset.c
9
*/
10

  
11
#include <avr/interrupt.h>
12
#include <util/delay.h>
13
#include <reset.h>
14

  
15
/**
16
 * @defgroup reset Reset
17
 * Functions for manipulation the ADC on the dragonfly board.
18
 * All definitions may be found in analog.h.
19
 *
20
 * @{
21
 **/
22

  
23
/**
24
 * Resets the AVR when called.  Sets the watchdog timer and lets it overflow
25
 * to reset the AVR.  The reset clears all memory and resets all registers
26
 * with the exception of the Watchdog Reset Flag (WDRF) in the MCU Control
27
 * and Status Register (MCUCSR).
28
 **/
29
void reset(void) {
30
    WDTCR &= 0xF8;
31
    WDTCR |= 0x08;
32
    _delay_ms(15);
33
}
34

  
35
/**@}**/ //end defgroup
trunk/code/projects/libdragonfly/reset.h
1
/**
2
 * 
3
 * @file reset.h
4
 * @brief Contains function(s) for resetting the robots
5
 * 
6
 * @author Colony Project, CMU Robotics Club, James Kong
7
*/
8

  
9
#ifndef _RESET_H_
10
#define _RESET_H_
11

  
12
/**
13
 * @addtogroup reset
14
 * @{
15
 **/
16
 
17
/** @brief Reset the robot **/
18
void reset(void);
19

  
20
/**@}**/ //end group
21

  
22
#endif

Also available in: Unified diff