/*
 * SCIB.h
 *
 *      Author: Aleksey Gerasimenko
 *      gerasimenko.aleksey.n@gmail.com
 */

#include "F28335/DSP28x_Project.h"

#include "DSP28335/SCIBase.h"

#ifndef DSP28335_SCIB_H_
#define DSP28335_SCIB_H_

#ifndef SCIB_BAUDRATE_DEFAULT
#define SCIB_BAUDRATE_DEFAULT   (DSP28335::BR9600)
#endif

#ifndef SCIB_PARITY_DEFAULT
#define SCIB_PARITY_DEFAULT     (DSP28335::NO)
//#define SCIB_PARITY_DEFAULT     (DSP28335::ODD)
//#define SCIB_PARITY_DEFAULT     (DSP28335::EVEN)
#endif

#ifndef SCIB_STOPBITS_DEFAULT
#define SCIB_STOPBITS_DEFAULT   (DSP28335::ONE)
#endif

#ifndef SCIB_LENGHT_DEFAULT
#define SCIB_LENGHT_DEFAULT     (DSP28335::LEN8)
#endif

#ifndef SCIB_GPIO_SETUP_DEFAULT
#define SCIB_GPIO_SETUP_DEFAULT (&DSP28335::GPIO::gpio_scib_setup)
#endif


namespace DSP28335
{

class SCIB: public SCIBase
{
public:
    SCIB(volatile struct SCI_REGS& SciRegs);
    void setup();
    void setup(DSP28335::SCISetup& setup);
    void get_default_configuration(DSP28335::SCIConfiguration& config);
    void get_configuration(DSP28335::SCIConfiguration& config);
    void set_configuration(DSP28335::SCIConfiguration& config);
    bool compare_configuration(DSP28335::SCIConfiguration& config);
protected:
    void _configure(DSP28335::SCIConfiguration& config);
};//SCIB

} /* namespace DSP28335 */

#endif /* DSP28335_SCIB_H_ */