add stm32f412cx micro to cpy
This commit is contained in:
parent
bfd56d4380
commit
46129e327d
|
@ -82,6 +82,13 @@ typedef struct {
|
||||||
#include "stm32f4/stm32f411xe/periph.h"
|
#include "stm32f4/stm32f411xe/periph.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef STM32F412Cx
|
||||||
|
#define HAS_DAC 0
|
||||||
|
#define HAS_TRNG 1
|
||||||
|
#define HAS_BASIC_TIM 1
|
||||||
|
#include "stm32f4/stm32f412cx/periph.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef STM32F412Zx
|
#ifdef STM32F412Zx
|
||||||
#define HAS_DAC 0
|
#define HAS_DAC 0
|
||||||
#define HAS_TRNG 1
|
#define HAS_TRNG 1
|
||||||
|
|
|
@ -82,6 +82,9 @@ extern const mp_obj_type_t mcu_pin_type;
|
||||||
#ifdef STM32F411xE
|
#ifdef STM32F411xE
|
||||||
#include "stm32f4/stm32f411xe/pins.h"
|
#include "stm32f4/stm32f411xe/pins.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef STM32F412Cx
|
||||||
|
#include "stm32f4/stm32f412cx/pins.h"
|
||||||
|
#endif
|
||||||
#ifdef STM32F412Zx
|
#ifdef STM32F412Zx
|
||||||
#include "stm32f4/stm32f412zx/pins.h"
|
#include "stm32f4/stm32f412zx/pins.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
#ifdef STM32F411xE
|
#ifdef STM32F411xE
|
||||||
#include "stm32f4/stm32f411xe/clocks.h"
|
#include "stm32f4/stm32f411xe/clocks.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef STM32F412Cx
|
||||||
|
#include "stm32f4/stm32f412cx/clocks.h"
|
||||||
|
#endif
|
||||||
#ifdef STM32F412Zx
|
#ifdef STM32F412Zx
|
||||||
#include "stm32f4/stm32f412zx/clocks.h"
|
#include "stm32f4/stm32f412zx/clocks.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Micro Python project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stm32f4xx_hal.h"
|
||||||
|
|
||||||
|
// Chip: STM32F412Cx
|
||||||
|
// Line Type: Access Line
|
||||||
|
// Speed: 100MHz (MAX)
|
||||||
|
|
||||||
|
// Note - uses the I2S PLL for USB to enable full 100MHz operation, since USB
|
||||||
|
// can't get the right divisors from 100MHz PLL settings.
|
||||||
|
|
||||||
|
// Defaults:
|
||||||
|
#ifndef CPY_CLK_VSCALE
|
||||||
|
#define CPY_CLK_VSCALE (PWR_REGULATOR_VOLTAGE_SCALE1)
|
||||||
|
#endif
|
||||||
|
#ifndef CPY_CLK_PLLN
|
||||||
|
#define CPY_CLK_PLLN (200)
|
||||||
|
#endif
|
||||||
|
#ifndef CPY_CLK_PLLP
|
||||||
|
#define CPY_CLK_PLLP (RCC_PLLP_DIV2)
|
||||||
|
#endif
|
||||||
|
#ifndef CPY_CLK_PLLQ
|
||||||
|
#define CPY_CLK_PLLQ (7)
|
||||||
|
#endif
|
||||||
|
#ifndef CPY_CLK_AHBDIV
|
||||||
|
#define CPY_CLK_AHBDIV (RCC_SYSCLK_DIV1)
|
||||||
|
#endif
|
||||||
|
#ifndef CPY_CLK_APB1DIV
|
||||||
|
#define CPY_CLK_APB1DIV (RCC_HCLK_DIV2)
|
||||||
|
#endif
|
||||||
|
#ifndef CPY_CLK_APB2DIV
|
||||||
|
#define CPY_CLK_APB2DIV (RCC_HCLK_DIV1)
|
||||||
|
#endif
|
||||||
|
#ifndef CPY_CLK_FLASH_LATENCY
|
||||||
|
#define CPY_CLK_FLASH_LATENCY (FLASH_LATENCY_3)
|
||||||
|
#endif
|
||||||
|
#ifndef CPY_CLK_USB_USES_AUDIOPLL
|
||||||
|
#define CPY_CLK_USB_USES_AUDIOPLL (1)
|
||||||
|
#endif
|
||||||
|
#ifndef BOARD_HSE_SOURCE
|
||||||
|
#define BOARD_HSE_SOURCE (RCC_HSE_ON)
|
||||||
|
#endif
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Micro Python project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "peripherals/gpio.h"
|
||||||
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
|
|
||||||
|
void stm32_peripherals_gpio_init(void) {
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
|
||||||
|
// Never reset pins
|
||||||
|
never_reset_pin_number(0,13); // PA13 SWDIO
|
||||||
|
never_reset_pin_number(0,14); // PA14 SWCLK
|
||||||
|
}
|
|
@ -0,0 +1,160 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "py/obj.h"
|
||||||
|
#include "py/mphal.h"
|
||||||
|
#include "peripherals/pins.h"
|
||||||
|
#include "peripherals/periph.h"
|
||||||
|
|
||||||
|
// I2C
|
||||||
|
|
||||||
|
I2C_TypeDef *mcu_i2c_banks[I2C_BANK_ARRAY_LEN] = {I2C1, I2C2, I2C3};
|
||||||
|
|
||||||
|
const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN] = {
|
||||||
|
PERIPH(1, 4, &pin_PB07),
|
||||||
|
PERIPH(1, 4, &pin_PB09),
|
||||||
|
PERIPH(2, 9, &pin_PB03),
|
||||||
|
PERIPH(2, 9, &pin_PB09),
|
||||||
|
PERIPH(3, 9, &pin_PB04),
|
||||||
|
PERIPH(3, 9, &pin_PB08)
|
||||||
|
};
|
||||||
|
|
||||||
|
const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN] = {
|
||||||
|
PERIPH(1, 4, &pin_PB06),
|
||||||
|
PERIPH(1, 4, &pin_PB08),
|
||||||
|
PERIPH(2, 4, &pin_PB10),
|
||||||
|
PERIPH(3, 4, &pin_PA08)
|
||||||
|
};
|
||||||
|
|
||||||
|
// SPI
|
||||||
|
|
||||||
|
SPI_TypeDef *mcu_spi_banks[SPI_BANK_ARRAY_LEN] = {SPI1, SPI2, SPI3, SPI4, SPI5};
|
||||||
|
|
||||||
|
const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN] = {
|
||||||
|
PERIPH(1, 5, &pin_PA05),
|
||||||
|
PERIPH(1, 5, &pin_PB03),
|
||||||
|
PERIPH(2, 5, &pin_PB10),
|
||||||
|
PERIPH(2, 5, &pin_PB13),
|
||||||
|
PERIPH(3, 6, &pin_PB03),
|
||||||
|
PERIPH(3, 7, &pin_PB12),
|
||||||
|
PERIPH(4, 6, &pin_PB13),
|
||||||
|
PERIPH(5, 6, &pin_PB00)
|
||||||
|
};
|
||||||
|
|
||||||
|
const mcu_periph_obj_t mcu_spi_mosi_list[SPI_MOSI_ARRAY_LEN] = {
|
||||||
|
PERIPH(1, 5, &pin_PA07),
|
||||||
|
PERIPH(1, 5, &pin_PB05),
|
||||||
|
PERIPH(2, 5, &pin_PB15),
|
||||||
|
PERIPH(3, 6, &pin_PB05),
|
||||||
|
PERIPH(4, 5, &pin_PA01),
|
||||||
|
PERIPH(5, 6, &pin_PA10),
|
||||||
|
PERIPH(5, 6, &pin_PB08)
|
||||||
|
};
|
||||||
|
|
||||||
|
const mcu_periph_obj_t mcu_spi_miso_list[SPI_MISO_ARRAY_LEN] = {
|
||||||
|
PERIPH(1, 5, &pin_PA06),
|
||||||
|
PERIPH(1, 5, &pin_PB04),
|
||||||
|
PERIPH(2, 5, &pin_PB14),
|
||||||
|
PERIPH(3, 6, &pin_PB04),
|
||||||
|
PERIPH(4, 6, &pin_PA11),
|
||||||
|
PERIPH(5, 6, &pin_PA12)
|
||||||
|
};
|
||||||
|
|
||||||
|
const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN] = {
|
||||||
|
PERIPH(1, 5, &pin_PA04),
|
||||||
|
PERIPH(1, 5, &pin_PA15),
|
||||||
|
PERIPH(2, 5, &pin_PB09),
|
||||||
|
PERIPH(2, 5, &pin_PB12),
|
||||||
|
PERIPH(3, 6, &pin_PA04),
|
||||||
|
PERIPH(3, 6, &pin_PA15),
|
||||||
|
PERIPH(4, 6, &pin_PB12),
|
||||||
|
PERIPH(5, 6, &pin_PB01)
|
||||||
|
};
|
||||||
|
|
||||||
|
// UART
|
||||||
|
|
||||||
|
USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, NULL, NULL, USART6};
|
||||||
|
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true};
|
||||||
|
|
||||||
|
const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN] = {
|
||||||
|
PERIPH(1, 7, &pin_PA09),
|
||||||
|
PERIPH(1, 7, &pin_PA15),
|
||||||
|
PERIPH(1, 7, &pin_PB06),
|
||||||
|
PERIPH(2, 7, &pin_PA02),
|
||||||
|
PERIPH(3, 7, &pin_PB10),
|
||||||
|
PERIPH(6, 8, &pin_PA11)
|
||||||
|
};
|
||||||
|
|
||||||
|
const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN] = {
|
||||||
|
PERIPH(1, 7, &pin_PA10),
|
||||||
|
PERIPH(1, 7, &pin_PB03),
|
||||||
|
PERIPH(1, 7, &pin_PB07),
|
||||||
|
PERIPH(2, 7, &pin_PA03),
|
||||||
|
PERIPH(6, 8, &pin_PA12)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Timers
|
||||||
|
// TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
|
||||||
|
TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
|
||||||
|
TIM11, TIM12, TIM13, TIM14};
|
||||||
|
|
||||||
|
// TIM8
|
||||||
|
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN] = {
|
||||||
|
TIM(1, 1, 1, &pin_PA08),
|
||||||
|
TIM(1, 1, 2, &pin_PA09),
|
||||||
|
TIM(1, 1, 3, &pin_PA10),
|
||||||
|
TIM(1, 1, 4, &pin_PA11),
|
||||||
|
TIM(2, 1, 1, &pin_PA00),
|
||||||
|
TIM(2, 1, 1, &pin_PA05),
|
||||||
|
TIM(2, 1, 1, &pin_PA15),
|
||||||
|
TIM(2, 1, 2, &pin_PA01),
|
||||||
|
TIM(2, 1, 2, &pin_PB03),
|
||||||
|
TIM(2, 1, 3, &pin_PA02),
|
||||||
|
TIM(2, 1, 3, &pin_PB10),
|
||||||
|
TIM(2, 1, 4, &pin_PA03),
|
||||||
|
TIM(3, 2, 1, &pin_PA06),
|
||||||
|
TIM(3, 2, 1, &pin_PB04),
|
||||||
|
TIM(3, 2, 2, &pin_PA07),
|
||||||
|
TIM(3, 2, 2, &pin_PB05),
|
||||||
|
TIM(3, 2, 3, &pin_PB00),
|
||||||
|
TIM(3, 2, 4, &pin_PB01),
|
||||||
|
TIM(4, 2, 1, &pin_PB06),
|
||||||
|
TIM(4, 2, 2, &pin_PB07),
|
||||||
|
TIM(4, 2, 3, &pin_PB08),
|
||||||
|
TIM(4, 2, 4, &pin_PB09),
|
||||||
|
TIM(5, 2, 1, &pin_PA00),
|
||||||
|
TIM(5, 2, 2, &pin_PA01),
|
||||||
|
TIM(5, 2, 3, &pin_PA02),
|
||||||
|
TIM(5, 2, 4, &pin_PA03),
|
||||||
|
TIM(9, 3, 1, &pin_PA02),
|
||||||
|
TIM(9, 3, 2, &pin_PA03),
|
||||||
|
TIM(10, 3, 1, &pin_PB08),
|
||||||
|
TIM(11, 3, 1, &pin_PB09),
|
||||||
|
TIM(12, 9, 1, &pin_PB14),
|
||||||
|
TIM(12, 9, 2, &pin_PB15),
|
||||||
|
TIM(13, 9, 1, &pin_PA06),
|
||||||
|
TIM(14, 9, 1, &pin_PA07)
|
||||||
|
};
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412CX_PERIPH_H
|
||||||
|
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412CX_PERIPH_H
|
||||||
|
|
||||||
|
// I2C
|
||||||
|
#define I2C_BANK_ARRAY_LEN 3
|
||||||
|
#define I2C_SDA_ARRAY_LEN 6
|
||||||
|
#define I2C_SCL_ARRAY_LEN 4
|
||||||
|
extern I2C_TypeDef *mcu_i2c_banks[I2C_BANK_ARRAY_LEN];
|
||||||
|
extern const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN];
|
||||||
|
extern const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN];
|
||||||
|
|
||||||
|
|
||||||
|
// SPI
|
||||||
|
#define SPI_BANK_ARRAY_LEN 5
|
||||||
|
#define SPI_SCK_ARRAY_LEN 8
|
||||||
|
#define SPI_MOSI_ARRAY_LEN 7
|
||||||
|
#define SPI_MISO_ARRAY_LEN 6
|
||||||
|
#define SPI_NSS_ARRAY_LEN 8
|
||||||
|
extern SPI_TypeDef *mcu_spi_banks[SPI_BANK_ARRAY_LEN];
|
||||||
|
extern const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN];
|
||||||
|
extern const mcu_periph_obj_t mcu_spi_mosi_list[SPI_MOSI_ARRAY_LEN];
|
||||||
|
extern const mcu_periph_obj_t mcu_spi_miso_list[SPI_MISO_ARRAY_LEN];
|
||||||
|
extern const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN];
|
||||||
|
|
||||||
|
// UART
|
||||||
|
#define UART_TX_ARRAY_LEN 6
|
||||||
|
#define UART_RX_ARRAY_LEN 5
|
||||||
|
extern USART_TypeDef *mcu_uart_banks[MAX_UART];
|
||||||
|
extern bool mcu_uart_has_usart[MAX_UART];
|
||||||
|
extern const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN];
|
||||||
|
extern const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN];
|
||||||
|
|
||||||
|
// Timers
|
||||||
|
#define TIM_BANK_ARRAY_LEN 14
|
||||||
|
#define TIM_PIN_ARRAY_LEN 34
|
||||||
|
extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN];
|
||||||
|
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
|
||||||
|
|
||||||
|
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412CX_PERIPH_H
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "py/obj.h"
|
||||||
|
#include "py/mphal.h"
|
||||||
|
#include "peripherals/pins.h"
|
||||||
|
|
||||||
|
const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1,0));
|
||||||
|
const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1,1));
|
||||||
|
const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1,2));
|
||||||
|
const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1,3));
|
||||||
|
const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1,4));
|
||||||
|
const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1,5));
|
||||||
|
const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1,6));
|
||||||
|
const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1,7));
|
||||||
|
const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC);
|
||||||
|
|
||||||
|
const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1,8));
|
||||||
|
const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1,9));
|
||||||
|
const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC);
|
||||||
|
const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC);
|
||||||
|
|
||||||
|
const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); // anti-tamp
|
||||||
|
const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); // OSC32_IN
|
||||||
|
const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); // OSC32_OUT
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412CX_PINS_H
|
||||||
|
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412CX_PINS_H
|
||||||
|
|
||||||
|
// pg 50
|
||||||
|
extern const mcu_pin_obj_t pin_PC13;
|
||||||
|
extern const mcu_pin_obj_t pin_PC14;
|
||||||
|
// pg 51
|
||||||
|
extern const mcu_pin_obj_t pin_PC15;
|
||||||
|
// pg 52
|
||||||
|
extern const mcu_pin_obj_t pin_PA00;
|
||||||
|
extern const mcu_pin_obj_t pin_PA01;
|
||||||
|
extern const mcu_pin_obj_t pin_PA02;
|
||||||
|
// pg 53
|
||||||
|
extern const mcu_pin_obj_t pin_PA03;
|
||||||
|
extern const mcu_pin_obj_t pin_PA04;
|
||||||
|
extern const mcu_pin_obj_t pin_PA05;
|
||||||
|
extern const mcu_pin_obj_t pin_PA06;
|
||||||
|
extern const mcu_pin_obj_t pin_PA07;
|
||||||
|
// pg 54
|
||||||
|
extern const mcu_pin_obj_t pin_PB00;
|
||||||
|
extern const mcu_pin_obj_t pin_PB01;
|
||||||
|
extern const mcu_pin_obj_t pin_PB02;
|
||||||
|
// pg 55
|
||||||
|
// none
|
||||||
|
// pg 56
|
||||||
|
extern const mcu_pin_obj_t pin_PB10;
|
||||||
|
extern const mcu_pin_obj_t pin_PB12;
|
||||||
|
extern const mcu_pin_obj_t pin_PB13;
|
||||||
|
// pg 57
|
||||||
|
extern const mcu_pin_obj_t pin_PB14;
|
||||||
|
extern const mcu_pin_obj_t pin_PB15;
|
||||||
|
// pg 58
|
||||||
|
// none
|
||||||
|
// pg 59
|
||||||
|
extern const mcu_pin_obj_t pin_PA08;
|
||||||
|
extern const mcu_pin_obj_t pin_PA09;
|
||||||
|
extern const mcu_pin_obj_t pin_PA10;
|
||||||
|
// pg 60
|
||||||
|
extern const mcu_pin_obj_t pin_PA11;
|
||||||
|
extern const mcu_pin_obj_t pin_PA12;
|
||||||
|
extern const mcu_pin_obj_t pin_PA13;
|
||||||
|
extern const mcu_pin_obj_t pin_PA14;
|
||||||
|
extern const mcu_pin_obj_t pin_PA15;
|
||||||
|
// pg 61
|
||||||
|
// none
|
||||||
|
// pg 62
|
||||||
|
extern const mcu_pin_obj_t pin_PB03;
|
||||||
|
extern const mcu_pin_obj_t pin_PB04;
|
||||||
|
// pg 63
|
||||||
|
extern const mcu_pin_obj_t pin_PB05;
|
||||||
|
extern const mcu_pin_obj_t pin_PB06;
|
||||||
|
extern const mcu_pin_obj_t pin_PB07;
|
||||||
|
extern const mcu_pin_obj_t pin_PB08;
|
||||||
|
extern const mcu_pin_obj_t pin_PB09;
|
||||||
|
|
||||||
|
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412CX_PINS_H
|
|
@ -49,6 +49,16 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef STM32F412Cx
|
||||||
|
#define STM32_FLASH_SIZE 0x100000 // 1MB
|
||||||
|
#ifndef INTERNAL_FLASH_FILESYSTEM_SIZE
|
||||||
|
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 // 48KiB
|
||||||
|
#endif
|
||||||
|
#ifndef INTERNAL_FLASH_FILESYSTEM_START_ADDR
|
||||||
|
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef STM32F412Zx
|
#ifdef STM32F412Zx
|
||||||
#define STM32_FLASH_SIZE 0x100000 // 1MB
|
#define STM32_FLASH_SIZE 0x100000 // 1MB
|
||||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 // 48KiB
|
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 // 48KiB
|
||||||
|
|
Loading…
Reference in New Issue