Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Carte_Moteur_test_asservissement_1M identification Carte_Moteur_test_asservissement_3M
7366_lib.h
00001 /************************** 00002 * 7366.h: 7366R header file 00003 **************************/ 00004 #ifndef DEF_SPI_7366 00005 #define DEF_SPI_7366 00006 00007 //Count modes 00008 #define NON_QUADRATURE 0 00009 #define QUADRATURE_X1 0x01 00010 #define QUADRATURE_X2 0x02 00011 #define QUADRATURE_X4 0x03 00012 00013 //running mode 00014 #define FREE_RUN 0 00015 #define SINGE_CYCLE 0x04 00016 #define RANGE_LIMIT 0x08 00017 #define MODULO_N 0x0C 00018 00019 //Index modes 00020 #define DISABLE_INDX 0 00021 #define INDX_LOADC 0x10 00022 #define INDX_RESET 0x20 00023 #define INDX_LOADO 0x30 00024 00025 //Index synchronous modes 00026 #define ASYNCH_INDX 0 00027 #define SYNCH_INDX 0x80 00028 00029 //Clock filter modes 00030 #define FILTER_1 0 00031 #define FILTER_2 0x80 00032 00033 /* Valid flags- Any of these config words can be ORed together */ 00034 #define NO_FLAGS 0 00035 #define IDX_FLAG 0x10 00036 #define CMP_FLAG 0x20 00037 #define BW_FLAG 0x40 00038 #define CY_FLAG 0x80 00039 00040 //Register 00041 #define MDR0 8 00042 #define MDR1 16 00043 #define DTR 24 00044 #define CNTR 32 00045 #define OTR 40 00046 #define STR 48 00047 00048 //Instructions 00049 #define CLR 0 00050 #define RD 64 00051 #define WR 128 00052 #define LOAD 192 00053 00054 //Byte counter mode 00055 #define CONFIG_4BYTES 0x00 00056 #define CONFIG_3BYTES 0x01 00057 #define CONFIG_2BYTES 0x02 00058 #define CONFIG_1BYTES 0x03 00059 00060 //enable 00061 #define CPT_ENABLE 0x00 00062 #define CPT_DISABLE 0x04 00063 00064 00065 #include "mbed.h" 00066 00067 00068 class SPI_7366 : public SPI 00069 { 00070 public: 00071 SPI_7366(PinName SPI_MOSI, PinName SPI_MISO, PinName SPI_SCLK,PinName SPI_SSEL); 00072 void setup(void); 00073 int32_t read_value(void); 00074 void set_as_inverted(void); 00075 protected: 00076 DigitalOut select; 00077 int sens; // 1 : normal / -1 : inverted 00078 }; 00079 00080 00081 #endif
Generated on Sat Aug 27 2022 05:01:04 by
 1.7.2
 1.7.2