Skip to content

Commit 2845ab2

Browse files
committed
Pico W WiFi support
1 parent 983c714 commit 2845ab2

File tree

614 files changed

+39149
-37081
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

614 files changed

+39149
-37081
lines changed

Firmware/LogicAnalyzer/.vscode/launch.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Hover to view descriptions of existing attributes.
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
6+
"showDevDebugOutput": "raw",
67
"configurations": [
78
{
89
"name": "Cortex Debug",
@@ -23,7 +24,8 @@
2324
"postRestartCommands": [
2425
"break main",
2526
"continue"
26-
]
27+
],
28+
"showDevDebugOutput": "raw"
2729
}
2830
]
2931
}

Firmware/LogicAnalyzer/.vscode/settings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555
"irq.h": "c",
5656
"IRQ.H": "cpp",
5757
"m0plus.h": "c",
58-
"platform.h": "c"
58+
"platform.h": "c",
59+
"dma.h": "c",
60+
"logicanalyzer_structs.h": "c",
61+
"cyw43_arch.h": "c",
62+
"logicanalyzer_build_settings.h": "c",
63+
"sync.h": "c",
64+
"flash.h": "c"
5965
},
6066
}

Firmware/LogicAnalyzer/CMakeLists.txt

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,43 @@ pico_sdk_init()
1919

2020
# Add executable. Default name is the project name, version 0.1
2121

22-
add_executable(LogicAnalyzer LogicAnalyzer.c )
22+
# add_executable(LogicAnalyzer LogicAnalyzer.c )
23+
24+
FILE(GLOB CSources *.c)
25+
ADD_EXECUTABLE(LogicAnalyzer ${CSources})
2326

2427
# Create C header file with the name <pio program>.pio.h
2528
pico_generate_pio_header(${PROJECT_NAME}
2629
${CMAKE_CURRENT_LIST_DIR}/LogicAnalyzer.pio
2730
)
2831

2932
pico_set_program_name(LogicAnalyzer "LogicAnalyzer")
30-
pico_set_program_version(LogicAnalyzer "0.1")
33+
pico_set_program_version(LogicAnalyzer "3.0")
34+
3135

3236
pico_enable_stdio_uart(LogicAnalyzer 0)
3337
pico_enable_stdio_usb(LogicAnalyzer 1)
3438

35-
# Add the standard library to the build
36-
target_link_libraries(LogicAnalyzer pico_stdlib)
39+
# Configure the correct cyw library based on what this is built for
40+
# Regular pico: empty
41+
# Pico W without WiFi support: pico_cyw43_arch_none
42+
# Pico W with WiFi support: pico_cyw43_arch_lwip_poll
43+
# set (CYW_LIB pico_cyw43_arch_lwip_poll)
44+
# set (CYW_LIB pico_cyw43_arch_none)
3745

3846
# Add any user requested libraries
3947
target_link_libraries(LogicAnalyzer
4048
pico_stdlib
4149
hardware_dma
4250
hardware_pio
4351
hardware_clocks
52+
hardware_flash
4453
pico_multicore
4554
pico_base_headers
46-
hardware_interp
47-
hardware_divider
55+
pico_multicore
56+
${CYW_LIB}
4857
)
4958

5059
pico_add_extra_outputs(LogicAnalyzer)
5160

61+
target_include_directories(LogicAnalyzer PRIVATE ${CMAKE_CURRENT_LIST_DIR} )
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include "Event_Machine.h"
2+
3+
//Initialize the event machine
4+
void event_machine_init(EVENT_MACHINE* machine, EVENT_HANDLER handler, uint8_t event_size, uint8_t queue_depth)
5+
{
6+
queue_init(&machine->queue, event_size, queue_depth);
7+
machine->handler = handler;
8+
}
9+
10+
bool event_has_events(EVENT_MACHINE* machine)
11+
{
12+
return &machine->queue.wptr != &machine->queue.rptr;
13+
}
14+
15+
//Adds an event to the machine
16+
void event_push(EVENT_MACHINE* machine, void* event)
17+
{
18+
queue_add_blocking(&machine->queue, event);
19+
}
20+
21+
//Processes the pending events
22+
void event_process_queue(EVENT_MACHINE* machine, void* event_buffer, uint8_t max_events)
23+
{
24+
uint8_t evt_count = 0;
25+
while(!queue_is_empty(&machine->queue) && evt_count++ < max_events)
26+
{
27+
queue_remove_blocking(&machine->queue, event_buffer);
28+
machine->handler(event_buffer);
29+
}
30+
}
31+
32+
//Clears the stored events in the machine
33+
void event_clear(EVENT_MACHINE* machine)
34+
{
35+
machine->queue.wptr = 0;
36+
machine->queue.rptr = 0;
37+
}
38+
39+
//Free an event machine
40+
void event_free(EVENT_MACHINE* machine)
41+
{
42+
queue_free(&machine->queue);
43+
machine->handler = NULL;
44+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef __EVENTMACHINE__
2+
#define __EVENTMACHINE__
3+
4+
#include "pico/stdlib.h"
5+
#include "pico/util/queue.h"
6+
7+
//Event handler function declaration
8+
typedef void(*EVENT_HANDLER)(void*);
9+
10+
//Event machine struct
11+
typedef struct _EVENT_MACHINE
12+
{
13+
//Queue to store events
14+
queue_t queue;
15+
//Function to process the events
16+
EVENT_HANDLER handler;
17+
18+
} EVENT_MACHINE;
19+
20+
void event_machine_init(EVENT_MACHINE* machine, EVENT_HANDLER handler, uint8_t args_size, uint8_t queue_depth);
21+
bool event_has_events(EVENT_MACHINE* machine);
22+
void event_push(EVENT_MACHINE* machine, void* event);
23+
void event_process_queue(EVENT_MACHINE* machine, void* event_buffer, uint8_t max_events);
24+
void event_clear(EVENT_MACHINE* machine);
25+
void event_free(EVENT_MACHINE* machine);
26+
27+
#endif

0 commit comments

Comments
 (0)