* Helper function - wait for confirmation, check for returned error code * * This uses the nature of the configure confirmation message design: * - byte 0 -> cs * - byte 1 -> Error Code, where * - 0 = OK * - 1 .. FE = Values defined by CiA. All currently defined values are slave rejects. * No further distinction on why the slave did reject the request. * - FF = Man
| 311 | * - CO_LSS_CFG_STORE_status |
| 312 | */ |
| 313 | static CO_LSSmaster_return_t |
| 314 | CO_LSSmaster_configureCheckWait(CO_LSSmaster_t* LSSmaster, uint32_t timeDifference_us, uint8_t csWait) { |
| 315 | CO_LSSmaster_return_t ret; |
| 316 | |
| 317 | if (CO_FLAG_READ(LSSmaster->CANrxNew)) { |
| 318 | uint8_t cs = LSSmaster->CANrxData[0]; |
| 319 | uint8_t errorCode = LSSmaster->CANrxData[1]; |
| 320 | CO_FLAG_CLEAR(LSSmaster->CANrxNew); |
| 321 | |
| 322 | if (cs == csWait) { |
| 323 | if (errorCode == 0U) { |
| 324 | ret = CO_LSSmaster_OK; |
| 325 | } else if (errorCode == 0xFFU) { |
| 326 | ret = CO_LSSmaster_OK_MANUFACTURER; |
| 327 | } else { |
| 328 | ret = CO_LSSmaster_OK_ILLEGAL_ARGUMENT; |
| 329 | } |
| 330 | } else { |
| 331 | ret = CO_LSSmaster_check_timeout(LSSmaster, timeDifference_us); |
| 332 | } |
| 333 | } else { |
| 334 | ret = CO_LSSmaster_check_timeout(LSSmaster, timeDifference_us); |
| 335 | } |
| 336 | |
| 337 | if ((ret != CO_LSSmaster_INVALID_STATE) && (ret != CO_LSSmaster_WAIT_SLAVE)) { |
| 338 | /* finished */ |
| 339 | LSSmaster->command = CO_LSSmaster_COMMAND_WAITING; |
| 340 | } |
| 341 | return ret; |
| 342 | } |
| 343 | |
| 344 | CO_LSSmaster_return_t |
| 345 | CO_LSSmaster_configureBitTiming(CO_LSSmaster_t* LSSmaster, uint32_t timeDifference_us, uint16_t bit) { |
no test coverage detected