Skip to content

Instantly share code, notes, and snippets.

View mattytrentini's full-sized avatar

Matt Trentini mattytrentini

View GitHub Profile
@mattytrentini
mattytrentini / i2cdetect.py
Created October 14, 2023 23:51
i2cdetect in MicroPython
def i2cdetect(addresses):
print(" 0 1 2 3 4 5 6 7 8 9 a b c d e f")
for i in range(0x8):
print(f"{i*0x10:02x}:", end="")
for j in range(0x10):
addr = i * 0x10 + j
if 0x02 < addr < 0x78:
if addr in addresses:
print(f" {addr:02x}", end="")
else:
@mattytrentini
mattytrentini / mpconfigboard.h
Created August 17, 2023 07:03
MicroPython board definition for the Nucleo H503RB
#define MICROPY_HW_BOARD_NAME "NUCLEO_H503RB"
#define MICROPY_HW_MCU_NAME "STM32H503RB"
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES)
#define MICROPY_PY_PYB_LEGACY (0)
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_ADC (1)

Mattie Math

Minivan

1) 14c + 19h = 421
2) c + h = 24

3) [2 x 14]
14c + 14h = 336
@mattytrentini
mattytrentini / tinypico_pinout.py
Last active March 24, 2023 02:27
TinyPICO Pinout
import re
tpp = """
┌────┐
╭───┤ ├───╮
│ │ │ │
[MO] [23] │ ⌾ └────┘ ⌾ │ [BAT]
[MI] [19] │ ⌾ ▣ │ ⏚
[SCK] [18] │ ⌾ ⌾ │ [5V]
[SS] [ 5] │ ⌾ ⌾ │ [3V3]
[SCL] [22] │ ⌾ ⌾ │ [ 4] [TCH0] [ADC2-0] [RTC10]
▁▁
▁▁▏▕▁▁
▏▕
▔▔
@mattytrentini
mattytrentini / portfeatures.md
Created November 22, 2021 06:54
List the features in any given MicroPython port
Feature Supported
Pin
PWM
ADC
DAC
Timer
UART
Soft I2C
I2C
diff --git a/ports/stm32/boards/NODE_151/mpconfigboard.h b/ports/stm32/boards/NODE_151/mpconfigboard.h
index a16a88e6e..f5344ca0d 100644
--- a/ports/stm32/boards/NODE_151/mpconfigboard.h
+++ b/ports/stm32/boards/NODE_151/mpconfigboard.h
@@ -1,8 +1,8 @@
#define MICROPY_HW_BOARD_NAME "Node151v2.2"
#define MICROPY_HW_MCU_NAME "STM32L151CCU"
-#define MICROPY_HW_UART_REPL PYB_UART_1
-#define MICROPY_HW_UART_REPL_BAUD 115200
diff --git a/ports/stm32/boards/NODE_151/mpconfigboard.h b/ports/stm32/boards/NODE_151/mpconfigboard.h
index 99ffc1f70..23358e9a9 100644
--- a/ports/stm32/boards/NODE_151/mpconfigboard.h
+++ b/ports/stm32/boards/NODE_151/mpconfigboard.h
@@ -5,7 +5,7 @@
#define MICROPY_HW_ENABLE_ADC (0)
#define MICROPY_HW_ENABLE_DMA (0)
#define MICROPY_HW_HAS_SWITCH (0) // Ought to be able to turn back on
-#define MICROPY_HW_HAS_FLASH (1)
+#define MICROPY_HW_HAS_FLASH (0)
diff --git a/.gitmodules b/.gitmodules
index ceaa5342b..7a2fe6bb3 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -13,8 +13,8 @@
url = https://github.com/pfalcon/berkeley-db-1.xx
[submodule "lib/stm32lib"]
path = lib/stm32lib
- url = https://github.com/micropython/stm32lib
- branch = work-F4-1.13.1+F7-1.5.0+L4-1.3.0
# modified by dpgeorge, works OK, needs a bit of tuning but it could be
# at the limit of the hardware
#
# This file is part of MicroPython MPU9250 driver
# Copyright (c) 2018 Mika Tuupola
# Copyright (c) 2018 0x1abin (added the yaw,picth,roll api and complementary filtering)
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php