-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
984d0b6
commit e104886
Showing
9 changed files
with
50 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "serialConnection.h" | ||
#include "includes.h" | ||
|
||
bool serialHasBeenInitialized = false; | ||
const u32 baudrateList[ITEM_BAUDRATE_COUNT] = {2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000}; | ||
|
||
void Serial_ReSourceDeInit(void) | ||
{ | ||
if (!serialHasBeenInitialized) return; | ||
serialHasBeenInitialized = false; | ||
Serial_DeInit(); | ||
} | ||
|
||
void Serial_ReSourceInit(void) | ||
{ | ||
if (serialHasBeenInitialized) return; | ||
serialHasBeenInitialized = true; | ||
|
||
memset(&infoHost, 0, sizeof(infoHost)); | ||
reminderSetUnConnected(); // reset connect status | ||
Serial_Init(infoSettings.baudrate); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef _SERIAL_CONNECTION_H_ | ||
#define _SERIAL_CONNECTION_H_ | ||
|
||
#include <stdint.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define ITEM_BAUDRATE_COUNT 9 | ||
|
||
extern const uint32_t baudrateList[ITEM_BAUDRATE_COUNT]; | ||
|
||
void Serial_ReSourceDeInit(void); | ||
void Serial_ReSourceInit(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters