Просмотр исходного кода

moved ymodem functions to shellmatta_ymodem.c

Strobel, Stefan | Friedrich Lütze GmbH 9 месяцев назад
Родитель
Сommit
f222fcae19
2 измененных файлов с 55 добавлено и 55 удалено
  1. 0 55
      src/shellmatta.c
  2. 55 0
      src/shellmatta_ymodem.c

+ 0 - 55
src/shellmatta.c

@@ -960,59 +960,4 @@ shellmatta_retCode_t shellmatta_printf( shellmatta_handle_t handle,
 }
 #endif
 
-/** 
- * @brief       starts the ymodem receive module 
- * @param[in]   handle      shellmatta instance handle
- * @param[in]   buffer      pointer to where the received data is stored
- * @param[in]   fileSize    pointer to where the file size is stored
- * @param[in]   packetSize  pointer to where the packet size is stored
- * @param[in]   callbacks   callback functions for ymodem module
- * @note        disables the transport layer if active
-*/
-uint8_t shellmatta_ymodem(  shellmatta_handle_t             handle,
-                            uint8_t*                        buffer,
-                            uint32_t*                       fileSize,
-                            uint16_t*                       packetSize,
-                            shellmatta_ymodem_callbacks_t   callbacks)
-{
-#ifdef SHELLMATTA_TRANSPORT
-    /* disable transport layer so control symbols won't be caught by it */
-    ((shellmatta_instance_t*)handle)->transportEnabled = false;
-#endif
-    shellmatta_ymodem_init(handle, buffer, fileSize, packetSize, callbacks);
-
-    /* send initial ymodem symbol to start transmission */
-    shellmatta_ymodem_control(handle, YMODEM_CRC);
-    return 0;
-}
-
-/**
- * @brief       Resets the ymodem module
- * @param[in]   doCancel    Set this flag to execute the cancel-callback function within the ymodem-reset function
- * @note        call this function after file transmission is done or cancelled
-*/
-void shellmatta_ymodem_end(shellmatta_handle_t handle, bool doCancel)
-{
-    shellmatta_ymodem_reset(handle, doCancel);
-    /* clear any possibly leftover inputs */
-    utils_clearInput((shellmatta_instance_t*)handle);
-}
-
-void shellmatta_ymodem_set_enable(bool doEnable)
-{
-    if (doEnable) 
-    {
-        shellmatta_ymodem_enable();
-    }
-    else
-    {
-        shellmatta_ymodem_disable();
-    }
-}
-
-bool shellmatta_ymodem_is_active(void)
-{
-    return shellmatta_ymodem_get_current_datatype() != YMODEM_NONE;
-}
-
 /** @} */

+ 55 - 0
src/shellmatta_ymodem.c

@@ -574,3 +574,58 @@ void shellmatta_ymodem_disable(void)
 {
     ymodem_is_enabled = false;
 }
+
+/** 
+ * @brief       starts the ymodem receive module 
+ * @param[in]   handle      shellmatta instance handle
+ * @param[in]   buffer      pointer to where the received data is stored
+ * @param[in]   fileSize    pointer to where the file size is stored
+ * @param[in]   packetSize  pointer to where the packet size is stored
+ * @param[in]   callbacks   callback functions for ymodem module
+ * @note        disables the transport layer if active
+*/
+uint8_t shellmatta_ymodem(  shellmatta_handle_t             handle,
+                            uint8_t*                        buffer,
+                            uint32_t*                       fileSize,
+                            uint16_t*                       packetSize,
+                            shellmatta_ymodem_callbacks_t   callbacks)
+{
+#ifdef SHELLMATTA_TRANSPORT
+    /* disable transport layer so control symbols won't be caught by it */
+    ((shellmatta_instance_t*)handle)->transportEnabled = false;
+#endif
+    shellmatta_ymodem_init(handle, buffer, fileSize, packetSize, callbacks);
+
+    /* send initial ymodem symbol to start transmission */
+    shellmatta_ymodem_control(handle, YMODEM_CRC);
+    return 0;
+}
+
+/**
+ * @brief       Resets the ymodem module
+ * @param[in]   doCancel    Set this flag to execute the cancel-callback function within the ymodem-reset function
+ * @note        call this function after file transmission is done or cancelled
+*/
+void shellmatta_ymodem_end(shellmatta_handle_t handle, bool doCancel)
+{
+    shellmatta_ymodem_reset(handle, doCancel);
+    /* clear any possibly leftover inputs */
+    utils_clearInput((shellmatta_instance_t*)handle);
+}
+
+void shellmatta_ymodem_set_enable(bool doEnable)
+{
+    if (doEnable) 
+    {
+        shellmatta_ymodem_enable();
+    }
+    else
+    {
+        shellmatta_ymodem_disable();
+    }
+}
+
+bool shellmatta_ymodem_is_active(void)
+{
+    return shellmatta_ymodem_get_current_datatype() != YMODEM_NONE;
+}