Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/other/airbraker/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: airbrake_ctrler
name: airbrake_ctrler
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/payload/control_freak/board-setup/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: control_freak bring up and debugging
name: control_freak bring up and debugging
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/payload/control_freak/flight-software/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: control_freak
name: control_freak
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/payload/control_freak/ground_station2/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: control_freak
name: control_freak
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/payload/control_freak/imagine/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: control_freak bring up and debugging
name: control_freak bring up and debugging
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/payload/control_freak/radio_test/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: control_freak bring up and debugging
name: control_freak bring up and debugging
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/compression/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: compression
name: compression
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/datalogger/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: datalogger
name: datalogger
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/gpio_blinky/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: gpio-blinky
name: gpio-blinky
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/littlefs/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: littlefs
name: littlefs
common:
build_only: true
Expand Down
4 changes: 2 additions & 2 deletions app/samples/littlefs/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ FS_LITTLEFS_DECLARE_CUSTOM_CONFIG(lfs3, 4, 16, 16, 64, 32);
// FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(lfs3);
static struct fs_mount_t lfs3_mnt = {.type = FS_LITTLEFS,
.fs_data = &lfs3,
.storage_dev = (void*) FIXED_PARTITION_ID(ext_storage_3),
.storage_dev = (void*) PARTITION_ID(ext_storage_3),
.mnt_point = "/lfs3"};

// create peripherals from devicetree
Expand Down Expand Up @@ -104,7 +104,7 @@ void print_statvfs(char* fname) {

/**
* @brief Clear the entire flash area
* @param fa_id ID of the flash area, usually a result of FIXED_PARTITION_ID
* @param fa_id ID of the flash area, usually a result of PARTITION_ID
*/
int32_t clear_flash_area(uint8_t fa_id) {
int32_t ret = 0;
Expand Down
2 changes: 1 addition & 1 deletion app/samples/lora_bcast/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: lora-back-and-forth
name: lora-back-and-forth
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/message_passing/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: message-passing
name: message-passing
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/openrocket_sensors/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: openrocket-sensors
name: openrocket-sensors
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/phase_detection/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: phase-detection
name: phase-detection
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/sensor/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: sensor
name: sensor
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/shield_blinky/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: shield_blinky
name: shield_blinky
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/shield_mcp3561r/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: shield_blinky
name: shield_blinky
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/sntp_client/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: sntp-client
name: sntp-client
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/soft_timer/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: soft-timer
name: soft-timer
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/tenants_and_tasks/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: tenants-and-tasks
name: tenants-and-tasks
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/tftp_server/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: tftp-server
name: tftp-server
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/time_travel/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: time-travel
name: time-travel
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/udp_bcast/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: udp-bcast
name: udp-bcast
common:
build_only: true
Expand Down
2 changes: 1 addition & 1 deletion app/samples/udp_rcv/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sample:
description:
description: udp-rcv
name: udp-rcv
common:
build_only: true
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/openrocket/barometer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
#
zephyr_library()

zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
zephyr_library_sources(openrocket_barom.c)
1 change: 1 addition & 0 deletions drivers/sensor/openrocket/gnss/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
#
zephyr_library()

zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
zephyr_library_sources(openrocket_gnss.c)
1 change: 1 addition & 0 deletions drivers/sensor/openrocket/imu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
#
zephyr_library()

zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
zephyr_library_sources(openrocket_imu.c)
1 change: 1 addition & 0 deletions drivers/sensor/openrocket/magnetometer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
#
zephyr_library()

zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
zephyr_library_sources(openrocket_magnetometer.c)
2 changes: 1 addition & 1 deletion include/f_core/net/application/c_sntp_server_tenant.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class CSntpServerTenant : public CCallbackTenant {

int getLastUpdateTimeAsSeconds(uint32_t& seconds);

uint32_t reckonAndByteSwapTimestamp(uint32_t timestamp) { return htonl(timestamp + OFFSET_1970_JAN_1); }
uint32_t reckonAndByteSwapTimestamp(uint32_t timestamp) { return net_htonl(timestamp + OFFSET_1970_JAN_1); }

void setupRtcTime();
};
4 changes: 2 additions & 2 deletions include/f_core/net/application/c_tftp_server_tenant.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class CTftpServerTenant : public CCallbackTenant {
* @param packet Packet data
* @param len Length of the packet
*/
void handleReadRequest(const sockaddr &srcAddr, const uint8_t *packet, int len);
void handleReadRequest(const struct sockaddr& srcAddr, const uint8_t* packet, int len);

/**
* Wait for acknowledgement from the client
Expand All @@ -98,7 +98,7 @@ class CTftpServerTenant : public CCallbackTenant {
* @param blockNum Block number to wait for
* @return 0 on success, negative error code on failure
*/
int waitForAck(CUdpSocket &dataSock, const sockaddr &srcAddr, uint16_t blockNum);
int waitForAck(CUdpSocket& dataSock, const struct sockaddr& srcAddr, uint16_t blockNum);

/**
* Non-standard TFTP function for generating a filesystem tree
Expand Down
8 changes: 5 additions & 3 deletions include/f_core/net/network/c_ipv4.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include <zephyr/posix/arpa/inet.h>
#include <zephyr/net/net_ip.h>
#include <zephyr/net/socket.h>
#include <zephyr/posix/netinet/in.h>

struct net_if; // Forward declaration
struct device;
Expand Down Expand Up @@ -39,7 +41,7 @@ class CIPv4 {
* Getter for address structure
* @return Address structure
*/
[[nodiscard]] in_addr GetAddr() const { return addr; }
[[nodiscard]] struct in_addr GetAddr() const { return addr; }

/**
* Getter for error code from initialization
Expand All @@ -56,7 +58,7 @@ class CIPv4 {
private:
const char* ip;
net_if& netIface;
in_addr addr{};
struct in_addr addr{};
int err = 0;

int initialize();
Expand Down
7 changes: 5 additions & 2 deletions include/f_core/net/transport/c_udp_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <f_core/net/c_transciever.h>
#include <zephyr/net/net_ip.h>
#include <zephyr/net/socket.h>
#include <zephyr/posix/sys/socket.h>

class CIPv4;

Expand Down Expand Up @@ -45,7 +46,8 @@ class CUdpSocket {
* @param[in] srcAddrLen Optional source address length
* @return Number of bytes received or negative error code
*/
int ReceiveSynchronous(void* data, size_t len, sockaddr* srcAddr = nullptr, socklen_t* srcAddrLen = nullptr);
int ReceiveSynchronous(void* data, size_t len, struct sockaddr* srcAddr = nullptr,
socklen_t* srcAddrLen = nullptr);

/**
* Transmit data asynchronously
Expand All @@ -68,7 +70,8 @@ class CUdpSocket {
/**
* See parent docs
*/
int ReceiveAsynchronous(void* data, size_t len, sockaddr* srcAddr = nullptr, socklen_t* srcAddrLen = nullptr);
int ReceiveAsynchronous(void* data, size_t len, struct sockaddr* srcAddr = nullptr,
socklen_t* srcAddrLen = nullptr);

/**
* Set transmit timeout
Expand Down
6 changes: 3 additions & 3 deletions lib/f_core/net/application/c_sntp_server_tenant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void CSntpServerTenant::Callback() {
uint32_t rxPacketSecondsTimestamp = 0;
uint32_t txPacketSecondsTimestamp = 0;
uint32_t lastUpdateTimeSeconds = 0;
sockaddr srcAddr = {0};
struct sockaddr srcAddr = {0};
socklen_t srcAddrLen = sizeof(srcAddr);

const int rxLen = sock.ReceiveAsynchronous(&clientPacket, sizeof(clientPacket), &srcAddr, &srcAddrLen);
Expand Down Expand Up @@ -116,7 +116,7 @@ void CSntpServerTenant::Callback() {
.poll = pollInterval,
.precision = precisionExponent,
.rootDelay = 0, // Unknown, but very small with the assumption Ethernet is used
.rootDispersion = htonl(GNSS_ROOT_DISPERSION_FIXED_POINT), // 0.5 ms
.rootDispersion = net_htonl(GNSS_ROOT_DISPERSION_FIXED_POINT), // 0.5 ms
.refTimestampSeconds = reckonAndByteSwapTimestamp(lastUpdateTimeSeconds),
.refTimestampFraction = 0,
.originateTimestampSeconds = clientPacket.txTimestampSeconds,
Expand All @@ -129,7 +129,7 @@ void CSntpServerTenant::Callback() {
memcpy(packet.referenceId, GPS_REFERENCE_CODE, 4);

sockaddr_in clientAddr = *reinterpret_cast<const sockaddr_in*>(&srcAddr);
uint16_t clientPort = ntohs(clientAddr.sin_port);
uint16_t clientPort = net_ntohs(clientAddr.sin_port);
sock.SetDstPort(clientPort);

int ret = sock.TransmitAsynchronous(&packet, sizeof(packet));
Expand Down
12 changes: 6 additions & 6 deletions lib/f_core/net/application/c_tftp_server_tenant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

LOG_MODULE_REGISTER(CTftpServerTenant);

char *inet_ntoa(in_addr in) {
char* inet_ntoa(struct in_addr in) {
static char buf[INET_ADDRSTRLEN];
unsigned char *bytes = (unsigned char *) &in.s_addr;
unsigned char* bytes = (unsigned char*)&in.s_addr;

snprintf(buf, sizeof(buf), "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]);

Expand Down Expand Up @@ -50,7 +50,7 @@ void CTftpServerTenant::Register() {
void CTftpServerTenant::Cleanup() {}

void CTftpServerTenant::Callback() {
sockaddr srcAddr = {0};
struct sockaddr srcAddr = {0};
socklen_t srcAddrLen = sizeof(srcAddr);
uint8_t packet[rwRequestPacketSize] = {0};
int rxLen = sock.ReceiveAsynchronous(packet, rwRequestPacketSize, &srcAddr, &srcAddrLen);
Expand All @@ -73,14 +73,14 @@ void CTftpServerTenant::Callback() {
}
}

int CTftpServerTenant::waitForAck(CUdpSocket &dataSock, const sockaddr &srcAddr, uint16_t blockNum) {
int CTftpServerTenant::waitForAck(CUdpSocket& dataSock, const struct sockaddr& srcAddr, uint16_t blockNum) {
static constexpr uint16_t ackPktSize = 4;
uint8_t ack[ackPktSize] = {0}; // 2 bytes for opcode, 2 for block number
const int maxRetries = 5;
int retries = 0;

while (retries < maxRetries) {
int ret = dataSock.ReceiveAsynchronous(ack, 4, const_cast<sockaddr *>(&srcAddr), nullptr);
int ret = dataSock.ReceiveAsynchronous(ack, 4, const_cast<struct sockaddr*>(&srcAddr), nullptr);
if (ret < 0) {
// If no data available yet, wait and retry.
if (errno == EWOULDBLOCK || errno == EAGAIN) {
Expand Down Expand Up @@ -108,7 +108,7 @@ int CTftpServerTenant::waitForAck(CUdpSocket &dataSock, const sockaddr &srcAddr,
return -1;
}

void CTftpServerTenant::handleReadRequest(const sockaddr &clientAddr, const uint8_t *packet, int len) {
void CTftpServerTenant::handleReadRequest(const struct sockaddr& clientAddr, const uint8_t* packet, int len) {
static constexpr uint16_t maxFilenameLen =
rwRequestPacketSize - strlen(tftpModeStrings[NETASCII]) + 4; // 4 for opcode and both zero terminators
const char *filename = reinterpret_cast<const char *>(&packet[2]);
Expand Down
8 changes: 4 additions & 4 deletions lib/f_core/net/network/c_ipv4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ CIPv4::CIPv4(const char* ip) : CIPv4(ip, net_if_get_default()) {};
CIPv4::CIPv4(const char* ip, const device* dev) : CIPv4(ip, net_if_lookup_by_dev(dev)) {};

int CIPv4::initialize() {
in_addr subnet{};
struct in_addr subnet{};

err = z_impl_net_addr_pton(AF_INET, ip, &addr);
err = net_addr_pton(AF_INET, ip, &addr);
if (err < 0) {
LOG_ERR("Invalid IP address");
return err;
Expand All @@ -28,7 +28,7 @@ int CIPv4::initialize() {
return -ENODEV;
}

err = z_impl_net_addr_pton(AF_INET, CLASS_A_NETMASK, &subnet);
err = net_addr_pton(AF_INET, CLASS_A_NETMASK, &subnet);
if (err < 0) {
LOG_ERR("Invalid subnet mask");
return err;
Expand All @@ -40,4 +40,4 @@ int CIPv4::initialize() {

LOG_DBG("Initialized IPv4 address %s", ip);
return 0;
}
}
Loading
Loading