RefreshMenu.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /**
  2. ******************************************************************************
  3. * @file RefreshMenu.h
  4. * @author Vincent
  5. * @version V1.0.0
  6. * @date 23-12-2015
  7. * @brief
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __FREFRESHMENU_H
  39. #define __FREFRESHMENU_H
  40. /* Includes ------------------------------------------------------------------*/
  41. //#include "at32f421.h"
  42. #include "ti_msp_dl_config.h"
  43. #include "uart_driver.h"
  44. #define FLASH_SIZE (1024*(*((uint32_t*)0x1FFFF7E0))) /* read from at32 flash capacity register(unit:byte) */
  45. #define APP_SIZE (64*1024)
  46. #define OTA_SIZE (8*1024)
  47. #define SRAM_SIZE (16)//(64) /* sram size, unit:kbyte */
  48. /* Define to variables declare---------------------------------------------------*/
  49. typedef enum {DISABLE = 0, ENABLE = !DISABLE} EventStatus, ControlStatus;
  50. typedef void (*otafun)(void);
  51. /* Private variables declare---------------------------------------------------*/
  52. typedef struct
  53. {
  54. _Bool wrenable;
  55. _Bool finished;
  56. uint8_t step;
  57. //uint8_t ackcmd;
  58. uint16_t userCmd;
  59. uint16_t packagecount;
  60. //uint32_t vesionold;
  61. //uint32_t vesionnew;
  62. //uint32_t buff[256];
  63. uint8_t * dataBuff_128B;
  64. uint32_t packageSize;
  65. uint8_t startUpSendCount;
  66. }download_t;
  67. typedef struct
  68. {
  69. _Bool AckEnable;
  70. uint8_t UpdateStatus:2;
  71. uint16_t TimeCounter_Update;
  72. uint16_t TimeCounter_Startup;
  73. uint16_t uwTimeThreshold;
  74. }updatecount_t;
  75. //extern download_t _;
  76. //extern updatecount_t __;
  77. extern download_t downLoad;
  78. extern updatecount_t update;
  79. extern uint8_t flag_FlashWR[];
  80. /*Private function declare---------------------------------------------------*/
  81. void User_Manu_Init(void);
  82. void User_Main_Manu(void);
  83. void Period_Stick(void);
  84. void updateAck(USART_Buf_TypeDef* ptUartTx);
  85. void startUpAck(void);
  86. void timeOutAck(USART_Buf_TypeDef* ptUartTx);
  87. void sendUpdateAck(uint16_t cmd, uint16_t packageNum);
  88. void sendAck(void);
  89. #endif /*__FREFRESHMENU_H */
  90. /*---------------------------- file end -------------------------------------*/