Commit Graph

80 Commits

Author SHA1 Message Date
Ryan Summers 0ea7499543
Merge pull request #3 from quartiq/release/0.3.0
Prepping for release
2023-07-03 14:51:20 +02:00
Ryan Summers 237009b628 Reverting repo update 2023-07-03 14:48:02 +02:00
Ryan Summers b1f98c3622 Prepping for release 2023-07-03 13:50:06 +02:00
Ryan Summers 753112e7b0
Merge pull request #1 from quartiq/feature/nal-removal
Removing NAL, reordering dependencies
2023-07-03 13:45:28 +02:00
Ryan Summers 0ecfe84ea0 Fixing smoltcp features 2023-07-03 13:43:12 +02:00
Ryan Summers 207a75358f Merge branch 'master' into feature/nal-removal 2023-07-03 13:39:50 +02:00
Ryan Summers 21ab601b0d
Merge pull request #2 from quartiq/feature/ci
Adding CI, format
2023-07-03 13:37:12 +02:00
Ryan Summers fc43e3b5c5 Fixing example features 2023-07-03 12:32:54 +02:00
Ryan Summers e94d1df1ec Adding dummy commit 2023-07-03 12:28:47 +02:00
Ryan Summers 0fa5c8f81c Enabling features in examples 2023-07-03 12:27:35 +02:00
Ryan Summers ed42d185df Updating example features 2023-07-03 12:26:47 +02:00
Ryan Summers 253a1f6f1d Adding format 2023-07-03 12:25:46 +02:00
Ryan Summers 273cf09ad2 Removing nal module 2023-07-03 12:23:44 +02:00
Ryan Summers fb2fd17277 Removing NAL, reordering dependencies 2023-07-03 12:21:26 +02:00
Harry Ho 512fd154bd nix: Use lib in place of deprecated stdenv.lib 2021-09-02 17:10:03 +08:00
Harry Ho fbcc3778d2 spi: Always delay for NSS setup time
* Fixes the lack of setup time delay of an fixed-byte command that immediately follows an N-byte command.
* Extra 50ns will be inserted in-between fixed-byte commands but should be acceptable.
2021-06-23 12:49:21 +08:00
Harry Ho bb6824b944 nal: Remove delay_ns func pointer 2021-06-04 13:21:02 +08:00
Harry Ho d8b1132b8a examples: Replace delay_ns with cortex-m delay 2021-06-03 15:06:24 +08:00
Harry Ho 999ca5f08a spi: Replace delay_ns func pointer with delay on cortex-m
* SPI NSS nanosecond delays now only takes place on Cortex-M CPUs
2021-06-03 15:03:43 +08:00
Harry Ho 9de8d77a24 Restore embedded_hal DelayUs for device init 2021-06-03 13:38:59 +08:00
Harry Ho ec20970a50 spi: Impose stricter NSS timing 2021-06-03 12:03:35 +08:00
Harry Ho 35b7924431 spi: Add back NSS high delay conditionally based on opcode type 2021-06-03 11:51:09 +08:00
Harry Ho d05d7f91e2 spi: Simplify all reg reads/writes as rw_n() 2021-06-03 11:51:09 +08:00
Harry Ho 27ba42c4fb spi: Introduce certain 1 & 3-byte opcodes to replace reg read/writes 2021-06-03 11:51:09 +08:00
Harry Ho edb1f64f26 nix: Use itm-tools from nixpkgs-21.05 2021-06-02 14:15:07 +08:00
Harry Ho 40a53cc0d6 spi: Fix Rx/Tx buffer logic & simplify
* tx/rx: Rename wrap_addr to start_addr for clarity
* Fix RX logic, when advancing the tail pointer, not retrieving the stored RX buffer start address but the default value instead
* Fix TX logic, when advancing the head pointer for next transmission, not retrieving the stored TX buffer end address but the default value instead
* Rename SPI-related const's to match the datasheet: RERXDATA→RRXDATA, WEGPDATA→WGPDATA
* Remove useless const's for SRAM default addresses for TX buffer
* Simplify code
2021-04-30 17:30:25 +08:00
Harry Ho 6d17703e6b Add Enc424j600::init() for complete initialisation 2021-04-29 17:08:19 +08:00
Harry Ho 78e4d82660 examples: Simplify & fix naming 2021-04-29 17:08:18 +08:00
Harry Ho b9b28f0725 Rename functions & classes for clarity
* EthController → EthPhy
  * ::receive_next() → ::recv_packet()
  * ::send_raw_packet() → ::send_packet()
* SpiEth -> Enc424j600
  * ::read_from_mac() → ::read_mac_addr()
  * ::write_mac_address() → ::write_mac_addr()
* EthControllerError → Error
  * ::GeneralError → ::RegisterError
* spi::SpiPortError -> spi::Error
2021-04-29 17:07:28 +08:00
Harry Ho 3529fcd192 Turn EthController trait methods unrelated to PHY into instance methods 2021-04-29 17:03:51 +08:00
Harry Ho 232a08f110 nal: Fix comments & styling 2021-03-17 10:21:18 +08:00
Harry Ho 2eadb652ff nal: Fix infinite loop when TX buffer is full
* For example, if the PHY linkup is down, instead of looping until resumption of the linkup, a write operation now closes the socket for re-connection in the future
2021-03-16 10:25:23 +08:00
Harry Ho 6de19f43cc nal: Prevent pushing duplicate handles for the same TcpSocket 2021-03-12 12:36:30 +08:00
Harry Ho 66c3aa534f nal: socket (TcpSocket) → handle; internal_socket → socket 2021-03-12 11:26:07 +08:00
Harry Ho 99899e6657 nal: Fix read/write not pushing erroneous socket back to the stack
* Based on quartiq's minimq as of 933687c2e4
* In minimq applications, a socket is expected to be returned when `nal::TcpStack::open()` is called
  * `MqttClient::read()`/`write()` takes away the TCP socket handle (wrapped as an `Option`) from its `RefCell`, and then calls `nal::TcpStack::read()`/`write()`; if NAL returns `nb::Error`, then the MQTT client will propagate and return the error, leaving `None` behind
  * Afterwards, when `MqttClient::socket_is_connected()` gets called (e.g. while polling the interface), it will detect that the socket handle is `None`, and attempt to call `nal::TcpStack::open()`
  * Since `open()` pops a socket from the array (`unused_handles`), when implementing this NAL the socket should have been pushed back to the stack, i.e. by `close()`; this prevents any future calls of `open()` from returning `NetworkError::NoSocket` due to emptiness of the array of socket handles
2021-03-11 17:32:44 +08:00
Harry Ho d9e50bbcb6 nal: Prevent looping until the stack successfully connects to remote
* `NetworkStack::connect()`:
  * Add timeout for connection attempt
  * Now returns the socket at TCP ESTABLISHED or CLOSED states, or after connection timeout
* Split `NetworkStack::update()` into `update()` (for controlling the clock) and `poll()` (for polling the smoltcp EthernetInterface)
* Also remove option `auto_time_update`; the main application is responsible for what values `embedded_time::clock::Clock::try_now()` should return
2021-03-05 14:52:57 +08:00
Harry Ho 6506562c3a cargo: fix [package] meta 2021-01-28 17:56:14 +08:00
Harry Ho 3d471bff0a cargo: cleanup features 2021-01-28 17:56:13 +08:00
occheung b6d1b3828a feature: add nal support 2021-01-26 17:21:53 +08:00
occheung 8da639b89d cargo: bump smoltcp version 2021-01-26 15:41:16 +08:00
occheung 6021623813 lib: add write mac 2021-01-25 18:32:21 +08:00
occheung 1add94c12e Remove cortex-m dependencies for delay (#2)
Co-Authored-By: occheung <dc@m-labs.hk>
Co-Committed-By: occheung <dc@m-labs.hk>
2021-01-25 12:35:23 +08:00
Sebastien Bourdeauducq 1ce193b8aa add gitignore 2021-01-20 15:26:48 +08:00
Sebastien Bourdeauducq 04ca484ded remove Cargo lockfile (this is a library) 2021-01-20 15:26:39 +08:00
Sebastien Bourdeauducq 01030f16a8 bump version 2021-01-20 15:22:24 +08:00
occheung 26dabd4dc0 spi: add CS delay 2021-01-18 15:33:27 +08:00
occheung c4b62cc238 lib: derive debug for error for unwrapping 2021-01-18 15:33:03 +08:00
occheung 356c3aefe2 lib: reduce stack usage 2021-01-18 15:32:32 +08:00
Sebastien Bourdeauducq 2ca717c94f add license 2021-01-18 13:21:52 +08:00
Sebastien Bourdeauducq d70937f053 update repo url 2021-01-18 13:16:58 +08:00