not in a working state
This commit is contained in:
parent
a889861d9f
commit
6b61d0298f
|
@ -7,8 +7,7 @@
|
|||
|
||||
|
||||
|
||||
#define SDCARD_PIO 1
|
||||
#define SDCARD_PIO_SM 7
|
||||
|
||||
#define SDCARD_PIN_SPI0_CS 26
|
||||
#define SDCARD_PIN_SPI0_SCK 18
|
||||
#define SDCARD_PIN_SPI0_MOSI 19
|
||||
|
@ -26,9 +25,14 @@ PicoCamera camera;
|
|||
int main() {
|
||||
stdio_init_all();
|
||||
|
||||
sleep_ms(5000);
|
||||
sleep_ms(2000);
|
||||
|
||||
camera.init();
|
||||
while (1){
|
||||
camera.mount_sdcard();
|
||||
sleep_ms(1000);
|
||||
}
|
||||
camera.print_directory_listing("");
|
||||
camera.memory_test();
|
||||
|
||||
gpio_init(camera.SW_A);
|
||||
|
|
|
@ -5,6 +5,6 @@ target_sources(pico_camera INTERFACE
|
|||
)
|
||||
|
||||
target_include_directories(pico_camera INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
add_definitions(-DSDCARD_PIN_SPI0_CS=26 -DSDCARD_PIN_SPI0_MISO=20)
|
||||
|
||||
# Pull in pico libraries that we need
|
||||
target_link_libraries(pico_camera INTERFACE pico_stdlib pimoroni_i2c ov2640 aps6404 fatfs sdcard)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "pico/stdlib.h"
|
||||
#include "hardware/sync.h"
|
||||
#include "pico_camera.hpp"
|
||||
#include "drivers/fatfs/ff.h"
|
||||
|
||||
namespace pimoroni {
|
||||
void PicoCamera::init(uint32_t* buffer, uint32_t buffer_len) {
|
||||
|
@ -94,9 +95,27 @@ namespace pimoroni {
|
|||
sleep_us(100);
|
||||
gpio_put(SDCARD_CS, 0);
|
||||
}
|
||||
}
|
||||
void PicoCamera::enable_psram(){
|
||||
gpio_set_function(18, GPIO_FUNC_PIO0);
|
||||
gpio_set_function(19, GPIO_FUNC_PIO0);
|
||||
gpio_set_function(20, GPIO_FUNC_PIO0);
|
||||
|
||||
}
|
||||
|
||||
void PicoCamera::enable_sdcard(){
|
||||
gpio_set_function(18, GPIO_FUNC_SPI);
|
||||
gpio_set_function(19, GPIO_FUNC_SPI);
|
||||
gpio_set_function(20, GPIO_FUNC_SPI);
|
||||
|
||||
}
|
||||
|
||||
void PicoCamera::mount_sdcard(){
|
||||
enable_sdcard();
|
||||
|
||||
printf("mounting sd card.. \n");
|
||||
|
||||
printf(" cs pin %d ", SDCARD_PIN_SPI0_CS);
|
||||
|
||||
file_result = f_mount(file_system_p, nullptr, 1);
|
||||
if (file_result != FR_OK) {
|
||||
|
@ -109,6 +128,7 @@ namespace pimoroni {
|
|||
sdcard_mounted = true;
|
||||
printf("done!\n");
|
||||
}
|
||||
enable_psram();
|
||||
}
|
||||
|
||||
void PicoCamera::print_directory_listing(const char* path){
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "drivers/ov2640/ov2640.hpp"
|
||||
#include "drivers/fatfs/ff.h"
|
||||
|
||||
|
||||
namespace pimoroni {
|
||||
|
||||
|
||||
|
@ -27,7 +28,8 @@ namespace pimoroni {
|
|||
void init(uint32_t* buffer=nullptr, uint32_t buffer_len=0);
|
||||
|
||||
void memory_test();
|
||||
|
||||
void enable_psram();
|
||||
void enable_sdcard();
|
||||
// sdcard functions
|
||||
void mount_sdcard();
|
||||
void print_directory_listing(const char* path);
|
||||
|
|
Loading…
Reference in New Issue