You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#ifndef __AMS_WIRELIB_HPP__
|
|
#define __AMS_WIRELIB_HPP__
|
|
|
|
#include <Arduino.h>
|
|
#include <stdint.h>
|
|
|
|
//Routines for fast digital read/write from the PORTs, PINs, DDRs
|
|
//This is specific to Arduino Nano
|
|
|
|
uint8_t read_portsD();
|
|
uint8_t read_portsB();
|
|
uint8_t read_portsC();
|
|
|
|
uint8_t read_portD(uint8_t N);
|
|
uint8_t read_portB(uint8_t N);
|
|
uint8_t read_portC(uint8_t N);
|
|
|
|
void write_portsD(uint8_t V);
|
|
void write_portsB(uint8_t V);
|
|
void write_portsC(uint8_t V);
|
|
|
|
void write_portD(uint8_t N, uint8_t V);
|
|
void write_portB(uint8_t N, uint8_t V);
|
|
void write_portC(uint8_t N, uint8_t V);
|
|
|
|
void set_portsmodeD(uint8_t iomode);
|
|
void set_portsmodeB(uint8_t iomode);
|
|
void set_portsmodeC(uint8_t iomode);
|
|
|
|
void set_portmodeD(uint8_t N, uint8_t iomode);
|
|
void set_portmodeB(uint8_t N, uint8_t iomode);
|
|
void set_portmodeC(uint8_t N, uint8_t iomode);
|
|
|
|
//Numbered Pin Digital IO
|
|
//amsPN mapping for Arduino Nano
|
|
//0-7 - PORTD
|
|
//8-15 - PORTB
|
|
//16-23 - PORTC (Analog Pins)
|
|
|
|
//1 - output, 0 - input
|
|
void set_pinmode(uint8_t amsPN, uint8_t iomode);
|
|
uint8_t read_pin(uint8_t amsPN);
|
|
void write_pin(uint8_t amsPN, uint8_t V);
|
|
|
|
#endif
|