mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-12-02 19:01:48 +00:00
Add ERT commodity type.
This commit is contained in:
@@ -63,6 +63,16 @@ Consumption Packet::consumption() const {
|
||||
return invalid_consumption;
|
||||
}
|
||||
|
||||
CommodityType Packet::commodity_type() const {
|
||||
if( type() == Type::SCM ) {
|
||||
return reader_.read(5, 4);
|
||||
}
|
||||
if( type() == Type::IDM ) {
|
||||
return reader_.read(4 * 8 + 4, 4);
|
||||
}
|
||||
return invalid_commodity_type;
|
||||
}
|
||||
|
||||
ManchesterFormatted Packet::symbols_formatted() const {
|
||||
return format_manchester(decoder_);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,11 @@ namespace ert {
|
||||
|
||||
using ID = uint32_t;
|
||||
using Consumption = uint32_t;
|
||||
using CommodityType = uint32_t;
|
||||
|
||||
constexpr ID invalid_id = 0;
|
||||
constexpr CommodityType invalid_commodity_type = -1;
|
||||
constexpr Consumption invalid_consumption = 0;
|
||||
|
||||
class Packet {
|
||||
public:
|
||||
@@ -60,6 +65,7 @@ public:
|
||||
|
||||
Type type() const;
|
||||
ID id() const;
|
||||
CommodityType commodity_type() const;
|
||||
Consumption consumption() const;
|
||||
|
||||
ManchesterFormatted symbols_formatted() const;
|
||||
@@ -74,9 +80,6 @@ private:
|
||||
const Reader reader_;
|
||||
const Type type_;
|
||||
|
||||
const ID invalid_id = 0;
|
||||
const Consumption invalid_consumption = 0;
|
||||
|
||||
bool crc_ok_idm() const;
|
||||
bool crc_ok_scm() const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user