8000 Merge pull request #10211 from blues/blues-add-cygnet · adafruit/circuitpython@ad73d0b · GitHub
[go: up one dir, main page]

Skip to content
< 10000 style data-styled="true" data-styled-version="5.3.11">.hEHvLI{min-width:0;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .bmcJak{min-width:0;}/*!sc*/ .fyKNMY[data-size="medium"]{color:var(--fgColor-default,var(--color-fg-default,#1F2328));}/*!sc*/ .gUkoLg{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}/*!sc*/ .dpBUfI{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ @media screen and (min-width:544px){.dpBUfI{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}}/*!sc*/ @media screen and (min-width:768px){.dpBUfI{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}}/*!sc*/ @media screen and (min-width:1012px){.dpBUfI{-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;}}/*!sc*/ .hKWjvQ{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .cvdqJW{width:20px;height:20px;margin-right:8px;margin-top:-1px;margin-left:1px;}/*!sc*/ .dkaFxu{font-weight:600;white-space:nowrap;color:var(--fgColor-default,var(--color-fg-default,#1F2328));}/*!sc*/ .dkaFxu:hover{color:var(--fgColor-default,var(--color-fg-default,#1F2328));-webkit-text-decoration:underline;text-decoration:underline;}/*!sc*/ .irPhWZ{width:60px;}/*!sc*/ .dNbsEP{width:62px;}/*!sc*/ .kHfwUD{width:60px;height:22px;}/*!sc*/ .bHLmSv{position:absolute;inset:0 -2px;cursor:col-resize;background-color:transparent;-webkit-transition-delay:0.1s;transition-delay:0.1s;}/*!sc*/ .bHLmSv:hover{background-color:var(--bgColor-neutral-muted,var(--color-neutral-muted,rgba(175,184,193,0.2)));}/*!sc*/ .hqtbbn{bottom:0 !important;-webkit-clip:rect(1px,1px,1px,1px);clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:84px;position:absolute;width:320px;}/*!sc*/ data-styled.g1[id="Box-sc-g0xbh4-0"]{content:"hEHvLI,bmcJak,fyKNMY,gUkoLg,dpBUfI,hKWjvQ,cvdqJW,dkaFxu,irPhWZ,dNbsEP,kHfwUD,bHLmSv,hqtbbn,"}/*!sc*/ .brGdpi{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;-webkit-clip:rect(0,0,0,0);clip:rect(0,0,0,0);white-space:nowrap;border-width:0;}/*!sc*/ data-styled.g4[id="_VisuallyHidden__VisuallyHidden-sc-11jhm7a-0"]{content:"brGdpi,"}/*!sc*/ .jjwhNb{position:relative;display:inline-block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}/*!sc*/ .jjwhNb::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";-webkit-font-smoothing:subpixel-antialiased;color:var(--tooltip-fgColor,var(--fgColor-onEmphasis,var(--color-fg-on-emphasis,#ffffff)));text-align:center;-webkit-text-decoration:none;text-decoration:none;text-shadow:none;text-transform:none;-webkit-letter-spacing:normal;-moz-letter-spacing:normal;-ms-letter-spacing:normal;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:var(--tooltip-bgColor,var(--bgColor-emphasis,var(--color-neutral-emphasis-plus,#24292f)));border-radius:6px;opacity:0;}/*!sc*/ @-webkit-keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ @keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ .jjwhNb:hover::after,.jjwhNb:active::after,.jjwhNb:focus::after,.jjwhNb:focus-within::after{display:inline-block;-webkit-text-decoration:none;text-decoration:none;-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .jjwhNb.tooltipped-no-delay:hover::after,.jjwhNb.tooltipped-no-delay:active::after,.jjwhNb.tooltipped-no-delay:focus::after,.jjwhNb.tooltipped-no-delay:focus-within::after{-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .jjwhNb.tooltipped-multiline:hover::after,.jjwhNb.tooltipped-multiline:active::after,.jjwhNb.tooltipped-multiline:focus::after,.jjwhNb.tooltipped-multiline:focus-within::after{display:table-cell;}/*!sc*/ .jjwhNb.tooltipped-s::after,.jjwhNb.tooltipped-se::after,.jjwhNb.tooltipped-sw::after{top:100%;right:50%;margin-top:6px;}/*!sc*/ .jjwhNb.tooltipped-se::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .jjwhNb.tooltipped-sw::after{margin-right:-16px;}/*!sc*/ .jjwhNb.tooltipped-n::after,.jjwhNb.tooltipped-ne::after,.jjwhNb.tooltipped-nw::after{right:50%;bottom:100%;margin-bottom:6px;}/*!sc*/ .jjwhNb.tooltipped-ne::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .jjwhNb.tooltipped-nw::after{margin-right:-16px;}/*!sc*/ .jjwhNb.tooltipped-s::after,.jjwhNb.tooltipped-n::after{-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%);}/*!sc*/ .jjwhNb.tooltipped-w::after{right:100%;bottom:50%;margin-right:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .jjwhNb.tooltipped-e::after{bottom:50%;left:100%;margin-left:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .jjwhNb.tooltipped-multiline::after{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}/*!sc*/ .jjwhNb.tooltipped-multiline.tooltipped-s::after,.jjwhNb.tooltipped-multiline.tooltipped-n::after{right:auto;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);}/*!sc*/ .jjwhNb.tooltipped-multiline.tooltipped-w::after,.jjwhNb.tooltipped-multiline.tooltipped-e::after{right:100%;}/*!sc*/ .jjwhNb.tooltipped-align-right-2::after{right:0;margin-right:0;}/*!sc*/ .jjwhNb.tooltipped-align-left-2::after{left:0;margin-left:0;}/*!sc*/ .hWlpPn{position:relative;display:inline-block;}/*!sc*/ .hWlpPn::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";-webkit-font-smoothing:subpixel-antialiased;color:var(--tooltip-fgColor,var(--fgColor-onEmphasis,var(--color-fg-on-emphasis,#ffffff)));text-align:center;-webkit-text-decoration:none;text-decoration:none;text-shadow:none;text-transform:none;-webkit-letter-spacing:normal;-moz-letter-spacing:normal;-ms-letter-spacing:normal;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:var(--tooltip-bgColor,var(--bgColor-emphasis,var(--color-neutral-emphasis-plus,#24292f)));border-radius:6px;opacity:0;}/*!sc*/ @-webkit-keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ @keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ .hWlpPn:hover::after,.hWlpPn:active::after,.hWlpPn:focus::after,.hWlpPn:focus-within::after{display:inline-block;-webkit-text-decoration:none;text-decoration:none;-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .hWlpPn.tooltipped-no-delay:hover::after,.hWlpPn.tooltipped-no-delay:active::after,.hWlpPn.tooltipped-no-delay:focus::after,.hWlpPn.tooltipped-no-delay:focus-within::after{-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .hWlpPn.tooltipped-multiline:hover::after,.hWlpPn.tooltipped-multiline:active::after,.hWlpPn.tooltipped-multiline:focus::after,.hWlpPn.tooltipped-multiline:focus-within::after{display:table-cell;}/*!sc*/ .hWlpPn.tooltipped-s::after,.hWlpPn.tooltipped-se::after,.hWlpPn.tooltipped-sw::after{top:100%;right:50%;margin-top:6px;}/*!sc*/ .hWlpPn.tooltipped-se::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .hWlpPn.tooltipped-sw::after{margin-right:-16px;}/*!sc*/ .hWlpPn.tooltipped-n::after,.hWlpPn.tooltipped-ne::after,.hWlpPn.tooltipped-nw::after{right:50%;bottom:100%;margin-bottom:6px;}/*!sc*/ .hWlpPn.tooltipped-ne::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .hWlpPn.tooltipped-nw::after{margin-right:-16px;}/*!sc*/ .hWlpPn.tooltipped-s::after,.hWlpPn.tooltipped-n::after{-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%);}/*!sc*/ .hWlpPn.tooltipped-w::after{right:100%;bottom:50%;margin-right:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .hWlpPn.tooltipped-e::after{bottom:50%;left:100%;margin-left:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .hWlpPn.tooltipped-multiline::after{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}/*!sc*/ .hWlpPn.tooltipped-multiline.tooltipped-s::after,.hWlpPn.tooltipped-multiline.tooltipped-n::after{right:auto;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);}/*!sc*/ .hWlpPn.tooltipped-multiline.tooltipped-w::after,.hWlpPn.tooltipped-multiline.tooltipped-e::after{right:100%;}/*!sc*/ .hWlpPn.tooltipped-align-right-2::after{right:0;margin-right:0;}/*!sc*/ .hWlpPn.tooltipped-align-left-2::after{left:0;margin-left:0;}/*!sc*/ data-styled.g5[id="Tooltip__TooltipBase-sc-17tf59c-0"]{content:"jjwhNb,hWlpPn,"}/*!sc*/ .irithh{position:relative;overflow:hidden;-webkit-mask-image:radial-gradient(white,black);mask-image:radial-gradient(white,black);background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5)));border-radius:3px;display:block;height:1.2em;width:60px;}/*!sc*/ .irithh::after{-webkit-animation:crVFvv 1.5s infinite linear;animation:crVFvv 1.5s infinite linear;background:linear-gradient(90deg,transparent,var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5))),transparent);content:'';position:absolute;-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);bottom:0;left:0;right:0;top:0;}/*!sc*/ .ihfxfT{position:relative;overflow:hidden;-webkit-mask-image:radial-gradient(white,black);mask-image:radial-gradient(white,black);background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5)));border-radius:3px;display:block;height:1.2em;width:62px;}/*!sc*/ .ihfxfT::after{-webkit-animation:crVFvv 1.5s infinite linear;animation:crVFvv 1.5s infinite linear;background:linear-gradient(90deg,transparent,var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5))),transparent);content:'';position:absolute;-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);bottom:0;left:0;right:0;top:0;}/*!sc*/ .kRBfod{position:relative;overflow:hidden;-webkit-mask-image:radial-gradient(white,black);mask-image:radial-gradient(white,black);background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5)));border-radius:3px;display:block;height:1.2em;width:60px;height:22px;}/*!sc*/ .kRBfod::after{-webkit-animation:crVFvv 1.5s infinite linear;animation:crVFvv 1.5s infinite linear;background:linear-gradient(90deg,transparent,var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5))),transparent);content:'';position:absolute;-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);bottom:0;left:0;right:0;top:0;}/*!sc*/ data-styled.g27[id="LoadingSkeleton-sc-695d630a-0"]{content:"irithh,ihfxfT,kRBfod,"}/*!sc*/ @-webkit-keyframes crVFvv{0%{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);}50%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}100%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}}/*!sc*/ @keyframes crVFvv{0%{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);}50%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}100%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}}/*!sc*/ data-styled.g54[id="sc-keyframes-crVFvv"]{content:"crVFvv,"}/*!sc*/

Commit ad73d0b

Browse files
authored
Merge pull request #10211 from blues/blues-add-cygnet
Add Blues Cygnet Feather (STM32L433) board
2 parents bd13492 + 5123f3d commit ad73d0b

File tree

24 files changed

+842
-27
lines changed

24 files changed

+842
-27
lines changed

ports/stm/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ endif
165165

166166
# Need this to avoid UART linker problems. TODO: rewrite to use registered callbacks.
167167
# Does not exist for F4 and lower
168-
ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F765xx STM32F767xx STM32F769xx STM32H743xx STM32H750xx STM32L4R5xx))
168+
ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F765xx STM32F767xx STM32F769xx STM32H743xx STM32H750xx STM32L4R5xx STM32L433xx))
169169
SRC_STM32 += $(HAL_DIR)/Src/stm32$(MCU_SERIES_LOWER)xx_hal_uart_ex.c
170170
endif
171171

@@ -197,9 +197,12 @@ ifneq ($(CIRCUITPY_AUDIOBUSIO_PDMIN),0)
197197
endif
198198

199199
ifneq ($(CIRCUITPY_USB),0)
200-
SRC_C += \
201-
lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c \
202-
lib/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c
200+
ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32L433xx))
201+
SRC_C += lib/tinyusb/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
202+
else
203+
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c
204+
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c
205+
endif
203206
endif
204207

205208
SRC_S = \

ports/stm/boards/STM32L433_boot.ld

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
GNU linker script for STM32L433 with bootloader
3+
*/
4+
5+
/* Specify the memory areas */
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256k /* entire flash */
9+
FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 4K /* ISR vector. Kind of wasteful. */
10+
FLASH_FIRMWARE (rx) : ORIGIN = 0x08011000, LENGTH = 192K-64K-4K
11+
FLASH_FS (rw) : ORIGIN = 0x08030000, LENGTH = 60K
12+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
13+
}
14+
15+
16+
/* produce a link error if there is not this amount of RAM for these sections */
17+
_minimum_stack_size = 24K;
18+
_minimum_heap_size = 16K;
19+
20+
/* Define the top end of the stack. The stack is full descending so begins just
21+
above last byte of RAM. Note that EABI requires the stack to be 8-byte
22+
aligned for a call. */
23+
_estack = ORIGIN(RAM) + LENGTH(RAM);
24+
25+
/* RAM extents for the garbage collector */
26+
_ram_start = ORIGIN(RAM);
27+
_ram_end = ORIGIN(RAM) + LENGTH(RAM);

ports/stm/boards/STM32L433_default.ld

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
GNU linker script for STM32L433 with filesystem
3+
*/
4+
5+
/* Specify the memory areas */
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K /* entire flash */
9+
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* ISR vector. */
10+
FLASH_FS (rw) : ORIGIN = 0x08004000, LENGTH = 48K
11+
FLASH_FIRMWARE (rx) : ORIGIN = 0x08010000, LENGTH = 256K - 48K - 16K
12+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
13+
}
14+
15+
/* produce a link error if there is not this amount of RAM for these sections */
16+
_minimum_stack_size = 24K;
17+
_minimum_heap_size = 16K;
18+
19+
/* Define the top end of the stack. The stack is full descending so begins just
20+
above last byte of RAM. Note that EABI requires the stack to be 8-byte
21+
aligned for a call. */
22+
_estack = ORIGIN(RAM) + LENGTH(RAM);
23+
24+
/* RAM extents for the garbage collector */
25+
_ram_start = ORIGIN(RAM);
26+
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
27+
28+
/* ensure the firmware is within bounds */
29+
ASSERT ( (ORIGIN(FLASH_FIRMWARE) + LENGTH(FLASH_FIRMWARE)) <= (ORIGIN(FLASH)+LENGTH(FLASH)), "FLASH_FIRMWARE out of bounds" );

ports/stm/boards/blues_cygnet/board.c

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "supervisor/board.h"
8+
#include "mpconfigboard.h"
9+
10+
#include "stm32l4xx.h"
11+
#include "stm32l433xx.h"
12+
13+
#include "shared-bindings/microcontroller/Pin.h"
14+
#include "shared-bindings/digitalio/DigitalInOut.h"
15+
#include "shared-bindings/digitalio/Direction.h"
16+
#include "shared-bindings/digitalio/DriveMode.h"
17+
#include "board.h"
18+
19+
digitalio_digitalinout_obj_t power_pin = { .base.type = &digitalio_digitalinout_type };
20+
digitalio_digitalinout_obj_t discharge_pin = { .base.type = &digitalio_digitalinout_type };
21+
22+
void initialize_discharge_pin(void) {
23+
/* Initialize the 3V3 discharge to be OFF and the output power to be ON */
24+
__HAL_RCC_GPIOA_CLK_ENABLE();
25+
__HAL_RCC_GPIOH_CLK_ENABLE();
26+
__HAL_RCC_GPIOB_CLK_ENABLE();
27+
28+
common_hal_digitalio_digitalinout_construct(&power_pin, &pin_PH00);
29+
common_hal_digitalio_digitalinout_construct(&discharge_pin, &pin_PH01);
30+
common_hal_digitalio_digitalinout_never_reset(&power_pin);
31+
common_hal_digitalio_digitalinout_never_reset(&discharge_pin);
32+
33+
GPIO_InitTypeDef GPIO_InitStruct;
34+
35+
/* Set DISCHARGE_3V3 as well as the pins we're not initially using to FLOAT */
36+
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
37+
GPIO_InitStruct.Pull = GPIO_NOPULL;
38+
GPIO_InitStruct.Pin = GPIO_PIN_1;
39+
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); /* PH1 DISCHARGE_3V3 */
40+
GPIO_InitStruct.Pin = GPIO_PIN_3;
41+
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /* PB3 is USB_DETECT */
42+
GPIO_InitStruct.Pin = GPIO_PIN_15;
43+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /* PA15 is CHARGE_DETECT */
44+
GPIO_InitStruct.Pin = GPIO_PIN_4;
45+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /* PA4 is BAT_VOLTAGE */
46+
47+
/* Turn on the 3V3 regulator */
48+
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
49+
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
50+
GPIO_InitStruct.Pin = GPIO_PIN_0;
51+
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
52+
HAL_GPIO_WritePin(GPIOH, GPIO_InitStruct.Pin, GPIO_PIN_SET);
53+
}
54+
55+
void board_init(void) {
56+
// enable the debugger while sleeping. Todo move somewhere more central (kind of generally useful in a debug build)
57+
SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
58+
59+
// Set tick interrupt priority, default HAL value is intentionally invalid
60+
// Without this, USB does not function.
61+
HAL_InitTick((1UL << __N 2851 VIC_PRIO_BITS) - 1UL);
62+
63+
__HAL_RCC_GPIOA_CLK_ENABLE();
64+
GPIO_InitTypeDef GPIO_InitStruct;
65+
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
66+
GPIO_InitStruct.Pull = GPIO_NOPULL;
67+
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
68+
GPIO_InitStruct.Pin = GPIO_PIN_8;
69+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
70+
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
71+
HAL_Delay(50);
72+
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
73+
}
74+
75+
void reset_board(void) {
76+
initialize_discharge_pin();
77+
}
78+
79+
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.

ports/stm/boards/blues_cygnet/board.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#pragma once
8+
9+
#include "common-hal/digitalio/DigitalInOut.h"
10+
11+
extern digitalio_digitalinout_obj_t power_pin;
12+
extern digitalio_digitalinout_obj_t discharge_pin;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2024 Blues Wireless Contributors.
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#pragma once
8+
9+
// Micropython setup
10+
11+
#define MICROPY_HW_BOARD_NAME "Cygnet"
12+
#define MICROPY_HW_MCU_NAME "STM32L433CCT6"
13+
14+
#define MICROPY_PY_SYS_PLATFORM MICROPY_HW_BOARD_NAME
15+
16+
#define STM32L433XX
17+
#define BOARD_CYGNET
18+
19+
#define LSE_VALUE ((uint32_t)32768)
20+
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
21+
#define BOARD_HAS_HIGH_SPEED_CRYSTAL (0)
22+
23+
// Increase drive strength of 32kHz external crystal, in line with calculations specified in ST AN2867 sections 3.3, 3.4, and STM32L4 datasheet DS12023 Table 58. LSE oscillator characteristics.
24+
// The drive strength RCC_LSEDRIVE_LOW is marginal for the 32kHz crystal oscillator stability, and RCC_LSEDRIVE_MEDIUMLOW meets the calculated drive strength with a small margin for parasitic capacitance.
25+
#define BOARD_LSE_DRIVE_LEVEL RCC_LSEDRIVE_MEDIUMLOW
26+
27+
// Bootloader only
28+
#ifdef UF2_BOOTLOADER_ENABLED
29+
#define BOARD_VTOR_DEFER (1) // Leave VTOR relocation to bootloader
30+
#endif
31+
32+
#define BOARD_NO_VBUS_SENSE (1)
33+
#define BOARD_NO_USB_OTG_ID_SENSE (1)
34+
35+
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
36+
#define DEFAULT_I2C_BUS_SDA (&pin_PB07)
37+
38+
#define DEFAULT_SPI_BUS_SS (&pin_PB08)
39+
#define DEFAULT_SPI_BUS_SCK (&pin_PA05)
40+
#define DEFAULT_SPI_BUS_MOSI (&pin_PB05)
41+
#define DEFAULT_SPI_BUS_MISO (&pin_PB06)
42+
43+
#define DEFAULT_UART_BUS_RX (&pin_PA10)
44+
#define DEFAULT_UART_BUS_TX (&pin_PA09)
45+
46+
#define CYGNET_DISCHARGE_3V3 (&pin_PH01)
47+
#define CYGNET_ENABLE_3V3 (&pin_PH00)
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
USB_VID = 0x30A4
2+
USB_PID = 0x03
3+
USB_PRODUCT = "Cygnet"
4+
USB_MANUFACTURER = "Blues Inc."
5+
6+
MCU_SERIES = L4
7+
MCU_VARIANT = STM32L433xx
8+
MCU_PACKAGE = LQFP48
9+
10+
LD_COMMON = boards/common_default.ld
11+
LD_DEFAULT = boards/STM32L433_default.ld
12+
UF2_OFFSET = 0x8000000
13+
UF2_BOOTLOADER ?= 0
14+
CIRCUITPY_BUILD_EXTENSIONS = bin
15+
16+
INTERNAL_FLASH_FILESYSTEM = 1
17+
LONGINT_IMPL = NONE
18+
CIRCUITPY_FULL_BUILD = 0
19+
20+
CIRCUITPY_AESIO = 0
21+
CIRCUITPY_ALARM = 0
22+
CIRCUITPY_ANALOGIO = 1
23+
CIRCUITPY_ATEXIT = 0
24+
CIRCUITPY_AUDIOBUSIO = 0
25+
CIRCUITPY_AUDIOBUSIO_I2SOUT = 0
26+
CIRCUITPY_AUDIOBUSIO_PDMIN = 0
27+
CIRCUITPY_AUDIOMIXER = 0
28+
CIRCUITPY_AUDIOMP3 = 0
29+
CIRCUITPY_AUDIOPWMIO = 0
30+
CIRCUITPY_BITBANGIO = 1
31+
CIRCUITPY_BLEIO = 0
32+
CIRCUITPY_BLEIO_HCI = 0
33+
CIRCUITPY_BINASCII = 0
34+
CIRCUITPY_BITMAPFILTER = 0
35+
CIRCUITPY_BITMAPTOOLS = 0
36+
CIRCUITPY_BUILTINS_POW3 = 0
37+
CIRCUITPY_BUSDEVICE = 0
38+
CIRCUITPY_BUSIO = 1
39+
CIRCUITPY_CANIO = 0
40+
CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE = 1
41+
CIRCUITPY_COUNTIO = 0
42+
CIRCUITPY_DIGITALIO = 1
43+
CIRCUITPY_DISPLAYIO = 0
44+
CIRCUITPY_ENABLE_MPY_NATIVE = 0
45+
CIRCUITPY_FRAMEBUFFERIO = 0
46+
CIRCUITPY_FREQUENCYIO = 0
47+
CIRCUITPY_FUTURE= 0
48+
CIRCUITPY_GETPASS = 0
49+
CIRCUITPY_GIFIO = 0
50+
CIRCUITPY_I2CTARGET = 0
51+
CIRCUITPY_JSON = 0
52+
CIRCUITPY_KEYPAD = 0
53+
CIRCUITPY_KEYPAD_DEMUX = 0
54+
CIRCUITPY_LTO = 1
55+
CIRCUITPY_MICROCONTROLLER = 1
56+
CIRCUITPY_MSGPACK = 0
57+
CIRCUITPY_NEOPIXEL_WRITE = 0
58+
CIRCUITPY_NVM = 0
59+
CIRCUITPY_ONEWIREIO = 0
60+
CIRCUITPY_OS = 1
61+
CIRCUITPY_PIXELBUF = 0
62+
CIRCUITPY_PIXELMAP = 0
63+
CIRCUITPY_PULSEIO = 1
64+
CIRCUITPY_PWMIO = 1
65+
CIRCUITPY_RANDOM = 0
66+
CIRCUITPY_RAINBOWIO = 0
67+
CIRCUITPY_RE = 0
68+
CIRCUITPY_REQUIRE_I2C_PULLUPS = 0
69+
CIRCUITPY_ROTARYIO_SOFTENCODER = 1
70+
CIRCUITPY_RGBMATRIX = 0
71+
CIRCUITPY_RTC = 0
72+
CIRCUITPY_SAFEMODE_PY = 0
73+
CIRCUITPY_SDCARDIO = 0
74+
CIRCUITPY_STATUS_BAR= 0
75+
CIRCUITPY_STORAGE = 1
76+
CIRCUITPY_SUPERVISOR = 1
77+
CIRCUITPY_SYNTHIO = 0
78+
CIRCUITPY_TERMINALIO = 0
79+
CIRCUITPY_TOUCHIO = 0
80+
CIRCUITPY_TOUCHIO_USE_NATIVE = 1
81+
CIRCUITPY_TRACEBACK = 0
82+
CIRCUITPY_ULAB = 0
83+
CIRCUITPY_USB_CDC = 1
84+
CIRCUITPY_USB_HID = 0
85+
CIRCUITPY_USB_IDENTIFICATION = 1
86+
CIRCUITPY_USB_MIDI = 0
87+
CIRCUITPY_USB_MIDI_ENABLED_DEFAULT= 0
88+
CIRCUITPY_USB_MSC = 1
89+
CIRCUITPY_USB_VENDOR = 0
90+
CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS= 0
91+
CIRCUITPY_VECTORIO = 0
92+
CIRCUITPY_ZLIB = 0
93+
94+
MICROPY_PY_ASYNC_AWAIT = 0
95+
96+
RELEASE_NEEDS_CLEAN_BUILD = 0
97+
98+
SUPEROPT_GC = 0
99+
SUPEROPT_VM = 0
100+
101+
CIRCUITPY_LTO_PARTITION = one
102+
103+
OPTIMIZATION_FLAGS = -Os
104+
105+
CFLAGS_BOARD = -fweb -frename-registers

ports/stm/boards/blues_cygnet/pins.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
// #include "py/objtuple.h"
8+
#include "shared-bindings/board/__init__.h"
9+
#include "board.h"
10+
11+
// Core Feather Pins
12+
static const mp_rom_map_elem_t board_module_globals_table[] = {
13+
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
14+
15+
{ MP_ROM_QSTR(MP_QSTR_ENABLE_3V3), &power_pin },
16+
{ MP_ROM_QSTR(MP_QSTR_DISCHARGE_3V3), &discharge_pin },
17+
18+
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA00) },
19+
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) },
20+
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA02) },
21+
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA03) },
22+
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB01) },
23+
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA07) },
24+
25+
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA04) },
26+
{ MP_ROM_QSTR(MP_QSTR_BUTTON_USR), MP_ROM_PTR(&pin_PC13) },
27+
28+
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB08) },
29+
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PB09) },
30+
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PB14) },
31+
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PB15) },
32+
33+
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA08) },
34+
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB04) }, // ADC, PWM, DAC2 output also
35+
36+
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) }, // PWM
37+
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) }, // PWM
38+
39+
{ MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PB08) },
40+
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA14) },
41+
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA13) },
42+
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB05) },
43+
44+
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA09) }, // ADC, PWM
45+
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA10) }, // PWM
46+
47+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
48+
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
49+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
50+
};
51+
52+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

ports/stm/common-hal/microcontroller/Pin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE};
2121
GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC, GPIOD};
2222
#elif defined(UFQFPN48)
2323
GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC};
24+
#elif defined(LQFP48)
25+
GPIO_TypeDef *ports[] = {GPIOA, GPIOB, GPIOC};
2426
#else
2527
#error Unknown package type
2628
#endif

0 commit comments

Comments
 (0)
0