Skip to content

Commit

Permalink
Merge pull request #20 from openwsn-berkeley/19-readme-c-documentation
Browse files Browse the repository at this point in the history
README: cleaner
  • Loading branch information
twatteyne authored Nov 10, 2022
2 parents 6f1faf7 + a94f124 commit 839bbac
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@ Your code ends up sending and receiving serial frames through those library, nev
On the Python side:

```
import happyserial
from happyserial import HappySerial
def rx_cb(self,rxframe):
print(rxframe) # called each time Python receives a frame
happyser = happyserial.Happyserial(rx_cb)
...
def _happyserial_rx_cb(buf):
print('rx: {}'.format(buf))
happy = HappySerial.HappySerial(
serialport = 'COM41',
rx_cb = _happyserial_rx_cb,
)
happyser.send(txframe=[0x00,0x01,0x02,0x03])
happy.tx([0x01,0x02,0x03])
```

On the C side:
Expand All @@ -56,16 +57,13 @@ On the C side:
#include "happyserial.h"
int main(void) {
uint8_t buf = {0x00,0x01,0x03};
happyserial_init(_happyserial_rx_cb);
...
happyserial_tx(buf,bufLen);
happyserial_tx(buf,sizeof(buf));
}
//=========================== interrupt handlers ==============================
void _happyserial_rx_cb(uint8_t* buf, uint8_t bufLen) {
...
}
Expand Down

0 comments on commit 839bbac

Please sign in to comment.