diff options
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/gpio.c | 3 | ||||
-rw-r--r-- | libmaple/libmaple.h | 26 | ||||
-rw-r--r-- | libmaple/timers.h | 2 | ||||
-rw-r--r-- | libmaple/usb/usb.c | 9 |
4 files changed, 21 insertions, 19 deletions
diff --git a/libmaple/gpio.c b/libmaple/gpio.c index 3940837..71e5230 100644 --- a/libmaple/gpio.c +++ b/libmaple/gpio.c @@ -34,8 +34,9 @@ void gpio_init(void) { rcc_clk_enable(RCC_GPIOA); rcc_clk_enable(RCC_GPIOB); rcc_clk_enable(RCC_GPIOC); +#if NR_GPIO_PORTS >= 4 /* Maple, but not Maple Mini */ rcc_clk_enable(RCC_GPIOD); -#if NR_GPIO_PORTS >= 7 +#elif NR_GPIO_PORTS >= 7 /* Maple Native (high density only) */ rcc_clk_enable(RCC_GPIOE); rcc_clk_enable(RCC_GPIOF); rcc_clk_enable(RCC_GPIOG); diff --git a/libmaple/libmaple.h b/libmaple/libmaple.h index 74488ab..225d7c4 100644 --- a/libmaple/libmaple.h +++ b/libmaple/libmaple.h @@ -43,7 +43,7 @@ #endif /* MCU-specific configuration */ -#ifdef MCU_STM32F103RB +#if defined(MCU_STM32F103RB) /* e.g., LeafLabs Maple */ /* Number of GPIO ports (GPIOA, GPIOB, etc.) */ @@ -80,8 +80,8 @@ #define STACK_TOP 0x20000800 /* Debug port settings (from ASSERT) */ - #define ERROR_LED_PORT GPIOA_BASE - #define ERROR_LED_PIN 5 + #define ERROR_LED_PORT GPIOB_BASE + #define ERROR_LED_PIN 12 #define ERROR_USART_NUM USART2 #define ERROR_USART_BAUD 9600 #define ERROR_TX_PORT GPIOA_BASE @@ -97,15 +97,14 @@ #define BITBAND_SRAM_BASE 0x22000000 #define BITBAND_PERI_REF 0x40000000 #define BITBAND_PERI_BASE 0x42000000 -#endif -#ifdef MCU_STM32F103ZE +#elif defined(MCU_STM32F103ZE) /* e.g., LeafLabs Maple Native */ #define NR_GPIO_PORTS 7 - #define NR_GPIO_PINS 63 + #define NR_GPIO_PINS 100 #define NR_TIMERS 8 - #define NR_USART 3 + #define NR_USART 5 /* NB: 4 and 5 are UART only */ #define NR_FSMC 1 #define NR_DAC_PINS 2 @@ -135,9 +134,8 @@ #define BITBAND_SRAM_BASE 0x22000000 #define BITBAND_PERI_REF 0x40000000 #define BITBAND_PERI_BASE 0x42000000 -#endif -#ifdef MCU_STM32F103CB +#elif defined(MCU_STM32F103CB) /* e.g., LeafLabs Maple Mini */ #define NR_GPIO_PORTS 3 @@ -151,7 +149,7 @@ #define VCOM_ID_PRODUCT 0x0005 #define USB_DISC_BANK GPIOB_BASE #define USB_DISC_PIN 9 - #define USB_CONFIG_MAX_POWER (100 >> 1) /* WTF does this mean */ + #define USB_CONFIG_MAX_POWER (100 >> 1) #define RESET_DELAY 100 #define USER_ADDR_ROM 0x08005000 @@ -174,12 +172,12 @@ #define BITBAND_SRAM_BASE 0x22000000 #define BITBAND_PERI_REF 0x40000000 #define BITBAND_PERI_BASE 0x42000000 -#endif -/* Make sure MCU-specific settings were defined */ -#ifndef NR_GPIO_PORTS -#error "No MCU type specified. Add something like -DMCU_STM32F103RB " \ +#else + +#error "No MCU type specified. Add something like -DMCU_STM32F103RB " \ "to your compiler arguments (probably in a Makefile)." + #endif /* Requires board configuration info */ diff --git a/libmaple/timers.h b/libmaple/timers.h index 8d28f60..99bcab6 100644 --- a/libmaple/timers.h +++ b/libmaple/timers.h @@ -208,6 +208,8 @@ typedef enum { TIMER4, /*< General purpose timer TIM4 */ #if NR_TIMERS >= 8 TIMER5, /*< General purpose timer TIM5; high density only */ + /* FIXME maple native: put timers 6 and 7 back in and make the + corresponding changes to timers.c */ /* TIMER6, /\*< Basic timer TIM6; high density only *\/ */ /* TIMER7, /\*< Basic timer TIM7; high density only *\/ */ TIMER8, /*< Advanced control timer TIM8; high density only */ diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c index 4e86ed0..d875785 100644 --- a/libmaple/usb/usb.c +++ b/libmaple/usb/usb.c @@ -332,9 +332,9 @@ void usbWaitReset(void) { * This function will quickly copy up to 64 bytes of data (out of an * arbitrarily large buffer) into the USB peripheral TX buffer and return the * number placed in that buffer. It is up to usercode to divide larger packets - * into 64-byte chunks to guarantee delivery. + * into 64-byte chunks to guarantee delivery. + * * - * */ void usbBlockingSendByte(char ch) { while (countTx); @@ -345,7 +345,8 @@ void usbBlockingSendByte(char ch) { while (countTx); } uint32 usbSendBytes(uint8* sendBuf, uint32 len) { - /* any checks on connection (via dtr/rts) done upstream in wirish or by user */ + /* any checks on connection (via dtr/rts) done upstream in wirish or + by user */ /* last xmit hasnt finished, abort */ if (countTx) { @@ -361,8 +362,8 @@ uint32 usbSendBytes(uint8* sendBuf, uint32 len) { if (len) { UserToPMABufferCopy(sendBuf,VCOM_TX_ADDR, len); _SetEPTxCount(VCOM_TX_ENDP, len); - _SetEPTxValid(VCOM_TX_ENDP); countTx += len; + _SetEPTxValid(VCOM_TX_ENDP); } return len; |