mirror of
https://github.com/robotdoly/DOLY-DIY.git
synced 2025-06-05 21:49:17 +02:00
Add files via upload
This commit is contained in:
58
CodeExamples/Doly/include/Gpio.h
Normal file
58
CodeExamples/Doly/include/Gpio.h
Normal file
@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
enum GpioType :uint8_t
|
||||
{
|
||||
GPIO_INPUT = 0,
|
||||
GPIO_OUTPUT = 1,
|
||||
GPIO_PWM = 2
|
||||
};
|
||||
|
||||
enum GpioState :bool
|
||||
{
|
||||
LOW = false,
|
||||
HIGH = true,
|
||||
};
|
||||
|
||||
enum PinId :uint8_t
|
||||
{
|
||||
// >= 50 GPIO_CHIP2
|
||||
Pin_Servo_Left_Enable = 56,
|
||||
Pin_Servo_Right_Enable = 57,
|
||||
};
|
||||
|
||||
enum PwmId :uint8_t
|
||||
{
|
||||
Pwm_Led_Left_B = 6,
|
||||
Pwm_Led_Left_G = 7,
|
||||
Pwm_Led_Left_R = 8,
|
||||
Pwm_Led_Right_B = 9,
|
||||
Pwm_Led_Right_G = 10,
|
||||
Pwm_Led_Right_R = 11,
|
||||
};
|
||||
|
||||
namespace GPIO
|
||||
{
|
||||
// Initialize IO pin
|
||||
// state is optional for GPIO
|
||||
// return 0 = success
|
||||
// return -1 = initialized failed
|
||||
// return -2 = wrong type
|
||||
int8_t init(PinId id, GpioType type, GpioState state = GpioState::LOW);
|
||||
|
||||
// Initialize PWM pin
|
||||
// return 0 = success
|
||||
// return -1 = initialized failed
|
||||
int8_t init(PwmId id);
|
||||
|
||||
// return 0 success
|
||||
// return -1 write failed
|
||||
// return -2 undefined id
|
||||
int8_t writePin(PinId id, GpioState state);
|
||||
|
||||
// return 0 success
|
||||
// return -1 write failed
|
||||
// return -2 undefined id
|
||||
int8_t writePwm(PwmId id, uint16_t value);
|
||||
|
||||
};
|
69
CodeExamples/Doly/include/LcdControl.h
Normal file
69
CodeExamples/Doly/include/LcdControl.h
Normal file
@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#define LCD_WIDTH 240
|
||||
#define LCD_HEIGHT 240
|
||||
|
||||
enum LcdColorDepth :uint8_t
|
||||
{
|
||||
// 0x06 = 18 bit, 0x03 = 12 bit
|
||||
LCD_12BIT = 0x03,
|
||||
LCD_18BIT = 0x06,
|
||||
};
|
||||
|
||||
enum LcdSide :uint8_t
|
||||
{
|
||||
LcdLeft = 0,
|
||||
LcdRight = 1,
|
||||
};
|
||||
|
||||
struct LcdData
|
||||
{
|
||||
uint8_t side;
|
||||
uint8_t* buffer;
|
||||
};
|
||||
|
||||
namespace LcdControl
|
||||
{
|
||||
// Initialize lcd
|
||||
// return 0 success
|
||||
// return 1 already initialized
|
||||
// return -1 open device failed
|
||||
// return -2 ioctl failed
|
||||
int8_t init(LcdColorDepth depth = LCD_12BIT);
|
||||
|
||||
// release file descriptor and deinitialize
|
||||
// return 0 success
|
||||
// return 1 already closed or not opened
|
||||
int8_t release();
|
||||
|
||||
// retuns state of lcds
|
||||
// return true initialized
|
||||
// return false not initialized
|
||||
bool isActive();
|
||||
|
||||
// fill lcd with RGB
|
||||
void LcdColorFill(LcdSide side, uint8_t R, uint8_t G, uint8_t B);
|
||||
|
||||
// write buffer data to lcd
|
||||
// return 0 success
|
||||
// return -1 ioct error
|
||||
// return -2 not active
|
||||
int8_t writeLcd(LcdData* frame_data);
|
||||
|
||||
//return lcd buffer size
|
||||
// pixel count * Color data byte size
|
||||
// ex. 240*240*3
|
||||
int getBufferSize();
|
||||
|
||||
// returns lcd color depth
|
||||
LcdColorDepth getColorDepth();
|
||||
|
||||
// brightness value min = 0, max = 10
|
||||
int8_t setBrightness(uint8_t value);
|
||||
|
||||
//converts 24 bit image to lcd image depth
|
||||
void LcdBufferFrom24Bit(uint8_t* output, uint8_t* input);
|
||||
};
|
||||
|
45
CodeExamples/Doly/include/ServoMotor.h
Normal file
45
CodeExamples/Doly/include/ServoMotor.h
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
// just for information, ignored if used more than defined (220 degree)
|
||||
// Arm servos can not rotate more than that.
|
||||
#define SERVO_ARM_MAX_ANGLE 220
|
||||
|
||||
enum ServoChannel : uint8_t
|
||||
{
|
||||
SERVO_LEFT,
|
||||
SERVO_RIGHT,
|
||||
SERVO_0,
|
||||
SERVO_1,
|
||||
};
|
||||
|
||||
namespace ServoMotor
|
||||
{
|
||||
// initialize all motors
|
||||
void Init();
|
||||
|
||||
//return true if module ready
|
||||
bool isActive();
|
||||
|
||||
// setup servo default values
|
||||
// 'min_us, max_us' depends on your servo and effects angle of movement
|
||||
// most PWM range them between (500us - 2500us)
|
||||
// 'angle' ignored for SERVO_LEFT & SERVO_RIGHT,
|
||||
// return 0 success
|
||||
// return -1 frequency interval error
|
||||
// return -2 angle error
|
||||
int8_t setup(ServoChannel channel, uint16_t min_us, uint16_t max_us, uint16_t angle, bool invert);
|
||||
|
||||
// sets servo position
|
||||
// return 0 success
|
||||
// return -1 max angle exceed error
|
||||
// return -2 speed range error (0-100)
|
||||
// return -3 undefined channel
|
||||
int8_t set(ServoChannel channel, float angle, uint8_t speed);
|
||||
|
||||
// stops servo
|
||||
// return 0 success
|
||||
// return -1 undefined servo
|
||||
int8_t stop(ServoChannel channel);
|
||||
};
|
||||
|
BIN
CodeExamples/Doly/libs/libGpio.a
Normal file
BIN
CodeExamples/Doly/libs/libGpio.a
Normal file
Binary file not shown.
BIN
CodeExamples/Doly/libs/libLcdControl.a
Normal file
BIN
CodeExamples/Doly/libs/libLcdControl.a
Normal file
Binary file not shown.
BIN
CodeExamples/Doly/libs/libServoMotor.a
Normal file
BIN
CodeExamples/Doly/libs/libServoMotor.a
Normal file
Binary file not shown.
BIN
CodeExamples/Doly/libs/libTimer.a
Normal file
BIN
CodeExamples/Doly/libs/libTimer.a
Normal file
Binary file not shown.
13
CodeExamples/LcdExample/README.md
Normal file
13
CodeExamples/LcdExample/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# LcdControl Example program
|
||||
|
||||
### Compile example program
|
||||
This example needs some static libraries and header files located under '/Doly/libs' & '/Doly/include'
|
||||
Make sure you have already copy '/Doly' folder under your root directory.
|
||||
|
||||
```bash
|
||||
g++ -L../Doly/libs -I../Doly/include -Wall -o test main.cpp -lLcdControl
|
||||
```
|
||||
|
||||
|
72
CodeExamples/LcdExample/main.cpp
Normal file
72
CodeExamples/LcdExample/main.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
#include "LcdControl.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <thread>
|
||||
|
||||
/// <summary>
|
||||
/// This program demonstrates how to setup and control servos,
|
||||
/// Also this program requires LcdControl library
|
||||
/// LcdControl is part of Project Doly, libararies and headers are located under '/Doly'
|
||||
/// Do not forget to Copy and Link related libraries.
|
||||
/// </summary>
|
||||
|
||||
int FillBufferExample();
|
||||
|
||||
int main()
|
||||
{
|
||||
// initialize Lcd
|
||||
// default Color depth is 12 Bit (4096 color)
|
||||
LcdControl::init(LCD_12BIT);
|
||||
|
||||
LcdColorDepth depth = LcdControl::getColorDepth();
|
||||
|
||||
// Fill with buffer example
|
||||
FillBufferExample();
|
||||
|
||||
// wait 2 seconds
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
|
||||
// fill with color example
|
||||
LcdControl::LcdColorFill(LcdLeft, 0, 0, 255);
|
||||
LcdControl::LcdColorFill(LcdRight, 255, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FillBufferExample()
|
||||
{
|
||||
// get LCD buffer size
|
||||
// buffer size depends on color depth
|
||||
// ex. Color depth 12 Bit frame size = 240px * 240px * 1.5
|
||||
// Color depth 18 Bit frame size = 240px * 240px * 3
|
||||
int buffer_size = LcdControl::getBufferSize();
|
||||
|
||||
// allocate & clear buffer
|
||||
uint8_t buf[buffer_size];
|
||||
memset(&buf, 0xFF, buffer_size);
|
||||
|
||||
// create data for each side
|
||||
LcdData frame_left;
|
||||
frame_left.buffer = buf;
|
||||
frame_left.side = LcdLeft;
|
||||
|
||||
LcdData frame_right;
|
||||
frame_right.buffer = buf;
|
||||
frame_right.side = LcdRight;
|
||||
|
||||
int retval = 0;
|
||||
// write buffer to LCD
|
||||
if (LcdControl::writeLcd(&frame_left) < 0)
|
||||
{
|
||||
printf("Left Lcd write failed! \n");
|
||||
retval = -1;
|
||||
}
|
||||
// write buffer to LCD
|
||||
if (LcdControl::writeLcd(&frame_right) < 0)
|
||||
{
|
||||
printf("Right Lcd write failed! \n");
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
13
CodeExamples/ServoExample/README.md
Normal file
13
CodeExamples/ServoExample/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# LcdControl Example program
|
||||
|
||||
### Compile example program
|
||||
This example needs some static libraries and header files located under '/Doly/libs' & '/Doly/include'
|
||||
Make sure you have already copy '/Doly' folder under your root directory.
|
||||
|
||||
```bash
|
||||
g++ -L../Doly/libs -I../Doly/include -Wall -o test main.cpp -lServoMotor -lTimer -lGpio -lpthread
|
||||
```
|
||||
|
||||
|
53
CodeExamples/ServoExample/main.cpp
Normal file
53
CodeExamples/ServoExample/main.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#include "ServoMotor.h"
|
||||
#include "Gpio.h"
|
||||
#include <thread>
|
||||
|
||||
/// <summary>
|
||||
/// This program demonstrates how to setup and control servos,
|
||||
/// Also this program requires pthread, ServoMotor, Gpio, Timer libraries
|
||||
/// ServoMotor, Gpio, Timer are part of Project Doly, libararies and headers are located under '/Doly'
|
||||
/// Do not forget to Copy and Link related libraries.
|
||||
/// </summary>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Setup Servo power control GPIO as output and set HIGH as a default value
|
||||
GPIO::init(Pin_Servo_Left_Enable, GPIO_OUTPUT, HIGH);
|
||||
GPIO::init(Pin_Servo_Right_Enable, GPIO_OUTPUT, HIGH);
|
||||
|
||||
// Initialize and configure servo motors
|
||||
ServoMotor::Init();
|
||||
// Setup needs channel, bandwitdh range, max angle and working direction parameters
|
||||
// Setup ignores the 'max angle' parameter for both arm servos, however they are already defined internally.
|
||||
ServoMotor::setup(SERVO_LEFT, 500, 2500, SERVO_ARM_MAX_ANGLE, false);
|
||||
ServoMotor::setup(SERVO_RIGHT, 500, 2500, SERVO_ARM_MAX_ANGLE, true);
|
||||
|
||||
// Sets servo zero positions
|
||||
// The 'speed' paramater range between 1-100
|
||||
ServoMotor::set(SERVO_LEFT, 0, 100);
|
||||
ServoMotor::set(SERVO_RIGHT, 0, 100);
|
||||
|
||||
// wait to get zero position
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
||||
|
||||
|
||||
// Sets servo positions
|
||||
// The 'speed' paramater range between 1-100
|
||||
ServoMotor::set(SERVO_LEFT, 90, 1);
|
||||
ServoMotor::set(SERVO_RIGHT, 90, 1);
|
||||
|
||||
// wait
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
|
||||
ServoMotor::set(SERVO_LEFT, SERVO_ARM_MAX_ANGLE, 100);
|
||||
ServoMotor::set(SERVO_RIGHT, SERVO_ARM_MAX_ANGLE, 100);
|
||||
|
||||
// wait servo
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
||||
|
||||
// disable servo power
|
||||
GPIO::writePin(Pin_Servo_Left_Enable, LOW);
|
||||
GPIO::writePin(Pin_Servo_Right_Enable, LOW);
|
||||
|
||||
return 0;
|
||||
}
|
BIN
PCB/BOM_Arm.csv
Normal file
BIN
PCB/BOM_Arm.csv
Normal file
Binary file not shown.
|
BIN
PCB/BOM_Bumper.csv
Normal file
BIN
PCB/BOM_Bumper.csv
Normal file
Binary file not shown.
|
BIN
PCB/BOM_Charger.csv
Normal file
BIN
PCB/BOM_Charger.csv
Normal file
Binary file not shown.
|
BIN
PCB/BOM_Head.csv
Normal file
BIN
PCB/BOM_Head.csv
Normal file
Binary file not shown.
|
BIN
PCB/BOM_IO.csv
Normal file
BIN
PCB/BOM_IO.csv
Normal file
Binary file not shown.
|
BIN
PCB/BOM_Motherboard.csv
Normal file
BIN
PCB/BOM_Motherboard.csv
Normal file
Binary file not shown.
|
BIN
PCB/Gerber_Arm_1mm.zip
Normal file
BIN
PCB/Gerber_Arm_1mm.zip
Normal file
Binary file not shown.
BIN
PCB/Gerber_Bumper_1.6mm.zip
Normal file
BIN
PCB/Gerber_Bumper_1.6mm.zip
Normal file
Binary file not shown.
BIN
PCB/Gerber_Charger_1mm.zip
Normal file
BIN
PCB/Gerber_Charger_1mm.zip
Normal file
Binary file not shown.
BIN
PCB/Gerber_Head_1.2mm.zip
Normal file
BIN
PCB/Gerber_Head_1.2mm.zip
Normal file
Binary file not shown.
BIN
PCB/Gerber_IO_1.6mm.zip
Normal file
BIN
PCB/Gerber_IO_1.6mm.zip
Normal file
Binary file not shown.
BIN
PCB/Gerber_Motherboard_1.2mm.zip
Normal file
BIN
PCB/Gerber_Motherboard_1.2mm.zip
Normal file
Binary file not shown.
1212
PCB/Schematic_DOLY_DIY_armboard_2023-02.pdf
Normal file
1212
PCB/Schematic_DOLY_DIY_armboard_2023-02.pdf
Normal file
File diff suppressed because it is too large
Load Diff
3489
PCB/Schematic_Doly_DIY_IO_board_2023-02.pdf
Normal file
3489
PCB/Schematic_Doly_DIY_IO_board_2023-02.pdf
Normal file
File diff suppressed because it is too large
Load Diff
4257
PCB/Schematic_Doly_DIY_bumper_v1.2210.pdf
Normal file
4257
PCB/Schematic_Doly_DIY_bumper_v1.2210.pdf
Normal file
File diff suppressed because it is too large
Load Diff
2026
PCB/Schematic_Doly_DIY_charger_2212.pdf
Normal file
2026
PCB/Schematic_Doly_DIY_charger_2212.pdf
Normal file
File diff suppressed because it is too large
Load Diff
18758
PCB/Schematic_Doly_DIY_headboard_v1.2212.pdf
Normal file
18758
PCB/Schematic_Doly_DIY_headboard_v1.2212.pdf
Normal file
File diff suppressed because it is too large
Load Diff
40679
PCB/Schematic_Doly_DIY_motherboard_v1.2302.pdf
Normal file
40679
PCB/Schematic_Doly_DIY_motherboard_v1.2302.pdf
Normal file
File diff suppressed because it is too large
Load Diff
BIN
STL/FDM_IO_lid.STL
Normal file
BIN
STL/FDM_IO_lid.STL
Normal file
Binary file not shown.
BIN
STL/FDM_LCD_aligner.STL
Normal file
BIN
STL/FDM_LCD_aligner.STL
Normal file
Binary file not shown.
BIN
STL/FDM_aligner.STL
Normal file
BIN
STL/FDM_aligner.STL
Normal file
Binary file not shown.
BIN
STL/FDM_arm.STL
Normal file
BIN
STL/FDM_arm.STL
Normal file
Binary file not shown.
BIN
STL/FDM_arm_lid.STL
Normal file
BIN
STL/FDM_arm_lid.STL
Normal file
Binary file not shown.
BIN
STL/FDM_arm_limiter.STL
Normal file
BIN
STL/FDM_arm_limiter.STL
Normal file
Binary file not shown.
BIN
STL/FDM_body_head.STL
Normal file
BIN
STL/FDM_body_head.STL
Normal file
Binary file not shown.
BIN
STL/FDM_body_main.STL
Normal file
BIN
STL/FDM_body_main.STL
Normal file
Binary file not shown.
BIN
STL/FDM_bottom_lid.STL
Normal file
BIN
STL/FDM_bottom_lid.STL
Normal file
Binary file not shown.
BIN
STL/FDM_bumper_back.STL
Normal file
BIN
STL/FDM_bumper_back.STL
Normal file
Binary file not shown.
BIN
STL/FDM_bumper_front.STL
Normal file
BIN
STL/FDM_bumper_front.STL
Normal file
Binary file not shown.
BIN
STL/FDM_charger_bottom.STL
Normal file
BIN
STL/FDM_charger_bottom.STL
Normal file
Binary file not shown.
BIN
STL/FDM_charger_cover.STL
Normal file
BIN
STL/FDM_charger_cover.STL
Normal file
Binary file not shown.
BIN
STL/FDM_charger_top.STL
Normal file
BIN
STL/FDM_charger_top.STL
Normal file
Binary file not shown.
BIN
STL/FDM_fan_lid.STL
Normal file
BIN
STL/FDM_fan_lid.STL
Normal file
Binary file not shown.
BIN
STL/FDM_hexagon_cap.STL
Normal file
BIN
STL/FDM_hexagon_cap.STL
Normal file
Binary file not shown.
BIN
STL/FDM_screw_cap_arm.STL
Normal file
BIN
STL/FDM_screw_cap_arm.STL
Normal file
Binary file not shown.
BIN
STL/FDM_track_TPU.STL
Normal file
BIN
STL/FDM_track_TPU.STL
Normal file
Binary file not shown.
BIN
STL/FDM_track_cover.STL
Normal file
BIN
STL/FDM_track_cover.STL
Normal file
Binary file not shown.
BIN
STL/FDM_wheel_back.STL
Normal file
BIN
STL/FDM_wheel_back.STL
Normal file
Binary file not shown.
BIN
STL/FDM_wheel_front.STL
Normal file
BIN
STL/FDM_wheel_front.STL
Normal file
Binary file not shown.
BIN
STL/SLA_hand.STL
Normal file
BIN
STL/SLA_hand.STL
Normal file
Binary file not shown.
BIN
STL/SLA_power_btn.STL
Normal file
BIN
STL/SLA_power_btn.STL
Normal file
Binary file not shown.
BIN
STL/SLA_servo_arm.STL
Normal file
BIN
STL/SLA_servo_arm.STL
Normal file
Binary file not shown.
BIN
STL/SLA_servo_top.STL
Normal file
BIN
STL/SLA_servo_top.STL
Normal file
Binary file not shown.
Reference in New Issue
Block a user