|
MRMS
|
#include <mrm-board.h>
Public Member Functions | |
| Board (Robot *robot, uint8_t maxNumberOfBoards, uint8_t devicesOnABoard, const char *boardName, BoardType boardType, BoardId id) | |
| void | add (char *deviceName, uint16_t canIn, uint16_t canOut) |
| bool | alive (uint8_t deviceNumber=0, bool checkAgainIfDead=false, bool errorIfNotAfterCheckingAgain=false) |
| uint8_t | count () |
| void | aliveSet (bool yesOrNo, uint8_t deviceNumber=0) |
| BoardType | boardType () |
| uint8_t | deadOrAliveCount () |
| uint8_t | devicesOnASingleBoard () |
| uint8_t | devicesMaximumNumberInAllBoards () |
| uint8_t | devicesScan (bool verbose=true, uint16_t mask=0xFFFF) |
| uint8_t | errorCodeLast () |
| uint8_t | errorWasInDeviceNumber () |
| void | firmwareRequest (uint8_t deviceNumber=0xFF) |
| uint16_t | fps (uint8_t deviceNumber=0) |
| void | fpsDisplay () |
| void | fpsRequest (uint8_t deviceNumber=0xFF) |
| BoardId | id () |
| void | idChange (uint16_t newDeviceNumber, uint8_t deviceNumber=0) |
| void | info (uint8_t deviceNumber=0xFF) |
| bool | isForMe (uint32_t canIdOut, uint8_t deviceNumber) |
| bool | isFromMe (uint32_t canIdOut, uint8_t deviceNumber) |
| uint32_t | lastMessageMs (uint8_t deviceNumber=0) |
| virtual bool | messageDecode (uint32_t canId, uint8_t data[8])=0 |
| bool | messagePrint (uint32_t msgId, uint8_t dlc, uint8_t *data, bool outbound) |
| ** Prints a frame More... | |
| void | messageSend (uint8_t *data, uint8_t dlc, uint8_t deviceNumber=0) |
| char * | name (uint8_t deviceNumber) |
| char * | name () |
| void | notificationRequest (uint8_t commandRequestingNotification, uint8_t deviceNumber) |
| void | oscillatorTest (uint8_t deviceNumber=0xFF) |
| void | reset (uint8_t deviceNumber=0xFF) |
| void | start (uint8_t deviceNumber=0xFF, uint8_t measuringModeNow=0, uint16_t refreshMs=0) |
| void | swap (uint8_t deviceNumber1, uint8_t deviceNumber2) |
| void | stop (uint8_t deviceNumber=0xFF) |
| virtual void | test (uint8_t deviceNumber=0xFF, uint16_t betweenTestsMs=0) |
Protected Member Functions | |
| bool | messageDecodeCommon (uint32_t canId, uint8_t data[8], uint8_t deviceNumber=0) |
Protected Attributes | |
| uint32_t | _alive |
| bool | _aliveReport = false |
| char | _boardsName [12] |
| BoardType | _boardType |
| uint8_t | canData [8] |
| uint8_t | devicesOnABoard |
| uint8_t | errorCode = 0 |
| uint8_t | errorInDeviceNumber = 0 |
| std::vector< uint16_t > * | fpsLast |
| BoardId | _id |
| std::vector< uint32_t > * | idIn |
| std::vector< uint32_t > * | idOut |
| std::vector< uint32_t > * | lastMessageReceivedMs |
| std::vector< uint32_t > * | _lastReadingMs |
| uint8_t | maximumNumberOfBoards |
| uint8_t | measuringMode = 0 |
| uint8_t | measuringModeLimit = 0 |
| uint8_t | _message [29] |
| std::vector< char[10]> * | _name |
| int | nextFree |
| Robot * | robotContainer |
Board is a class of all the boards of the same type, not a single board!
| Board::Board | ( | Robot * | robot, |
| uint8_t | maxNumberOfBoards, | ||
| uint8_t | devicesOnABoard, | ||
| const char * | boardName, | ||
| BoardType | boardType, | ||
| BoardId | id | ||
| ) |
| robot | - robot containing this board |
| maxNumberOfBoards | - maximum number of boards |
| devicesOnABoard | - number of devices on each board |
| boardName | - board's name |
| id | - unique id |
Board is a single instance for all boards of the same type, not a single board (if there are more than 1 of the same type)!
| robot | - robot containing this board |
| esp32CANBusSingleton | - a single instance of CAN Bus common library for all CAN Bus peripherals. |
| maxNumberOfBoards | - maximum number of boards |
| devicesOn1Board | - number of devices on each board |
| boardName | - board's name |
| id | - unique id |
Add a device.
| deviceName | |
| canIn | |
| canOut |
| bool Board::alive | ( | uint8_t | deviceNumber = 0, |
| bool | checkAgainIfDead = false, |
||
| bool | errorIfNotAfterCheckingAgain = false |
||
| ) |
Did it respond to last ping? If not, try another ping and see if it responds.
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. 0xFF - any alive. |
| checkAgainIfDead | - try another ping |
| errorIfNotAfterCheckingAgain | - the robot will stop. Otherwise only warning displayed. |
| void Board::aliveSet | ( | bool | yesOrNo, |
| uint8_t | deviceNumber = 0 |
||
| ) |
Set aliveness
| yesOrNo | |
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
| uint8_t Board::count | ( | ) |
Did any device respond to last ping?
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
| uint8_t Board::deadOrAliveCount | ( | ) |
Count all the devices, alive or not
|
inline |
Maximum number of devices in all groups (boards) @raturn - number of devices
|
inline |
Number of devices in each group (board)
Ping devices and refresh alive array
| verbose | - prints statuses |
| mask | - bitwise, 16 bits - no more than 16 devices! Bit == 1 - scan, 0 - no scan. |
|
inline |
Last error code
|
inline |
Device which caused last error
| void Board::firmwareRequest | ( | uint8_t | deviceNumber = 0xFF | ) |
Request firmware version
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. 0xFF - for all devices. |
Request firmware version
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
Frames Per Second
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
Frames Per Second
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. 0xFF - for all devices. |
| void Board::fpsDisplay | ( | ) |
Display FPS for all devices
| void Board::fpsRequest | ( | uint8_t | deviceNumber = 0xFF | ) |
Request Frames Per Second
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. 0xFF - for all devices. |
|
inline |
Board class id, not each device's
Change CAN Bus id
| newDeviceNumber | - new number |
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
Change CAN Bus id
| newId | - CAN Bus id |
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
| void Board::info | ( | uint8_t | deviceNumber = 0xFF | ) |
Request information
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. 0xFF - for all devices. |
Is the frame addressed to this device's Arduino object?
| canIdOut | - CAN Bus id. |
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
Is the frame addressed to this device's Arduino object?
| canIdOut | - CAN Bus id. |
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the deviceNumber, starting with 0. |
Does the frame originate from this device's Arduino object?
| canIdOut | - CAN Bus id. |
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the deviceNumber, starting with 0. |
Last message received
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
Read CAN Bus message into local variables
| canId | - CAN Bus id |
| data | - 8 bytes from CAN Bus message. |
Implemented in Mrm_us1, Mrm_us, Mrm_us_b, Mrm_therm_b_can, Mrm_ref_can, Mrm_node, Mrm_lid_can_b2, Mrm_lid_can_b, Mrm_ir_finder3, Mrm_ir_finder_can, Mrm_fet_can, Mrm_col_can, Mrm_col_b, SensorBoard, MotorBoard, and Mrm_8x8a.
|
protected |
Common part of message decoding
| canId | - CAN Bus id |
| data | - 8 bytes from CAN Bus message. |
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
** Prints a frame
Prints a frame
| msgId | - messageId |
| dlc | - data length |
| data | - payload |
| outbound | - otherwise inbound |
Prints a frame
| msgId | - messageId |
| dlc | - data length |
| data | - payload |
| outbound | - otherwise inbound |
Send CAN Bus message
| dlc | - data length |
| data | - payload |
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
|
inline |
Returns device group's name
| char * Board::name | ( | uint8_t | deviceNumber | ) |
Returns device's name
| deviceNumber | - Motor's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
Returns device's name
| deviceNumber | - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
Request notification
| commandRequestingNotification | |
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
| void Board::oscillatorTest | ( | uint8_t | deviceNumber = 0xFF | ) |
Reserved for production
| deviceNumber | - Devices's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
| void Board::reset | ( | uint8_t | deviceNumber = 0xFF | ) |
Reset
| deviceNumber | - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. 0xFF - all devices. |
| void Board::start | ( | uint8_t | deviceNumber = 0xFF, |
| uint8_t | measuringModeNow = 0, |
||
| uint16_t | refreshMs = 0 |
||
| ) |
Starts periodical CANBus messages that will be refreshing values that can be read by reading()
| deviceNumber | - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. 0xFF - all devices. |
| measuringModeNow | - Measuring mode id. Default 0. |
| refreshMs | - gap between 2 CAN Bus messages to refresh local Arduino copy of device's data. 0 - device's default. |
| void Board::stop | ( | uint8_t | deviceNumber = 0xFF | ) |
Stops periodical CANBus messages that refresh values that can be read by reading()
| deviceNumber | - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
add() assigns device numbers one after another. swap() changes the sequence later. Therefore, add(); add(); will assign number 0 to a device with the smallest CAN Bus id and 1 to the one with the next smallest. If we want to change the order so that now the device 1 is the one with the smalles CAN Bus id, we will call swap(0, 1); after the the add() commands.
| deviceNumber1 | - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. |
| deviceNumber2 | - Second device. |
Test
| deviceNumber | - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. 0xFF - all devices. |
| betweenTestsMs | - time in ms between 2 tests. 0 - default. |
Reimplemented in Mrm_lid_can_b, and MotorBoard.