#ifndef MAIN_H
#define MAIN_H

#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"

#include "hardware/clocks.h"
#include "hardware/watchdog.h"
#include "pico/multicore.h"
#include "hardware/i2c.h"
#include "pico/binary_info.h"
#include "hardware/uart.h"
#include "hardware/pwm.h"
#include "hardware/adc.h"

#define UART0 uart0
#define BAUD_RATE 4800
#define DATA_BITS 8
#define STOP_BITS 1
#define PARITY UART_PARITY_NONE

#define UART0_TX_PIN 1
#define UART0_RX_PIN 0

int Read_ID = 0x01;
unsigned char Tx_Buffer[8];
unsigned char Rx_Buffer[40];
unsigned char read_enable, receive_finished, receive_number;
unsigned long Voltage_data, Current_data, Power_data, Energy_data, Pf_data, CO2_data, Temperature_data, Hz_data;
int sec;

unsigned int calccrc(unsigned char crcbuf, unsigned int crc);
unsigned int chkcrc(unsigned char *buf, unsigned char len);
void read_data(void);
void Analysis_data(void);
void Print_data(void);
static uint16_t IM1253B(void);

#endif
