kopia lustrzana https://github.com/amedes/pico_tnc
Porównaj commity
3 Commity
f62b18344d
...
ce456533c1
Autor | SHA1 | Data |
---|---|---|
amedes | ce456533c1 | |
amedes | e6c065588f | |
amedes | 484b10291c |
BIN
pico_tnc.uf2
BIN
pico_tnc.uf2
Plik binarny nie jest wyświetlany.
|
@ -31,12 +31,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
#ifdef RASPBERRYPI_PICO
|
||||
#include "ax25.h"
|
||||
|
||||
//#ifdef RASPBERRYPI_PICO
|
||||
#ifdef PICO_DEFAULT_UART
|
||||
|
||||
#include "hardware/dma.h"
|
||||
|
||||
#include "ax25.h"
|
||||
|
||||
#define OUT_INV (1 << 11)
|
||||
#define OUT_REV (1 << 10)
|
||||
|
||||
|
@ -78,11 +79,12 @@ int ax25_fcs(uint32_t crc, const uint8_t *data, int size)
|
|||
|
||||
#else
|
||||
|
||||
#warning using C standard routine
|
||||
|
||||
#define CRC16_POLY 0x10811 /* G(x) = 1 + x^5 + x^12 + x^16 */
|
||||
|
||||
int ax25_fcs(int crc, const uint8_t packet[], int length)
|
||||
int ax25_fcs(uint32_t crc, const uint8_t packet[], int length)
|
||||
{
|
||||
uint32_t crc;
|
||||
int i, j;
|
||||
|
||||
if (length <= 0) return -1; // packet too short
|
||||
|
|
|
@ -45,6 +45,8 @@ void usb_write(uint8_t const *data, int len)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (!tud_cdc_connected()) return;
|
||||
|
||||
if (!queue_is_empty(&usb_queue)) {
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
|
@ -73,6 +75,8 @@ void usb_write_char(uint8_t ch)
|
|||
{
|
||||
int i = 0;
|
||||
|
||||
if (!tud_cdc_connected()) return;
|
||||
|
||||
if (!queue_is_empty(&usb_queue)) {
|
||||
|
||||
queue_try_add(&usb_queue, &ch);
|
||||
|
@ -93,6 +97,8 @@ void usb_output(void)
|
|||
{
|
||||
uint8_t data;
|
||||
|
||||
if (!tud_cdc_connected()) return;
|
||||
|
||||
if (queue_is_empty(&usb_queue)) return;
|
||||
|
||||
while (tud_cdc_write_available() > 0) {
|
||||
|
|
Ładowanie…
Reference in New Issue