Skip to content

Commit

Permalink
break: Remove Electrical/Optical broadband - make single BroadbandCon…
Browse files Browse the repository at this point in the history
…fig (#29)

# Summary
Breaking changes made to the API regarding Broadband naming. Specifically

  * Removes NodeType::kElectricalBroadband
  * Removes NodeType::kOpticalBroadband
  * Adds NodeType::kBroadbandSource
  * Adds NodeType::kSpikeSource
  * Refactors the BroadbandSourceConfig to have a oneof for the signal type and consolidates the shared fields

# Testing
  * Added a CI for compilation
  • Loading branch information
gilbert-sci authored Feb 6, 2025
1 parent c841ecb commit 6b02951
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 42 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/proto-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Proto Compilation Check

on:
push:
paths:
- '**.proto'
pull_request:
paths:
- '**.proto'

jobs:
check-proto:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Protobuf Compiler
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Check protoc version
run: protoc --version

- name: Create temp directory for compilation
run: mkdir -p /tmp/proto_compiled

- name: Compile Proto files
run: |
PROTO_FILES=$(find api -name '*.proto')
echo "Compiling $PROTO_FILES"
protoc --proto_path=. $PROTO_FILES --cpp_out=/tmp/proto_compiled
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Synapse API 1.0
# Synapse API 1.1

The Synapse Protocol defines a standard interface for interacting with a wide range of possible neural interface devices.

Expand Down
18 changes: 9 additions & 9 deletions api/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ syntax = "proto3";
package synapse;

import "api/datatype.proto";
import "api/nodes/electrical_broadband.proto";
import "api/nodes/broadband_source.proto";
import "api/nodes/electrical_stimulation.proto";
import "api/nodes/optical_broadband.proto";
import "api/nodes/optical_stimulation.proto";
import "api/nodes/spike_detect.proto";
import "api/nodes/spectral_filter.proto";
import "api/nodes/stream_out.proto";
import "api/nodes/stream_in.proto";
import "api/nodes/disk_writer.proto";
import "api/nodes/spike_source.proto";

enum NodeType {
kNodeTypeUnknown = 0;
kStreamIn = 1;
kStreamOut = 2;
kElectricalBroadband = 3;
kBroadbandSource = 3;
kElectricalStimulation = 4;
kOpticalBroadband = 5;
kOpticalStimulation = 6;
kSpikeDetect = 7;
kOpticalStimulation = 5;
kSpikeDetect = 6;
kSpikeSource = 7;
kSpectralFilter = 8;
kDiskWriter = 9;
}
Expand All @@ -32,13 +32,13 @@ message NodeConfig {
oneof config {
StreamOutConfig stream_out = 3;
StreamInConfig stream_in = 4;
ElectricalBroadbandConfig electrical_broadband = 5;
BroadbandSourceConfig broadband_source = 5;
ElectricalStimulationConfig electrical_stimulation = 6;
OpticalBroadbandConfig optical_broadband = 7;
OpticalStimulationConfig optical_stimulation = 8;
SpikeDetectConfig spike_detect = 9;
SpectralFilterConfig spectral_filter = 10;
DiskWriterConfig disk_writer = 11;
SpikeSourceConfig spike_source = 12;
}
}

Expand All @@ -47,7 +47,7 @@ message NodeStatus {
uint32 id = 2;
oneof status {
StreamOutStatus stream_out = 3;
ElectricalBroadbandStatus electrical_broadband = 4;
BroadbandSourceStatus broadband_source = 4;
StreamInStatus stream_in = 5;
ElectricalStimulationStatus electrical_stimulation = 6;
}
Expand Down
20 changes: 20 additions & 0 deletions api/nodes/broadband_source.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

import "api/nodes/signal_config.proto";
import "api/nodes/signal_status.proto";

package synapse;

message BroadbandSourceConfig {
uint32 peripheral_id = 1;
uint32 bit_width = 2;
uint32 sample_rate_hz = 3;
float gain = 4;

// Implementation specific configurations
SignalConfig signal = 5;
}

message BroadbandSourceStatus {
SignalStatus status = 1;
}
19 changes: 0 additions & 19 deletions api/nodes/electrical_broadband.proto

This file was deleted.

11 changes: 0 additions & 11 deletions api/nodes/optical_broadband.proto

This file was deleted.

22 changes: 22 additions & 0 deletions api/nodes/signal_config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
syntax = "proto3";

import "api/channel.proto";

package synapse;

message ElectrodeConfig {
repeated Channel channels = 1;
float low_cutoff_hz = 2;
float high_cutoff_hz = 3;
}

message PixelConfig {
repeated uint32 pixel_mask = 1;
}

message SignalConfig {
oneof signal_type {
ElectrodeConfig electrode = 1;
PixelConfig pixel = 2;
}
}
18 changes: 18 additions & 0 deletions api/nodes/signal_status.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
syntax = "proto3";

package synapse;

message ElectrodeStatus {
float lsb_uV = 1;
}

message PixelStatus {

}

message SignalStatus {
oneof signal_type {
ElectrodeStatus electrode = 1;
PixelStatus pixel = 2;
}
}
16 changes: 16 additions & 0 deletions api/nodes/spike_source.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";

import "api/channel.proto";
import "api/nodes/signal_config.proto";

package synapse;

message SpikeSourceConfig {
uint32 peripheral_id = 1;
uint32 sample_rate_hz = 2;
float spike_window_ms = 3;
float gain = 4;
float threshold_uV = 5;

ElectrodeConfig electrodes = 6;
}
4 changes: 2 additions & 2 deletions api/synapse.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import "api/files.proto";
message Peripheral {
enum Type {
kUnknown = 0;
kElectricalRecord = 1;
kBroadbandSource = 1;
kElectricalStimulation = 2;
kOpticalStimulation = 3;
kOpticalRecord = 4;
kSpikeSource = 4;
}
string name = 1;
string vendor = 2;
Expand Down

0 comments on commit 6b02951

Please sign in to comment.