##// END OF EJS Templates
Merge
Merge

File last commit:

r97:596815cfc1ab dev_alexis
r98:f9a57da11dca merge dev_alexis
Show More
bsp.c
101 lines | 2.7 KiB | text/x-c | CLexer
/*------------------------------------------------------------------------------
-- This file is a part of the libuc, microcontroler library
-- Copyright (C) 2014, Kaveh Mohamadabadi
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------------
-- Author : Kaveh Mohamadabadi
-- Mail : kaveh.mohamadabadi@gmail.com
-------------------------------------------------------------------------------*/
#include "bsp.h"
#include <streamdevices.h>
#include <malloc.h>
#include <gpio.h>
#include <uart.h>
#include <stdio.h>
uint32_t OSC0 =12000000;
uint32_t INTOSC =16000000;
uint32_t RTCOSC =32768;
uint32_t currentCpuFreq=0;
extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
gpio_t TickLed = LED1;
float VREF0 =(float)3.3;
int bsp_init()
{
int i=0;
for(i=0;i<32;i++)
{
__opnfiles__[i] = NULL;
}
bsp_GPIO_init();
bsp_uart_init();
printf("\r================================================================\n\r");
printf("================================================================\n\r");
printf(BSP);
printf(" initialised\n\r");
printf("================================================================\n\r");
return 1;
}
void bsp_GPIO_init()
{
gpio_t LED_list[]={LED1, LED2, LED3};
gpio_t LEDx;
for (int i=0;2;i++)
{
LEDx=gpioopen(LED_list[i]);
gpiosetdir(&LEDx,gpiooutdir);
}
}
void bsp_GPIO_init()
{
}
void bsp_uart_init()
{
if(__opnfiles__[1]==NULL)
{
// streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice));
// uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,19200,PB10,PB11,-1,-1);
// uartmkstreamdev(uart,fd1);
// __opnfiles__[1] = fd1; //stdo
// __opnfiles__[0] = fd1; //stdi
}
else
{
// uartopenandconfig(2,uartparitynone | uart8bits | uartonestop,115200,PB10,PB11,-1,-1);
}
}
void bsp_spi_init()
{
}
void bsp_iic_init()
{
}