Forth Calculator
Rows are input ports with pull up resistors and interrupts, columns are open drain output ports.
C0 C1 C2 C3 C4
+--------+--------+--------+--------+--------+
| Pi | 1/x | x^2 | LOG | LN |
| R/S | y^x | SQRT | 10^x | e^x | R0
| A | B | C | D | E |
| R/S | SL | SR | RL | RR |
+--------+--------+--------+--------+--------+
| STO | RCL | SIN | COS | TAN |
| CEIL | FLOOR | ASIN | ACOS | ATAN | R1
| STO | RCL | | | F |
| | SLn | SRn | | |
+--------+--------+--------+--------+--------+
| ENTER | SWAP | - | E | BS |
| DUP | ROT | ABS | F>S | CLx | R2
| ENTER | SWAP | - | E | BS |
| DUP | ROT | ABS | S>F | CLx |
+--------+--------+--------+--------+--------+
| CLOCK | 7 | 8 | 9 | / |
| FLOAT | HEX | DEC | OCT | BIN | R3
| CLOCK | 7 | 8 | 9 | / |
| FLOAT | HEX | DEC | OCT | BIN |
+--------+--------+--------+--------+--------+
| CALC | 4 | 5 | 6 | * |
| TERM | FIX | ENG | SCI | PREC | R4
| CALC | 4 | 5 | 6 | * |
| TERM | SIGN | UNSGN | | |
+--------+--------+--------+--------+--------+
| f | 1 | 2 | 3 | - |
| f | p | n | u | m | R5
| f | 1 | 2 | 3 | - |
| f | XOR | AND | NOT | OR |
+--------+--------+--------+--------+--------+
| C ON | 0 | . | FFCT | + |
| OFF | k | M | G | T | R6
| C ON | 0 | . | FCT | + |
| OFF | */ | MOD | /MOD | |
+--------+--------+--------+--------+--------+
Description |
Dongle |
Function |
Calculator |
JTAG 10pin |
GND |
CN1.1 |
GND |
GND |
3, 5, 9 |
NRST |
CN1.2 |
RES |
RST |
10 |
PA13 |
CN1.3 |
SWDIO |
- |
2 |
PA14 |
CN1.4 |
SWDCLK |
- |
4 |
PB3 |
CN1.5 |
SWO |
ROW0 |
|
3V3 |
CN1.6 |
3V3 |
3V3 |
1 |
PB2 |
CN1.7 |
|
ROW1 |
|
PA5 |
CN1.8 |
D13 |
COL4 |
|
PA6 |
CN1.9 |
D12 |
ROW2 |
|
PA7 |
CN1.10 |
D11 |
ROW3 |
|
PB8 |
CN2.1 |
D15 SCL |
SCL Display |
|
PB9 |
CN2.2 |
D14 SDA |
SDA Display |
|
PA0 |
CN2.3 |
A3 |
COL0 |
|
PA2 |
CN2.4 |
D1 |
COL2 |
|
PA3 |
CN2.5 |
D0 |
COL3 |
|
PB6 |
CN2.6 |
UARTRX |
ROW4 |
|
PA9 |
CN2.7 |
D9 |
ROW5 |
|
PA8 |
CN2.8 |
D6 |
ROW6 |
|
GND |
CN2.9 |
GND |
GND |
|
PA1 |
CN2.10 |
A2 |
COL1 |
|
Keypad
Function |
Description |
Port |
Pin |
Int |
COL0 |
D12 |
PC2 |
JP3.5 |
EXTI2 |
COL1 |
D11 |
PC3 |
JP3.6 |
EXTI3 |
COL2 |
A0 |
PA4 |
JP1.12 |
EXTI4 |
COL3 |
A1 |
PA5 |
JP1.11 |
EXTI9_5 |
COL4 |
D3 (MISO) |
PB14 |
JP1.4 |
EXTI15_10 |
Function |
Description |
Port |
Pin |
ROW0 |
UART_RX / D0 |
PB11 |
JP1.3 |
ROW1 |
A2 |
PA6 |
JP1.10 |
ROW2 |
A3 |
PA7 |
JP1.9 |
ROW3 |
A4 |
PC4 |
JP1.8 |
ROW4 |
A5 |
PC5 |
JP1.7 |
ROW5 |
UART_TX / D1 |
PB10 |
JP1.2 |
ROW6 |
D10 |
PB9 |
JP3.7 |
Display
OLED
EPD
Function |
Description |
Port |
Pin |
Int |
SPI SCK |
D2 |
PB13 |
JP1.6 |
|
SPI MOSI |
D4 |
PB15 |
JP1.5 |
|
CS |
Button B / D6 |
PC6 |
JP3.9 |
|
RESET |
Button A / D9 |
PB8 |
JP3.8 |
|
BUSY |
D13 / red LED |
PC1 |
JP3.4 |
EXTI1 |
DATA/COMMAND |
Button C / D5 |
PC7 |
JP3.10 |
|
Buttons
Buzzer
BOM
- Perfboard square grid of 0.1 inches, pads on both sides (plate-through holes), 2" x 3.5", $3
- SBC
- STM32WB55 Dongle, part of P-NUCLEO-WB55, DigiKey 497-18384-ND
- STM32F405
- OLED display
- 35 pcs push buttons, fit in 0.4" grid
- Würth 430473035826, DigiKey #732-7021-1-ND, data sheet, $0.5
- TE Connectivity ALCOSWITCH Switches 1825910-6, $0.15
- C&K PTS 647 SN50 SMTR2 LFS, DigiKey #PTS647SN50SMTR2LFSCT-ND, smaller 4.5 x 4.5 mm, $0.2
- Wires
- USB Connector e.g.
- I2C Connector
ToDos
- Rundung ab 4 Stellen z.B. 9999e fs. :.00E3
- Fehlermeldung auf OLED, patch in datastackandmacros.s Fehler_Quit und Fehler_Quit_n
- on/off
Button Overlay
Inkscape
overlay.svg: overlay.svg
special characters
Press F8 to get to text mode.
Click with mouse on the canvas (Inkscape lingo for page) where you want your text.
You will now have the text cursor on the canvas.
Press Ctrl U to get into unicode entry mode.
The status line at the bottom of the Inkscape window will now show "Unicode (enter to finish)".
Type 03bc which is the unicode for the µ character, then press Enter (Return), if everything went well you will now have the µ character on the canvas.
LPM
app_entry.c
void Init_Exti( void )
{
/**< Disable all wakeup interrupt on CPU1 except
IPCC(36), HSEM(38),
EXTI1, EXTI2, EXTI3, EXTI4, EXTI5, EXTI6, EXTI7, EXTI9, EXTI11, and EXTI12 for push button keys,
EXTI0 for Wakeup,
EXTI10 for UART Rx
*/
// LL_EXTI_DisableIT_0_31(~0);
#ifndef BASIC
LL_EXTI_DisableIT_0_31 ( (~0) & (~(LL_EXTI_LINE_1 | LL_EXTI_LINE_2 | LL_EXTI_LINE_3
| LL_EXTI_LINE_4 | LL_EXTI_LINE_5 | LL_EXTI_LINE_6
| LL_EXTI_LINE_7 | LL_EXTI_LINE_9 | LL_EXTI_LINE_11
| LL_EXTI_LINE_12
| LL_EXTI_LINE_0
| LL_EXTI_LINE_10
| LL_EXTI_LINE_8
)) );
#else
LL_EXTI_DisableIT_0_31 ( (~0) & (~(LL_EXTI_LINE_1 | LL_EXTI_LINE_2 | LL_EXTI_LINE_3 )) );
#endif
LL_EXTI_DisableIT_32_63( (~0) & (~(LL_EXTI_LINE_36 | LL_EXTI_LINE_38)) );
return;
}
tud_task() wait for event?
STM32Cube\Repository\STM32Cube_FW_WB_V1.17.3\Projects\P-NUCLEO-WB55.Nucleo\Applications\BLE\BLE_HeartRateFreeRTOS
Low Power Timer
freertos_posrt.c
hw_timerserver.c
/**
* Configure EXTI module
*/
LL_EXTI_EnableRisingTrig_0_31(RTC_EXTI_LINE_WAKEUPTIMER_EVENT);
LL_EXTI_EnableIT_0_31(RTC_EXTI_LINE_WAKEUPTIMER_EVENT);
flash.c
taskENTER_CRITICAL();
taskEXIT_CRITICAL();
SDIO
https://community.st.com/t5/stm32-mcus-products/stm32cubemx-sdio-f4/td-p/410536
Project
STM32F413H_DISCOVERY
FatFs_uSD_RTOS
stm32f413h_discovery_sd.c
uint8_t BSP_SD_Init(void)
{
uint8_t sd_state = MSD_OK;
/* uSD device interface configuration */
uSdHandle.Instance = SDIO;
uSdHandle.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
uSdHandle.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
uSdHandle.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
uSdHandle.Init.BusWide = SDIO_BUS_WIDE_1B;
uSdHandle.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_ENABLE;
uSdHandle.Init.ClockDiv = SDIO_TRANSFER_CLK_DIV;
/* Msp SD Detect pin initialization */
BSP_SD_Detect_MspInit(&uSdHandle, NULL);
/* Check if SD card is present */
if(BSP_SD_IsDetected() != SD_PRESENT)
{
return MSD_ERROR_SD_NOT_PRESENT;
}
/* Msp SD initialization */
BSP_SD_MspInit(&uSdHandle, NULL);
/* HAL SD initialization */
if(HAL_SD_Init(&uSdHandle) != HAL_OK)
{
sd_state = MSD_ERROR;
}
/* Configure SD Bus width */
if(sd_state == MSD_OK)
{
/* Enable wide operation */
if(HAL_SD_ConfigWideBusOperation(&uSdHandle, SDIO_BUS_WIDE_4B) != HAL_OK)
{
sd_state = MSD_ERROR;
}
else
{
sd_state = MSD_OK;
}
}
return sd_state;
}
/**
* @brief Initializes the SD MSP.
* @param hsd: SD handle
* @param Params : pointer on additional configuration parameters, can be NULL.
*/
__weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
{
static DMA_HandleTypeDef dma_rx_handle;
static DMA_HandleTypeDef dma_tx_handle;
GPIO_InitTypeDef gpio_init_structure;
/* Prevent unused argument(s) compilation warning */
UNUSED(Params);
/* Enable SDIO clock */
__HAL_RCC_SDIO_CLK_ENABLE();
/* Enable DMA2 clocks */
__DMAx_TxRx_CLK_ENABLE();
/* Enable GPIOs clock */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
/* Common GPIO configuration */
gpio_init_structure.Mode = GPIO_MODE_AF_PP;
gpio_init_structure.Pull = GPIO_PULLUP;
gpio_init_structure.Speed = GPIO_SPEED_HIGH;
gpio_init_structure.Alternate = GPIO_AF12_SDIO;
/* GPIOC configuration: SD_D[0..3] and SD_clk */
gpio_init_structure.Pin = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;
HAL_GPIO_Init(GPIOC, &gpio_init_structure);
/* GPIOA configuration: SD cmd */
gpio_init_structure.Pin = GPIO_PIN_6;
HAL_GPIO_Init(GPIOA, &gpio_init_structure);
/* NVIC configuration for SDIO interrupts */
HAL_NVIC_SetPriority(SDIO_IRQn, 0x0E, 0x00);
HAL_NVIC_EnableIRQ(SDIO_IRQn);
/* Configure DMA Rx parameters */
dma_rx_handle.Init.Channel = SD_DMAx_Rx_CHANNEL;
dma_rx_handle.Init.Direction = DMA_PERIPH_TO_MEMORY;
dma_rx_handle.Init.PeriphInc = DMA_PINC_DISABLE;
dma_rx_handle.Init.MemInc = DMA_MINC_ENABLE;
dma_rx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
dma_rx_handle.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
dma_rx_handle.Init.Mode = DMA_PFCTRL;
dma_rx_handle.Init.Priority = DMA_PRIORITY_VERY_HIGH;
dma_rx_handle.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
dma_rx_handle.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
dma_rx_handle.Init.MemBurst = DMA_MBURST_INC4;
dma_rx_handle.Init.PeriphBurst = DMA_PBURST_INC4;
dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
/* Associate the DMA handle */
__HAL_LINKDMA(hsd, hdmarx, dma_rx_handle);
/* Deinitialize the stream for new transfer */
HAL_DMA_DeInit(&dma_rx_handle);
/* Configure the DMA stream */
HAL_DMA_Init(&dma_rx_handle);
/* Configure DMA Tx parameters */
dma_tx_handle.Init.Channel = SD_DMAx_Tx_CHANNEL;
dma_tx_handle.Init.Direction = DMA_MEMORY_TO_PERIPH;
dma_tx_handle.Init.PeriphInc = DMA_PINC_DISABLE;
dma_tx_handle.Init.MemInc = DMA_MINC_ENABLE;
dma_tx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
dma_tx_handle.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
dma_tx_handle.Init.Mode = DMA_PFCTRL;
dma_tx_handle.Init.Priority = DMA_PRIORITY_VERY_HIGH;
dma_tx_handle.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
dma_tx_handle.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
dma_tx_handle.Init.MemBurst = DMA_MBURST_INC4;
dma_tx_handle.Init.PeriphBurst = DMA_PBURST_INC4;
dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
/* Associate the DMA handle */
__HAL_LINKDMA(hsd, hdmatx, dma_tx_handle);
/* Deinitialize the stream for new transfer */
HAL_DMA_DeInit(&dma_tx_handle);
/* Configure the DMA stream */
HAL_DMA_Init(&dma_tx_handle);
/* NVIC configuration for DMA transfer complete interrupt */
HAL_NVIC_SetPriority(SD_DMAx_Rx_IRQn, 0x0F, 0x00);
HAL_NVIC_EnableIRQ(SD_DMAx_Rx_IRQn);
/* NVIC configuration for DMA transfer complete interrupt */
HAL_NVIC_SetPriority(SD_DMAx_Tx_IRQn, 0x0F, 0x00);
HAL_NVIC_EnableIRQ(SD_DMAx_Tx_IRQn);
}
Egg Timer
On/Off |
On/Off |
On/Off |
M |
1/x |
STO |
S |
x^2 |
ENTER |
Start/Stop |
R/S Pi |
CLOCK |
Clear |
CALC |
f |
--
Peter Schmid - 2024-05-24
- overlay.png: