Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/driver_an…
Browse files Browse the repository at this point in the history
…d_hal_update
  • Loading branch information
stellar-aria committed Dec 19, 2023
2 parents 3b8c15b + 4bb0f8a commit 66cb8fb
Show file tree
Hide file tree
Showing 31 changed files with 1,357 additions and 947 deletions.
34 changes: 33 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,38 @@
"windows": {
"MIMode": "gdb",
}
},
{
"name": "Debug",
"configFiles": [
"interface/stlink.cfg",
"target/stm32h7x.cfg"
],
"cwd": "${workspaceFolder}",
"debuggerArgs": [
"-d",
"${workspaceRoot}"
],
// Here's where you can put the path to the program you want to debug:
//"executable": "${workspaceRoot}/examples/SDMMC_HelloWorld/build/SDMMC_HelloWorld.elf",
"executable": "${workspaceRoot}/examples/uart/Dma_Receive/build/Dma_Receive.elf",
"interface": "swd",
"openOCDLaunchCommands": [
"init",
"reset init",
"gdb_breakpoint_override hard"
],
"preRestartCommands": [
"load",
"enable breakpoint",
"monitor reset"
],
"request": "launch",
"runToMain": true,
"servertype": "openocd",
"showDevDebugOutput": true,
"svdFile": "${workspaceRoot}/.vscode/STM32H750x.svd",
"type": "cortex-debug"
}
]
}
}
22 changes: 18 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@

## Unreleased

## v5.4.0

### Features

* adc: added ConversionSpeed configuration to the AdcChannelConfig (#579)
* board: Updated Daisy board definitions to use new Pin system (#581)
* board: added official support for new Daisy Seed2 DFM hardware (built in compatibility with DaisySeed class).
* device: added driver for SK9822 (#574)
* examples: added a number of minimal examples for the Seed/Seed2DFM
* gatein: added new Init function that is compatible with newer C++ `Pin` type.

### Bug Fixes

* patchsm: Corrected gate out pin assignment confusion added by (#417) as noted by [apbianco](https://forum.electro-smith.com/u/apbianco) and [tele_player](https://forum.electro-smith.com/u/tele_player)
* midi: improvements to UART transport stability, and fixes to parser (#566, #564, #583)
* qspi: fixed memory cache invalidation for Persistent Storage (#572)
* spi: fixed issue with unpredictable pin states at end of transmission (#553, #559)

### Other

* build: removed redundant compile-time def from CMake build (#565)
* docs: use explicit grouping; omit comments from output (#563)
* docs: fix typo in GPIO guide (#567)

## v5.3.0

Expand Down Expand Up @@ -52,7 +66,7 @@
* bootloader: Working with the bootloader has been simplified. See [the new guide for updates on usage](https://electro-smith.github.io/libDaisy/md_doc_md__a7__getting__started__daisy__bootloader.html)
* usb: `USBHost` class has added support for user callbacks on device connection, disconnection, and when the MSC class becomes active.
* uart: Adds DMA RX and TX modes, similar to how they work on the I2C and SPI.
* uart: Update function names to be more in line with the new DMA / Blocking scheme.
* uart: Update function names to be more in line with the new DMA / Blocking scheme.
* The old methods are wrappers for the new ones to preserve backwards compatibility, but **will be removed in a future version**.
* Affected functions: `PollReceive`, `PollTx`, `StartRx`, `RxActive`, `FlushRx`, `PopRx`, `Readable`

Expand Down Expand Up @@ -97,7 +111,7 @@
* testing: debugging configuration now uses `lldb` debugging extension to support unit test debugging on macOS with Apple Silicon
* driver: oled_ssd130x.h - Add the SpiHandle:Config struct to SSD130x4WireTransport:Config to allow full access to the SPI peripheral configuration.
* hid: fixed issue in `AnalogControl` where computed coeff could be out of range with certain block sizes
* driver: added missing alternate function pin mappings for SPI2, and UART for pins available on the patch_sm hardware
* driver: added missing alternate function pin mappings for SPI2, and UART for pins available on the patch_sm hardware
* usb: fixed issue with MIDI output from USB
* driver: fixed off-by-one error in qspi erase function.

Expand Down Expand Up @@ -246,7 +260,7 @@ max11300driver.ConfigurePinAsAnalogWrite(daisy::MAX11300::PIN_1, daisy::MAX11300

### Other

* switch: Use `System::GetNow()` rather than the update rate to calculate `TimeHeldMs()`.
* switch: Use `System::GetNow()` rather than the update rate to calculate `TimeHeldMs()`.
* This has also been applied to the `Encoder` class (since it uses `Switch` internally).
* usb host: ST Middleware for USB Host support has been added to the Middlewares folder
* fatfs: changed default `FS_LOCK` to 0, allowing for more simultaneously open FIL objects.
Expand Down Expand Up @@ -440,7 +454,7 @@ sdram.Init();

### Other

* test: add unit testing for midi parser.
* test: add unit testing for midi parser.
* tests: add tests for `FIFO`
* docs: Update TODO comment in `uart.h` to reflect most recent uart update.
* ci: add filters to the workflows
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ add_library(${TARGET} STATIC
${MODULE_DIR}/hid/encoder.cpp
${MODULE_DIR}/hid/gatein.cpp
${MODULE_DIR}/hid/led.cpp
${MODULE_DIR}/hid/midi.cpp
${MODULE_DIR}/hid/midi_parser.cpp
${MODULE_DIR}/hid/parameter.cpp
${MODULE_DIR}/hid/rgb_led.cpp
${MODULE_DIR}/hid/switch.cpp
Expand Down
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ hid/ctrl \
hid/encoder \
hid/gatein \
hid/led \
hid/midi \
hid/midi_parser \
hid/parameter \
hid/rgb_led \
hid/switch \
Expand Down Expand Up @@ -85,7 +87,7 @@ BUILD_DIR = build

# manually adding necessary HAL files
# generated by `find Drivers/STM32H7xx_HAL_Driver/**/*.c -print`
C_SOURCES =
C_SOURCES =
C_SOURCES += \
Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c \
Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_adc.c \
Expand Down Expand Up @@ -206,7 +208,7 @@ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_swpmi.c \
Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_tim.c \
Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_usart.c \
Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_usb.c \
Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_utils.c \
Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_utils.c

# Middleware sources
C_SOURCES += \
Expand Down Expand Up @@ -280,7 +282,7 @@ MCU = -mthumb $(FLOAT-ABI) $(FPU) $(CPU)

# macros for gcc
# AS defines
AS_DEFS =
AS_DEFS =

# C defines
C_DEFS = \
Expand All @@ -292,7 +294,7 @@ C_DEFS = \
-DHSE_VALUE=16000000 \
-DUSE_HAL_DRIVER \
-DUSE_FULL_LL_DRIVER \
-DDATA_IN_D2_SRAM
-DDATA_IN_D2_SRAM
# ^ added for easy startup access


Expand All @@ -311,7 +313,7 @@ C_INCLUDES = \
-IMiddlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc \
-IMiddlewares/Third_Party/FatFs/src \
-I$(MODULE_DIR) \
-I.
-I.

# suppressions for warnings introduced by HAL/FatFS
WARNINGS += -Wall -Wno-attributes -Wno-strict-aliasing -Wno-maybe-uninitialized -Wno-missing-attributes -Wno-stringop-overflow #-Werror
Expand All @@ -337,7 +339,7 @@ CFLAGS += \
CPPFLAGS = $(CFLAGS) $(CPP_WARNINGS)
CPPFLAGS += \
-fno-exceptions \
-fno-rtti
-fno-rtti

C_STANDARD = -std=gnu11
CPP_STANDARD += -std=gnu++14
Expand Down Expand Up @@ -378,7 +380,7 @@ $(BUILD_DIR)/$(TARGET).a: $(SORTED_OBJECTS) Makefile
$(AR) -r $@ $(SORTED_OBJECTS)

$(BUILD_DIR):
mkdir $@
mkdir $@

#######################################
# clean up
Expand Down
8 changes: 7 additions & 1 deletion examples/MIDI_UART_Input/MIDI_UART_Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ int main(void)
{
case NoteOn:
// Do something on Note On events
{
uint8_t bytes[3] = {0x90, 0x00, 0x00};
bytes[1] = msg.data[0];
bytes[2] = msg.data[1];
midi.SendMessage(bytes, 3);
}
break;
default: break;
}
Expand All @@ -91,7 +97,7 @@ int main(void)
if(!event_log.IsEmpty())
{
auto msg = event_log.PopFront();
char outstr[64];
char outstr[128];
char type_str[16];
GetMidiTypeAsString(msg, type_str);
sprintf(outstr,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
/** TODO fix / remove this example
* anticipated issue that it only shows 1 byte every 100ms
* which may be misleading to user
*
* also, it should probably use serial print to pipe out
* data instead of the patch's display.
*/
#include "daisy_patch.h"

using namespace daisy;

/** Consts */
const size_t kUartBufferSize = 512;

/** Globals */
DaisyPatch hw;
UartHandler uart;
uint8_t uart_buffer[kUartBufferSize];
char receive_str[kUartBufferSize];

/** Happens automatically whenever transaction completes */
void uartCallback(uint8_t* data,
size_t size,
void* context,
UartHandler::Result res)
{
/** Clear receive_str */
std::fill(&receive_str[0], &receive_str[kUartBufferSize - 1], 0);
/** Copy new data into the receive str */
std::copy(&data[0], &data[size - 1], &receive_str[0]);
}

int main(void)
{
Expand All @@ -19,21 +44,16 @@ int main(void)

// initialize the UART peripheral, and start reading
uart.Init(uart_conf);
uart.DmaReceiveFifo();
uart.DmaListenStart(uart_buffer, kUartBufferSize, uartCallback, nullptr);

uint8_t pop = 0;
uint8_t pop = 0;
uint8_t send = 0;
while(1)
{
// send the data in a blocking fashion
uart.BlockingTransmit(&send, 1);
send++;

// if there's data, pop it from the FIFO
if(uart.ReadableFifo()){
pop = uart.PopFifo();
}

// clear the display
hw.display.Fill(false);

Expand All @@ -43,10 +63,10 @@ int main(void)
hw.display.SetCursor(0, 0);
hw.display.WriteString(cstr, Font_7x10, true);

// draw the receive buffer contents
sprintf(cstr, "%d", pop);
// draw the latest receive buffer contents
sprintf(receive_str, "%d", pop);
hw.display.SetCursor(0, 12);
hw.display.WriteString(cstr, Font_7x10, true);
hw.display.WriteString(receive_str, Font_7x10, true);

// update the display
hw.display.Update();
Expand Down
88 changes: 50 additions & 38 deletions examples/uart/Dma_Fifo_Receive/Dma_Fifo_Receive.cpp
Original file line number Diff line number Diff line change
@@ -1,57 +1,69 @@
/** TODO fix / remove this example
* anticipated issue that it only shows 1 byte every 100ms
* which may be misleading to user
*
* also, it should probably use serial print to pipe out
* data instead of the patch's display.
*/
#include "daisy_patch.h"

using namespace daisy;

DaisyPatch hw;
/** Consts */
const size_t kUartBufferSize = 512;

DaisyPatch hw;
UartHandler uart;
uint8_t uart_buffer[kUartBufferSize];
char receive_str[kUartBufferSize];

/** Happens automatically whenever transaction completes */
void uartCallback(uint8_t* data,
size_t size,
void* context,
UartHandler::Result res)
{
/** Clear receive_str */
std::fill(&receive_str[0], &receive_str[kUartBufferSize - 1], 0);
/** Copy new data into the receive str */
std::copy(&data[0], &data[size - 1], &receive_str[0]);
}

int main(void)
{
// Initialize the Daisy Patch
hw.Init();

// Configure the Uart Peripheral
UartHandler::Config uart_conf;
uart_conf.periph = UartHandler::Config::Peripheral::USART_1;
uart_conf.mode = UartHandler::Config::Mode::RX;
uart_conf.pin_config.tx = Pin(PORTB, 6);
uart_conf.pin_config.rx = Pin(PORTB, 7);

// Initialize the Uart Peripheral
uart.Init(uart_conf);

// Start the FIFO Receive
uart.DmaReceiveFifo();

uint8_t pop = 0;
while(1) {
// if there's data, pop it from the FIFO
if(uart.ReadableFifo()){
pop = uart.PopFifo();
hw.seed.SetLed(false);
}
else{
hw.seed.SetLed(true);
}

// clear the display
// Initialize the Daisy Patch
hw.Init();

// Configure the Uart Peripheral
UartHandler::Config uart_conf;
uart_conf.periph = UartHandler::Config::Peripheral::USART_1;
uart_conf.mode = UartHandler::Config::Mode::RX;
uart_conf.pin_config.tx = Pin(PORTB, 6);
uart_conf.pin_config.rx = Pin(PORTB, 7);

// Initialize the Uart Peripheral
uart.Init(uart_conf);
uart.DmaListenStart(uart_buffer, kUartBufferSize, uartCallback, nullptr);

while(1)
{
// clear the display
hw.display.Fill(false);

// draw the title text
// draw the title text
char cstr[26];
sprintf(cstr, "Uart DMA Fifo Rx");
hw.display.SetCursor(0, 0);
hw.display.WriteString(cstr, Font_7x10, true);

// draw the last popped data
sprintf(cstr, "%d", pop);
// draw the last popped data
hw.display.SetCursor(0, 12);
hw.display.WriteString(cstr, Font_7x10, true);
// update the display
hw.display.Update();
hw.display.WriteString(receive_str, Font_7x10, true);

// update the display
hw.display.Update();

// wait 100 ms
// wait 100 ms
System::Delay(100);
}
}
}
2 changes: 2 additions & 0 deletions examples/uart/Dma_Receive/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ CPP_SOURCES = Dma_Receive.cpp
# Library Locations
LIBDAISY_DIR = ../../..

OPT=-O0

# Core location, and generic Makefile.
SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core
include $(SYSTEM_FILES_DIR)/Makefile
Loading

0 comments on commit 66cb8fb

Please sign in to comment.