Port of flash_cc2531 to FreeBSD. This is likely more just include a wiringPi compatible library for FreeBSD. Any new files are BSD licensed and NOT GPLv3 license.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

71 lines
1.9 KiB

  1. /***********************************************************************
  2. Copyright © 2019 Jean Michault.
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. *************************************************************************/
  14. #include <wiringPi.h>
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17. #include <stdbool.h>
  18. #include <string.h>
  19. #include <stdint.h>
  20. #include <unistd.h>
  21. #include "CCDebugger.h"
  22. void helpo()
  23. {
  24. fprintf(stderr,"usage : cc_chipid [-d pin_DD] [-c pin_DC] [-r pin_reset]\n");
  25. fprintf(stderr," -c : change pin_DC (default 27)\n");
  26. fprintf(stderr," -d : change pin_DD (default 28)\n");
  27. fprintf(stderr," -r : change reset pin (default 24)\n");
  28. }
  29. int main(int argc,char *argv[])
  30. {
  31. int opt;
  32. int rePin=-1;
  33. int dcPin=-1;
  34. int ddPin=-1;
  35. while( (opt=getopt(argc,argv,"d:c:r:h?")) != -1)
  36. {
  37. switch(opt)
  38. {
  39. case 'd' : // DD pinglo
  40. ddPin=atoi(optarg);
  41. break;
  42. case 'c' : // DC pinglo
  43. dcPin=atoi(optarg);
  44. break;
  45. case 'r' : // restarigi pinglo
  46. rePin=atoi(optarg);
  47. break;
  48. case 'h' : // helpo
  49. case '?' : // helpo
  50. helpo();
  51. exit(0);
  52. break;
  53. }
  54. }
  55. // initialize GPIO and debugger
  56. cc_init(rePin,dcPin,ddPin);
  57. // enter debug mode
  58. cc_enter();
  59. // get ChipID :
  60. uint16_t res;
  61. res = cc_getChipID();
  62. printf(" ID = %04x.\n",res);
  63. cc_setActive(false);
  64. }