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.
ActuatorHub.h
00001 #ifndef ACTUATORHUB_H_ 00002 #define ACTUATORHUB_H_ 00003 00004 #include "../../../CommonLibraries/RingBuffer/RingBuffer.h" 00005 00006 extern RINGBUFFER::RingBuffer RS485SendBuffer; 00007 extern RINGBUFFER::RingBuffer BluetoothSendBuffer; 00008 00009 namespace ACTUATORHUB { 00010 #define MOTOR_ADDR 'M' 00011 #define MOTOR2_ADDR 'N' 00012 #define MOTOR3_ADDR 'O' 00013 #define SOLENOID_ADDR 'S' 00014 #define BLUETOOTH_ADDR 'B' 00015 #define TAPELED_ADDR 'L' 00016 00017 namespace MOTOR { 00018 #define FREE 0 00019 #define BACK 1 00020 #define FOR 2 00021 #define BRAKE 3 00022 00023 typedef struct { 00024 uint8_t dir; 00025 uint8_t pwm; 00026 }MotorStatus; 00027 00028 typedef union { 00029 struct { 00030 int data3 : 2; 00031 int data2 : 2; 00032 int data1 : 2; 00033 int data0 : 2; 00034 }; 00035 uint8_t all; 00036 }MotorDirectionData; 00037 00038 typedef struct { 00039 MotorDirectionData direction0to3; 00040 MotorDirectionData direction4to7; 00041 MotorDirectionData direction8to9; 00042 00043 uint8_t pwm0; 00044 uint8_t pwm1; 00045 uint8_t pwm2; 00046 uint8_t pwm3; 00047 uint8_t pwm4; 00048 uint8_t pwm5; 00049 uint8_t pwm6; 00050 uint8_t pwm7; 00051 uint8_t pwm8; 00052 uint8_t pwm9; 00053 uint8_t pwm10; 00054 uint8_t pwm11; 00055 uint8_t pwm12; 00056 }AllMotorData; 00057 00058 class Motor { 00059 public: 00060 static void Initialize(); 00061 static void Update(MotorStatus *status); 00062 static void SetDefault(); 00063 }; 00064 } 00065 00066 namespace SOLENOID { 00067 #define SOLENOID_ON 1 00068 #define SOLENOID_OFF 0 00069 00070 #define ALL_SOLENOID_ON 0xffff 00071 #define ALL_SOLENOID_OFF 0 00072 00073 typedef union { 00074 struct { 00075 int : 4; 00076 int solenoid11 : 1; 00077 int solenoid10 : 1; 00078 int solenoid9 : 1; 00079 int solenoid8 : 1; 00080 int solenoid7 : 1; 00081 int solenoid6 : 1; 00082 int solenoid5 : 1; 00083 int solenoid4 : 1; 00084 int solenoid3 : 1; 00085 int solenoid2 : 1; 00086 int solenoid1 : 1; 00087 int solenoid0 : 1; 00088 }; 00089 uint16_t all; 00090 }SolenoidStatus; 00091 00092 class Solenoid { 00093 public: 00094 static void Initialize(); 00095 static void Update(SolenoidStatus status); 00096 }; 00097 } 00098 00099 class ActuatorHub { 00100 public: 00101 static void Update(); 00102 }; 00103 } 00104 00105 #endif
Generated on Mon Jul 18 2022 14:24:17 by
1.7.2