Browse Source

update

hpp272
zhaohe 2 years ago
parent
commit
d7d52febd4
  1. 13
      usrc/hardware.cpp

13
usrc/hardware.cpp

@ -41,6 +41,9 @@ uint32_t ADC_Get_Average(uint8_t ch, uint8_t times) {
uint8_t i;
switch (ch) // 选择ADC通道
{
case 0:
sConfig.Channel = ADC_CHANNEL_0;
break;
case 1:
sConfig.Channel = ADC_CHANNEL_1;
break;
@ -157,6 +160,9 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int
PROCESS_CMD(kcmd_set_io, 0, 8) { return 0; }
PROCESS_CMD(kcmd_set_io, 0, 9) { return 0; }
/**
* @brief
*/
PROCESS_CMD(kcmd_readadc_raw, 0, 0) {
uint32_t adc_val = ADC_Get_Average(0, 12);
receipt[0] = cmdheader->data[0];
@ -165,6 +171,9 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int
if (fromwhere == kuart) printf("==== adc_val0: %d\n", adc_val);
return 0;
}
/**
* @brief
*/
PROCESS_CMD(kcmd_readadc_raw, 0, 1) {
uint32_t adc_val = ADC_Get_Average(1, 12);
receipt[0] = cmdheader->data[0];
@ -173,6 +182,9 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int
if (fromwhere == kuart) printf("==== adc_val1: %d\n", adc_val);
return 0;
}
/**
* @brief
*/
PROCESS_CMD(kcmd_readadc_raw, 0, 2) {
uint32_t adc_val = ADC_Get_Average(2, 12);
receipt[0] = cmdheader->data[0];
@ -205,6 +217,7 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int
if (fromwhere == kuart) printf("==== adc_val9: %d\n", adc_val);
return 0;
}
PROCESS_CMD(kcmd_m211887_operation, 0, 1) {
hpp272_data_t *hpp272data = hpp272.readVal();
if (hpp272data) {

Loading…
Cancel
Save