nbus_impl.c 764 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "nbus_impl.h"
  2. extern nBus_TypeDef nBus;
  3. nBus_functionCode_t* nbus_unicastToModule(nBus_TypeDef *nbus, nBus_functionCode_t *code){
  4. if(nbus->function_code.function == CMD_VERSION) {
  5. nbus->tx_buffer[4] = '0';
  6. nbus->tx_buffer[5] = '.';
  7. nbus->tx_buffer[6] = '1';
  8. nbus->tx_length += 3;
  9. code->error = 0;
  10. }
  11. if(nbus->function_code.function == CMD_ECHO) {
  12. for(uint8_t i=3 ; i<nbus->rx_length-1 ; i++){
  13. nbus->tx_buffer[i+1] = nbus->rx_buffer[i];
  14. }
  15. nbus->tx_length += (nbus->rx_length-4);
  16. code->error = 0;
  17. }
  18. return code;
  19. }
  20. void nbus_broadcast(nBus_TypeDef *nbus, nBusCommandType_t request_type){
  21. if(request_type == BROADCAST_SPECIFIC_SENSORS) {
  22. }
  23. if(request_type == BROADCAST_GLOBAL) {
  24. }
  25. nbus->send_response = NO_RESPONSE;
  26. }