Giter Site home page Giter Site logo

rp2040nexus / pico-10base-t-library Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tvlad1234/pico-10base-t-library

0.0 0.0 0.0 28 KB

Library which allows the Pi Pico to send UDP packets over 10BASE-T Ethernet

License: MIT License

C 98.11% CMake 1.89%

pico-10base-t-library's Introduction

Pico-10BASE-T-Library

Library which allows the Pi Pico to send UDP packets over 10BASE-T Ethernet
Based on Pico-10BASE-T by kingyoPiyo
Example code can be found here

What does it do?

This library allows the Raspbery Pi Pico (or any other RP2040-based board) to send UDP traffic over Ethernet with no extra hardware. This is acomplished by using the PIO blocks inside the RP2040. This library also makes use of the second core of the microcontroller, which handles the link pulse and data sending.

How to use it?

The hardware configuration used here is the same as in Pico-10BASE-T.

In order to use this library, you must add the Pico-10BASE-T-Library subdirectory to the CMakeLists.txt of your project and include 10baset in target_link_libraries. Then, just add the 10baset.h header into your code.

The dest_ip_t type is a structure which is used to specify the destination IP for the transmit functions. It contains the four bytes of the destination IP: ip1, ip2, ip3, ip4.

The library provides the following functions:
void eth_core_start() is used to initialize the Ethernet link on the second core and PIO.
void eth_set_ip(uint8_t ip1, uint8_t ip2, uint8_t ip3, uint8_t ip4) sets the IP address of the board.
void udp_printf(dest_ip_t ip, uint16_t port, const char *format, ...) sends a formatted string to the specified destination IP address on the specified port over UDP. It should be used just like a regular printf function, however be mindful of the UDP payload size limitation set in 10baset.h, which can be modified to suit your own application.
void udp_send_data(dest_ip_t ip, uint16_t port, uint8_t data[], uint16_t length) sends data to the specified IP, over the specified port. It works by packing the data into a payload structure.
void udp_send_payload(udp_payload *payload) transmits a pre-packaged payload.

pico-10base-t-library's People

Contributors

tvlad1234 avatar puhitaku avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.