Skip to content
Snippets Groups Projects
Commit e9f230e1 authored by Fanis Baikas's avatar Fanis Baikas
Browse files

Added Fast-kNN demo folder with updated implementation of kNN classifier

parent 404ad99e
Branches
No related tags found
No related merge requests found
Pipeline #11590 passed
...@@ -42,5 +42,6 @@ add_subdirectory(clock_scaling_power_measurement) ...@@ -42,5 +42,6 @@ add_subdirectory(clock_scaling_power_measurement)
add_subdirectory(nanosoc_demo) add_subdirectory(nanosoc_demo)
add_subdirectory(nanosoc_regression) add_subdirectory(nanosoc_regression)
add_subdirectory(fast_knn_demo2) add_subdirectory(fast_knn_demo2)
add_subdirectory(fast_knn_demo)
add_subdirectory(srimanth_demo) add_subdirectory(srimanth_demo)
#add_subdirectory(FT1248) #add_subdirectory(FT1248)
\ No newline at end of file
if (TARGET tinyusb_device)
set(PROJECT_NAME fast_knn_demo)
# Add your source files
add_executable(${PROJECT_NAME}
fast_knn_demo.cpp
hardware_config.c
)
#target_compile_definitions(fast_knn_demo PRIVATE
## PICO_DEFAULT_UART=0
# PICO_DEFAULT_UART_TX_PIN=28
# PICO_DEFAULT_UART_RX_PIN=29
# PICO_DEFAULT_UART_BAUD_RATE=9600
# )
pico_enable_stdio_usb(${PROJECT_NAME} 1)
pico_enable_stdio_uart(${PROJECT_NAME} 0)
pico_generate_pio_header(${PROJECT_NAME}
${SOCLABS_PIO_PATH}/ft1248x1/ft1248x1_sm.pio
)
# Don't forget to link the libraries you need!
target_link_libraries(${PROJECT_NAME}
pico_explorer
hardware_pio
hardware_i2c
nanosoc_graphics
nanosoc_board_system
pico_multicore
I2C_device_bus
hardware_clocks
FatFs_SPI
)
# create map/bin/hex file etc.
pico_add_extra_outputs(${PROJECT_NAME})
elseif(PICO_ON_DEVICE)
message(WARNING "not building hello_usb because TinyUSB submodule is not initialized in the SDK")
endif()
This diff is collapsed.
// Accelerator engine registers
#define FAST_KNN_REGS_BASE (0x60008000UL)
typedef struct {
uint32_t UNLAB_IMG_DOT_PROD; //ADDR offset 0x00
uint32_t LAB_IMG_DOT_PROD; //ADDR offset 0x04
uint32_t COMB_DOT_PROD; //ADDR offset 0x08
uint32_t BYTE_COUNTER_REG; //ADDR offset 0x0C
uint32_t PRIMING_MODE_REG; //ADDR offset 0x10
uint32_t SW_RESET_REG; //ADDR offset 0x14
} FAST_KNN_regs_typedef;
\ No newline at end of file
/* hw_config.c
Copyright 2021 Carl John Kugler III
Licensed under the Apache License, Version 2.0 (the License); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
/*
This file should be tailored to match the hardware design.
There should be one element of the spi[] array for each hardware SPI used.
There should be one element of the sd_cards[] array for each SD card slot.
The name is should correspond to the FatFs "logical drive" identifier.
(See http://elm-chan.org/fsw/ff/doc/filename.html#vol)
The rest of the constants will depend on the type of
socket, which SPI it is driven by, and how it is wired.
*/
#include <string.h>
//
#include "my_debug.h"
//
#include "hw_config.h"
//
#include "ff.h" /* Obtains integer types */
//
#include "diskio.h" /* Declarations of disk functions */
static spi_t spis[] = {{
.hw_inst = spi0,
.miso_gpio = 0,
.mosi_gpio = 19,
.sck_gpio = 18,
.baud_rate = 12500 * 1000
}};
// Hardware Configuration of the SD Card "objects"
static sd_card_t sd_cards[] = {{
.pcName = "0:",
.spi = &spis[0],
.ss_gpio = 1,
.use_card_detect = false
}};
/* ********************************************************************** */
size_t sd_get_num() { return count_of(sd_cards); }
sd_card_t *sd_get_by_num(size_t num) {
if (num <= sd_get_num()) {
return &sd_cards[num];
} else {
return NULL;
}
}
size_t spi_get_num() { return count_of(spis); }
spi_t *spi_get_by_num(size_t num) {
if (num <= sd_get_num()) {
return &spis[num];
} else {
return NULL;
}
}
/* [] END OF FILE */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment