File syn_n2k.h¶
Go to the source code of this file
NMEA 2000 Marine CAN Protocol Stack. More...
#include "../common/syn_defs.h"#include "../drivers/syn_can.h"#include "syn_j1939.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_N2K_BatteryStatus Battery Status (PGN 127508). |
| struct | SYN_N2K_CogSogRapid Rapid Update COG & SOG (PGN 129026). |
| struct | SYN_N2K_DcDetailedStatus DC Detailed Status (PGN 127506). |
| struct | SYN_N2K_EnvParams Environmental Parameters (PGN 130310). |
| struct | SYN_N2K_FastPacketRx NMEA 2000 Fast-Packet RX Re-assembly Context. |
| struct | SYN_N2K_PositionRapid Rapid Update Position (PGN 129025). Coordinates stored in 1e-7 degrees (signed 32-bit integer). |
| struct | SYN_N2K_VesselHeading Vessel Heading (PGN 127250). |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_n2k_decode_battery (const SYN_CAN_Frame * frame, SYN_N2K_BatteryStatus * battery) Decode PGN 127508 (Battery Status) from an 8-byte CAN frame. |
| SYN_Status | syn_n2k_decode_cog_sog_rapid (const SYN_CAN_Frame * frame, SYN_N2K_CogSogRapid * cog_sog) Decode PGN 129026 (COG & SOG, Rapid Update) from an 8-byte CAN frame. |
| SYN_Status | syn_n2k_decode_dc_detailed (const SYN_CAN_Frame * frame, SYN_N2K_DcDetailedStatus * dc) Decode PGN 127506 (DC Detailed Status) from an 8-byte CAN frame. |
| SYN_Status | syn_n2k_decode_environment (const SYN_CAN_Frame * frame, SYN_N2K_EnvParams * env) Decode PGN 130310 (Environmental Parameters) from an 8-byte CAN frame. |
| SYN_Status | syn_n2k_decode_heading (const SYN_CAN_Frame * frame, SYN_N2K_VesselHeading * heading) Decode PGN 127250 (Vessel Heading) from an 8-byte CAN frame. |
| SYN_Status | syn_n2k_decode_position_rapid (const SYN_CAN_Frame * frame, SYN_N2K_PositionRapid * pos) Decode PGN 129025 (Position, Rapid Update) from an 8-byte CAN frame. |
| SYN_Status | syn_n2k_encode_battery (uint8_t sa, const SYN_N2K_BatteryStatus * battery, SYN_CAN_Frame * frame) Encode PGN 127508 (Battery Status) into an 8-byte CAN frame. |
| SYN_Status | syn_n2k_encode_cog_sog_rapid (uint8_t sa, const SYN_N2K_CogSogRapid * cog_sog, SYN_CAN_Frame * frame) Encode PGN 129026 (COG & SOG, Rapid Update) into an 8-byte CAN frame. |
| SYN_Status | syn_n2k_encode_dc_detailed (uint8_t sa, const SYN_N2K_DcDetailedStatus * dc, SYN_CAN_Frame * frame) Encode PGN 127506 (DC Detailed Status) into an 8-byte CAN frame. |
| SYN_Status | syn_n2k_encode_environment (uint8_t sa, const SYN_N2K_EnvParams * env, SYN_CAN_Frame * frame) Encode PGN 130310 (Environmental Parameters) into an 8-byte CAN frame. |
| SYN_Status | syn_n2k_encode_heading (uint8_t sa, const SYN_N2K_VesselHeading * heading, SYN_CAN_Frame * frame) Encode PGN 127250 (Vessel Heading) into an 8-byte CAN frame. |
| SYN_Status | syn_n2k_encode_position_rapid (uint8_t sa, const SYN_N2K_PositionRapid * pos, SYN_CAN_Frame * frame) Encode PGN 129025 (Position, Rapid Update) into an 8-byte CAN frame. |
| SYN_Status | syn_n2k_fastpacket_process (SYN_N2K_FastPacketRx * rx, const SYN_CAN_Frame * frame, uint32_t target_pgn, const uint8_t ** out_payload, size_t * out_len) Process an incoming CAN frame in the Fast-Packet multi-frame RX reassembler. |
Detailed Description¶
Implements NMEA 2000 (IEC 61162-3) marine CAN bus PGN encoders, decoders, and Fast-Packet multi-frame transport protocol reassembly.
Public Functions Documentation¶
function syn_n2k_decode_battery¶
Decode PGN 127508 (Battery Status) from an 8-byte CAN frame.
Parameters:
frameSource CAN frame.batteryOutput Battery status structure.
Returns:
SYN_OK on success.
function syn_n2k_decode_cog_sog_rapid¶
Decode PGN 129026 (COG & SOG, Rapid Update) from an 8-byte CAN frame.
SYN_Status syn_n2k_decode_cog_sog_rapid (
const SYN_CAN_Frame * frame,
SYN_N2K_CogSogRapid * cog_sog
)
Parameters:
frameSource CAN frame.cog_sogOutput COG & SOG structure.
Returns:
SYN_OK on success.
function syn_n2k_decode_dc_detailed¶
Decode PGN 127506 (DC Detailed Status) from an 8-byte CAN frame.
SYN_Status syn_n2k_decode_dc_detailed (
const SYN_CAN_Frame * frame,
SYN_N2K_DcDetailedStatus * dc
)
Parameters:
frameSource CAN frame.dcOutput DC detailed status structure.
Returns:
SYN_OK on success.
function syn_n2k_decode_environment¶
Decode PGN 130310 (Environmental Parameters) from an 8-byte CAN frame.
Parameters:
frameSource CAN frame.envOutput Environmental parameters structure.
Returns:
SYN_OK on success.
function syn_n2k_decode_heading¶
Decode PGN 127250 (Vessel Heading) from an 8-byte CAN frame.
Parameters:
frameSource CAN frame.headingOutput Heading structure.
Returns:
SYN_OK on success.
function syn_n2k_decode_position_rapid¶
Decode PGN 129025 (Position, Rapid Update) from an 8-byte CAN frame.
SYN_Status syn_n2k_decode_position_rapid (
const SYN_CAN_Frame * frame,
SYN_N2K_PositionRapid * pos
)
Parameters:
frameSource CAN frame.posOutput Position structure.
Returns:
SYN_OK on success.
function syn_n2k_encode_battery¶
Encode PGN 127508 (Battery Status) into an 8-byte CAN frame.
SYN_Status syn_n2k_encode_battery (
uint8_t sa,
const SYN_N2K_BatteryStatus * battery,
SYN_CAN_Frame * frame
)
Parameters:
saSource address.batteryBattery status structure.frameOutput CAN frame.
Returns:
SYN_OK on success.
function syn_n2k_encode_cog_sog_rapid¶
Encode PGN 129026 (COG & SOG, Rapid Update) into an 8-byte CAN frame.
SYN_Status syn_n2k_encode_cog_sog_rapid (
uint8_t sa,
const SYN_N2K_CogSogRapid * cog_sog,
SYN_CAN_Frame * frame
)
Parameters:
saSource address.cog_sogCOG & SOG structure.frameOutput CAN frame.
Returns:
SYN_OK on success.
function syn_n2k_encode_dc_detailed¶
Encode PGN 127506 (DC Detailed Status) into an 8-byte CAN frame.
SYN_Status syn_n2k_encode_dc_detailed (
uint8_t sa,
const SYN_N2K_DcDetailedStatus * dc,
SYN_CAN_Frame * frame
)
Parameters:
saSource address.dcDC detailed status structure.frameOutput CAN frame.
Returns:
SYN_OK on success.
function syn_n2k_encode_environment¶
Encode PGN 130310 (Environmental Parameters) into an 8-byte CAN frame.
SYN_Status syn_n2k_encode_environment (
uint8_t sa,
const SYN_N2K_EnvParams * env,
SYN_CAN_Frame * frame
)
Parameters:
saSource address.envEnvironmental parameters structure.frameOutput CAN frame.
Returns:
SYN_OK on success.
function syn_n2k_encode_heading¶
Encode PGN 127250 (Vessel Heading) into an 8-byte CAN frame.
SYN_Status syn_n2k_encode_heading (
uint8_t sa,
const SYN_N2K_VesselHeading * heading,
SYN_CAN_Frame * frame
)
Parameters:
saSource address.headingHeading structure.frameOutput CAN frame.
Returns:
SYN_OK on success.
function syn_n2k_encode_position_rapid¶
Encode PGN 129025 (Position, Rapid Update) into an 8-byte CAN frame.
SYN_Status syn_n2k_encode_position_rapid (
uint8_t sa,
const SYN_N2K_PositionRapid * pos,
SYN_CAN_Frame * frame
)
Parameters:
saSource address.posPosition structure (Lat/Lon in 1e-7 degrees).frameOutput CAN frame.
Returns:
SYN_OK on success.
function syn_n2k_fastpacket_process¶
Process an incoming CAN frame in the Fast-Packet multi-frame RX reassembler.
SYN_Status syn_n2k_fastpacket_process (
SYN_N2K_FastPacketRx * rx,
const SYN_CAN_Frame * frame,
uint32_t target_pgn,
const uint8_t ** out_payload,
size_t * out_len
)
Parameters:
rxFast-Packet RX state context.frameIncoming CAN frame.target_pgnExpected target PGN for the Fast-Packet message.out_payloadOutput pointer receiving reassembled payload buffer.out_lenOutput length of payload in bytes.
Returns:
SYN_OK if payload complete, or SYN_BUSY if Fast-Packet frames are still pending.
The documentation for this class was generated from the following file src/syntropic/proto/syn_n2k.h