Freeze
This commit is contained in:
parent
70798b6bf7
commit
3e77d34ccc
10 changed files with 669 additions and 146 deletions
|
|
@ -16,6 +16,19 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#define SERIAL_BUFFER_CLEAR() \
|
||||
do { \
|
||||
while (Serial.available()) { \
|
||||
Serial.read(); \
|
||||
} \
|
||||
} while (0)
|
||||
#define SERIAL_SEND_OK() \
|
||||
do { \
|
||||
Serial.print("ok\n"); \
|
||||
Serial.flush(); \
|
||||
SERIAL_BUFFER_CLEAR(); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* @brief Calculate CRC16 using XMODEM polynomial
|
||||
* @param data Pointer to data buffer
|
||||
|
|
@ -24,26 +37,4 @@
|
|||
*/
|
||||
uint16_t calculate_crc16_xmodem(uint8_t *data, uint16_t len);
|
||||
|
||||
/**
|
||||
* @brief Convert ADC reading to temperature in 0.1°C
|
||||
* @param adc_value 12-bit ADC reading
|
||||
* @return Temperature in 0.1°C
|
||||
*/
|
||||
int16_t adc_to_temperature_c(uint16_t adc_value);
|
||||
|
||||
/**
|
||||
* @brief Convert ADC reading to voltage in mV
|
||||
* @param adc_value ADC reading
|
||||
* @return Voltage in mV
|
||||
*/
|
||||
uint16_t adc_to_voltage_mv(uint16_t adc_value);
|
||||
|
||||
/**
|
||||
* @brief Read ADC with oversampling
|
||||
* @param pin Analog pin to read
|
||||
* @param samples Number of samples for oversampling
|
||||
* @return Averaged ADC value
|
||||
*/
|
||||
uint16_t read_adc_oversampled(uint8_t pin, uint8_t samples);
|
||||
|
||||
#endif // UTILS_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue