added variant black_f4 + cleanup old F1 anf F2 definitions
This commit is contained in:
parent
e49f7faeef
commit
3d775ac3c5
|
@ -29,6 +29,34 @@ discovery_f407.build.error_led_port=GPIOD
|
|||
discovery_f407.build.error_led_pin=14
|
||||
discovery_f407.build.board=STM32DiscoveryF407
|
||||
|
||||
##############################################################
|
||||
black_f407vet6.name=STM32 Black F407VET6
|
||||
|
||||
black_f407vet6.upload.tool=stlink_upload
|
||||
black_f407vet6.upload.protocol=stlink
|
||||
|
||||
black_f407vet6.upload.file_type=bin
|
||||
black_f407vet6.upload.ram.maximum_size=65535
|
||||
black_f407vet6.upload.flash.maximum_size=514288
|
||||
black_f407vet6.upload.maximum_size=514288
|
||||
|
||||
#black_f407vet6.upload.usbID=0483:3748
|
||||
#black_f407vet6.upload.altID=1
|
||||
#black_f407vet6.upload.auto_reset=true
|
||||
|
||||
black_f407vet6.build.mcu=cortex-m4
|
||||
black_f407vet6.build.f_cpu=168000000L
|
||||
black_f407vet6.build.core=maple
|
||||
black_f407vet6.build.extra_flags=-mthumb -DSTM32_HIGH_DENSITY -DSTM32F4 -DBOARD_black_f4
|
||||
black_f407vet6.build.ldscript=ld/jtag.ld
|
||||
black_f407vet6.build.variant=black_f407vet6
|
||||
black_f407vet6.build.variant_system_lib=lib_f407.a
|
||||
black_f407vet6.build.vect=VECT_TAB_BASE
|
||||
black_f407vet6.build.density=STM32_HIGH_DENSITY
|
||||
black_f407vet6.build.error_led_port=GPIOA
|
||||
black_f407vet6.build.error_led_pin=7
|
||||
black_f407vet6.build.board=STM32BlackF407VET6
|
||||
|
||||
##############################################################
|
||||
stm32f4stamp.name=STM32F4Stamp F405
|
||||
|
||||
|
|
|
@ -41,9 +41,7 @@
|
|||
#include "adc.h"
|
||||
#include "timer.h"
|
||||
#include "usb.h"
|
||||
#ifdef STM32F2
|
||||
//#include "usbF4.h"
|
||||
#endif
|
||||
|
||||
|
||||
static void setupFlash(void);
|
||||
static void setupClocks(void);
|
||||
|
@ -59,7 +57,7 @@ void init(void) {
|
|||
systick_init(SYSTICK_RELOAD_VAL);
|
||||
gpio_init_all();
|
||||
|
||||
#ifdef STM32F2
|
||||
#ifdef STM32F4
|
||||
rcc_clk_enable(RCC_SYSCFG);
|
||||
#else
|
||||
afio_init();
|
||||
|
@ -84,11 +82,13 @@ bool boardUsesPin(uint8 pin) {
|
|||
}
|
||||
|
||||
static void setupFlash(void) {
|
||||
/*
|
||||
#ifndef STM32F2
|
||||
// for F2 and F4 CPUs this is done in SetupClock...(), e.g. in SetupClock168MHz()
|
||||
flash_enable_prefetch();
|
||||
flash_set_latency(FLASH_WAIT_STATE_2);
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -121,8 +121,8 @@ static void setupNVIC() {
|
|||
static void adcDefaultConfig(const adc_dev* dev);
|
||||
|
||||
static void setupADC() {
|
||||
#ifdef STM32F2
|
||||
setupADC_F2();
|
||||
#ifdef STM32F4
|
||||
setupADC_F4();
|
||||
#else
|
||||
rcc_set_prescaler(RCC_PRESCALER_ADC, RCC_ADCPRE_PCLK_DIV_6);
|
||||
#endif
|
||||
|
|
|
@ -140,6 +140,8 @@ bool boardUsesPin(uint8 pin);
|
|||
#include "aeroquad32mini.h"
|
||||
#elif defined(BOARD_discovery_f4)
|
||||
#include "discovery_f4.h"
|
||||
#elif defined(BOARD_black_f4)
|
||||
#include "black_f4.h"
|
||||
#elif defined(BOARD_freeflight)
|
||||
#include "freeflight.h"
|
||||
#else
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#ifndef _IO_H_
|
||||
#define _IO_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "gpio.h"
|
||||
#include "adc.h"
|
||||
|
||||
|
@ -179,9 +180,11 @@ static inline void toggleLED() {
|
|||
* accomplished portably over all LeafLabs boards by calling
|
||||
* pinMode(BOARD_BUTTON_PIN, INPUT).
|
||||
*
|
||||
* @param button - one of available on-board buttons (up to 3 for black F4)
|
||||
*
|
||||
* @see pinMode()
|
||||
*/
|
||||
uint8 isButtonPressed();
|
||||
uint8 isButtonPressed(uint8_t button);
|
||||
|
||||
/**
|
||||
* Wait until the button is pressed and released, timing out if no
|
||||
|
@ -195,12 +198,14 @@ uint8 isButtonPressed();
|
|||
* button is pressed. If timeout_millis is left out (or 0), wait
|
||||
* forever.
|
||||
*
|
||||
* @param button - one of available on-board buttons (up to 3 for black F4)
|
||||
*
|
||||
* @return true, if the button was pressed; false, if the timeout was
|
||||
* reached.
|
||||
*
|
||||
* @see pinMode()
|
||||
*/
|
||||
uint8 waitForButtonPress(uint32 timeout_millis=0);
|
||||
uint8 waitForButtonPress(uint8_t button, uint32 timeout_millis=0);
|
||||
|
||||
/**
|
||||
* Shift out a byte of data, one bit at a time.
|
||||
|
|
|
@ -92,7 +92,7 @@ void HardwareSerial::begin(uint32 baud) {
|
|||
|
||||
const stm32_pin_info *txi = &PIN_MAP[tx_pin];
|
||||
const stm32_pin_info *rxi = &PIN_MAP[rx_pin];
|
||||
#ifdef STM32F2
|
||||
#ifdef STM32F4
|
||||
// int af = 7<<8;
|
||||
if (usart_device == UART4 || usart_device == UART5) {
|
||||
gpio_set_af_mode(txi->gpio_device, txi->gpio_bit, 8);
|
||||
|
|
|
@ -74,7 +74,7 @@ const adc_dev *ADC3 = &adc3;
|
|||
*/
|
||||
void adc_init(const adc_dev *dev) {
|
||||
rcc_clk_enable(dev->clk_id);
|
||||
#ifdef STM32F2
|
||||
#ifdef STM32F4
|
||||
if(dev->clk_id == RCC_ADC1) {
|
||||
rcc_reset_dev(dev->clk_id);
|
||||
}
|
||||
|
@ -136,7 +136,9 @@ void adc_set_sample_rate(const adc_dev *dev, adc_smp_rate smp_rate) {
|
|||
* @brief Calibrate an ADC peripheral
|
||||
* @param dev adc device
|
||||
*/
|
||||
void adc_calibrate(const adc_dev *dev) {
|
||||
void adc_calibrate(const adc_dev *dev)
|
||||
{
|
||||
/*
|
||||
#ifndef STM32F2
|
||||
__io uint32 *rstcal_bit = bb_perip(&(dev->regs->CR2), 3);
|
||||
__io uint32 *cal_bit = bb_perip(&(dev->regs->CR2), 2);
|
||||
|
@ -149,6 +151,7 @@ void adc_calibrate(const adc_dev *dev) {
|
|||
while (*cal_bit)
|
||||
;
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,8 +174,8 @@ uint16 adc_read(const adc_dev *dev, uint8 channel) {
|
|||
return (uint16)(regs->DR & ADC_DR_DATA);
|
||||
}
|
||||
|
||||
void setupADC_F2() {
|
||||
#ifdef STM32F2
|
||||
void setupADC_F4(void)
|
||||
{
|
||||
uint32 tmpreg1 = 0;
|
||||
|
||||
tmpreg1 = ADC_COMMON->CCR;
|
||||
|
@ -196,5 +199,4 @@ void setupADC_F2() {
|
|||
|
||||
/* Write to ADC CCR */
|
||||
ADC_COMMON->CCR = tmpreg1;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ extern "C"{
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef STM32F2
|
||||
typedef struct
|
||||
{
|
||||
__io uint32 CSR; /*!< ADC Common status register, Address offset: ADC1 base address + 0x300 */
|
||||
|
@ -52,7 +51,6 @@ extern "C"{
|
|||
} ADC_Common_TypeDef;
|
||||
#define ADC_COMMON ((ADC_Common_TypeDef *) 0x40012300)
|
||||
|
||||
#endif
|
||||
|
||||
/** ADC register map type. */
|
||||
typedef struct adc_reg_map {
|
||||
|
@ -94,23 +92,12 @@ extern const adc_dev *ADC3;
|
|||
* Register map base pointers
|
||||
*/
|
||||
|
||||
#ifdef STM32F2
|
||||
/** ADC1 register map base pointer. */
|
||||
#define ADC1_BASE ((struct adc_reg_map*)0x40012000)
|
||||
/** ADC2 register map base pointer. */
|
||||
#define ADC2_BASE ((struct adc_reg_map*)0x40012100)
|
||||
/** ADC3 register map base pointer. */
|
||||
#define ADC3_BASE ((struct adc_reg_map*)0x40012200)
|
||||
#else
|
||||
/** ADC1 register map base pointer. */
|
||||
#define ADC1_BASE ((struct adc_reg_map*)0x40012400)
|
||||
/** ADC2 register map base pointer. */
|
||||
#define ADC2_BASE ((struct adc_reg_map*)0x40012800)
|
||||
#ifdef STM32_HIGH_DENSITY
|
||||
/** ADC3 register map base pointer. */
|
||||
#define ADC3_BASE ((struct adc_reg_map*)0x40013C00)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Register bit definitions
|
||||
|
@ -167,17 +154,10 @@ extern const adc_dev *ADC3;
|
|||
#define ADC_CR2_JEXTTRIG_BIT 15
|
||||
#define ADC_CR2_EXTTRIG_BIT 20
|
||||
#define ADC_CR2_TSEREFE_BIT 23
|
||||
#ifdef STM32F2
|
||||
#define ADC_CR2_JSWSTART_BIT 22
|
||||
#define ADC_CR2_SWSTART_BIT 30
|
||||
#define ADC_CR2_EXTSEL (0x0F000000)
|
||||
#define ADC_CR2_JEXTSEL (0x000F0000)
|
||||
#else
|
||||
#define ADC_CR2_JSWSTART_BIT 21
|
||||
#define ADC_CR2_SWSTART_BIT 22
|
||||
#define ADC_CR2_EXTSEL (0x000E0000)
|
||||
#define ADC_CR2_JEXTSEL (0x00007000)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -388,7 +368,7 @@ static inline void adc_disable_all(void) {
|
|||
adc_foreach(adc_disable);
|
||||
}
|
||||
|
||||
void setupADC_F2();
|
||||
extern void setupADC_F4(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
@ -30,9 +30,4 @@
|
|||
* @brief Direct Memory Access peripheral support
|
||||
*/
|
||||
|
||||
#ifdef STM32F2
|
||||
#include "dmaF2.h"
|
||||
#include <libmaple/dma_common.h>
|
||||
#else
|
||||
#include "dmaF1.h"
|
||||
#endif
|
||||
#include "dmaF4.h"
|
||||
|
|
|
@ -52,11 +52,7 @@ typedef struct exti_reg_map {
|
|||
} exti_reg_map;
|
||||
|
||||
/** EXTI register map base pointer */
|
||||
#ifdef STM32F2
|
||||
#define EXTI_BASE ((struct exti_reg_map*)0x40013C00)
|
||||
#else
|
||||
#define EXTI_BASE ((struct exti_reg_map*)0x40010400)
|
||||
#endif
|
||||
|
||||
/** External interrupt trigger mode */
|
||||
typedef enum exti_trigger_mode {
|
||||
|
|
|
@ -31,8 +31,5 @@
|
|||
* (AFIO) prototypes, defines, and inlined access functions.
|
||||
*/
|
||||
|
||||
#ifdef STM32F2
|
||||
#include "gpioF2.h"
|
||||
#else
|
||||
#include "gpioF1.h"
|
||||
#endif
|
||||
|
||||
#include "gpioF4.h"
|
||||
|
|
|
@ -42,19 +42,24 @@
|
|||
*
|
||||
* FIXME this has no business being here
|
||||
*/
|
||||
/*
|
||||
#if defined(MCU_STM32F103VE) || defined(MCU_STM32F205VE) || defined(MCU_STM32F406VG)
|
||||
/* e.g., Aeroquad32 */
|
||||
#define USER_ADDR_ROM 0x08010000 /* ala42 */
|
||||
// e.g., Aeroquad32
|
||||
#define USER_ADDR_ROM 0x08010000 // ala42
|
||||
#define USER_ADDR_RAM 0x20000C00
|
||||
#define STACK_TOP 0x20000800
|
||||
#elif defined(BOARD_freeflight)
|
||||
*/
|
||||
#define USER_ADDR_ROM 0x08000000
|
||||
#define USER_ADDR_RAM 0x20000000
|
||||
#define USER_ADDR_RAM 0x20000C00
|
||||
#define STACK_TOP 0x20000800
|
||||
/*
|
||||
#else
|
||||
#define USER_ADDR_ROM 0x08005000
|
||||
#define USER_ADDR_RAM 0x20000C00
|
||||
#define STACK_TOP 0x20000800
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -46,10 +46,12 @@ typedef long long int64;
|
|||
typedef void (*voidFuncPtr)(void);
|
||||
|
||||
#define __io volatile
|
||||
#ifndef __attr_flash
|
||||
#define __attr_flash __attribute__((section (".USER_FLASH")))
|
||||
|
||||
#endif
|
||||
#ifndef __always_inline
|
||||
#define __always_inline inline __attribute__((always_inline))
|
||||
|
||||
#endif
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
|
|
@ -29,8 +29,5 @@
|
|||
* @brief reset and clock control definitions and prototypes
|
||||
*/
|
||||
|
||||
#ifdef STM32F2
|
||||
#include "rccF2.h"
|
||||
#else
|
||||
#include "rccF1.h"
|
||||
#endif
|
||||
|
||||
#include "rccF4.h"
|
||||
|
|
|
@ -3,17 +3,11 @@ sp := $(sp).x
|
|||
dirstack_$(sp) := $(d)
|
||||
d := $(dir)
|
||||
BUILDDIRS += $(BUILD_PATH)/$(d)
|
||||
ifneq ($(MCU_FAMILY), STM32F2)
|
||||
BUILDDIRS += $(BUILD_PATH)/$(d)/usb
|
||||
BUILDDIRS += $(BUILD_PATH)/$(d)/usb/usb_lib
|
||||
LIBMAPLE_INCLUDES := -I$(LIBMAPLE_PATH) -I$(LIBMAPLE_PATH)/usb -I$(LIBMAPLE_PATH)/usb/usb_lib
|
||||
else
|
||||
BUILDDIRS += $(BUILD_PATH)/$(d)/usbF4/STM32_USB_Device_Library/Core/src
|
||||
BUILDDIRS += $(BUILD_PATH)/$(d)/usbF4/STM32_USB_Device_Library/Class/cdc/src
|
||||
BUILDDIRS += $(BUILD_PATH)/$(d)/usbF4/STM32_USB_OTG_Driver/src
|
||||
BUILDDIRS += $(BUILD_PATH)/$(d)/usbF4/VCP
|
||||
LIBMAPLE_INCLUDES := -I$(LIBMAPLE_PATH) -I$(LIBMAPLE_PATH)/usbF4
|
||||
endif
|
||||
|
||||
|
||||
# Local flags
|
||||
|
@ -42,18 +36,6 @@ cSRCS_$(d) := adc.c \
|
|||
usart.c \
|
||||
util.c
|
||||
|
||||
ifneq ($(MCU_FAMILY), STM32F2)
|
||||
cSRCS_$(d) += \
|
||||
usb/descriptors.c \
|
||||
usb/usb.c \
|
||||
usb/usb_callbacks.c \
|
||||
usb/usb_hardware.c \
|
||||
usb/usb_lib/usb_core.c \
|
||||
usb/usb_lib/usb_init.c \
|
||||
usb/usb_lib/usb_int.c \
|
||||
usb/usb_lib/usb_mem.c \
|
||||
usb/usb_lib/usb_regs.c
|
||||
else
|
||||
V=1
|
||||
cSRCS_$(d) += \
|
||||
usbF4/STM32_USB_Device_Library/Core/src/usbd_core.c \
|
||||
|
@ -69,11 +51,7 @@ else
|
|||
usbF4/VCP/usbd_usr.c \
|
||||
usbF4/usb.c \
|
||||
usbF4/VCP/misc.c
|
||||
endif
|
||||
|
||||
ifneq ($(MCU_FAMILY), STM32F2)
|
||||
cSRCS_$(d) += bkp.c
|
||||
endif
|
||||
|
||||
sSRCS_$(d) := exc.S
|
||||
|
||||
|
|
|
@ -138,69 +138,8 @@
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(MCU_STM32F103RB)
|
||||
/* e.g., LeafLabs Maple */
|
||||
|
||||
#define STM32_NR_GPIO_PORTS 4
|
||||
#define STM32_DELAY_US_MULT 12
|
||||
#define STM32_SRAM_END ((void*)0x20005000)
|
||||
|
||||
#define NR_GPIO_PORTS STM32_NR_GPIO_PORTS
|
||||
#define DELAY_US_MULT STM32_DELAY_US_MULT
|
||||
|
||||
#elif defined(MCU_STM32F103ZE)
|
||||
/* e.g., LeafLabs Maple Native */
|
||||
|
||||
#define STM32_NR_GPIO_PORTS 7
|
||||
#define STM32_DELAY_US_MULT 12
|
||||
#define STM32_SRAM_END ((void*)0x20010000)
|
||||
|
||||
#define NR_GPIO_PORTS STM32_NR_GPIO_PORTS
|
||||
#define DELAY_US_MULT STM32_DELAY_US_MULT
|
||||
|
||||
#elif defined(MCU_STM32F103CB)
|
||||
/* e.g., LeafLabs Maple Mini */
|
||||
|
||||
/* This STM32_NR_GPIO_PORTS value is not, strictly speaking, true.
|
||||
* But only pins 0 and 1 exist, and they're used for OSC on the
|
||||
* Mini, so we'll live with this for now. */
|
||||
#define STM32_NR_GPIO_PORTS 3
|
||||
#define STM32_DELAY_US_MULT 12
|
||||
#define STM32_SRAM_END ((void*)0x20005000)
|
||||
|
||||
#define NR_GPIO_PORTS STM32_NR_GPIO_PORTS
|
||||
#define DELAY_US_MULT STM32_DELAY_US_MULT
|
||||
|
||||
#elif defined(MCU_STM32F103RE)
|
||||
/* e.g., LeafLabs Maple RET6 edition */
|
||||
|
||||
#define STM32_NR_GPIO_PORTS 4
|
||||
#define STM32_DELAY_US_MULT 12
|
||||
#define STM32_SRAM_END ((void*)0x20010000)
|
||||
|
||||
#define NR_GPIO_PORTS STM32_NR_GPIO_PORTS
|
||||
#define DELAY_US_MULT STM32_DELAY_US_MULT
|
||||
|
||||
#elif defined(MCU_STM32F103VE)
|
||||
/* e.g., LeafLabs Maple Native */
|
||||
|
||||
#define STM32_NR_GPIO_PORTS 5
|
||||
#define STM32_DELAY_US_MULT 12
|
||||
#define STM32_SRAM_END ((void*)0x20010000)
|
||||
|
||||
#define NR_GPIO_PORTS STM32_NR_GPIO_PORTS
|
||||
#define DELAY_US_MULT STM32_DELAY_US_MULT
|
||||
|
||||
#elif defined(MCU_STM32F205VE)
|
||||
#define STM32_TICKS_PER_US 120
|
||||
#define STM32_NR_GPIO_PORTS 5
|
||||
#define STM32_DELAY_US_MULT (STM32_TICKS_PER_US/3)
|
||||
#define STM32_SRAM_END ((void*)0x20010000)
|
||||
|
||||
#define NR_GPIO_PORTS STM32_NR_GPIO_PORTS
|
||||
#define DELAY_US_MULT STM32_DELAY_US_MULT
|
||||
|
||||
#elif defined(MCU_STM32F406VG)
|
||||
#if defined( STM32F4 )
|
||||
#define STM32_TICKS_PER_US 168
|
||||
#define STM32_NR_GPIO_PORTS 5
|
||||
#define STM32_DELAY_US_MULT (STM32_TICKS_PER_US/3)
|
||||
|
|
|
@ -113,13 +113,8 @@ typedef struct timer_bas_reg_map {
|
|||
} timer_bas_reg_map;
|
||||
|
||||
|
||||
#ifdef STM32F2
|
||||
/** Timer 1 register map base pointer */
|
||||
#define TIMER1_BASE ((struct timer_adv_reg_map*)0x40010000)
|
||||
#else
|
||||
/** Timer 1 register map base pointer */
|
||||
#define TIMER1_BASE ((struct timer_adv_reg_map*)0x40012C00)
|
||||
#endif
|
||||
/** Timer 2 register map base pointer */
|
||||
#define TIMER2_BASE ((struct timer_gen_reg_map*)0x40000000)
|
||||
/** Timer 3 register map base pointer */
|
||||
|
@ -133,14 +128,8 @@ typedef struct timer_bas_reg_map {
|
|||
#define TIMER6_BASE ((struct timer_bas_reg_map*)0x40001000)
|
||||
/** Timer 7 register map base pointer */
|
||||
#define TIMER7_BASE ((struct timer_bas_reg_map*)0x40001400)
|
||||
|
||||
#ifdef STM32F2
|
||||
/** Timer 8 register map base pointer */
|
||||
#define TIMER8_BASE ((struct timer_adv_reg_map*)0x40010400)
|
||||
#else
|
||||
/** Timer 8 register map base pointer */
|
||||
#define TIMER8_BASE ((struct timer_adv_reg_map*)0x40013400)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -62,11 +62,7 @@ typedef struct usart_reg_map {
|
|||
} usart_reg_map;
|
||||
|
||||
/** USART1 register map base pointer */
|
||||
#ifdef STM32F2
|
||||
#define USART1_BASE ((struct usart_reg_map*)0x40011000)
|
||||
#else
|
||||
#define USART1_BASE ((struct usart_reg_map*)0x40013800)
|
||||
#endif
|
||||
/** USART2 register map base pointer */
|
||||
#define USART2_BASE ((struct usart_reg_map*)0x40004400)
|
||||
/** USART3 register map base pointer */
|
||||
|
|
|
@ -173,7 +173,9 @@ typedef unsigned char u8;
|
|||
#elif defined (__ICCARM__) /* IAR Compiler */
|
||||
#define __packed __packed
|
||||
#elif defined ( __GNUC__ ) /* GNU Compiler */
|
||||
#ifndef __packed
|
||||
#define __packed __attribute__ ((__packed__))
|
||||
#endif
|
||||
#elif defined (__TASKING__) /* TASKING Compiler */
|
||||
#define __packed __unaligned
|
||||
#endif /* __CC_ARM */
|
||||
|
@ -206,7 +208,9 @@ typedef unsigned char u8;
|
|||
#elif defined (__ICCARM__) /* IAR Compiler */
|
||||
#define __packed __packed
|
||||
#elif defined ( __GNUC__ ) /* GNU Compiler */
|
||||
#ifndef __packed
|
||||
#define __packed __attribute__ ((__packed__))
|
||||
#endif
|
||||
#elif defined (__TASKING__) /* TASKING Compiler */
|
||||
#define __packed __unaligned
|
||||
#endif /* __CC_ARM */
|
||||
|
|
|
@ -255,7 +255,7 @@ typedef struct {
|
|||
|
||||
void systemHardReset(void) {
|
||||
SCB_TypeDef* rSCB = (SCB_TypeDef *) SCB_BASE;
|
||||
typedef void (*funcPtr)(void);
|
||||
//typedef void (*funcPtr)(void); // not used
|
||||
|
||||
/* Reset */
|
||||
rSCB->AIRCR = (u32)AIRCR_RESET_REQ;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "usbd_desc.h"
|
||||
#include "usb.h"
|
||||
#include <gpio.h>
|
||||
#include <rccF2.h>
|
||||
#include <rccF4.h>
|
||||
#include <usbd_cdc_vcp.h>
|
||||
|
||||
USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "wirish_math.h"
|
||||
#include "wirish_time.h"
|
||||
#include <wirish_constants.h>
|
||||
#include "HardwareSPI.h"
|
||||
#include "HardwareSerial.h"
|
||||
#include "HardwareTimer.h"
|
||||
#include "usb_serial.h"
|
||||
|
|
|
@ -28,9 +28,7 @@
|
|||
* @brief Arduino-compatible ADC implementation.
|
||||
*/
|
||||
|
||||
#include "libmaple.h"
|
||||
#include "wirish.h"
|
||||
#include "io.h"
|
||||
|
||||
/* Assumes that the ADC has been initialized and that the pin is set
|
||||
* to INPUT_ANALOG */
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include "wirish.h"
|
||||
#include "io.h"
|
||||
|
||||
|
||||
void pinMode(uint8 pin, WiringPinMode mode) {
|
||||
gpio_pin_mode outputMode;
|
||||
|
@ -111,21 +111,21 @@ void togglePin(uint8 pin) {
|
|||
|
||||
#define BUTTON_DEBOUNCE_DELAY 1
|
||||
|
||||
uint8 isButtonPressed() {
|
||||
if (digitalRead(BOARD_BUTTON_PIN)) {
|
||||
uint8 isButtonPressed(uint8_t button) {
|
||||
if (digitalRead(button)) {
|
||||
delay(BUTTON_DEBOUNCE_DELAY);
|
||||
while (digitalRead(BOARD_BUTTON_PIN))
|
||||
while (digitalRead(button))
|
||||
;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 waitForButtonPress(uint32 timeout) {
|
||||
uint8 waitForButtonPress(uint8_t button, uint32 timeout) {
|
||||
uint32 start = millis();
|
||||
uint32 time;
|
||||
if (timeout == 0) {
|
||||
while (!isButtonPressed())
|
||||
while (!isButtonPressed(button))
|
||||
;
|
||||
return true;
|
||||
}
|
||||
|
@ -136,6 +136,6 @@ uint8 waitForButtonPress(uint32 timeout) {
|
|||
time - start > timeout) {
|
||||
return false;
|
||||
}
|
||||
} while (!isButtonPressed());
|
||||
} while (!isButtonPressed(button));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,20 @@
|
|||
* @brief Stores STM32-specific information related to a given Maple pin.
|
||||
* @see PIN_MAP
|
||||
*/
|
||||
#ifdef BOARD_black_f4
|
||||
// restructure members to build consecutive pairs
|
||||
typedef struct stm32_pin_info {
|
||||
gpio_dev *gpio_device; /**< Maple pin's GPIO device */
|
||||
uint8 gpio_bit; /**< Pin's GPIO port bit. */
|
||||
timer_dev *timer_device; /**< Pin's timer device, if any. */
|
||||
uint8 timer_channel; /**< Timer channel, or 0 if none. */
|
||||
const adc_dev *adc_device; /**< ADC device, if any. */
|
||||
uint8 adc_channel; /**< Pin ADC channel, or ADCx if none. */
|
||||
uint8 filler;
|
||||
} stm32_pin_info;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct stm32_pin_info {
|
||||
gpio_dev *gpio_device; /**< Maple pin's GPIO device */
|
||||
timer_dev *timer_device; /**< Pin's timer device, if any. */
|
||||
|
@ -58,6 +72,7 @@ typedef struct stm32_pin_info {
|
|||
uint8 filler;
|
||||
} stm32_pin_info;
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Variable attribute, instructs the linker to place the marked
|
||||
* variable in Flash instead of RAM. */
|
||||
|
|
|
@ -12,13 +12,13 @@ version=0.1.0
|
|||
|
||||
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
||||
compiler.c.cmd=arm-none-eabi-gcc
|
||||
compiler.c.flags=-c -g -Os -w -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
||||
compiler.c.flags=-c -g -Os -Wall -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
||||
compiler.c.elf.cmd=arm-none-eabi-g++
|
||||
compiler.c.elf.flags=-Os -Wl,--gc-sections
|
||||
compiler.S.cmd=arm-none-eabi-gcc
|
||||
compiler.S.flags=-c -g -x assembler-with-cpp -MMD
|
||||
compiler.cpp.cmd=arm-none-eabi-g++
|
||||
compiler.cpp.flags=-c -g -Os -w -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
||||
compiler.cpp.flags=-c -g -Os -Wall -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
||||
compiler.ar.cmd=arm-none-eabi-ar
|
||||
compiler.ar.flags=rcs
|
||||
compiler.objcopy.cmd=arm-none-eabi-objcopy
|
||||
|
@ -44,12 +44,10 @@ compiler.ar.extra_flags=
|
|||
compiler.elf2hex.extra_flags=
|
||||
|
||||
|
||||
|
||||
##compiler.libs.c.flags="-I{build.system.path}/libmaple" "-I{build.system.path}/libmaple/include" "-I{build.system.path}/libmaple/stm32f1/include" "-I{build.system.path}/libmaple/stm32f1/include/series" "-I{build.system.path}/libmaple/usb/stm32f1" "-I{build.system.path}/libmaple/usb/usb_lib"
|
||||
#compiler.libs.c.flags="-I{build.system.path}/libmaple" "-I{build.system.path}/libmaple/include" "-I{build.system.path}/libmaple/stm32f1/include" "-I{build.system.path}/libmaple/usb/stm32f1" "-I{build.system.path}/libmaple/usb/usb_lib"
|
||||
|
||||
|
||||
compiler.libs.c.flags="-I{build.core.path}/libmaple" -I{build.core.path}/libmaple/usbF4 -I{build.core.path}/libmaple/usbF4/STM32_USB_Device_Library/Core/inc -I{build.core.path}/libmaple/usbF4/STM32_USB_Device_Library/Class/cdc/inc -I{build.core.path}/libmaple/usbF4/STM32_USB_OTG_Driver/inc -I{build.core.path}/libmaple/usbF4/VCP
|
||||
compiler.libs.c.flags=-I{build.core.path} -I{build.core.path}/libmaple -I{build.core.path}/libmaple/usbF4 -I{build.core.path}/libmaple/usbF4/STM32_USB_Device_Library/Core/inc -I{build.core.path}/libmaple/usbF4/STM32_USB_Device_Library/Class/cdc/inc -I{build.core.path}/libmaple/usbF4/STM32_USB_OTG_Driver/inc -I{build.core.path}/libmaple/usbF4/VCP
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue