Add pio onewire example (#334)

* Adds PIO onewire example

Co-authored-by: martin <admin@crossleys.biz>
This commit is contained in:
mjcross
2023-03-26 22:48:23 +01:00
committed by GitHub
parent 56b4522ce4
commit 9a82398d82
12 changed files with 434 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
#include "hardware/pio.h"
#include "hardware/clocks.h" // for clock_get_hz() in generated header
#include "onewire_library.pio.h" // generated by pioasm
typedef struct {
PIO pio;
uint sm;
uint jmp_reset;
int offset;
int gpio;
} OW;
bool ow_init (OW *ow, PIO pio, uint offset, uint gpio);
void ow_send (OW *ow, uint data);
uint8_t ow_read (OW *ow);
bool ow_reset (OW *ow);
int ow_romsearch (OW *ow, uint64_t *romcodes, int maxdevs, uint command);