Changes from review of PR 118

This commit is contained in:
Gregory Nutt 2016-08-18 11:29:48 -06:00
parent c0074fd6b8
commit cfad547b8d
23 changed files with 55 additions and 1300 deletions

View File

@ -937,14 +937,14 @@ config ARCH_BOARD_SPARK
MCU from STMicro.
config ARCH_BOARD_STM32_BUTTERFLY2
bool "Kamami STM32Butterfly2 development board"
depends on ARCH_CHIP_STM32F107VC
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
---help---
A configuration for the Kamami STM32Butterfly2 development board
based on STM32F107VC micro-controler chip with optional ETH
board.
bool "Kamami STM32Butterfly2 development board"
depends on ARCH_CHIP_STM32F107VC
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
---help---
A configuration for the Kamami STM32Butterfly2 development board
based on STM32F107VC micro-controler chip with optional ETH
board.
config ARCH_BOARD_STM32_TINY
bool "STM32-Tiny board"

View File

@ -173,7 +173,8 @@
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
@ -192,7 +193,7 @@ extern "C" {
* initialized.
******************************************************************************/
EXTERN void stm32_boardinitialize(void);
void stm32_boardinitialize(void);
#undef EXTERN
#if defined(__cplusplus)

View File

@ -1,7 +1,7 @@
############################################################################
# configs/viewtool-stm32f107/nsh/Make.defs
# configs/stm32butterfly2/nsh/Make.defs
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
#!/bin/bash
# configs/viewtool-stm32f107/nsh/setenv.sh
# configs/stm32butterfly2/nsh/setenv.sh
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
############################################################################
# configs/viewtool-stm32f107/nsh/Make.defs
# configs/stm32butterfly2/nsh/Make.defs
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
#!/bin/bash
# configs/viewtool-stm32f107/nsh/setenv.sh
# configs/stm32butterfly2/nsh/setenv.sh
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
############################################################################
# configs/viewtool-stm32f107/nsh/Make.defs
# configs/stm32butterfly2/nsh/Make.defs
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
#!/bin/bash
# configs/viewtool-stm32f107/nsh/setenv.sh
# configs/stm32butterfly2/nsh/setenv.sh
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
############################################################################
# configs/viewtool-stm32f107/nsh/Make.defs
# configs/stm32butterfly2/nsh/Make.defs
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
#!/bin/bash
# configs/viewtool-stm32f107/nsh/setenv.sh
# configs/stm32butterfly2/nsh/setenv.sh
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/viewtool-stm32f107/scripts/dfu.ld
* configs/stm32butterfly2/scripts/dfu.ld
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/viewtool-stm32f107/scripts/flash.ld
* configs/stm32butterfly2/scripts/flash.ld
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without

View File

@ -83,4 +83,3 @@ int board_adc_setup(void)
ainfo("INFO: ADC12_IN10 initialized succesfully\n");
return OK;
}

View File

@ -92,4 +92,3 @@ int board_app_initialize(uintptr_t arg)
return rv;
}

View File

@ -127,5 +127,5 @@ int stm32_usbhost_initialize(void);
static inline int stm32_usbhost_initialize(void) { return 0; }
#endif
#endif // __CONFIGS_STM32_BUTTERFLY2_SRC_STM32_BUTTERFLY2_H
#endif /* __CONFIGS_STM32_BUTTERFLY2_SRC_STM32_BUTTERFLY2_H */

View File

@ -59,8 +59,10 @@
* Private Declarations
****************************************************************************/
static const uint32_t buttons[NUM_BUTTONS] = {
GPIO_JOY_O, GPIO_JOY_U, GPIO_JOY_D, GPIO_JOY_R, GPIO_JOY_L };
static const uint32_t buttons[NUM_BUTTONS] =
{
GPIO_JOY_O, GPIO_JOY_U, GPIO_JOY_D, GPIO_JOY_R, GPIO_JOY_L
};
/*****************************************************************************
* Public Functions
@ -76,6 +78,7 @@ static const uint32_t buttons[NUM_BUTTONS] = {
void board_button_initialize(void)
{
int i;
for (i = 0; i != NUM_BUTTONS; ++i)
{
stm32_configgpio(buttons[i]);
@ -104,4 +107,3 @@ uint8_t board_buttons(void)
return rv;
}

View File

@ -62,6 +62,7 @@
****************************************************************************/
/* Identifies led state */
enum led_state
{
LED_ON = false,
@ -231,13 +232,16 @@ void board_userled_initialize(void)
void board_userled(int led, bool ledon)
{
unsigned int ledbit;
#ifndef CONFIG_ARCH_LEDS
if (led == BOARD_LED4)
{
return;
}
#endif
unsigned int ledbit = 1 << led;
ledbit = 1 << led;
led_state(ledon, ledbit);
}
@ -261,4 +265,3 @@ void board_userled_all(uint8_t ledset)
led_state(led_OFF, ~ledset);
#endif
}

View File

@ -135,8 +135,8 @@ static int stm32_cd(int irq, void *context)
now = tp.tv_sec * 1000 + tp.tv_nsec / 1000000;
/* When inserting card, card detect plate might bounce causing this
* interrupt to be called many time on single card insert/deinsert. Thus we
* are allowing only one interrupt every 100ms.
* interrupt to be called many time on single card insert/deinsert. Thus
* we are allowing only one interrupt every 100ms.
*/
if (now - debounce_time > prev)
@ -214,4 +214,3 @@ int stm32_mmcsd_initialize(int minor)
spiinfo("INFO: mmcsd card has been initialized successfully\n");
return OK;
}

View File

@ -61,6 +61,7 @@
void stm32_spidev_initialize(void)
{
spiinfo("INFO: Initializing spi gpio pins\n");
stm32_configgpio(GPIO_SD_CS);
stm32_configgpio(GPIO_SD_CD);
}
@ -76,6 +77,7 @@ void stm32_spi1select(struct spi_dev_s *dev, enum spi_dev_e devid,
bool select)
{
spiinfo("INFO: Selecting spi dev: %d, state: %d\n", devid, select);
if (devid == SPIDEV_MMCSD)
{
stm32_gpiowrite(GPIO_SD_CS, !select);
@ -92,6 +94,7 @@ void stm32_spi1select(struct spi_dev_s *dev, enum spi_dev_e devid,
uint8_t stm32_spi1status(struct spi_dev_s *dev, enum spi_dev_e devid)
{
spiinfo("INFO: Requesting info from spi dev: %d\n", devid);
if (devid == SPIDEV_MMCSD)
{
if (stm32_gpioread(GPIO_SD_CD) == 0)
@ -100,6 +103,5 @@ uint8_t stm32_spi1status(struct spi_dev_s *dev, enum spi_dev_e devid)
}
}
return 0;
return 0;
}

View File

@ -56,7 +56,7 @@
void stm32_usb_initialize(void)
{
uinfo("INFO: Initializing usb otgfs gpio pins\n");
stm32_configgpio(GPIO_OTGFS_VBUS);
stm32_configgpio(GPIO_OTGFS_PWRON);
}

View File

@ -75,4 +75,3 @@ void stm32_usbsuspend(struct usbdev_s *dev, bool resume)
{
uinfo("INFO: usb %s", resume ? "resumed" : "suspended");
}

View File

@ -85,6 +85,7 @@ static void* usbhost_detect(void *arg)
struct usbhost_hubport_s *hport;
uinfo("INFO: Starting usb detect thread\n");
for (;;)
{
CONN_WAIT(g_usbconn, &hport);
@ -115,6 +116,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_MSC
uinfo("INFO: Initializing USB MSC class\n");
if ((rv = usbhost_msc_initialize()) < 0)
{
uerr("ERROR: Failed to register mass storage class: %d\n", rv);
@ -123,6 +125,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_CDACM
uinfo("INFO: Initializing CDCACM usb class\n");
if ((rv = usbhost_cdacm_initialize()) < 0)
{
uerr("ERROR: Failed to register CDC/ACM serial class: %d\n", rv);
@ -131,6 +134,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_HIDKBD
uinfo("INFO: Initializing HID Keyboard usb class\n");
if ((rv = usbhost_kbdinit()) < 0)
{
uerr("ERROR: Failed to register the KBD class: %d\n", rv);
@ -139,6 +143,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_HIDMOUSE
uinfo("INFO: Initializing HID Mouse usb class\n");
if ((rv = usbhost_mouse_init()) < 0)
{
uerr("ERROR: Failed to register the mouse class: %d\n", rv);
@ -147,6 +152,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_HUB
uinfo("INFO: Initializing USB HUB class\n");
if ((rv = usbhost_hub_initialize()) < 0)
{
uerr("ERROR: Failed to register hub class: %d\n", rv);
@ -192,4 +198,3 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
{
stm32_gpiowrite(GPIO_OTGFS_PWRON, enable);
}