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

#include "F28335/DSP28x_Project.h"

#include "DSP28335/SCIBase.h"

#ifndef DSP28335_SCIC_H_
#define DSP28335_SCIC_H_

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

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

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

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

#ifndef SCIC_GPIO_SETUP_DEFAULT
#define SCIC_GPIO_SETUP_DEFAULT (&DSP28335::GPIO::gpio_scic_setup)
#endif


namespace DSP28335
{

class SCIC: public SCIBase
{
public:
    SCIC(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);
};

} /* namespace DSP28335 */

#endif /* DSP28335_SCIC_H_ */