Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**
sahilmgandhi 18:6a4db94011d3 2 * \file
sahilmgandhi 18:6a4db94011d3 3 *
sahilmgandhi 18:6a4db94011d3 4 * \brief SAM System related functionality
sahilmgandhi 18:6a4db94011d3 5 *
sahilmgandhi 18:6a4db94011d3 6 * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved.
sahilmgandhi 18:6a4db94011d3 7 *
sahilmgandhi 18:6a4db94011d3 8 * \asf_license_start
sahilmgandhi 18:6a4db94011d3 9 *
sahilmgandhi 18:6a4db94011d3 10 * \page License
sahilmgandhi 18:6a4db94011d3 11 *
sahilmgandhi 18:6a4db94011d3 12 * Redistribution and use in source and binary forms, with or without
sahilmgandhi 18:6a4db94011d3 13 * modification, are permitted provided that the following conditions are met:
sahilmgandhi 18:6a4db94011d3 14 *
sahilmgandhi 18:6a4db94011d3 15 * 1. Redistributions of source code must retain the above copyright notice,
sahilmgandhi 18:6a4db94011d3 16 * this list of conditions and the following disclaimer.
sahilmgandhi 18:6a4db94011d3 17 *
sahilmgandhi 18:6a4db94011d3 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
sahilmgandhi 18:6a4db94011d3 19 * this list of conditions and the following disclaimer in the documentation
sahilmgandhi 18:6a4db94011d3 20 * and/or other materials provided with the distribution.
sahilmgandhi 18:6a4db94011d3 21 *
sahilmgandhi 18:6a4db94011d3 22 * 3. The name of Atmel may not be used to endorse or promote products derived
sahilmgandhi 18:6a4db94011d3 23 * from this software without specific prior written permission.
sahilmgandhi 18:6a4db94011d3 24 *
sahilmgandhi 18:6a4db94011d3 25 * 4. This software may only be redistributed and used in connection with an
sahilmgandhi 18:6a4db94011d3 26 * Atmel microcontroller product.
sahilmgandhi 18:6a4db94011d3 27 *
sahilmgandhi 18:6a4db94011d3 28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
sahilmgandhi 18:6a4db94011d3 29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
sahilmgandhi 18:6a4db94011d3 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
sahilmgandhi 18:6a4db94011d3 31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
sahilmgandhi 18:6a4db94011d3 32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sahilmgandhi 18:6a4db94011d3 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sahilmgandhi 18:6a4db94011d3 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sahilmgandhi 18:6a4db94011d3 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
sahilmgandhi 18:6a4db94011d3 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
sahilmgandhi 18:6a4db94011d3 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
sahilmgandhi 18:6a4db94011d3 38 * POSSIBILITY OF SUCH DAMAGE.
sahilmgandhi 18:6a4db94011d3 39 *
sahilmgandhi 18:6a4db94011d3 40 * \asf_license_stop
sahilmgandhi 18:6a4db94011d3 41 *
sahilmgandhi 18:6a4db94011d3 42 */
sahilmgandhi 18:6a4db94011d3 43 /*
sahilmgandhi 18:6a4db94011d3 44 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
sahilmgandhi 18:6a4db94011d3 45 */
sahilmgandhi 18:6a4db94011d3 46
sahilmgandhi 18:6a4db94011d3 47 #include <system.h>
sahilmgandhi 18:6a4db94011d3 48 #include <toolchain.h>
sahilmgandhi 18:6a4db94011d3 49
sahilmgandhi 18:6a4db94011d3 50 /**
sahilmgandhi 18:6a4db94011d3 51 * \internal
sahilmgandhi 18:6a4db94011d3 52 * Dummy initialization function, used as a weak alias target for the various
sahilmgandhi 18:6a4db94011d3 53 * init functions called by \ref system_init().
sahilmgandhi 18:6a4db94011d3 54 */
sahilmgandhi 18:6a4db94011d3 55 void _system_dummy_init(void);
sahilmgandhi 18:6a4db94011d3 56 void _system_dummy_init(void)
sahilmgandhi 18:6a4db94011d3 57 {
sahilmgandhi 18:6a4db94011d3 58 return;
sahilmgandhi 18:6a4db94011d3 59 }
sahilmgandhi 18:6a4db94011d3 60
sahilmgandhi 18:6a4db94011d3 61 #if !defined(__DOXYGEN__)
sahilmgandhi 18:6a4db94011d3 62 # if defined(__GNUC__)
sahilmgandhi 18:6a4db94011d3 63 void system_clock_init(void) WEAK __attribute__((alias("_system_dummy_init")));
sahilmgandhi 18:6a4db94011d3 64 void system_board_init(void) WEAK __attribute__((alias("_system_dummy_init")));
sahilmgandhi 18:6a4db94011d3 65 void _system_events_init(void) WEAK __attribute__((alias("_system_dummy_init")));
sahilmgandhi 18:6a4db94011d3 66 void _system_extint_init(void) WEAK __attribute__((alias("_system_dummy_init")));
sahilmgandhi 18:6a4db94011d3 67 void _system_divas_init(void) WEAK __attribute__((alias("_system_dummy_init")));
sahilmgandhi 18:6a4db94011d3 68 # elif defined(__ICCARM__)
sahilmgandhi 18:6a4db94011d3 69 void system_clock_init(void);
sahilmgandhi 18:6a4db94011d3 70 void system_board_init(void);
sahilmgandhi 18:6a4db94011d3 71 void _system_events_init(void);
sahilmgandhi 18:6a4db94011d3 72 void _system_extint_init(void);
sahilmgandhi 18:6a4db94011d3 73 void _system_divas_init(void);
sahilmgandhi 18:6a4db94011d3 74 # pragma weak system_clock_init=_system_dummy_init
sahilmgandhi 18:6a4db94011d3 75 # pragma weak system_board_init=_system_dummy_init
sahilmgandhi 18:6a4db94011d3 76 # pragma weak _system_events_init=_system_dummy_init
sahilmgandhi 18:6a4db94011d3 77 # pragma weak _system_extint_init=_system_dummy_init
sahilmgandhi 18:6a4db94011d3 78 # pragma weak _system_divas_init=_system_dummy_init
sahilmgandhi 18:6a4db94011d3 79 # endif
sahilmgandhi 18:6a4db94011d3 80 #endif
sahilmgandhi 18:6a4db94011d3 81
sahilmgandhi 18:6a4db94011d3 82 /**
sahilmgandhi 18:6a4db94011d3 83 * \brief Initialize system
sahilmgandhi 18:6a4db94011d3 84 *
sahilmgandhi 18:6a4db94011d3 85 * This function will call the various initialization functions within the
sahilmgandhi 18:6a4db94011d3 86 * system namespace. If a given optional system module is not available, the
sahilmgandhi 18:6a4db94011d3 87 * associated call will effectively be a NOP (No Operation).
sahilmgandhi 18:6a4db94011d3 88 *
sahilmgandhi 18:6a4db94011d3 89 * Currently the following initialization functions are supported:
sahilmgandhi 18:6a4db94011d3 90 * - System clock initialization (via the SYSTEM CLOCK sub-module)
sahilmgandhi 18:6a4db94011d3 91 * - Board hardware initialization (via the Board module)
sahilmgandhi 18:6a4db94011d3 92 * - Event system driver initialization (via the EVSYS module)
sahilmgandhi 18:6a4db94011d3 93 * - External Interrupt driver initialization (via the EXTINT module)
sahilmgandhi 18:6a4db94011d3 94 */
sahilmgandhi 18:6a4db94011d3 95 void system_init(void)
sahilmgandhi 18:6a4db94011d3 96 {
sahilmgandhi 18:6a4db94011d3 97 /* Configure GCLK and clock sources according to conf_clocks.h */
sahilmgandhi 18:6a4db94011d3 98 system_clock_init();
sahilmgandhi 18:6a4db94011d3 99
sahilmgandhi 18:6a4db94011d3 100 /* Initialize board hardware */
sahilmgandhi 18:6a4db94011d3 101 system_board_init();
sahilmgandhi 18:6a4db94011d3 102
sahilmgandhi 18:6a4db94011d3 103 /* Initialize EVSYS hardware */
sahilmgandhi 18:6a4db94011d3 104 _system_events_init();
sahilmgandhi 18:6a4db94011d3 105
sahilmgandhi 18:6a4db94011d3 106 /* Initialize External hardware */
sahilmgandhi 18:6a4db94011d3 107 _system_extint_init();
sahilmgandhi 18:6a4db94011d3 108
sahilmgandhi 18:6a4db94011d3 109 /* Initialize DIVAS hardware */
sahilmgandhi 18:6a4db94011d3 110 _system_divas_init();
sahilmgandhi 18:6a4db94011d3 111 }
sahilmgandhi 18:6a4db94011d3 112