[l1] fix whitespace and missing license info
Earlier additions to the L1 support were not correctly using linux coding guidelines as specified in /HACKING. Some examples were also missing license information.
This commit is contained in:
parent
20bfcaeb1c
commit
48eed286b9
@ -1,5 +1,20 @@
|
||||
/*
|
||||
* Karl Palsson, 2012 <karlp@tweak.net.au
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2012 Karl Palsson <karlp@tweak.net.au>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
@ -15,7 +30,8 @@
|
||||
|
||||
static struct state_t state;
|
||||
|
||||
void clock_setup(void) {
|
||||
void clock_setup(void)
|
||||
{
|
||||
/* Lots of things on all ports... */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_GPIOAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_GPIOBEN);
|
||||
@ -24,7 +40,8 @@ void clock_setup(void) {
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
}
|
||||
|
||||
void gpio_setup(void) {
|
||||
void gpio_setup(void)
|
||||
{
|
||||
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_DISCO_GREEN_PIN);
|
||||
|
||||
/* Setup GPIO pins for USART2 transmit. */
|
||||
@ -34,7 +51,8 @@ void gpio_setup(void) {
|
||||
gpio_set_af(GPIOA, GPIO_AF7, GPIO2);
|
||||
}
|
||||
|
||||
void usart_setup(void) {
|
||||
void usart_setup(void)
|
||||
{
|
||||
usart_set_baudrate(USART_CONSOLE, 115200);
|
||||
usart_set_databits(USART_CONSOLE, 8);
|
||||
usart_set_stopbits(USART_CONSOLE, USART_STOPBITS_1);
|
||||
@ -53,7 +71,8 @@ void usart_setup(void) {
|
||||
* @param len
|
||||
* @return
|
||||
*/
|
||||
int _write(int file, char *ptr, int len) {
|
||||
int _write(int file, char *ptr, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (file == STDOUT_FILENO || file == STDERR_FILENO) {
|
||||
@ -69,7 +88,8 @@ int _write(int file, char *ptr, int len) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void BUTTON_DISCO_USER_isr(void) {
|
||||
void BUTTON_DISCO_USER_isr(void)
|
||||
{
|
||||
exti_reset_request(BUTTON_DISCO_USER_EXTI);
|
||||
if (state.falling) {
|
||||
state.falling = false;
|
||||
@ -84,7 +104,8 @@ void BUTTON_DISCO_USER_isr(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void setup_buttons(void) {
|
||||
void setup_buttons(void)
|
||||
{
|
||||
/* Enable EXTI0 interrupt. */
|
||||
nvic_enable_irq(BUTTON_DISCO_USER_NVIC);
|
||||
|
||||
@ -97,7 +118,8 @@ void setup_buttons(void) {
|
||||
exti_enable_request(BUTTON_DISCO_USER_EXTI);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
int j = 0;
|
||||
clock_setup();
|
||||
|
@ -1,7 +1,20 @@
|
||||
/*
|
||||
* General configuration of the device
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Karl Palsson <karlp@tweak.net.au> 2012
|
||||
* Copyright (C) 2012 Karl Palsson <karlp@tweak.net.au>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SYSCFG_H
|
||||
@ -31,7 +44,6 @@ extern "C" {
|
||||
#define BUTTON_DISCO_USER_isr exti0_isr
|
||||
#define BUTTON_DISCO_USER_NVIC NVIC_EXTI0_IRQ
|
||||
|
||||
|
||||
struct state_t {
|
||||
bool falling;
|
||||
};
|
||||
|
@ -22,7 +22,8 @@
|
||||
#include <libopencm3/stm32/l1/gpio.h>
|
||||
#include <libopencm3/stm32/usart.h>
|
||||
|
||||
void clock_setup(void) {
|
||||
void clock_setup(void)
|
||||
{
|
||||
/* We are running on MSI after boot. */
|
||||
/* Enable GPIOD clock for LED & USARTs. */
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_GPIOAEN);
|
||||
@ -32,7 +33,8 @@ void clock_setup(void) {
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
}
|
||||
|
||||
void usart_setup(void) {
|
||||
void usart_setup(void)
|
||||
{
|
||||
/* Setup USART2 parameters. */
|
||||
usart_set_baudrate(USART2, 38400);
|
||||
usart_set_databits(USART2, 8);
|
||||
@ -45,7 +47,8 @@ void usart_setup(void) {
|
||||
usart_enable(USART2);
|
||||
}
|
||||
|
||||
void gpio_setup(void) {
|
||||
void gpio_setup(void)
|
||||
{
|
||||
/* Setup GPIO pin GPIO7 on GPIO port B for Green LED. */
|
||||
gpio_mode_setup(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO7);
|
||||
|
||||
@ -56,7 +59,8 @@ void gpio_setup(void) {
|
||||
gpio_set_af(GPIOA, GPIO_AF7, GPIO2);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int main(void)
|
||||
{
|
||||
int i, j = 0, c = 0;
|
||||
|
||||
clock_setup();
|
||||
|
@ -74,8 +74,6 @@
|
||||
/* VREFINTRDYF: Internal voltage reference (VREFINT) ready flag */
|
||||
#define PWR_CSR_VREFINTRDYF (1 << 3)
|
||||
|
||||
|
||||
|
||||
/* --- Function prototypes ------------------------------------------------- */
|
||||
|
||||
typedef enum {
|
||||
|
@ -29,8 +29,7 @@
|
||||
u32 rcc_ppre1_frequency = 2097000;
|
||||
u32 rcc_ppre2_frequency = 2097000;
|
||||
|
||||
const clock_scale_t clock_vrange1_config[CLOCK_VRANGE1_END] =
|
||||
{
|
||||
const clock_scale_t clock_vrange1_config[CLOCK_VRANGE1_END] ={
|
||||
{ /* 24MHz PLL from HSI */
|
||||
.pll_source = RCC_CFGR_PLLSRC_HSI_CLK,
|
||||
.pll_mul = RCC_CFGR_PLLMUL_MUL3,
|
||||
|
Loading…
x
Reference in New Issue
Block a user