-
-
Notifications
You must be signed in to change notification settings - Fork 23
dam ioc/hw/chimera #1823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
emilysxng
wants to merge
8
commits into
master
Choose a base branch
from
emily/dam_hw
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
dam ioc/hw/chimera #1823
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e6aee2d
intial
emilysxng 0b3d8a2
revert to old hw_uarts
emilysxng baa2a61
format
emilysxng 1b71a11
build
emilysxng cb57a3a
cmake
emilysxng bd4b62f
Merge branch 'master' into emily/dam_hw
emilysxng c05a8ef
dam chimera
emilysxng e8854d9
Merge branch 'master' into emily/dam_hw
emilysxng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,19 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package DAM; | ||
| package dam; | ||
|
|
||
| enum GpioNetName { | ||
| GPIO_NET_NAME_UNSPECIFIED = 0; | ||
| TELEM_PWR_EN = 1; | ||
| BUZZER_PWR_EN = 2; | ||
| TSIM_RED_EN = 3; | ||
| NTSIM_GRN_EN = 4; | ||
| R_SHDN_SENSE = 5; | ||
| L_SHDN_SENSE = 6; | ||
| LED = 7; | ||
| BOOT = 8; | ||
| SD_PRESENT = 9; | ||
| N_RTC_INT1 = 10; | ||
| _900M = 11; | ||
| SD_FAIL = 12; | ||
| GPIO_NTP = 1; | ||
| GPIO_BUZZER_PWR_EN = 2; | ||
| GPIO_TSIM_RED_EN = 3; | ||
| GPIO_NTSIM_GRN_EN = 4; | ||
| GPIO_R_SHDN_SENSE = 5; | ||
| GPIO_L_SHDN_SENSE = 6; | ||
| GPIO_LED = 7; | ||
| GPIO_BOOT = 8; | ||
| GPIO_SD_PRESENT = 9; | ||
| GPIO_900M = 10; | ||
| GPIO_SD_FAIL = 11; | ||
| GPIO_D_P_PULLUP = 12; | ||
| } | ||
|
|
||
| enum AdcNetName { | ||
| ADC_NET_NAME_UNSPECIFIED = 0; | ||
| } | ||
|
|
||
| enum I2cNetName { | ||
| I2C_NET_NAME_UNSPECIFIED = 0; | ||
| RTC_I2C= 1; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,65 @@ | ||
| #include "chimera_v2.hpp" | ||
| #include "tasks.h" | ||
| #include "hw_gpios.hpp" | ||
| #include "shared.pb.h" | ||
| #include <dam.pb.h> | ||
|
|
||
| #include <optional> | ||
| #include <functional> | ||
|
|
||
| class DAMChimeraConfig : public chimera_v2::config | ||
| { | ||
| public: | ||
| ~DAMChimeraConfig() override = default; | ||
| std::optional<std::reference_wrapper<const hw::Gpio>> id_to_gpio(const _GpioNetName *gnn) const override; | ||
|
|
||
| std::optional<std::reference_wrapper<const hw::Gpio>> id_to_gpio(const _GpioNetName *gnn) const override | ||
| { | ||
| if (gnn->which_name != gpio_net_name_tag) | ||
| { | ||
| LOG_ERROR("Chimera: Expected GPIO net name with tag %d, got %d", gpio_net_name_tag, gnn->which_name); | ||
| return std::nullopt; | ||
| } | ||
|
|
||
| switch (gnn->name.dam_net_name) | ||
| { | ||
| case dam_GpioNetName_GPIO_NTP: | ||
| return std::cref(ntp_pin); | ||
| case dam_GpioNetName_GPIO_BUZZER_PWR_EN: | ||
| return std::cref(buzzer_pwr_en_pin); | ||
| case dam_GpioNetName_GPIO_TSIM_RED_EN: | ||
| return std::cref(tsim_red_en_pin); | ||
| case dam_GpioNetName_GPIO_NTSIM_GRN_EN: | ||
| return std::cref(ntsim_green_en_pin); | ||
| case dam_GpioNetName_GPIO_R_SHDN_SENSE: | ||
| return std::cref(r_shdn_sense_pin); | ||
| case dam_GpioNetName_GPIO_L_SHDN_SENSE: | ||
| return std::cref(l_shdn_sense_pin); | ||
| case dam_GpioNetName_GPIO_LED: | ||
| return std::cref(led_pin); | ||
| case dam_GpioNetName_GPIO_BOOT: | ||
| return std::cref(boot_pin); | ||
| case dam_GpioNetName_GPIO_SD_PRESENT: | ||
| return std::cref(sd_present); | ||
| case dam_GpioNetName_GPIO_900M: | ||
| return std::cref(_900m_pin); | ||
| case dam_GpioNetName_GPIO_SD_FAIL: | ||
| return std::cref(sd_fail_pin); | ||
| case dam_GpioNetName_GPIO_D_P_PULLUP: | ||
| return std::cref(d_p_pullup_pin); | ||
| default: | ||
| case dam_GpioNetName_GPIO_NET_NAME_UNSPECIFIED: | ||
| LOG_INFO("Chimera: Unknown GPIO net name"); | ||
| return std::nullopt; | ||
| } | ||
| } | ||
|
|
||
| public: | ||
| DAMChimeraConfig() { gpio_net_name_tag = GpioNetName_dam_net_name_tag; } | ||
|
|
||
| } dam_config; | ||
|
|
||
| void tasks_preInit() {} | ||
| void tasks_init() | ||
|
|
||
| [[noreturn]] void tasks_init() // sus, maybe put in tasks_run100Hz() | ||
| { | ||
| chimera_v2::task(dam_config); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capitalize this please -Amir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm delete this file