 =========================================
 */
 int set_adc_register(byte reg, byte *value, int write_len) {
-    /* when specified register is invalid */
+    /* when desired register is invalid */
     if (reg < 0x00 || reg > 0x3F) {
         if (DEBUG_ENABLED) {
             print_byte(reg);

void setup() {
    /* initiate serial communication */
    Serial.begin(115200);
    /* initiate ADC */
    init_adc();
    /* reset ADC to default state */
    reset_adc();
    /* set ADC configuration */
    /* enable ch0 and ch1 */
    enable_adc_channel(CH0_REG, true, AIN0, AIN1);
    enable_adc_channel(CH1_REG, true, AIN2, AIN3);
    /* set the ADC data mode */
    set_adc_data_mode(CONTINUOUS_READ_MODE);
    /* set the ADC filter samplingrate to 1007 Hz*/
    set_adc_filter_speed(FILTCON0_REG, SPS_1007);
    /* set the ADC setup coding to BIPLOAR output*/
    set_adc_setup_codig(SETUPCON0_REG, BIPOLAR_CODED_OUTPUT);
    /* wait for ADC */
    delay(10);

}

/*
=====================================
enables or disables ADC channels
@param byte - channel
@param bool - status
@param byte - optional analog input 1
@param byte - optional analog input 2
@return int - error code
=====================================
*/
int enable_adc_channel(int channel, bool status, byte ain1 = NULL, byte ain2 = NULL) {
    /* when channel out of range */
    if (channel < 0 || channel > 15) {
        if (DEBUG_ENABLED) {
            print_byte(channel);
            Serial.println("enable channel out of range");
