Skip to content
Snippets Groups Projects
Select Git revision
21 results Searching

board.c

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    board.c 5.86 KiB
    /*******************************************************************************
     * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a
     * copy of this software and associated documentation files (the "Software"),
     * to deal in the Software without restriction, including without limitation
     * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     * and/or sell copies of the Software, and to permit persons to whom the
     * Software is furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included
     * in all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
     * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     * OTHER DEALINGS IN THE SOFTWARE.
     *
     * Except as contained in this notice, the name of Maxim Integrated
     * Products, Inc. shall not be used except as stated in the Maxim Integrated
     * Products, Inc. Branding Policy.
     *
     * The mere transfer of this software does not imply any licenses
     * of trade secrets, proprietary technology, copyrights, patents,
     * trademarks, maskwork rights, or any other form of intellectual
     * property whatsoever. Maxim Integrated Products, Inc. retains all
     * ownership rights.
     *
     * $Date: 2018-12-03 19:30:05 +0000 (Mon, 03 Dec 2018) $
     * $Revision: 39561 $
     *
     ******************************************************************************/
    
    #include <stdio.h>
    #include "mxc_config.h"
    #include "mxc_sys.h"
    #include "mxc_assert.h"
    #include "board.h"
    #include "uart.h"
    #include "gpio.h"
    #include "mxc_pins.h"
    #include "led.h"
    #include "pb.h"
    #include "spixfc.h"
    
    /***** Global Variables *****/
    mxc_uart_regs_t * ConsoleUart = MXC_UART_GET_UART(CONSOLE_UART);
    extern uint32_t SystemCoreClock;
    
    const gpio_cfg_t pb_pin[] = {
        {PORT_0, PIN_23, GPIO_FUNC_IN, GPIO_PAD_PULL_UP},   // TOP GPIO3 / Button 1
        {PORT_0, PIN_20, GPIO_FUNC_IN, GPIO_PAD_PULL_UP},   // Wristband GPIO1
        {PORT_1, PIN_7, GPIO_FUNC_IN, GPIO_PAD_PULL_UP},   // TOP GPIO5 / Button 2
    };
    const unsigned int num_pbs = (sizeof(pb_pin) / sizeof(gpio_cfg_t));
    
    const gpio_cfg_t led_pin[] = {
        {PORT_0, PIN_21, GPIO_FUNC_OUT, GPIO_PAD_NONE},     // Wristband GPIO2
        {PORT_0, PIN_22, GPIO_FUNC_OUT, GPIO_PAD_NONE},     // Wristband GPIO3
    };
    const unsigned int num_leds = (sizeof(led_pin) / sizeof(gpio_cfg_t));
    
    /***** File Scope Variables *****/
    const uart_cfg_t uart_cfg = {
        .parity = UART_PARITY_DISABLE,
        .size   = UART_DATA_SIZE_8_BITS,
        .stop   = UART_STOP_1,