We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f21345 commit a0bf887Copy full SHA for a0bf887
adam/src/fn_network/network_write.c
@@ -1,8 +1,34 @@
1
#include <stdbool.h>
2
#include <stdint.h>
3
+#include <eos.h>
4
#include "fujinet-network.h"
5
+#include "fujinet-network-adam.h"
6
7
uint8_t network_write(char* devicespec, uint8_t *buf, uint16_t len)
8
{
- return 0;
9
+ struct _w
10
+ {
11
+ uint8_t cmd;
12
+ uint16_t len;
13
+ uint8_t buf[1024];
14
+ } w;
15
+
16
+ uint8_t u = network_unit_adamnet(devicespec);
17
18
+ if (!u)
19
+ return FN_ERR_NO_DEVICE;
20
21
+ w.cmd = 'W';
22
23
+ while (len)
24
25
+ w.len = (len > 1024) ? 1024 : len;
26
+ memcpy(w.buf,buf,w.len);
27
+ len -= w.len;
28
29
+ if (eos_write_character_device(u,w,w.len + 3) != ADAMNET_OK)
30
+ return FN_ERR_IO_ERROR;
31
+ }
32
33
+ return FN_ERR_OK;
34
}
0 commit comments