Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Philip A Levis
EE185
Commits
067aab8c
Commit
067aab8c
authored
Nov 01, 2021
by
Vidisha Srivastav
Browse files
include changes to motor control bindings + minor bug fixes
parent
604ed077
Changes
4
Hide whitespace changes
Inline
Side-by-side
software/firmware/circuitpython-main/ports/atmel-samd/common-hal/motor_control/Accel.c
View file @
067aab8c
...
...
@@ -272,10 +272,10 @@ acceleration get_raw_accel(ACCEL_TYPE side){
accel
=
read_bird_accelerometer
(
&
center_sensor
);
}
else
if
(
side
==
RIGHTWING
){
accel
=
read_i2c_accelerometer
(
&
right_wing
);
accel
=
read_i2c_accelerometer
(
right_wing
);
}
else
if
(
side
==
LEFTWING
)
{
accel
=
read_i2c_accelerometer
(
&
left_wing
);
accel
=
read_i2c_accelerometer
(
left_wing
);
}
else
printf
(
"Invalid accelerometer choice. Please select LEFTWING(0), CENTER(1) or RIGHTWING(2)"
);
...
...
software/firmware/circuitpython-main/ports/atmel-samd/common-hal/motor_control/Accel.h
View file @
067aab8c
...
...
@@ -24,10 +24,7 @@ typedef uint8_t ACCEL_TYPE;
void
init_accels
(
void
);
acceleration
get_raw_accel
(
uint8_t
);
void
accel_reset
(
uint8_t
);
<<<<<<<
HEAD
void
init_accels
(
void
);
=======
>>>>>>>
spi
-
driver
-
refactor
void
test_spi_reading
(
void
);
void
test_spi_reset
(
void
);
...
...
software/firmware/circuitpython-main/ports/atmel-samd/common-hal/motor_control/SPI.c
View file @
067aab8c
...
...
@@ -15,6 +15,11 @@
static
bool
initted
=
false
;
/*
Checks if sensor has been initted. If not:
Initializes the Feather M4 SPI bus, selected GPIO pin, and accelerometer object for a new sensor object
*/
void
spi_init
(
spi_sensor_t
*
device
){
if
(
initted
){
return
;
...
...
@@ -70,7 +75,7 @@ static void *_read_register (spi_sensor_t *device, uint8_t reg, size_t length)
return
device
->
gbuf
;
}
//
Uncomment when needed since circuitpython doesn't compile with warnings
//
Send a register and value to write within that register over the SPI bus using a buffer
void
spi_write_register_byte
(
spi_sensor_t
*
device
,
uint8_t
reg
,
uint8_t
value
)
{
device
->
gbuf
[
0
]
=
reg
&
0x7F
;
...
...
@@ -80,6 +85,7 @@ void spi_write_register_byte(spi_sensor_t *device, uint8_t reg, uint8_t value)
common_hal_adafruit_bus_device_spidevice_exit
(
&
device
->
sensor
);
}
// Reads an individual byte from a
uint8_t
spi_read_register_byte
(
spi_sensor_t
*
device
,
uint8_t
reg
)
{
return
*
(
int
*
)
_read_register
(
device
,
reg
,
1
);
...
...
software/firmware/circuitpython-main/shared-bindings/motor_control/__init__.c
View file @
067aab8c
...
...
@@ -61,12 +61,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(control_motor_tasks_obj, 1, control_motor_obj_tasks);
// This is the function that initializes the accelerometers. Called once in python script.
<<<<<<<
HEAD
STATIC
mp_obj_t
control_motor_obj_init_accels
(
void
)
{
init_accels
();
=======
STATIC
mp_obj_t
control_motor_obj_init_spi
(
void
)
{
>>>>>>>
spi
-
driver
-
refactor
return
mp_const_none
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment