Kind of working hardware sync
This commit is contained in:
@ -853,6 +853,9 @@ void pin_setup(void) {
|
|||||||
/* Safe state: start with VAA turned off: */
|
/* Safe state: start with VAA turned off: */
|
||||||
disable_rf_power();
|
disable_rf_power();
|
||||||
|
|
||||||
|
scu_pinmux(SCU_PINMUX_GPIO3_10, SCU_GPIO_PDN | SCU_CONF_FUNCTION0);
|
||||||
|
scu_pinmux(SCU_PINMUX_GPIO3_11, SCU_GPIO_PDN | SCU_CONF_FUNCTION0);
|
||||||
|
|
||||||
gpio_input(&gpio_sync_in_a);
|
gpio_input(&gpio_sync_in_a);
|
||||||
gpio_input(&gpio_sync_in_b);
|
gpio_input(&gpio_sync_in_b);
|
||||||
|
|
||||||
@ -904,9 +907,8 @@ void led_toggle(const led_t led) {
|
|||||||
gpio_toggle(&gpio_led[led]);
|
gpio_toggle(&gpio_led[led]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hw_sync_start() {
|
void hw_sync_syn() {
|
||||||
gpio_set(&gpio_sync_out_a);
|
gpio_set(&gpio_sync_out_a);
|
||||||
gpio_set(&gpio_sync_out_b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hw_sync_stop() {
|
void hw_sync_stop() {
|
||||||
@ -914,6 +916,10 @@ void hw_sync_stop() {
|
|||||||
gpio_clear(&gpio_sync_out_b);
|
gpio_clear(&gpio_sync_out_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hw_sync_ack() {
|
||||||
|
gpio_set(&gpio_sync_out_b);
|
||||||
|
}
|
||||||
|
|
||||||
void hw_sync_copy_state() {
|
void hw_sync_copy_state() {
|
||||||
if(gpio_read(&gpio_sync_in_a)) {
|
if(gpio_read(&gpio_sync_in_a)) {
|
||||||
gpio_set(&gpio_sync_out_a);
|
gpio_set(&gpio_sync_out_a);
|
||||||
|
@ -271,8 +271,9 @@ void led_on(const led_t led);
|
|||||||
void led_off(const led_t led);
|
void led_off(const led_t led);
|
||||||
void led_toggle(const led_t led);
|
void led_toggle(const led_t led);
|
||||||
|
|
||||||
void hw_sync_start();
|
void hw_sync_syn();
|
||||||
void hw_sync_stop();
|
void hw_sync_stop();
|
||||||
|
void hw_sync_ack();
|
||||||
bool hw_sync_ready();
|
bool hw_sync_ready();
|
||||||
void hw_sync_copy_state();
|
void hw_sync_copy_state();
|
||||||
|
|
||||||
|
@ -253,26 +253,19 @@ int main(void) {
|
|||||||
|
|
||||||
unsigned int phase = 0;
|
unsigned int phase = 0;
|
||||||
|
|
||||||
hw_sync_start();
|
led_off(LED3);
|
||||||
|
hw_sync_syn();
|
||||||
while(true) {
|
while(true) {
|
||||||
// Check whether we need to initiate a CPLD update
|
// Check whether we need to initiate a CPLD update
|
||||||
if (start_cpld_update)
|
if (start_cpld_update)
|
||||||
cpld_update();
|
cpld_update();
|
||||||
|
|
||||||
|
|
||||||
hw_sync_copy_state();
|
|
||||||
|
|
||||||
// check for hardware sync
|
|
||||||
if(hw_sync_ready()) {
|
if(hw_sync_ready()) {
|
||||||
synced = true;
|
synced = true;
|
||||||
//hw_sync_start();
|
hw_sync_ack();
|
||||||
} else if(hw_sync_count++ > 1000000) {
|
led_on(LED3);
|
||||||
//hw_sync_stop();
|
}
|
||||||
led_toggle(LED3);
|
|
||||||
hw_sync_count = 0;
|
|
||||||
} else if(hw_sync_count == 500000) {
|
|
||||||
//hw_sync_start();
|
|
||||||
}
|
|
||||||
|
|
||||||
//int gpio_sync_in_flag = gpio_get(gpio_sync_in);
|
//int gpio_sync_in_flag = gpio_get(gpio_sync_in);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user