A code for the spindling of bots.

Dependencies:   MX12 ServoRingBuffer mbed-src

Fork of SpindleBot by MRD Lab

SSPI/SSPI.h

Committer:
labmrd
Date:
2015-08-13
Revision:
14:7c5beaa9fb01
Parent:
4:e44ac08027bd

File content as of revision 14:7c5beaa9fb01:

#ifndef SSPI_H
#define SSPI_H

#include "mbed.h"

/* var=target variable, pos=bit number to act upon 0-n */
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define BIT_SET(var,pos) ((var) |= (1<<(pos)))
#define BIT_CLEAR(var,pos) ((var) &= ~(1<<(pos)))
#define BIT_FLIP(var,pos) ((var) ^= (1<<(pos)))

#define SCLK_DELAY_US 1


class SSPI {

public:
    SSPI(PinName mosi, PinName miso, PinName sclk);
    unsigned char write(unsigned char data);
    
private:
    DigitalOut MOSI;
    DigitalIn MISO;
    DigitalOut SCLK;
};


#endif //SSPI_H