Skip to content

Commit

Permalink
ssd1306 dma display support, clang-format config (#20)
Browse files Browse the repository at this point in the history
* add indicator led position; use pico default (since we use that)

* remove older ssd1306 things; prepping for dma code

* update with cmake stub from latest pico-sdk

* wip dma-driven i2c display; note: blocks for 100ms between ops!

uses ugui for display writing. need to write isr-driven queue for i2c
transactions.

gh issue #5

* wip isr driven linked list (not quite working)

* fix linked list, turn off malloc mutex, tidy

* these @todos are redundant now

* sample text whilst i work on positioning

* use 5x12 pixel font positioned in a 5x16 area, y+2 offset

* crlf -> lf

* enable all warnings, warnings are errors

* unused variable

* if ug_wingetarea fails, a.xs/ys will be used uninited

* comment unused code (think it can be removed)

* dbg counters case for unknown devices

* change compile options to definitions for portability

* fix mismatching indentation on enum

* clang-format these files to match rest of src

* c style reformatting hints

* stub of check for device presence

* repoint display write to a noop when not available
  • Loading branch information
borb authored Oct 31, 2022
1 parent 354cfd5 commit c402691
Show file tree
Hide file tree
Showing 21 changed files with 17,115 additions and 899 deletions.
18 changes: 18 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
BasedOnStyle: llvm

IndentWidth: 4
UseTab: Never
ColumnLimit: 120

BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: true
AfterStruct: true
AfterExternBlock: true
AfterEnum: true

IndentCaseLabels: true

AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ set(PICO_TINYUSB_PATH "${CMAKE_SOURCE_DIR}/tinyusb/")

include(cmake/pico_sdk_import.cmake)

add_compile_options(-Wall -Werror)

# configuration options

# uncomment for debug slurry
add_compile_options(-DDEBUG_MESSAGES=1)
add_compile_definitions(DEBUG_MESSAGES=1)

# set the board revision (changes which pins are mapped to which ports)
add_compile_options(-DHIDPICO_REVISION=4)
add_compile_definitions(HIDPICO_REVISION=4)

# debugging for tinyusb - be warned that it can cause timing issues causing things to break
# add_compile_options(-DCFG_TUSB_DEBUG=2)
# add_compile_definitions(CFG_TUSB_DEBUG=2)

project(amigahid-pico C CXX ASM)

pico_sdk_init()

add_subdirectory(src)
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ crazy talk:

on the fence at the moment, but the current license choice is Eclipse Public License 2.0 (EPL-2.0).

## third party licenses

* µgui: this code contains 'µgui' by achim döbler; the license for this can be read at in the [display readme](./src/display/README.md)

## whuh... who?

nine <[nine@aphlor.org](mailto:nine@aphlor.org)>
21 changes: 16 additions & 5 deletions cmake/pico_sdk_import.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,22 @@ if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
)
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
)
endif ()

if (NOT pico_sdk)
message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk)
Expand Down
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ pico_enable_stdio_uart(amigahid-pico 1)
target_link_libraries(amigahid-pico PUBLIC
pico_stdlib
pico_multicore
hardware_dma
hardware_gpio
hardware_i2c
hardware_pio
tinyusb_host
tinyusb_board
)

pico_add_extra_outputs(amigahid-pico)
add_compile_definitions(PICO_USE_MALLOC_MUTEX=0)

pico_add_extra_outputs(amigahid-pico)
5 changes: 5 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
# define HIDPICO_REVISION 4
#endif

// the pico has an onboard led on gp25; use this as a default indicator
#ifndef INDICATOR_LED
# define INDICATOR_LED PICO_DEFAULT_LED_PIN
#endif

#if HIDPICO_REVISION == 2
# define I2C_PORT i2c0
# define I2C_PIN_SDA 4
Expand Down
2 changes: 1 addition & 1 deletion src/display/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
target_sources(amigahid-pico PRIVATE ssd1306.c)
target_sources(amigahid-pico PRIVATE disp_ssd.c ugui.c)
21 changes: 0 additions & 21 deletions src/display/LICENSE

This file was deleted.

60 changes: 57 additions & 3 deletions src/display/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
# ssd1306 support for the Raspberry Pi Pico
# ugui

The source code within this directory was written by David Schramm, and can be found [in this GitHub repository](https://github.com/daschr/pico-ssd1306).
this path contains the excellent µgui library from achim döbler.

This source is licensed under the MIT license, a copy of which is included in this directory under the filename [LICENSE](./LICENSE).
this code can be obtained from [github.com/achimdoebler/UGUI](https://github.com/achimdoebler/UGUI). the license follows.

## license

```
/* -------------------------------------------------------------------------------- */
/* -- µGUI - Generic GUI module (C)Achim Döbler, 2015 -- */
/* -------------------------------------------------------------------------------- */
// µGUI is a generic GUI module for embedded systems.
// This is a free software that is open for education, research and commercial
// developments under license policy of following terms.
//
// Copyright (C) 2015, Achim Döbler, all rights reserved.
// URL: http://www.embeddedlightning.com/
//
// * The µGUI module is a free software and there is NO WARRANTY.
// * No restriction on use. You can use, modify and redistribute it for
// personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
// * Redistributions of source code must retain the above copyright notice.
//
/* -------------------------------------------------------------------------------- */
/* -- MY SPECIAL THANKS GO TO -- */
/* -------------------------------------------------------------------------------- */
// Andrey Filimonov (-->https://github.com/Sermus)
// for giving valuable suggestions, reporting bugs and adding several new features.
// Andrey also put a lot of work in the implementaion of anti-aliased font support.
//
// Mikhail Podkur (-->https://github.com/MikhailPodkur)
// for adding cyrillic 8x12 font, checkbox feature and RGB565 support.
//
// Gustavo Denardin
// for giving valuable suggestions regarding real-time os support.
//
// Samuel Kleiser
// for reporting bugs and giving examples how to improve µGUI.
/* -------------------------------------------------------------------------------- */
/* -- REVISION HISTORY -- */
/* -------------------------------------------------------------------------------- */
// Dec 20, 2015 V0.31 Checkbox component with all funtions added.
// Cyrillic font 8x12 added.
// RGB565 color schema added.
// Windows components font could be getted from current GUI by default
// Mar 18, 2015 V0.3 Driver support added.
// Window and object support added.
// Touch support added.
// Fixed some minor bugs.
//
// Oct 20, 2014 V0.2 Function UG_DrawRoundFrame() added.
// Function UG_FillRoundFrame() added.
// Function UG_DrawArc() added.
// Fixed some minor bugs.
//
// Oct 11, 2014 V0.1 First release.
/* -------------------------------------------------------------------------------- */
```
Loading

0 comments on commit c402691

Please sign in to comment.