semvec/pypi-packages huggingface dataset:
canano 0.0.4
Python library for Canano Raspberry Pi add-on board

# canano

Python library for Canano Raspberry Pi add-on board. <img align="right" src="https://i.ibb.co/FnDczVM/board2.jpg">


## Installation

Use [pip](https://pip.pypa.io/en/stable/) to install package on Raspberry Pi

```bash
pip install canano
```
Copy ```/scripts``` using [svn](https://subversion.apache.org/) or by cloning the repo
```bash
sudo svn checkout https://github.com/Tbruno25/canano/trunk/scripts
```

Run ```rpi_setup.py``` to modify ```/boot/config``` and ```/etc/network/interfaces```  for use with the canano board

```bash
sudo python3 scripts/rpi_setup.py
sudo reboot
```

## Usage
The api currently gives you control over the components on the board
```python
from canano import red_led, green_led, relay, button

red_led.on() # activate
green_led.off() # deactivate
button.state # returns state 
```
canano controls the socketcan interface allowing you to easily adjust on the fly
```python
from canano import canano
canano.baud = 250000 # sets bus baudrate to 250k
canano.reset() # clears buffer 
canano.bus # python-can bus object 
canano.bus.recv() # returns next message
```
Play around with it to find interesting use cases! 


## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

<p align="center">
<img src="https://i.ibb.co/1XXtwDD/board.jpg">
</p
pysocketcan 0.0.2
Python wrapper around common Linux SocketCAN commands

# PySocketCAN
The ```pysocketcan``` module provides a class to quickly modify Linux SocketCAN parameters directly from Python.

For example, to change the baudrate in Linux you need to run
```bash
$ sudo ip link set can0 down
$ sudo ip link set can0 type can bitrate 250000
$ sudo ip link set can0 up
```
The  ```pysocketcan``` equivalent is
```python
>>> can0.baud = 250000
```



## Installation

Use [pip](https://pip.pypa.io/en/stable/) to install

```bash
$ pip install pysocketcan
```

## Usage

```python
import pysocket as pysc

>>> pysc.view_available() # returns available interfaces
'can0'
>>> can0 = pysc.Interface("can0") # instantiate interface object

>>> can0.on() # set interface up
>>> can0.off() # set interface down
>>> can0.state # returns current state of interface
'STOPPED'

>>> can0.baud = 250000 # sets the baudrate
>>> can0.baud # returns current baudrate
'250000'

>>> can0.status # returns currently active modes
'LOOPBACK,LISTEN-ONLY,TRIPLE-SAMPLING'
>>> can0.listen_only = False # turns mode off
>>> can0.status
'LOOPBACK,TRIPLE-SAMPLING'
```
If can-utils is installed you can also use
```python
>>> can0.receive() # returns bus message
>>> can0.send(100, 12345678) # adds message to bus
```
#### Note:
To function correctly Python needs root priveleges
```bash
$ sudo python3
     # or
$ sudo venv/bin/python3
```
## Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.