Skip to content
Snippets Groups Projects
Commit 1d726f86 authored by Michael DM Dryden's avatar Michael DM Dryden
Browse files

Merge branch 'develop' into feature/swv-dpv-ADC_timing

parents 8d698e0a ce7d530e
Branches
Tags
No related merge requests found
...@@ -22,20 +22,11 @@ void ads1255_init_pins(void) ...@@ -22,20 +22,11 @@ void ads1255_init_pins(void)
arch_ioport_set_port_level(IOPORT_PORTE, PIN4_bm|PIN5_bm|PIN7_bm, PIN4_bm|PIN7_bm); arch_ioport_set_port_level(IOPORT_PORTE, PIN4_bm|PIN5_bm|PIN7_bm, PIN4_bm|PIN7_bm);
arch_ioport_set_pin_dir(IOPORT_CREATE_PIN(PORTD,5), IOPORT_DIR_INPUT); arch_ioport_set_pin_dir(IOPORT_CREATE_PIN(PORTD,5), IOPORT_DIR_INPUT);
arch_ioport_set_pin_sense_mode(IOPORT_CREATE_PIN(PORTD,5), IOPORT_SENSE_FALLING); arch_ioport_set_pin_sense_mode(IOPORT_CREATE_PIN(PORTD,5), IOPORT_SENSE_FALLING);
// ioport_configure_port_pin(&PORTE, PIN4_bm, IOPORT_INIT_HIGH | IOPORT_DIR_OUTPUT);
// ioport_configure_port_pin(&PORTE, PIN5_bm, IOPORT_INIT_LOW | IOPORT_DIR_OUTPUT);
// ioport_configure_port_pin(&PORTE, PIN6_bm, IOPORT_DIR_INPUT);
// ioport_configure_port_pin(&PORTE, PIN7_bm, IOPORT_INIT_HIGH | IOPORT_DIR_OUTPUT);
//DRDY
// ioport_configure_port_pin(&PORTE, PIN3_bm, IOPORT_DIR_INPUT | IOPORT_FALLING); v1 Board
// ioport_configure_port_pin(&PORTD, PIN5_bm, IOPORT_DIR_INPUT | IOPORT_FALLING);
} }
void ads1255_init_module(void){ void ads1255_init_module(void){
usart_spi_init(&USARTE1); usart_spi_init(&USARTE1);
usart_spi_setup_device(&USARTE1, &spi_device_conf, SPI_MODE_1, 1900000UL, 0);// usart_spi_setup_device(&USARTE1, &spi_device_conf, SPI_MODE_1, 1900000UL, 0);
} }
void ads1255_sync(void){ void ads1255_sync(void){
...@@ -54,7 +45,6 @@ void ads1255_reg_read(uint8_t address){ ...@@ -54,7 +45,6 @@ void ads1255_reg_read(uint8_t address){
usart_spi_select_device(&USARTE1, &spi_device_conf); usart_spi_select_device(&USARTE1, &spi_device_conf);
// while (ioport_pin_is_high(IOPORT_CREATE_PIN(PORTD, 5)));
while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5))) while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5)))
usart_spi_write_packet(&USARTE1, &(command_buffer[0]), 2); usart_spi_write_packet(&USARTE1, &(command_buffer[0]), 2);
...@@ -70,7 +60,7 @@ void ads1255_reg_read(uint8_t address){ ...@@ -70,7 +60,7 @@ void ads1255_reg_read(uint8_t address){
void ads1255_reset(){ void ads1255_reset(){
usart_spi_select_device(&USARTE1, &spi_device_conf); usart_spi_select_device(&USARTE1, &spi_device_conf);
// while (ioport_pin_is_high(IOPORT_CREATE_PIN(PORTD, 5)));
while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5))); while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5)));
usart_spi_transmit(&USARTE1, ADS_RESET); usart_spi_transmit(&USARTE1, ADS_RESET);
...@@ -79,7 +69,6 @@ void ads1255_reset(){ ...@@ -79,7 +69,6 @@ void ads1255_reset(){
printf("ADS1255: Waiting for calibration\n\r"); printf("ADS1255: Waiting for calibration\n\r");
#endif #endif
// while (ioport_pin_is_high(IOPORT_CREATE_PIN(PORTD, 5)));
while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5))); while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5)));
usart_spi_deselect_device(&USARTE1, &spi_device_conf); usart_spi_deselect_device(&USARTE1, &spi_device_conf);
...@@ -158,7 +147,7 @@ void ads1255_setup(uint8_t buff, uint8_t rate, uint8_t pga){ ...@@ -158,7 +147,7 @@ void ads1255_setup(uint8_t buff, uint8_t rate, uint8_t pga){
usart_spi_write_packet(&USARTE1, (uint8_t*)&command_buffer, 6); usart_spi_write_packet(&USARTE1, (uint8_t*)&command_buffer, 6);
usart_spi_transmit(&USARTE1, ADS_SYNC); usart_spi_transmit(&USARTE1, ADS_SYNC);
usart_spi_transmit(&USARTE1, ADS_SELFCAL); usart_spi_transmit(&USARTE1, ADS_SELFCAL);
// while (ioport_pin_is_high(IOPORT_CREATE_PIN(PORTD, 5)));
while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5))) while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5)))
; ;
usart_spi_deselect_device(&USARTE1, &spi_device_conf); usart_spi_deselect_device(&USARTE1, &spi_device_conf);
...@@ -203,8 +192,7 @@ void ads1255_wakeup(void){ ...@@ -203,8 +192,7 @@ void ads1255_wakeup(void){
void ads1255_rdatac(void){ void ads1255_rdatac(void){
usart_spi_select_device(&USARTE1, &spi_device_conf); usart_spi_select_device(&USARTE1, &spi_device_conf);
usart_spi_transmit(&USARTE1, ADS_RDATAC); usart_spi_transmit(&USARTE1, ADS_RDATAC);
// while (ioport_pin_is_high(IOPORT_CREATE_PIN(PORTD, 5)));
while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5))) while (arch_ioport_get_pin_level(IOPORT_CREATE_PIN(PORTD, 5)))
; ;
usart_spi_deselect_device(&USARTE1, &spi_device_conf); usart_spi_deselect_device(&USARTE1, &spi_device_conf);
...@@ -302,7 +290,6 @@ int32_t ads1255_read_fast24(void){ ...@@ -302,7 +290,6 @@ int32_t ads1255_read_fast24(void){
else else
input_buffer.uint[3] = 0x0; input_buffer.uint[3] = 0x0;
// printf("%x %x %x\n\r", input_buffer.uint[2],input_buffer.uint[1], input_buffer.uint[0]);
cpu_irq_restore(flags); cpu_irq_restore(flags);
return input_buffer.int32; return input_buffer.int32;
} }
......
...@@ -12,8 +12,6 @@ int16_t p1, p2, p3, p4; ...@@ -12,8 +12,6 @@ int16_t p1, p2, p3, p4;
uint16_t u1, u2, u3, u4; uint16_t u1, u2, u3, u4;
uint8_t p5, o1, o2, o3; uint8_t p5, o1, o2, o3;
//uint16_t step_dac[50], step_seconds[50];
//Internal function declarations //Internal function declarations
int8_t command_handler(char command); int8_t command_handler(char command);
...@@ -134,22 +132,20 @@ int main(void){ ...@@ -134,22 +132,20 @@ int main(void){
pmic_set_scheduling(PMIC_SCH_ROUND_ROBIN); pmic_set_scheduling(PMIC_SCH_ROUND_ROBIN);
delay_ms(500);
stdio_usb_init(); stdio_usb_init();
stdio_usb_enable(); stdio_usb_enable();
ads1255_init_pins(); ads1255_init_pins();
ads1255_init_module(); ads1255_init_module();
ads1255_setup(ADS_BUFF_ON,ADS_DR_60,ADS_PGA_2);
PORTD.INT0MASK = PIN5_bm; PORTD.INT0MASK = PIN5_bm;
PORTD.INT1MASK = PIN5_bm; PORTD.INT1MASK = PIN5_bm;
PORTD.INTCTRL = PORT_INT0LVL_OFF_gc | PORT_INT1LVL_OFF_gc; PORTD.INTCTRL = PORT_INT0LVL_OFF_gc | PORT_INT1LVL_OFF_gc;
dma_enable();
max5443_init_pins(); max5443_init_pins();
max5443_init_module(); max5443_init_module();
delay_ms(300);
ads1255_wakeup(); ads1255_wakeup();
ads1255_rdatac(); ads1255_rdatac();
......
No preview for this file type
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment