NessLab(6033).c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * NessLab.c
  3. *
  4. * Created on: Aug 3, 2020
  5. * Author: parkyj
  6. */
  7. #include "main.h"
  8. #include "NessLab.h"
  9. #include "adc.h"
  10. #include "crc.h"
  11. //extern uint8_t NessLab_Checksum(uint8_t* data,uint8_t size);
  12. Nesslab_Prot Currstatus;
  13. uint8_t data_Tx[50] = {0,};
  14. void NessLab_Operate(uint8_t* data){
  15. uint8_t datatype = data[NessLab_MsgID0];
  16. switch(datatype){
  17. case NessLab_STATUS_REQ:
  18. ADC_Check();
  19. break;
  20. }
  21. Uart1_Data_Send(&Currstatus, 30);
  22. }
  23. void NessLab_Frame_Set(){
  24. Currstatus.Header0 = 0x7E;
  25. Currstatus.Header1 = 0x7E;
  26. /* Exception Header Tail Checksum */
  27. Currstatus.Checksum = NessLab_Checksum(&Currstatus.MsgId, 17);
  28. Currstatus.Tail0 = 0x7E;
  29. Currstatus.Tail1 = 0x7E;
  30. }
  31. void NessLab_Status_Check(){
  32. //HAL_GPIO_ReadPin(, GPIO_Pin)
  33. }
  34. void NessLab_PAU_Enable(){
  35. HAL_GPIO_WritePin(AMP_EN_GPIO_Port,AMP_EN_Pin, HAL_GPIO_ReadPin(PAU_EN_GPIO_Port, PAU_EN_Pin));
  36. //HAL_GPIO_WritePin(AMP_EN_GPIO_Port,AMP_EN_Pin, HAL_GPIO_ReadPin(PAU_RESET_GPIO_Port, PAU_RESET_Pin));
  37. }
  38. void NessLab_GPIO_Operate(){
  39. NessLab_PAU_Enable();
  40. }