Skip to content

Commit 5734b1d

Browse files
add render-documentation workflow
1 parent f529993 commit 5734b1d

File tree

4 files changed

+229
-4
lines changed

4 files changed

+229
-4
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Render Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".github/workflows/render-documentation.ya?ml"
9+
- "examples/**"
10+
- "src/**"
11+
pull_request:
12+
branches:
13+
- main
14+
paths:
15+
- ".github/workflows/render-documentation.ya?ml"
16+
- "examples/**"
17+
- "src/**"
18+
workflow_dispatch:
19+
20+
jobs:
21+
render-docs:
22+
permissions:
23+
contents: write
24+
uses: arduino/render-docs-github-action/.github/workflows/render-docs.yml@main
25+
with:
26+
source-path: './src'
27+
target-path: './docs/api.md'
28+
fail-on-warnings: false

src/Arduino_10BASE_T1S_PHY_Interface.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ class Arduino_10BASE_T1S_PHY_Interface
2929
public:
3030
virtual ~Arduino_10BASE_T1S_PHY_Interface() { }
3131

32+
/**
33+
* @brief Initializes the PHY interface with the specified network settings.
34+
*
35+
* This method configures the PHY interface with the provided IP address,
36+
* network mask, gateway, MAC address, and PLCA settings.
37+
*
38+
* @param ip_addr The IP address to assign to the interface.
39+
* @param network_mask The network mask to use.
40+
* @param gateway The gateway IP address.
41+
* @param mac_addr The MAC address to assign to the interface.
42+
* @param t1s_plca_settings The PLCA settings to use.
43+
* @return Returns true if the initialization was successful, false otherwise.
44+
*/
3245
virtual bool begin(IPAddress const ip_addr,
3346
IPAddress const network_mask,
3447
IPAddress const gateway,

src/Arduino_10BASE_T1S_UDP.h

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,174 @@
3636
class Arduino_10BASE_T1S_UDP : public UDP
3737
{
3838
public:
39+
/**
40+
* @class Arduino_10BASE_T1S_UDP
41+
* @brief UDP communication class for Arduino 10BASE-T1S library.
42+
*/
3943
Arduino_10BASE_T1S_UDP();
4044
virtual ~Arduino_10BASE_T1S_UDP();
4145

4246

4347
/* arduino:UDP */
48+
/**
49+
* @brief Initializes the UDP instance to listen on the specified port.
50+
*
51+
* This method sets up the UDP protocol to begin listening for incoming packets
52+
* on the given port. It should be called before attempting to send or receive
53+
* UDP packets.
54+
*
55+
* @param port The local port to listen on.
56+
* @return Returns 1 if successful, 0 if there was an error.
57+
*/
4458
virtual uint8_t begin(uint16_t port) override;
59+
60+
61+
/**
62+
* @brief Stops the UDP connection and releases any associated resources.
63+
*
64+
* This method overrides the base class implementation to properly close
65+
* the UDP socket and perform necessary cleanup operations.
66+
*/
4567
virtual void stop() override;
4668

69+
/**
70+
* @brief Begins the construction of a UDP packet to the specified IP address and port.
71+
*
72+
* Initializes the UDP packet buffer and prepares it to send data to the given destination.
73+
*
74+
* @param ip The destination IP address.
75+
* @param port The destination port number.
76+
* @return int Returns 1 on success, 0 on failure.
77+
*/
4778
virtual int beginPacket(IPAddress ip, uint16_t port) override;
79+
80+
/**
81+
* @brief Begins the construction of a UDP packet to the specified host and port.
82+
*
83+
* Initializes the UDP packet buffer and prepares it to send data to the given destination.
84+
*
85+
* @param host The destination host name or IP address as a string.
86+
* @param port The destination port number.
87+
* @return int Returns 1 on success, 0 on failure.
88+
*/
4889
virtual int beginPacket(const char *host, uint16_t port) override;
90+
91+
/**
92+
* @brief Finishes the construction of a UDP packet and sends it.
93+
*
94+
* This method finalizes the UDP packet and transmits it to the previously specified
95+
* destination IP address and port.
96+
*
97+
* @return int Returns 1 on success, 0 on failure.
98+
*/
4999
virtual int endPacket() override;
100+
101+
/**
102+
* @brief Sends a single byte of data in the current UDP packet.
103+
*
104+
* This method appends a single byte to the current UDP packet buffer.
105+
*
106+
* @param data The byte of data to send.
107+
* @return size_t Returns the number of bytes written, which is always 1 for a single byte.
108+
*/
50109
virtual size_t write(uint8_t data) override;
110+
111+
/**
112+
* @brief Sends a buffer of data in the current UDP packet.
113+
*
114+
* This method appends a specified number of bytes from the provided buffer to the
115+
* current UDP packet buffer.
116+
*
117+
* @param buffer Pointer to the data buffer to send.
118+
* @param size The number of bytes to write from the buffer.
119+
* @return size_t Returns the number of bytes written, which may be less than size if an error occurs.
120+
*/
51121
virtual size_t write(const uint8_t * buffer, size_t size) override;
52122

123+
/**
124+
* @brief Sends a string in the current UDP packet.
125+
*
126+
* This method appends a null-terminated string to the current UDP packet buffer.
127+
*
128+
* @param str Pointer to the null-terminated string to send.
129+
* @return size_t Returns the number of bytes written, including the null terminator.
130+
*/
53131
virtual int parsePacket() override;
132+
133+
/**
134+
* @brief Checks if there are any incoming UDP packets available to read.
135+
*
136+
* This method checks the internal buffer for any received UDP packets.
137+
*
138+
* @return int Returns the number of available bytes in the current packet, or 0 if no packets are available.
139+
*/
54140
virtual int available() override;
141+
142+
/**
143+
* @brief Reads a single byte from the current UDP packet.
144+
*
145+
* This method retrieves the next byte from the current UDP packet buffer.
146+
*
147+
* @return int Returns the byte read, or -1 if no data is available.
148+
*/
55149
virtual int read() override;
150+
151+
/**
152+
* @brief Reads a specified number of bytes from the current UDP packet into a buffer.
153+
*
154+
* This method reads data from the current UDP packet into the provided buffer.
155+
*
156+
* @param buffer Pointer to the buffer where the data will be stored.
157+
* @param len The number of bytes to read into the buffer.
158+
* @return int Returns the number of bytes read, which may be less than len if not enough data is available.
159+
*/
56160
virtual int read(unsigned char* buffer, size_t len) override;
161+
162+
/**
163+
* @brief Reads a specified number of bytes from the current UDP packet into a character buffer.
164+
*
165+
* This method reads data from the current UDP packet into the provided character buffer.
166+
*
167+
* @param buffer Pointer to the character buffer where the data will be stored.
168+
* @param len The number of bytes to read into the buffer.
169+
* @return int Returns the number of bytes read, which may be less than len if not enough data is available.
170+
*/
57171
virtual int read(char* buffer, size_t len) override;
172+
173+
/**
174+
* @brief Peeks at the next byte in the current UDP packet without removing it from the buffer.
175+
*
176+
* This method retrieves the next byte from the current UDP packet buffer without consuming it.
177+
*
178+
* @return int Returns the next byte, or -1 if no data is available.
179+
*/
58180
virtual int peek() override;
181+
182+
/**
183+
* @brief Flushes the current UDP packet buffer.
184+
*
185+
* This method clears the current UDP packet buffer, discarding any unsent data.
186+
*/
59187
virtual void flush() override;
60188

189+
/**
190+
* @brief Returns the IP address of the remote host that sent the last received packet.
191+
*
192+
* This method retrieves the IP address of the sender of the last received UDP packet.
193+
*
194+
* @return IPAddress Returns the IP address of the remote host.
195+
*/
61196
virtual IPAddress remoteIP() override;
197+
198+
/**
199+
* @brief Returns the port number of the remote host that sent the last received packet.
200+
*
201+
* This method retrieves the port number of the sender of the last received UDP packet.
202+
*
203+
* @return uint16_t Returns the port number of the remote host.
204+
*/
62205
virtual uint16_t remotePort() override;
63206

64-
65207
/* This function MUST not be called from the user of this library,
66208
* it's used for internal purposes only.
67209
*/

src/microchip/TC6_Arduino_10BASE_T1S.h

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,31 @@ enum class DIO { A0, A1 };
7474
class TC6_Arduino_10BASE_T1S : public Arduino_10BASE_T1S_PHY_Interface
7575
{
7676
public:
77+
/**
78+
* @class TC6_Arduino_10BASE_T1S
79+
* @brief Arduino 10BASE-T1S PHY interface implementation using TC6.
80+
*
81+
* This class provides the implementation of the Arduino_10BASE_T1S_PHY_Interface
82+
* using the TC6 hardware abstraction layer for 10BASE-T1S communication.
83+
*/
7784
TC6_Arduino_10BASE_T1S(TC6_Io & tc6_io);
7885

7986
virtual ~TC6_Arduino_10BASE_T1S();
8087

81-
88+
/**
89+
* @brief Initializes the TC6 Arduino 10BASE-T1S PHY interface with the specified network settings.
90+
*
91+
* This method configures the TC6 interface with the provided IP address,
92+
* network mask, gateway, MAC address, and PLCA settings.
93+
*
94+
* @param ip_addr The IP address to assign to the interface.
95+
* @param network_mask The network mask to use.
96+
* @param gateway The gateway IP address.
97+
* @param mac_addr The MAC address to assign to the interface.
98+
* @param t1s_plca_settings The PLCA settings to use.
99+
* @param t1s_mac_settings The MAC settings to use.
100+
* @return Returns true if the initialization was successful, false otherwise.
101+
*/
82102
virtual bool begin(IPAddress const ip_addr,
83103
IPAddress const network_mask,
84104
IPAddress const gateway,
@@ -88,15 +108,37 @@ class TC6_Arduino_10BASE_T1S : public Arduino_10BASE_T1S_PHY_Interface
88108

89109

90110
virtual void service() override;
91-
111+
92112
void digitalWrite(DIO const dio, bool const value);
93113

114+
/**
115+
* @brief Gets the PLCA status.
116+
*
117+
* This method retrieves the current PLCA status from the TC6 hardware.
118+
*
119+
* @param on_plca_status Callback function to handle the PLCA status.
120+
* @return bool Returns true if the PLCA status was successfully retrieved, false otherwise.
121+
*/
94122
bool getPlcaStatus(TC6LwIP_On_PlcaStatus on_plca_status);
123+
/**
124+
* @brief Enables PLCA (Physical Layer Collision Avoidance).
125+
*
126+
* This method enables the PLCA functionality on the TC6 hardware.
127+
*
128+
* @return bool Returns true if PLCA was successfully enabled, false otherwise.
129+
*/
95130
bool enablePlca();
96131

132+
/**
133+
* @brief Checks if sending data would block.
134+
*
135+
* This method checks if the TC6 hardware is currently able to send data
136+
* without blocking.
137+
*
138+
* @return bool Returns true if sending data would block, false otherwise.
139+
*/
97140
bool sendWouldBlock();
98141

99-
100142
private:
101143
TC6_Io & _tc6_io;
102144
TC6LwIP_t _lw;

0 commit comments

Comments
 (0)