K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
Loading...
Searching...
No Matches

Public Headers

file  can.h
 

Data Structures

struct  kfsw_can_info
 
struct  kfsw_can_test_result
 

Macros

#define KFSW_CAN_INTERFACE_NAME_SIZE   10U
 
#define KFSW_CAN_BITRATE_125K   125000U
 
#define KFSW_CAN_BITRATE_250K   250000U
 
#define KFSW_CAN_BITRATE_500K   500000U
 
#define KFSW_CAN_BITRATE_800K   800000U
 
#define KFSW_CAN_BITRATE_1M   1000000U
 

Functions

int kfsw_can_open (void)
 
void kfsw_can_get_info (struct kfsw_can_info *info)
 
bool kfsw_can_bitrate_supported (uint32_t bitrate)
 
int kfsw_can_set_bitrate (uint32_t bitrate)
 
int kfsw_can_test_peer (uint16_t peer, uint32_t timeout_ms, struct kfsw_can_test_result *result)
 

Description

CAN configuration, interface state, bitrate selection and peer tests.

Macro Documentation

◆ KFSW_CAN_BITRATE_125K

#define KFSW_CAN_BITRATE_125K   125000U

#include <can.h>

Bitrates an operator may select.

Anything else is refused.

◆ KFSW_CAN_INTERFACE_NAME_SIZE

#define KFSW_CAN_INTERFACE_NAME_SIZE   10U

#include <can.h>

Longest interface name libcsp's text parser accepts, plus a terminator.

Function Documentation

◆ kfsw_can_bitrate_supported()

bool kfsw_can_bitrate_supported ( uint32_t  bitrate)

#include <can.h>

Check whether a bitrate is supported.

Exposed so a parameter validator can reject a bitrate before the controller is opened.

◆ kfsw_can_get_info()

void kfsw_can_get_info ( struct kfsw_can_info *  info)

#include <can.h>

Read the CAN configuration and interface state.

◆ kfsw_can_open()

int kfsw_can_open ( void  )

#include <can.h>

Open the chosen CAN controller and register it with libcsp.

Called by the CSP lifecycle after the router exists and before it starts. Returns 0 on success, a negative errno if the controller is missing or refuses the configured bitrate.

◆ kfsw_can_set_bitrate()

int kfsw_can_set_bitrate ( uint32_t  bitrate)

#include <can.h>

Apply a new bitrate, restarting the controller.

This function only reports whether the controller accepted the change.

Returns 0 on success, -EINVAL for an unsupported bitrate, -ENODEV when no controller is open.

◆ kfsw_can_test_peer()

int kfsw_can_test_peer ( uint16_t  peer,
uint32_t  timeout_ms,
struct kfsw_can_test_result *  result 
)

#include <can.h>

Ping a peer whose route leaves through the CAN interface.

Returns CSP_ERR_NOTSUP when the route to the peer is not CAN, or the peer is this node and the ping would never reach the bus.