Skip to content

Commit

Permalink
Initial Public Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AmeNote-Michael committed Feb 6, 2024
0 parents commit 5ec8088
Show file tree
Hide file tree
Showing 10,912 changed files with 4,756,496 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/*
.vscode/*
.DS_Store
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "lib/FreeRTOS-Kernel"]
path = lib/FreeRTOS-Kernel
url = git@github.com:FreeRTOS/FreeRTOS-Kernel.git
[submodule "lib/ni-midi2"]
path = lib/ni-midi2
url = git@github.com:midi2-dev/ni-midi2.git
[submodule "lib/AM_MIDI2.0Lib"]
path = lib/AM_MIDI2.0Lib
url = git@github.com:midi2-dev/AM_MIDI2.0Lib.git
[submodule "lib/tusb_ump"]
path = lib/tusb_ump
url = git@github.com:midi2-dev/tusb_ump.git
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.12)

#############################################
# Pull in Pico SDK (must be before project)

# inject tinyusb dependency
# NO LONGER NEEDED as using APP specific driver routines. See ump_driver files.
# set (PICO_TINYUSB_PATH "${CMAKE_CURRENT_LIST_DIR}/lib/tinyusb")

include(pico_sdk_import.cmake)


#############################################

# Pull in FreeRTOS-Kernel (must be before pico_sdk_init() )
set(FREERTOS_KERNEL_PATH "${CMAKE_CURRENT_LIST_DIR}/lib/FreeRTOS-Kernel")
include(FreeRTOS_Kernel_import.cmake)
message( "!!!FreeRTOS Path is: ${FREERTOS_KERNEL_PATH}")

project(AmeNote C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

if (PICO_SDK_VERSION_STRING VERSION_LESS "1.3.1")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.3.1 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
endif()

set(PICO_EXAMPLES_PATH ${PROJECT_SOURCE_DIR})

# Initialize the SDK
pico_sdk_init()

# include(example_auto_set_url.cmake)

add_compile_options(-Wall
-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
-Wno-unused-function # we have some for the docs that aren't called
-Wno-maybe-uninitialized
)

add_subdirectory(lib/AM_MIDI2.0Lib)
add_subdirectory(ProtoZOA_Main)
add_subdirectory(ProtoZOA_PicoProbe)


add_subdirectory(UUT/DIN_Bridge)
add_subdirectory(UUT/CME_WIDI_CORE_EXP)
add_subdirectory(UUT/USB_FunctionBlocks)
add_subdirectory(UUT/CDC_FunctionBlocks)

set(NIMIDI2_CUSTOM_SYSEX_DATA_ALLOCATOR ON CACHE BOOL "Build with custom sysex data allocator" FORCE)
add_subdirectory(lib/ni-midi2)
add_subdirectory(UUT_FreeRTOS/USB_MIDI_Echo)
add_subdirectory(UUT_FreeRTOS/FreeRTOS_Tasks)
93 changes: 93 additions & 0 deletions Common/cobs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
//
// Created by andrew on 24/05/22.
//

#include "include/cobs.h"


void cobsUMP::processSerial(uint8_t serialByte){
//Process COBS
if(serialByte == 0){
uintBlockLength = 0;
usPos = 4;
ump = 0;
return;
}
if(!uintBlockLength){
uintBlockLength = serialByte;
serialByte=0;
}
if(usPos!=4)ump += serialByte << (8 * usPos);
if(!usPos){
umpAvail=true;
usPos = 3;

}else{
usPos--;
}
uintBlockLength--;

}

bool cobsUMP::availableUMP() {
return umpAvail;
}

uint32_t cobsUMP::readUMP() {
uint32_t outUMP = ump;
umpAvail = false;
ump = 0;
return outUMP;
}


uint8_t cobsUMP::encode(const void *data, uint8_t length, uint8_t *buffer)
{

uint8_t *encode = buffer; // Encoded byte pointer
uint8_t *codep = encode++; // Output code pointer
uint8_t code = 1; // Code value

for (const auto *byte = (const uint8_t *)data; length--; ++byte)
{
if (*byte) // Byte not zero, write it
*encode++ = *byte, ++code;

if (!*byte || code == 0xff) // Input is zero or block completed, restart
{
*codep = code, code = 1, codep = encode;
if (!*byte || length)
++encode;
}
}
*codep = code; // Write final code value

return (uint8_t)(encode - buffer);
}


//void cobsUMP::sendBufferUMP(uint8_t* buffer, uint8_t length)
//{
// if (tud_cdc_connected())
// {
// for (uint i = 0; i < length; i++)
// tud_cdc_write_char(buffer[i]);
//
// tud_cdc_write_char(0x00);
// tud_cdc_write_flush();
// }
//}


//void cobsUMP::sendUMP(uint32_t * ump, uint8_t size){
// uint8_t sBytes[size*4];
// uint8_t buffer[size*4 + 2];
// uint8_t sbPos=0;
// for(uint8_t j = 0;j<size;j++){
// for(uint8_t i = 4;i;i--){
// sBytes[sbPos++] = ump[j] >> (8*(i-1));
// }
// }
// uint8_t newLength = encode(sBytes, size*4, buffer);
// //sendBufferUMP(buffer, newLength);
//}
139 changes: 139 additions & 0 deletions Common/include/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/

#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/

/* Scheduler Related */
#define configUSE_PREEMPTION 1
#define configUSE_TICKLESS_IDLE 0
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 1
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES 32
#define configMINIMAL_STACK_SIZE ( configSTACK_DEPTH_TYPE ) 256
#define configUSE_16_BIT_TICKS 0

#define configIDLE_SHOULD_YIELD 1

/* Synchronization Related */
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configUSE_QUEUE_SETS 1
#define configUSE_TIME_SLICING 1
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 0
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5

/* System */
#define configSTACK_DEPTH_TYPE uint32_t
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t

/* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configTOTAL_HEAP_SIZE (128*1024)
#define configAPPLICATION_ALLOCATED_HEAP 0

/* Hook function related definitions. */
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0

/* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS 0
#define configUSE_TRACE_FACILITY 1
#define configUSE_STATS_FORMATTING_FUNCTIONS 0

/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES 1

/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH 1024

/* Interrupt nesting behaviour configuration. */
/*
#define configKERNEL_INTERRUPT_PRIORITY [dependent of processor]
#define configMAX_SYSCALL_INTERRUPT_PRIORITY [dependent on processor and application]
#define configMAX_API_CALL_INTERRUPT_PRIORITY [dependent on processor and application]
*/

/* SMP port only */
#define configNUM_CORES 2
#define configTICK_CORE 0
#define configRUN_MULTIPLE_PRIORITIES 0

/* RP2040 specific */
#define configSUPPORT_PICO_SYNC_INTEROP 1
#define configSUPPORT_PICO_TIME_INTEROP 1

#include <assert.h>
/* Define to trap errors during development. */
#define configASSERT(x) assert(x)

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetIdleTaskHandle 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xTaskAbortDelay 1
#define INCLUDE_xTaskGetHandle 1
#define INCLUDE_xTaskResumeFromISR 1
#define INCLUDE_xQueueGetMutexHolder 1

/* A header file that defines trace macro can be included here. */

#endif /* FREERTOS_CONFIG_H */

31 changes: 31 additions & 0 deletions Common/include/cobs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Created by andrew on 24/05/22.
//

#ifndef COBS_H
#define COBS_H
#include <cstdint>

class cobsUMP {
private:
uint8_t usPos = 4;
uint8_t uintBlockLength = 0;
uint32_t ump;
bool umpAvail = false;
//void sendBufferUMP(uint8_t* buffer, uint8_t length);

public:

void processSerial(uint8_t serialByte);
bool availableUMP();
uint32_t readUMP();

//void sendUMP(uint32_t * ump, uint8_t size);
static uint8_t encode(const void *data, uint8_t length, uint8_t *buffer);

};




#endif //PICO_EXAMPLES_COBS_H
61 changes: 61 additions & 0 deletions Common/include/interchip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// Created by andrew on 27/05/22.
//

#ifndef PICO_EXAMPLES_INTERCHIP_H
#define PICO_EXAMPLES_INTERCHIP_H

#define CAP1 0x0
#define CAP2 0x1
#define CAP3 0x2
#define CAP4 0x3
#define CAP5 0x4
#define CAP6 0x5
#define CAPRATIO 0x6

#define DISP_UP 0x7
#define DISP_DOWN 0x8
#define DISP_LEFT 0x9
#define DISP_RIGHT 0xA
#define DISP_CENTER 0xB
#define DISP_A 0xC
#define DISP_B 0xD

#define POT1 0x0
#define POT2 0x1

#define BUTTON_UP 0x80
#define BUTTON_DOWN 0x90

#define POTS 0xA0
#define ENCODER 0xB0

#include "pico/stdlib.h"

class interchip {
private:
uint8_t in_buf[1];

uint8_t messType;
uint8_t potType;
int analogMSB = -1;

void (*buttonup)(uint8_t button) = nullptr;
void (*buttondown)(uint8_t button) = nullptr;
void (*analog)(uint8_t pot, uint16_t value) = nullptr;
void (*encoder)(int dir) = nullptr;

public:

void startup();

void process();

inline void setButtonUp(void (*fptr)(uint8_t button)){ buttonup = fptr; }
inline void setButtonDown(void (*fptr)(uint8_t button)){ buttondown = fptr; }
inline void setAnalog(void (*fptr)(uint8_t pot, uint16_t value)){ analog = fptr; }
inline void setEncoder(void (*fptr)(int dir)){ encoder = fptr; }
};


#endif //PICO_EXAMPLES_INTERCHIP_H
Loading

0 comments on commit 5ec8088

Please sign in to comment.