#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/uart.h"
#include "EBYTE.h"
#define PIN_RX 2
#define PIN_TX 3
#define PIN_M0 4
#define PIN_M1 5
#define PIN_AX 6
#define UART_ID uart0
#define BAUD_RATE 9600
// We are using pins 0 and 1, but see the GPIO function select table in the
// datasheet for information on which other pins can be used.
#define UART_TX_PIN 0
#define UART_RX_PIN 1
int main() {
// Set up our UART with the required speed.
uart_init(UART_ID, BAUD_RATE);
// create the transceiver object, passing in the serial and pins
EBYTE Transceiver(&UART_ID, PIN_M0, PIN_M1, PIN_AX);
// Set the TX and RX pins by using the function select on the GPIO
// Set datasheet for more information on function select
gpio_set_function(UART_TX_PIN, GPIO_FUNC_UART);
gpio_set_function(UART_RX_PIN, GPIO_FUNC_UART);
// start the transceiver serial port--i have yet to get a different
// baud rate to work--data sheet says to keep on 9600
ESerial.begin(9600);
// this init will set the pinModes for you
Transceiver.init();
// all these calls are optional but shown to give examples of what you can do
// Serial.println(Transceiver.GetAirDataRate());
// Serial.println(Transceiver.GetChannel());
// Transceiver.SetAddressH(1);
// Transceiver.SetAddressL(0);
// Chan = 5;
// Transceiver.SetChannel(Chan);
// save the parameters to the unit,
// Transceiver.SaveParameters(PERMANENT);
// you can print all parameters and is good for debugging
// if your units will not communicate, print the parameters
// for both sender and receiver and make sure air rates, channel
// and address is the same
Transceiver.PrintParameters();
// Send out a string, with CR/LF conversions
uart_puts(UART_ID, " Hello, UART!\n");
}