Skip to content

Commit

Permalink
Add KNoT Type ID angular velocity
Browse files Browse the repository at this point in the history
Add angular velocity KNOT Type ID with units rad/seg and deg/seg.
  • Loading branch information
luigiluz committed Jan 22, 2020
1 parent cdaf25c commit d19fb92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/knot_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@

#define UNIT_ACCELERATION_MASK (UNIT_MASK(KNOT_UNIT_ACCELERATION_MS2))

#define UNIT_ANG_VEL_MASK (UNIT_MASK(KNOT_UNIT_ANGULAR_VELOCITY_RADSEG) | \
UNIT_MASK(KNOT_UNIT_ANGULAR_VELOCITY_DEGSEG))

#define TYPE_ID_MASK(type) (type & 0x000F)

static const struct schema {
Expand Down Expand Up @@ -126,7 +129,8 @@ static const struct schema {
{KNOT_VALUE_TYPE_INT, UNIT_SPEED_MASK },
{KNOT_VALUE_TYPE_FLOAT, UNIT_VOLFLOW_MASK },
{KNOT_VALUE_TYPE_INT, UNIT_ENERGY_MASK },
{KNOT_VALUE_TYPE_FLOAT, UNIT_ACCELERATION_MASK }
{KNOT_VALUE_TYPE_FLOAT, UNIT_ACCELERATION_MASK },
{KNOT_VALUE_TYPE_FLOAT, UNIT_ANG_VEL_MASK}
};

static const uint8_t logic_types[] = {
Expand Down
5 changes: 4 additions & 1 deletion src/knot_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@
#define KNOT_TYPE_ID_VOLUMEFLOW 0x0014
#define KNOT_TYPE_ID_ENERGY 0x0015
#define KNOT_TYPE_ID_ACCELERATION 0x0016
#define KNOT_TYPE_ID_ANGULAR_VELOCITY 0x0017

// MAX TypeID for basic units
#define KNOT_TYPE_ID_BASIC_MAX (KNOT_TYPE_ID_ACCELERATION+1)
#define KNOT_TYPE_ID_BASIC_MAX (KNOT_TYPE_ID_ANGULAR_VELOCITY+1)

// TypeIDs for logical units
#define KNOT_TYPE_ID_PRESENCE 0xFFF0
Expand Down Expand Up @@ -129,6 +130,8 @@
#define KNOT_UNIT_ENERGY_CAL 0x05
#define KNOT_UNIT_ENERGY_KCAL 0x06
#define KNOT_UNIT_ACCELERATION_MS2 0X01
#define KNOT_UNIT_ANGULAR_VELOCITY_RADSEG 0X01
#define KNOT_UNIT_ANGULAR_VELOCITY_DEGSEG 0X02

// definition of value type
#define KNOT_VALUE_TYPE_INT 0x01
Expand Down

0 comments on commit d19fb92

Please sign in to comment.