| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #include "nbus_slave.h"
- #if MODULE_SLAVE == 1
- inline void setErrorResponse(nBus_TypeDef *nbus, uint8_t code)
- {
- nbus->function_code.error = 1;
- nbus->tx_buffer[4] = code;
- nbus->tx_length += 1;
- }
- void nbus_slave_broadcast(nBus_TypeDef *nbus, nBusCommandType_t request_type)
- {
- if (request_type == BROADCAST_SPECIFIC_SENSORS)
- {
- }
- if (request_type == BROADCAST_GLOBAL)
- {
- switch (nbus->function_code.function)
- {
- case CMD_START: {
- nbus->measure_active = MEASURE_RUNNING;
- nbus->interface->start();
- nbus->hw_platform->led_on();
- }
- break;
- case CMD_STOP: {
- nbus->measure_active = MEASURE_STOPPED;
- nbus->interface->stop();
- nbus->hw_platform->led_off();
- }
- break;
- default:; // nothing
- }
- }
- nbus->send_response = NO_RESPONSE;
- }
- #endif
|