Permalink
Browse files

Initialize code for TS100

  • Loading branch information...
perillamint committed Aug 12, 2017
1 parent ed1320e commit 17be96cdf81ba74b5247a08cbb81aa9322107bd2
Showing with 71 additions and 0 deletions.
  1. +17 −0 src/stm32f103/target_stm32f103.c
  2. +48 −0 src/stm32f103/ts100/config.h
  3. +6 −0 src/targets.mk
@@ -79,6 +79,23 @@ void target_gpio_setup(void) {
}
#endif

/* Setup Buttons */
#if HAVE_BUTTON
{
const uint8_t mode = GPIO_MODE_INPUT;
const uint8_t conf = (BUTTON_EXT_PUPD ? GPIO_CNF_INPUT_FLOAT
: GPIO_CNF_INPUT_PULL_UPDOWN);

gpio_set_mode(BUTTON_GPIO_PORT, mode, conf, BUTTON_GPIO_PIN);

#if !BUTTON_EXT_PUPD && !BUTTON_ACTIVE_HIGH
gpio_set(BUTTON_GPIO_PORT, BUTTON_GPIO_PIN);
#else
gpio_clear(BUTTON_GPIO_PORT, BUTTON_GPIO_PIN);
#endif
}
#endif

#if HAVE_USB_PULLUP_CONTROL
{
const uint8_t mode = GPIO_MODE_OUTPUT_10_MHZ;
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2016, Devan Lai
*
* Permission to use, copy, modify, and/or distribute this software
* for any purpose with or without fee is hereby granted, provided
* that the above copyright notice and this permission notice
* appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#ifndef CONFIG_H_INCLUDED
#define CONFIG_H_INCLUDED

#define APP_BASE_ADDRESS 0x08004000
#define FLASH_PAGE_SIZE 1024
#define DFU_UPLOAD_AVAILABLE 1
#define DFU_DOWNLOAD_AVAILABLE 1

#define HAVE_LED 1
#define LED_GPIO_PORT GPIOC
#define LED_GPIO_PIN GPIO12
#define LED_OPEN_DRAIN 0

#define HAVE_BUTTON 1
#define BUTTON_GPIO_PORT GPIOA
#define BUTTON_GPIO_PIN GPIO9
#define BUTTON_ACTIVE_HIGH 0
#define BUTTON_EXT_PUPD 0

#define HAVE_USB_PULLUP_CONTROL 0
#define USB_PULLUP_GPIO_PORT GPIOB
#define USB_PULLUP_GPIO_PIN GPIO9
#define USB_PULLUP_ACTIVE_HIGH 0
#define USB_PULLUP_OPEN_DRAIN 1

#define USES_GPIOA 1
#define USES_GPIOB 1
#define USES_GPIOC 1

#endif
@@ -39,6 +39,12 @@ ifeq ($(TARGET),STLINK)
LDSCRIPT := ./stm32f103/stm32f103x8.ld
ARCH = STM32F1
endif
ifeq ($(TARGET),TS100)
TARGET_COMMON_DIR := ./stm32f103
TARGET_SPEC_DIR := ./stm32f103/ts100
LDSCRIPT := ./stm32f103/stm32f103x8.ld
ARCH = STM32F1
endif

ifndef ARCH
$(error Unknown target $(TARGET))

0 comments on commit 17be96c

Please sign in to comment.