Added getting and setting time for CUDA

This commit is contained in:
dingusdev 2021-02-23 07:16:18 -07:00
parent e7e28b4497
commit 03a3a0369a
2 changed files with 19 additions and 2 deletions

View File

@ -316,10 +316,24 @@ void ViaCuda::pseudo_command(int cmd, int data_count) {
}
response_header(CUDA_PKT_PSEUDO, 0);
break;
case CUDA_GET_REAL_TIME:
response_header(CUDA_PKT_PSEUDO, 0);
this->out_buf[0] = (uint8_t)((this->real_time >> 24) & 0xFF);
this->out_buf[1] = (uint8_t)((this->real_time >> 16) & 0xFF);
this->out_buf[2] = (uint8_t)((this->real_time >> 8) & 0xFF);
this->out_buf[3] = (uint8_t)((this->real_time) & 0xFF);
break;
case CUDA_READ_PRAM:
response_header(CUDA_PKT_PSEUDO, 0);
this->pram_obj->read_byte(this->in_buf[2]);
break;
case CUDA_SET_REAL_TIME:
response_header(CUDA_PKT_PSEUDO, 0);
this->real_time = in_buf[0] >> 24;
this->real_time += in_buf[0] >> 16;
this->real_time += in_buf[0] >> 8;
this->real_time += in_buf[0];
break;
case CUDA_WRITE_PRAM:
response_header(CUDA_PKT_PSEUDO, 0);
this->pram_obj->write_byte(this->in_buf[2], this->in_buf[3]);
@ -431,4 +445,4 @@ void ViaCuda::i2c_comb_transaction(
this->next_out_handler = &ViaCuda::i2c_handler;
this->is_open_ended = true;
}
}
}

View File

@ -89,7 +89,9 @@ enum {
/** Cuda pseudo commands. */
enum {
CUDA_START_STOP_AUTOPOLL = 0x01, /* start/stop device auto-polling */
CUDA_GET_REAL_TIME = 0x03, /* get real time */
CUDA_READ_PRAM = 0x07, /* read parameter RAM */
CUDA_SET_REAL_TIME = 0x09, /* set real time */
CUDA_WRITE_PRAM = 0x0C, /* write parameter RAM */
CUDA_SET_AUTOPOLL_RATE = 0x14, /* set auto-polling rate */
CUDA_GET_AUTOPOLL_RATE = 0x16, /* get auto-polling rate */
@ -132,6 +134,7 @@ private:
int32_t out_count;
int32_t out_pos;
uint8_t poll_rate;
int32_t real_time;
bool is_open_ended;
uint8_t curr_i2c_addr;
@ -165,4 +168,4 @@ private:
uint8_t dev_addr, uint8_t sub_addr, uint8_t dev_addr1, const uint8_t* in_buf, int in_bytes);
};
#endif /* VIACUDA_H */
#endif /* VIACUDA_H */