Qt Quick Ultralite Automotive Cluster Demo

/****************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
#ifndef CANDRIVERHELPER_H #define CANDRIVERHELPER_H #include <etl/vector.h> #include <etl/optional.h> struct ee_rscfd_message; namespace CanBus { namespace CanDriverHelper { typedef void (*InterruptVector)(); typedef void (*CanMessageHandler)(ee_rscfd_message &); // AFL hardware limits const unsigned int MAX_RECEIVE_RULES_PER_CHANNEL = 128; const unsigned int MAX_RECEIVE_RULES_FOR_UNIT = 64 * 3; struct MessageFiler { uint32_t id; uint32_t mask; etl::optional<bool> remoteFrame; etl::optional<bool> extenedFrame; }; typedef etl::vector<MessageFiler, MAX_RECEIVE_RULES_PER_CHANNEL> MessageFilterList; void configure(bool canFD, uint32_t bitrate, uint32_t dataBitrate, uint32_t numChannels); bool stopCAN(uint32_t controllerId); bool initCAN(uint32_t controllerId, uint32_t numChannels); bool startCAN(uint32_t controllerId, uint32_t channelNo); bool setupReceieveRules(uint32_t controllerId, uint32_t channelNo, const MessageFilterList &filterList); bool setupFIFOs(uint32_t controllerId); bool setGlobalInterrupts(uint32_t controllerId, InterruptVector errorInterrupt); bool setChannelInterrupts(uint32_t controllerId, uint32_t channelNo, InterruptVector errorInterrupt); bool printFIFOStatus(uint32_t controllerId, bool checkEmpty, bool checkFull, bool checkLost); bool receiveMessages(uint32_t controllerId, CanMessageHandler receivedMessageHandler); bool sendMessage(unsigned int controllerId, unsigned int channelNo, ee_rscfd_message &message); uint16_t getError(uint32_t controllerId, uint32_t channelNo); } // namespace CanDriverHelper } // namespace CanBus #endif // CANDRIVERHELPER_H