Skip to content
Snippets Groups Projects
Commit 7da62ae3 authored by Paulus Kruger's avatar Paulus Kruger
Browse files

added binary

parent 23a8061c
No related branches found
No related tags found
No related merge requests found
File added
......@@ -8,14 +8,14 @@
#include "hba_tx.pio.h"
#include "hba_rx.pio.h"
//#define TX_RAW_TIME //This will give the raw time between edges instead of decoding it
#define SIMULATE_HBAT //Reply on request
#define TX_RAW_TIME //This will give the raw time between edges instead of decoding it
//#define SIMULATE_HBAT //Reply on request
const uint TX_PIN = 14; //25=LED to test
const uint RX_PIN = 14;
const uint TX_PIN = 17; //25=LED to test
const uint RX_PIN = 17;
///#define TXtimeout 0x1000
#define TXtimeout 0x80
#define TXtimeout 0x1000
//#define TXtimeout 0x80
//Need to change norm delay constants if time is changed!! This can be done using TX_RAW_TIME and python scripts.
inline uint16_t NormDelay(uint16_t x){ return (TXtimeout-x+19)/20; }
......@@ -25,7 +25,7 @@ char buffer1[BUFFERSIZE];
uint16_t buffer2[BUFFERSIZE];
uint8_t bcnt1=0,bcnt2=0;
uint8_t bcnt3=0,bcnt4=0;
uint16_t dummy;
uint32_t dummy;
void core1_entry() {
while (1) {
// printf("3");
......@@ -45,10 +45,17 @@ while (1) {
else {
int x = getchar_timeout_us(0);
if (x!=PICO_ERROR_TIMEOUT){
if (x==0) {
// gpio_set_dir(TX_PIN, GPIO_OUT);
// gpio_put(TX_PIN,0);
gpio_set_pulls(TX_PIN,false,true);
} else {
gpio_set_pulls(TX_PIN,true,false);
buffer1[bcnt1]=x;
bcnt1++;bcnt1%=BUFFERSIZE;
}
}
}
}};
int main() {
......@@ -70,7 +77,7 @@ int main() {
printf("Init\n");
// gpio_init(LED_PIN);
// gpio_set_dir(LED_PIN, GPIO_OUT);
// gpio_set_pulls(TX_PIN,true,false);
gpio_set_pulls(TX_PIN,true,false);
// gpio_set_pulls(RX_PIN,true,false);
pio_sm_put_blocking(pio_tx, sm , 12500); //Bitrate = 150e6 / val. e.g. 15k = 10kHz
pio_sm_put_blocking(pio_rx, sm1, TXtimeout); //Timeout
......@@ -85,7 +92,7 @@ int main() {
} else if ((pio_sm_get_tx_fifo_level(pio_tx, sm)<4) && (bcnt1!=bcnt2)) { //Second priority: Keep TX FIFO full
pio_sm_put_blocking(pio_tx, sm, buffer1[bcnt2]);
bcnt2++;bcnt2%=BUFFERSIZE;
} else if (dummy++==0) printf(".");
} else if (dummy++==0) printf("\n");
}
#endif //TX_RAW_TIME
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment