some general testing things
This commit is contained in:
parent
31d55f0186
commit
1abbe4ea97
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
*.egg-info/
|
||||
build/
|
||||
|
@ -1,7 +1,7 @@
|
||||
MEMORY
|
||||
{
|
||||
RAM : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
FLASH : ORIGIN = 0x00000000, LENGTH = 64K
|
||||
FLASH : ORIGIN = 0x00000000, LENGTH = 80K
|
||||
}
|
||||
|
||||
REGION_ALIAS("REGION_TEXT", FLASH);
|
||||
|
@ -4,7 +4,7 @@ use crate::proto::{
|
||||
serialize_response_error, serialize_response_value, PacketParser, ResponsePacket, Settings, ErrorCodes
|
||||
};
|
||||
|
||||
struct CommandInterface {
|
||||
pub struct CommandInterface {
|
||||
parser: PacketParser,
|
||||
}
|
||||
|
||||
|
@ -15,11 +15,14 @@ use core::{
|
||||
use embedded_hal::prelude::{_embedded_hal_blocking_i2c_Read, _embedded_hal_blocking_i2c_Write};
|
||||
use mcp4726::Status;
|
||||
use riscv_rt::entry;
|
||||
use smoltcp::socket::{Socket, self};
|
||||
use smoltcp::wire::{IpAddress, Ipv4Address};
|
||||
use smoltcp::{
|
||||
iface::{SocketSet, SocketStorage},
|
||||
time::Instant,
|
||||
wire::HardwareAddress,
|
||||
socket::tcp::Socket as TcpSocket,
|
||||
socket::tcp::SocketBuffer,
|
||||
};
|
||||
|
||||
mod eth;
|
||||
@ -98,6 +101,13 @@ fn main() -> ! {
|
||||
let mut socket_storage = [SocketStorage::EMPTY; 4];
|
||||
let mut socket_set = SocketSet::new(&mut socket_storage[..]);
|
||||
|
||||
//let mut tx_storage = [0u8; 128];
|
||||
//let mut rx_storage = [0u8; 128];
|
||||
//let mut tx_buf = SocketBuffer::new(&mut tx_storage[..]);
|
||||
//let mut rx_buf = SocketBuffer::new(&mut rx_storage[..]);
|
||||
//let mut command_socket = socket_set.add(TcpSocket::new(tx_buf, rx_buf));
|
||||
|
||||
|
||||
let mut last_blink: u32 = 0;
|
||||
let mut toggle = false;
|
||||
//defmt::info!("Done setup");
|
||||
@ -120,6 +130,8 @@ fn main() -> ! {
|
||||
//write_reg(0xf000_381c, 1u32);
|
||||
}
|
||||
|
||||
//let mut cmd = command_interface::CommandInterface::new();
|
||||
|
||||
loop {
|
||||
let now = millis();
|
||||
if now - last_blink > 1000 {
|
||||
@ -132,6 +144,7 @@ fn main() -> ! {
|
||||
}
|
||||
|
||||
if iface.poll(Instant::from_millis(now), &mut device, &mut socket_set) {
|
||||
//cmd.run(socket_set.get_mut(command_socket));
|
||||
}
|
||||
|
||||
handle_timer_event();
|
||||
|
@ -1,2 +1,17 @@
|
||||
IP = "192.168.88.69"
|
||||
PORT = 2000
|
||||
|
||||
import socket
|
||||
from .command_packets import CommandPacket, Settings, PacketParser
|
||||
|
||||
def main():
|
||||
print("Hello world!")
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||
sock.connect((IP, PORT))
|
||||
sock.send(CommandPacket(False, Settings.Gain, 125).serialize())
|
||||
|
||||
data = sock.recv(1024)
|
||||
|
||||
parser = PacketParser()
|
||||
data, packet = parser.parse_bytearray(data)
|
||||
if packet is not None:
|
||||
print(packet)
|
||||
|
Loading…
Reference in New Issue
Block a user