added support for LDR and models

This commit is contained in:
2025-02-23 21:31:08 -05:00
parent 988765e2c2
commit f067bc26f9
13 changed files with 147 additions and 264 deletions

20
proto.h
View File

@@ -5,33 +5,20 @@
#include <stdbool.h>
#include "commons.h"
#ifdef IS_MASTER
#define SET_WRITE() do{digitalWrite(RS485_RX_TX_SELECT, 1);} while(0)
#define SET_READ() do{digitalWrite(RS485_RX_TX_SELECT, 0);} while(0)
#else
#define SET_WRITE() do { RS_MODE_SetHigh();} while(0)
#define SET_READ() do { RS_MODE_SetLow();} while(0)
#endif
/*=****************************************************************************/
bool byte_in (uint8_t in, uint8_t* p_cmd, uint8_t* p_id, uint16_t* p_led1,
uint16_t* p_led2, uint16_t* p_sensor, errors_t* p_error);
#ifdef IS_MASTER
/*=****************************************************************************/
errors_t send_get (uint8_t peer_id);
bool byte_in (uint8_t in, uint8_t* p_cmd, uint16_t* p_led1, uint16_t* p_led2);
/*=****************************************************************************/
errors_t send_set (uint8_t peer_id, uint16_t led1, uint16_t led2);
#else
errors_t send_model (uint8_t peer_id, uint8_t model);
/*=****************************************************************************/
errors_t send_data (uint8_t peer_id, uint16_t sensor);
errors_t send_data (uint8_t peer_id, uint16_t moisture, uint16_t light);
/*=****************************************************************************/
errors_t send_error (uint8_t peer_id, errors_t err);
#endif
/*=****************************************************************************/
errors_t uart_rx_byte (uint8_t* p_byte);
@@ -39,5 +26,4 @@ errors_t uart_rx_byte (uint8_t* p_byte);
/*=****************************************************************************/
errors_t uart_tx_byte (uint8_t byte);
#endif